For some reason, the motor shield keeps reporting motor faults after motor runs for very brief moment (less than 5 seconds). I do not think it is because of the heat. The code is using demo code of the shield without any modification. If I disable the motor fault check function, the system appears to function fine.
Motor supply voltage: 6v from 5 NiCad (or NiMh) batteries.
Arduino supply voltage: Same battery source via the motor shield with the VIN connected.
Robot & Motor info: robotshop.com/dfrobot-2wd-mo … duino.html
What might be causing the problem? How do I correct it?
Sorry we did not get back to you sooner and sorry you are having trouble with the motor shield. Do you have an oscilloscope? Can you look at the motor supply voltage when the errors occur? Does the error occur if you run the program without your motors connected? Are you receiving the “Mx fault” messages in the serial monitor? Can you check the solder connections you’ve made on the pins that connect to Arduino pins 6 and 12? If you are still having trouble can you post a picture of your setup and explain all the connections you’ve made?
Thank you for the response. Unfortunately, I do not have an oscilloscope. I have a digital voltmeter and checked the supply voltage. It seems to be ok. I also did try separate power supply i.e. used 9V batter to feed Arduino board and use 6v batteries for the shield. Another test I did also change from NiMh batter to alkaline batteries (a bit higher voltage). Both of these experiments did not improve the problem.
I do not think I see the “Mx fault” messages in the serial monitor. I have not tried to run the shield without motor connected. That is a good suggestion. The Arduino’s pin 6 and 12, you meant the pin 6 and 12 as labelled on the Arduino board, correct? I visually inspected them and they appear to be ok. I will look around this area for more.
If you haven’t seen the fault messages in the serial monitor, what do you mean when you say the “the motor shield keeps reporting motor faults”? What problem are you seeing? Changing to alkaline batteries would most likely only worsen the problem for two reasons. First, alkalines cannot supply as much current as NiMH batteries, and, second, a higher voltage means the motor will be trying to draw more current. Your understanding of my description about pins 6 and 12 sounds correct. Can you post a picture of your setup and explain all the connections you’ve made?
I am sorry my fault saying that I did not see “Mx fault”. I saw “M2 fault”. I ran some more testings and the results are below:
The fault appears to be specific to M2. I only see “M2 fault” but not “M1 fault”.
Removed both motors (both M1 and M2 are removed) : No fault reported.
Removed M2 (only M1 connected): No fault reported.
Removed M1 (only M2 connected): Fault reported.
My set up is:
An Aruduino with the motor shield stacked on top. No other sensors. The 6v from 5 NiMh batteries connected to the shield and provided voltage to Arduino. There is a switch to turn on or off/connected to charge plug. The motors are from the kit base that I reported in the initial post. I looked around the pin 6 and 12 as you suggested. I think the solder joints look ok to my eyes.
I attached a few pictures. I am not sure these are what you are looking for or not.
Those pictures are good, unfortunately, I don’t see anything wrong in them. A M2 fault in the unmodified demo program means that the Arduino is reading low voltage on pin 12. The shield has a pullup resistor between the net connected to pin 12 and VDD. Lets try to use your multimeter to verify things are connected correctly on the shield:
Start by disconnecting the power and separating the shield from the motors, power supply and the Arduino. With your multimeter, you can check continuity between the chip pins (the rightmost arrows in the picture above) and the M2EN A=B jumper (the middle arrow on the bottom). Also, you can check that the pullup resistor (the leftmost arrow) is connected by measuring the resistance between M2EN A=B and VDD is 4.7K and you can check that the resistance between pin 12 (the top arrow) and M2EN A=B should be 1k Ohm.
Thank you for the check points and the information. I am not sure what the problem is. I checked all of the connections as you pointed out and they are as expected. I also tested input/output function of the pin separately and it works. I also tried with a different Arduino board and it has the same problem. The problem seem to occurs when ramp up/down the motor speeds. If I run the motor at a constant speed then I do not see any issue. I do not think there is any thing wrong with the shield. I do not need to ramp motor speeds. I am good for now.
What you are describing sounds like a power problem. I suspect the voltage of your batteries is dropping when the motor ramps up. Do you have a bench power supply or a more reliable battery pack you could try to see if the problem goes away? Do you have an oscilloscope you can use to look at the voltage while the motors are ramping?
I was having similar problems with Arduino and a motor driver shield (a not Pololu one though).
The problem is related to the power supply - 6V at Vin seems to be barely enough for the Arduino. The 5V regulator on Arduino apparently has a dropout about 1V, and so the input voltage must be greater than 6V. According to the Arduino Uno specifications the recommended voltage is at least 7V.
When you power on your motor the voltage on the battery drops below 6V and the regulator on Arduino doesn’t provide stable voltage to the microcontroller, and it resets itself.
- Use > 7V battery, e.g. 6 x 1.2V NiCad or 5 x 1.5V alkaline batteries. The disadvantage is that some motors are designed to work from 6V, and using higher voltage can potentially damage them. Perhaps it is possible to use PWM to lower average voltage a bit.
- Use separate battery for motors. On my motor shield I had to disconnect it’s Vin input from the Arduino. And connect motor’s power supply to it.