Pages: [1]   Go Down
Author Topic: help: Killer Flying Robot HEAD :-(  (Read 1187 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 301
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
What is the solution, so that my dc motors receive power "if and only if" the sketch is running? Well for starting, I can use a relay, but what about this unhappy use case that follows?

1. relay is off
2. arduino goes on
3. sketch starts (variables initialized)
4. relay goes on
5. motors start running, constrained to sketch variables (say, L298 by Arduino PWM passing 3v)
6. Arduino restarts (say, accidentally, and same time L298 being no more constrained by MCU, passes full 12v and my robot head starts to fly, instead of turn! :-) )

Perhaps the question is: what to do so that L298 is off, if Sketch is not running? (pass power to it by Arduino sketch? or better solution please?)
Logged

0
Online Online
Shannon Member
****
Karma: 222
Posts: 12730
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

When the chip resets the pins are all set to be inputs - normally this will switch off any connected relays as the transistor driving them will get no current.
Logged

[ I won't respond to messages, use the forum please ]

USA
Offline Offline
God Member
*****
Karma: 14
Posts: 644
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It wasn't until I had read the majority of your post that I realized you were asking for advice on how to keep the head of your robot from flying off, instead of how to control the head of a flying killer robot.  That's just as well because I've pledged to use my Arduino powers only for Good... smiley-wink  

Running the L298 off the on board regulator will only have the L298 be off when the Arduino is unpowered.  So it will still be powered during a reset.  Also MarkT is correct about the Arduino pins defaulting as inputs.

However to really ensure the L298 won't be uncontrolled, you could setup a transistor switch between the 12 VDC power supply and the L298.  The switch would be attached to an I/O pin, is initialized as LOW in the setup() function, and set HIGH only after the sketch is ready to control the L298.  Then if the Arduino is off, the motor is off, and if the Arduino resets the motor will be remain off until the proper control signals can be sent to the L298.  The additional advantage is it allows you to have a sensor based (e.g. bumpers or proximity sensors) "kill switch" that can toggle the transistor and stop the motor very quickly if something gets in the way of the head's rotation.
Logged

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 301
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
Thank you, I will try the relay and have no question about that implementation, but the second response opens me new questions:

I wrote about relay because my motor is 12v and around 2A because I don't know what transistor to use to implement the switch and the best schema for it so not to get it hot, etc. in terms of a safe design, could you please suggest?

And yes: this is a question of safety, 2 motors will turn the head up and down, left and right (installed vertically to each other) and I am trying to approach full guarantee that no movement will happen out of expectation, specially 'when something goes wrong' based on "if something can go wrong, will go wrong", but again, we have another from Murphy: "if all seems working correct, something is wrong!" :-(

May only Arduino help to be sure that motors never go out of control :-)
Logged

USA
Offline Offline
God Member
*****
Karma: 14
Posts: 644
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I wrote about relay because my motor is 12v and around 2A because I don't know what transistor to use to implement the switch and the best schema for it so not to get it hot, etc. in terms of a safe design, could you please suggest?

First, you'll want to make sure the transistor is rated above the voltage and current levels it's going to see during operation.  In this case I'd say the maximum ratings need to be at least 20 VDC and 3 A (and really I'd get over 4 A if it's practical).  Second, you'll want it packaged so that it's easy to to attach to a heat sink, so you want one with a thermally conductive tab.  preferably one that is large with a hole for a fastner some form of TO-220 package fits the bill.  

Here's a tutorial on how to use a MOSFET type of transistor as a switch with an Ardunio and a higher powered device like a DC motor (you could use a BJT as well, but MOSFETs are better suited for these voltage and current levels).  The specific transistor used in the tutorial would work in your case (in fact it's rated to handle many times the voltage and current), but as long as you keep in mind the two points I've made above you will be able to select a different one you can safely use.

Edit: Oh and the tutorial I linked to showing a direct connection to the motor, with the transistor switch circuitry on the negative side of the motor (i.e. a low side switch).  My original suggestion was to have the transistor switch between the power supply and the L298's input for the +12 VDC (i.e. a high side switch).  Either configuration would work to interrupt the power to the motor when the transistor is closed.
« Last Edit: October 04, 2012, 01:21:13 pm by Far-seeker » Logged

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 301
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks, thanks and again thanks!
Logged

Pages: [1]   Go Up
Jump to: