Arduino Uno Motor Shield Rev 3 current sensing

Hello,

I am trying to understand how to use the current sensing function of the Motor Shield Rev 3. For one channel (say channel A) the current sensing pin is A0, and it says in some literature that the current sensor is calibrated for 3.3V/2 Amps (2 being the current limit per channel). Given that the Uno is 5 V logic, and therefore the A0 in reading 0 to 1023 is scaled for 5 Volts, a 5 V reading will give 1023 feedback from A0. This means, then, that for the Motor Shield 3, if channel A is running at 2 Amps (max) I would expect to read (3.3/5)*1024 = 676 reading for A0. If a DC motor connected to channel A was only drawing 500 mA, then I would expect the A0 reading to be about 676/4 = 169 reading on A0. Can anyone confirm that my interpretation is correct? Thanks a lot, Steven Lightfoot

There is a commonly used stepper motor shield V3. For that shield:
Make a search for current adjusting it.
If it's another shield, please post the technical manual/datasheet.

Yes, its this shield, Rev 3. The OEM motor shield from Arduino, that drives a stepper or 2 DC motors.

Arduino Motor Shield Rev3 — Arduino Online Shop

This web page says this "On each channel will be a voltage proportional to the measured current, which can be read as a normal analog input, through the function analogRead() on the analog input A0 and A1. For your convenience it is calibrated to be 3.3V when the channel is delivering its maximum possible current, that is 2A."

I interpret this to mean what I wrote in my question, can you or anyone confirm my interpretation is correct? Really appreciate your input. Thanks, Steven Lightfoot

That's a completely different board from the ones I use.
What's the current limit You want to set?
It looks like 2 Amp, 3.3 volt.
1 Amp 1.65 volt.
0.165 volt per 100 mA......

Your logic is correct. The L298 chip has 0.15ohm shunt resistors in it's ground lines, which voltages are amplified 11x with an LMV358 (the rail2rail version). Giving 0.15*11= 1.65volt per Amp on A0/A1.

It is however a lossy L298 dinosaur without proper heatsink, so only good for small toy motors.
It can drive stepper motors, but only slow/hybrid 30ohm versions.
Leo..

Thanks, that is how I read it. 100 mA equals a reading of 0.165 V, so 500 mA would give 0.825 V, so for a 5 V A0 range (0-1023) I would expect 0.825 V to give a digital reading of about 169.

It makes sense to me that they designed the shield Rev 3 to have a max V of 3.3, so it can use used with Arduino type boards running at 5V or 3.3V and is thus compatible with both, you just have to know the scaling/calibration so you get the right reading when using 5 V.

Appreciate your help and comments. Steven Lightfoot

Perfect thanks. Really appreciate the confirmation, input.

I agree with your assessment about it being old and limited. I did not know that at first, as it turns out my application is indeed and limited to two 130 size DC motors, max current specd at 500 mA stalled, much lower loaded running free. So I expect it to work OK for this app.

I needed to get my project going so I bought this shield, but also have a mosfet style low-loss Adafruit shield, that I will use in the future (ITS problem is that is came with non attached headers, so I need to solder those at some point).

Again, thank you.

Steven Lightfoot

I would use a DMM to check the setting. USB 5 volt is never 5.0 volt and analogRead will not be very precise.

Thanks, I may check with my multimeter. I am planning to power it with a 6 VDC wall wart (500 mA limit) which I measured giving 6.3 VDC steady. The Arduino logic voltage of course remains separate. I want to drive two motors in parallel so I may buy a bigger wall wart specd for say 7 or 8 VDC and higher current rating. Overall I want to keep the current under 1 AMP overall due to the lack of heat sink on the driver chip.

Btw I am surprised Arduino sells this shield without a heat sink and makes no mention of the fact the chip is lossy and builds heat if you run closer to the 4 amp current limit (for both channels operating). Other boards that use the same chip often seem to have a heat sink build in. I bought this Arduino OEM model specifically so it was ultra compatible and without any engineering issues, being an OEM part, yet still even it is not ideal.

The L298 drops 2-4volt, so you won't have a lot left for your motors.
Better make that a 9volt supply.
Leo..

1 Like

OK good to know. I plan to trying running one this week, to see what happens.

Appreciated your input. I have now run it, works! but I have more questions, wonder if you might be able to answer:

  1. The pwm system makes noise (490 Hz) you can hear, from the boards, above and beyond motor/fan noise. Can anything be done about reducing that noise?

  2. My motor at 6.3 VDC supply would not turn until I hit pwm duty cycle level 50 and above, below that I would hear the pwm 490 Hz but the motor would not run. Comments?

  3. I am getting inconsistent readings from A0, often zeroes, and sometimes higher currents than I should be getting, fyi motors are feely spinning, with props, not stalled. Sometimes readings are >500 mA, which is the wall wart limit, and greater than the stall current (500 mA) I should ne reading maybe 200 mA loaded max. The boards remain cool, wall wart and motor is cool to the touch. Any thoughts?

Thanks!!!

Steven Lightfoot

I have a little more data now, its seems that for the 12 seconds of operation I am using for now, I start at 70% duty, then move to 60 and 50, and over the 12 second period, the current goes from like about 800 mA to 200 mA, is this possibly an inrush current phenom?

Steven Lightfoot

Some final data, I run for about 15 seconds now, and the typical A0 readings (direct) are: 312, 240, 112, 0, 0. In amps this is about 1 amp, .75 amp, 400mA, then 0 and 0 amps. This must be an inrush current phenom, though I am curious about why the steady state readings at the end are zeroes. Any insights would be appreciated! Is what I am seeing considered normal? All components are cool and stable.

Steven Lightfoot

Arduino's default PWM frequency on four PWM pins is ~500Hz, two are twice that frequency. Google "Arduino pwm frequency". Silent fans (inside your computer) work on frequencies outside your hearing range, like 25kHz. Frequency can be changed with timers (advanced coding).

That's how motors work. Mechanical threshold. If you want lower speed, then set the fan to full speed for a second and then reduce. That's how computer fans also do it.

PWM is a digital signal, not a voltage. A sample could fall in the HIGH or LOW of that PWM signal.
You could average many samples, to get a smooth current value.
Leo..

Thanks, very helpful. I realized what I was seeing in terms of A0 readings (current on channel A) was inrush current, it peaks maybe 5X the current at which it settles at for steady state running after 5 seconds or so. When I say inconsistent readings, I was referring to readings of A0 (the current sensing from the motor shield), I didnt think there was a PWM factor involved. Can you explain more about that?

As for the comments for mech threshold (static friction) and pwm noise, great comments. I will just live with the buzzing and I did in fact overpower the motor to bump it, then throttled back.

Steven Lightfoot

Ugh. It now looks like I have fried my Arduino Uno. No idea why. USB and everything unresponsive, no lights on.

Back but that was weird. Thanks for your help. I need now to study the Uno power manageent!

Steven Lightfoot

Need to read up on PWM too.
It's not a constant voltage, but rapidly switching the motor on/off.
Full voltage, nothing, full voltage, nothing, etc. At a fixed rate of ~500 times per second.
The PWM value sets the average on/off time, 128 being 50% of the time on.
PWM is used to minimise the losses you would have with linear (voltage) regulation.
Leo..