[TriEmbed] Pinewood derby help

Scott Hall scottghall1 at gmail.com
Sun Jan 8 21:32:41 CST 2017


I would like to backtrack this discussion with a little more electronics theory
than has been discussed thus far.

Design considerations:
- PWM output drive from controller
- driving the motor indirectly and not from the controller pins themselves (load
current consideration)
- motor current requirements
- back-EMF protection, and motor sparks noise generation

dc motor speed control using arduino

/{ image courtesy of a discussion of using PWM to control motor speed://
   PWM Control using Arduino - How to Control DC Motor and LED using PWM
<http://www.circuitstoday.com/pwm-generation-and-control-using-arduino>
//   http://www.circuitstoday.com/pwm-generation-and-control-using-arduino ;
   PDF available at:
http://www.idc-online.com/technical_references/pdfs/electronic_engineering/PWM_Control_using_Arduino.pdf
   same circuit design in Simon Monk's article on Adafruit:
   Arduino Lesson 13, DC motors
<https://learn.adafruit.com/adafruit-arduino-lesson-13-dc-motors/overview>
   https://learn.adafruit.com/adafruit-arduino-lesson-13-dc-motors/overview }
/
Looking at this image, a motor capable of being driven from a 9V battery is
motor-speed controlled by an Arduino microcontroller board.  Though you mention
a different controller and motor voltage (4.5V via AA batteries), the primary
design are there:

- a bipolar transistor to handle the motor current switching
- a current limiting resister to protect the base of the transistor
- a capacitor to snub the spark noise from the motor

Note that the main design point is to switch the motor current directly, and not
have it pass through the controller's output, and to protect the switch from the
back "electromotive force" generated by the inductive motor.  Note that the
back-EMF can be considerably higher than the supply voltage -- in this case
upwards of tens of volts, and appears in the opposite polarity of the supply
voltage.  The 2N2222 transistor is fairly tolerant of these kinds of reverse
voltage and other "noise" spikes generated by the motor.

If it were me, I would instead substitute a darlington matched-pair of
transistors, such as a TIP120, and a snubbing diode:

TIP120-dcmotor

/{ image courtesy of: Using Arduino and TIP120 to control a DC motor
<http://www.devacron.com/arduino-tip120-control-dc-motor/>//
   http://www.devacron.com/arduino-tip120-control-dc-motor/ }
/
Note that in this case a diode is used to control the back-EMF.  I disagree with
this designer where he places the diode across darlington, but instead I would
put it across the motor leads, stripe toward the supply positive (green wire in
this figure).

This designer uses both:


/{ image courtesy of: //Use Arduino with TIP transistor to control motors and
high power devices
<http://www.pcbway.com/project/share/Use_Arduino_with_TIP120_transistor_to_control_motors_and_high_power_devices.html>//://
//  
//http://www.pcbway.com/project/share/Use_Arduino_with_TIP120_transistor_to_control_motors_and_high_power_devices.html//}//
/
If you read his description, he explains the roll of both:

    ENTER THE 1K RESISTOR & 1N4004 DIODE & 1UF CAPACITOR!
    The TIP120 is a very robust item. It can handle lots of power (see specs)
    but the Arduino can't. So we must protect the Arduino from potential party
    crashers. For starters, we use a 1K Ohm resistor between the Arduino pins
    and the TIP120 Base pin. This is insurance against electric shorts. The
    TIP120 can handle 60V and 5A but I assure you the Arduino won't.
     
    Then we have those DC motors. The internal brushes on toy/hobby DC motors
    generate lots of potentially harmful sparks and stray electricity that needs
    to be blocked. Instead of guessing which motor is safe and which is not, we
    simply add a $0.20 diode and $0.10 1uF ceramic capacitor to our circuit.
    Some electromechanical devices such as solenoids may require different
    capacitors.
     
    Placing the ceramic capacitor on the + & - poles of the motor will act as
    suppressor of sparks and surges generated by motor brushes, which can be
    harmful to your circuit.
     
    A small ceramic capacitor in the range of .01 to 0.1 uF is probably
    sufficient to offer protection from hobby DC motors. But If you are using
    brushless motors, such as the PC fan I am using in this tutorial, don't use
    a capacitor.
     
    As for the 1N4004 diode, it allows current to pass in one direction from
    positive to negative but will block any stray current that tries to go in
    the opposite direction, which might have undesirable effects on your circuit.
     
    Unlike resistors which allow current to flow in both directions, diodes were
    designed to let current pass from positive into negative, not the other way
    around. When you look closely at those small diodes we use in our projects,
    you will see a ring on one end of the diode cylinder. This tough guy can
    block high voltage (400V) with high current (1A). Again, no need to
    understand all this stuff so long as you connect the circuit properly.

Here is my preferred hookup, and one I use in a lot of control circuits:
Motor driven by TIP122

And this is published in Arduino.CC's own website:




/{ source: //Arduino: Transistor Motor Control
<https://www.arduino.cc/en/Tutorial/TransistorMotorControl>//
//   //https://www.arduino.cc/en/Tutorial/TransistorMotorControl//}//
/
The takeaway from all this is:

  * Wire the Arduino PWM pin to the Base of the TIP120 through a 1kOhm, or at
    least 270 Ohm, resistor in series.
  * Wire the TIP120 Emitter to Ground of the Arduino.
  * Wire one lead of the motor to the positive side of your battery pack, the
    other lead to the Collector of the TIP120
  * Put a diode across the leads of the motor, perhaps a 1N4007, wired *reverse
    biased* (cathode towards battery positive in previous point).
  * Add a disk capacitor of say 0.10 uF 12 Volts in parallel with the diode,
    connected with its negative lead (usually marked) towards the Collector of
    the TIP120
  * Wire the negative of the battery pack to the Arduino ground.

A couple more references:

  * Arduino - Control a DC motor with TIP 120, potentiometer and multiple power
    supplies
    <http://luckylarry.co.uk/arduino-projects/arduino-control-a-dc-motor-with-potentiometer-and-multiple-power-supplies/>
    http://luckylarry.co.uk/arduino-projects/arduino-control-a-dc-motor-with-potentiometer-and-multiple-power-supplies/
  * Arduino - Control a DC motor with TIP 120, potentiometer and multiple power
    supplies
    <http://duino4projects.com/arduino-control-dc-motor-tip120-potentiometer-multiple-power-supplies/>
    http://duino4projects.com/arduino-control-dc-motor-tip120-potentiometer-multiple-power-supplies/

- sgh

On 01/07/2017 09:37 PM, Craig Cook via TriEmbed wrote:
> At my cub pack we have a "Dad's race" the night before the boys race.  Dads
> don't have to comply to the same rules the boys do.  i.e. if we can get a
> motor on the car and it weighs more than 5oz, thats fine.  Purely for
> engineering fun.
>
> I have a donor RC dump truck I am going to take the motor and axel out of.  I
> have a NTC CHIP I was going to strap on to control the motor.
>
> I've got the kernel upgraded to 4.4 and PWM working.
>
> Am I correct in thinking if I can hook up the motor to the CHIP board I could
> use PWM to "slow" it down? i.e. if I let the motor spin at full speed the
> derby car wheels may just sit and spin.  If I can send the right amount of
> pulses I should be able to control the motor speed.
>
> The dump truck was powered by 3 x AA batteries, which makes me believe the
> motor accepts 5V or less, so using the CHIP should not fry it.  The motor has
> a 1 ohm resistor attached and a capacitor with 104 written on it.
>
> I'm ready to attach the motor to the CHIP, any reason I shouldn't and see what
> happens?
>
> Thanks
>
> Craig

-- 
Scott G. Hall
Raleigh, NC, USA
ScottGHall1 at GMail.Com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.triembed.org/pipermail/triembed_triembed.org/attachments/20170108/aaee9ca7/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pwm-motor-speed-control-using-arduino.png
Type: image/png
Size: 9530 bytes
Desc: not available
URL: <http://mail.triembed.org/pipermail/triembed_triembed.org/attachments/20170108/aaee9ca7/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TIP120-dcmotor.jpg
Type: image/jpeg
Size: 96058 bytes
Desc: not available
URL: <http://mail.triembed.org/pipermail/triembed_triembed.org/attachments/20170108/aaee9ca7/attachment.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 160648183.jpg
Type: image/jpeg
Size: 27047 bytes
Desc: not available
URL: <http://mail.triembed.org/pipermail/triembed_triembed.org/attachments/20170108/aaee9ca7/attachment-0001.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 9fsYs.jpg
Type: image/jpeg
Size: 121090 bytes
Desc: not available
URL: <http://mail.triembed.org/pipermail/triembed_triembed.org/attachments/20170108/aaee9ca7/attachment-0002.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TransistorMotor_bb.png
Type: image/png
Size: 34405 bytes
Desc: not available
URL: <http://mail.triembed.org/pipermail/triembed_triembed.org/attachments/20170108/aaee9ca7/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TransistorMotor_schem.png
Type: image/png
Size: 12801 bytes
Desc: not available
URL: <http://mail.triembed.org/pipermail/triembed_triembed.org/attachments/20170108/aaee9ca7/attachment-0002.png>


More information about the TriEmbed mailing list