go away spammer

Author Topic: Electronic on/off switching circuit  (Read 2054 times)

0 Members and 1 Guest are viewing this topic.

Offline ben23fTopic starter

  • Jr. Member
  • **
  • Posts: 12
  • Helpful? 0
Electronic on/off switching circuit
« on: March 24, 2014, 11:54:29 PM »
Hi All,

I have a system on my robot where when I switch the power on, it powers the microcontroller.
I need to have a pause between powering on my microcontroller and powering on my motor driver circuit.

What I was thinking was have a circuit that sends the battery power to the motor driver circuit only when it receives a digital HIGH from the microcontroller.

Any suggestions of a circuit that I can make or buy?
at the moment I have two switches one to turn on the microcontroller then another to switch on the motor driver circuit. The problem with this is that the microcontroller is already running the program when I switch on the motors so the motors are starting from random parts of the program.

Thanks for any help!

Offline bdeuell

  • Robot Overlord
  • ****
  • Posts: 189
  • Helpful? 15
Re: Electronic on/off switching circuit
« Reply #1 on: March 25, 2014, 12:26:36 AM »
A relay controlled by a digital output pin on the micro-controller.


Offline jwatte

  • Supreme Robot
  • *****
  • Posts: 1,345
  • Helpful? 82
Re: Electronic on/off switching circuit
« Reply #2 on: March 25, 2014, 10:44:36 AM »
A relay is really simple. Unfortunately, it typically uses more current than is safe to deliver through a digital output pin of a microcontroller. Thus, you typically end up with a small transistor driven by the microcontroller, and the transistor drives the coil of the relay. Look at the coil voltage and current ratings of the relay to make sure you have the right kind of power supply for the coil available.
A relay is a few dollars, and a transistor is fifty cents, and you need a base resistor if you use a NPN like the 2N2222 (no resistor needed if using a N-channel CMOS like the 2N7000.)

An alternative is to use a power P-channel MOSFET as a high end switch, with a 4.7k pull-up resistor from gate to source, and source connected to + of motor battery. Then use that same transistor from above to pull the gate low to turn on the MOSFET. Note that MOSFETs often do not like more than 20V between source and gate, so if your motor is high-voltage (more than 12V, say,) it's probably a good idea to include a 12V Zener between source and drain, and another resistor between drain and switching-transistor (say, 2k2 or so.)

If you just want to buy something that works, try a suitably rated gear motor driver board (H-bridge.) You only need one half of the H-bridge. Pololu makes a variety of motor drivers that can take high voltage and/or current.

Here's how I would build it:



Bonus points for putting a 2 mA LED between R2 and Q2 to use as an "on" indicator and do something useful with the small current that will flow while this is on :-)

If the voltage you're switching is 12V or less, then you can remove D1 and R2 (replace R2 with a wire.) if you're switching more than about 24V, you want to use the SUP75-P05 rated for 50V, and probably want to make R1 less and R2 more (swap their values, say.)
Finally, this circuit does not let you use PWM to control the switched load, because it doesn't switch very fast, and would overheat if you switched it hundreds of times per second. MOSFETs can carry a lot of current when totally ON; they are vulnerable in the moment of switching when resistance is higher, but they're not blocking all the current yet.
« Last Edit: March 25, 2014, 10:48:30 AM by jwatte »

 


Get Your Ad Here