Dec 31, 2013

Profiling DC motors

For the second design of the LEGO test machine #2, I stopped using rotary encoders an switched to ACS712 lowcurrent sensors.


I initially hooked them to a multimeter and an Arduino to tweak the 2 potentiometers of the sensors. Following some of the steps from this MobileAPES post, I've set the voltage (Vref potentiometer) to 2.5v without any problems but the gain (GAIN potentiometer) was initially tricky. Back when I was using the rotary encoders, I was running the motors as slow as possible (speed of 65-85) in order to not stress the parts. At those speed the current fluctuations are too large and I had to find out what is the optimal low speed of the motors.
I decided to log the data out to better see what was going on. The initial test was to log the current sensor values every 1ms while raising the motor speed from 64 to 210 by increment of 5 every 20ms. 


Yellow=speed / Blue=running freely / Red=stalled (prevented from turning)

Clearly the values I get from the motor is erratic when the speed is below ~110. So I profiled the motor again from 130 to 230.


Yellow=speed / Blue=running freely / Red=stalled (prevented from turning)

Now I know the how slow the motors can go and how to detect a stall using the current sensor. This also told me how long the motor takes to ramp up to speed when initially set at a speed of 130.

Here's the diagram of the machine made with Fritzing:


I don't have the Adafruit motor shield [fritzing] part so I used the Arduino motor shield rev3 instead. The missing details are the following: The servo is connected on SER0 (pin 9), the push-down motor is connected on M2 and the lift-arm motor is connected to M3.

The code and the Fritzing diagram for this new version are available on git.

1 comment: