Author Topic: MCU to Motor Driver (and NPN resistor + laser); Add pull-down resistors?  (Read 2299 times)

0 Members and 1 Guest are viewing this topic.

Offline GertlexTopic starter

  • Supreme Robot
  • *****
  • Posts: 763
  • Helpful? 24
  • Nuclear Engineer · Roboticist
    • Index of Oddities
I'm connecting the Wixel MCU to the VNH5019 Motor Driver board to drive a motor.

Schematic: (Apologies for quality... probably won't use my tablet for this sort of thing again)

This is a partial schematic... other pins on the Wixel go to an XBee board.  A 5V switching regulator converts 12V to 5V, and the Wixel has its own built-in 3.3V regulator.

When testing this setup (with partially implemented software; PWM is still WIP), I can correctly drive pins P1_1 or P1_3 high, and get LEDs on the motor driver to light up as expected when I tell the motor to spin.  However, when the motor is not spinning, my multimeter still measures 3.3V between P1_1 (or P1_3) and Gnd... If I hook up an extra LED+resistor between P1_1/P1_3 and GND, the LED only lights up when I direct the motor to spin.

So somehow the GPIO pins on the Wixel aren't doing a good job of holding low? Should I be using pull-down resistors, and are the below green additions a correct implementation?


Also in the diagram, I have an NPN transistor with connections Collector=5V, Base=3.3V GPIO (P1_5), and Emitter=Laser diode.  This works fine, as well.  The one weird thing I'm seeing is that when I power up, the laser is weakly on.  When I press a button that enables the laser, it goes to full brightness.  I release the button, and the laser goes completely off.  I can't reproduce that initial state after startup.  Is this another candidate for some sort of pull-down resistor? Can funky things happen if I do 3.3V to the Base, while 5V to the Collector?
I

Offline GertlexTopic starter

  • Supreme Robot
  • *****
  • Posts: 763
  • Helpful? 24
  • Nuclear Engineer · Roboticist
    • Index of Oddities
Added the pull-down for the laser and it now is off when the bot initially powers up. Guess I've probably got the right idea.
I

Offline waltr

  • Supreme Robot
  • *****
  • Posts: 1,944
  • Helpful? 99
Typical micro-controllers power on with their IO pins as inputs (or Hi-Z) so the transistor's base is not driven.
Second, transistors do have some leakage from the collector to the base, so if the base is 'floating' the base Voltage can rise enough for the transistor to turn on.
A resistor from the base to the emitter will prevent this and keep the transistor off. 10k Ohm is a common value used for this.

This can also be applied to any input pins on another IC that would be driven by a u-Controller's outputs.

Offline GertlexTopic starter

  • Supreme Robot
  • *****
  • Posts: 763
  • Helpful? 24
  • Nuclear Engineer · Roboticist
    • Index of Oddities
Typical micro-controllers power on with their IO pins as inputs (or Hi-Z) so the transistor's base is not driven.

...

This can also be applied to any input pins on another IC that would be driven by a u-Controller's outputs.

Thanks for the insights! :)
I

 


Get Your Ad Here

data_list