Unable to Upload Program with Motor Shield

Hi!

I require your help regarding a problem I’m encountering.

I’ve recently purchased the Omni Mechanum 4WD 10011 robot. I’ve been trying to program the arduino and it doesn’t work and gives me an error (the settings are as per the instructions from the manual).

When I remove the motor shield and load the program into the arduino, it works, with the same settings.

How do I program the wheels if I’m unable to do so without the motor shield?

Thank you so much in advance for your help!

@Sambhavi Welcome to the RobotShop Community. It sounds like the motor shield uses the same pins which are used to program the Arduino board, so it is not possible to use both at the same time. This is often the case with shields, so (assuming this is the case) you need to physically remove the shield every time you upload a new program.You can then still likely send normal serial commands to the MCU.

  • Remove USB cable / power
  • Remove shield
  • Upload new code
  • Replace shield
  • Replace USB cable / power
  • Send serial commands
1 Like

Thanks, I understand why it is necessary to remove the shield now.

I am however facing another issue now. On first look when I uploaded the demo actions code, it seemed to be working, but as I started testing the individual movements it seemed to be going wrong.

For example, for it to move diagonal, 2 of the diagonal wheels should move. However, just 2 wheels turn - but they are not the intended wheels. Sometimes all the wheels just turn, as if they got a boost of power.

I have double-checked the wiring connections with this manual as well. Is there anything I should do in terms of coding, to get the robot moving? Or is this a hardware issue?

I’ve downloaded all my codes, libraries manuals from this link: https://www.robotshop.com/media/files/zip/arduino_library.zip

Thank you very much for your support!

Best,
Sambhavi

It sounds like it may be one or more of the issues below:

  • Incorrect motors wired to the wrong terminals
  • Wheels are connected in the wrong way
  • Code is using pins which are not the same as what you have

Hello!

So I’ve done the following:

  1. Checked the motor wirings to the terminals- I’ve set them exactly according to the diagram in the manual

  2. tested the “setCarAdvance” in the demo code- then switched the live and ground for motor 2 such that all of the wheels would be moving in the same direction. Also, what I understand from this is that this just switched the direction of the motor(at the terminal), so it shouldn’t be giving me the speed problems I’m facing(as given in the table below)

  3. Checked the pins in the code- they are the same as given in the diagram in the manual.

  4. Wheels are physically connected the right way- checked that as well. But as I have mentioned, I’ve switched M2’s live and ground for it to turn properly for setCarAdvance test, and to make proper referencing for the rest of the code.

Here is the table for the testing for all the functions:

Is there something wrong with the code, motors, encoders or the board? Because even if the directions of turning were wrong, the wheels jumping forward and backward in varying speeds make me wonder if this is a hardware issue. If this is because of the code, I’m using the demo code from https://www.robotshop.com/media/files/zip/arduino_library.zip as given on the main website.

Thank you once again for your support.

Btw, this is the table that I have with the live and ground not changed for M2 (original connections)

Best Regards,
Sambhavi

Interesting. Some ideas:

  • Raise the rover off of the ground to see if the wheels turn freely (i.e. a weight issue or a friction issue). You might even remove the Mecanum wheels and replace them with yogurt lids to just see direction of rotation and speed
  • What battery are you using? Several of these points seem symptomatic of undervoltage / under current.
  • Triple check all electrical connections to ensure proper contact everywhere, no loose wires or strands
  • Check the electronic components for any burn marks, bad solder points etc.

If nothing above leads to a solution, we’ll have you reach out to the manufacturer directly at [email protected]

Hello,
I’ve done the following the past few days:

  1. Raised the motors off the ground, and ran the commends- no change

  2. The battery was the same one as the one provided by the manufacturer, Ni-Mh battery
    -even after fully charging the battery (shows 13.4V), the motors still jump when moving, and motors don’t turn the way they are supposed to.

  3. There really aren’t any loose strands or wires and I check the connections every time I upload a program- because of the removal and attaching of the shield

  4. There aren’t any burn marks, maybe some areas could have been soldered stronger:

This is me running everything again, and everything seeming wrong noted down.

I’ve tried one more thing:

  1. I’ve tried to change the speed by changing the speedMMPS value to be given through the demoActions, and there is no change in the speed of the Robot.

I believe there is either something wrong with the microcontroller or the encoders of the motors, (especially motor 2) which are not accepting my commands via the codes provided.

  1. The motor 2 does 2 actions better(moving forward and rotating right) after I switched the live and ground of the motor

Would you be able to help me reach the manufacturer?

These are the videos of how the robot moves with each of the commands:
This picture is to show that the wheels have been mounted properly:

(The robot is flipped in the video so that arduino could be accessed easily)
FORWARD

LEFT

LOWER LEFT

LOWER RIGHT

RIGHT

LOWER LEFT

ROTATE RIGHT

UPPER LEFT

UPPER RIGHT

BACKWARD

Thank you very much for your support.
Best regards,
Sambhavi

We have written to the manufacturer and copied you.

1 Like

Hi @Sambhavi!

In case you didn’t see an email from manufacturer, here it is:

Before uploading the program, please disconnect the jumper shown in the picture below and the connection of the ultrasonic sensor,Reconnect the connection after uploading the program

Thank you for your help so far! I appreciate it!

1 Like

Hi!
I’ve done this (I just remove the entire shield when programming, but I’ve tried this specifically too), but this still doesn’t help me with my speed issue(not able to change the speed in the demoActions module (the speed doesn’t slow down)…

I can’t seem to pinpoint the reason for the speed not changing… The manufacturer hasn’t gotten back to me yet about this yet. Do you happen to have any idea?
Thank you for your support!
Best Regards,
Sambhavi

1 Like

Hello, I’ve done the following:

  1. Uploaded the libraries and codes with respect to this website:
    https://www.robotshop.com/en/4wd-arduino-compatible-mecanum-robot.html
  2. I’m able to turn the motors, individually, so the motors are working properly. I’ve connected them to the power source directly to test them, and they work fine.
  3. I’m able to turn the motors individually as well.
  4. I always check the connections every time i upload codes
  5. I’m not able to change the speeds of the motors- I don’t know if it is an encoder issue, microcontroller/shield issue or a code related issue?

Thank you for your time and support!
Best regards,
Sambhavi

1 Like

Reply from manufacturer:

Dear Sir

Thanks for your mail.It is the weekend, and I will get back to you after asking the engineer next Monday.

Thanks.

1 Like