[Q] Robot with dual batteries and relay for 2nd battery

In referance to this post, I bought a relay to try.
http://arduino.cc/forum/index.php/topic,55492.0.html

This one

I also got a DPDT Switch to replace the single master switch

Since the relay is a 5v, can I power it from the 5v arduino pin or do i really need a transistor to turn on the relay?

I have a tip120 and tip42 on hand, would they work?

Since I am turning a serial motor controller do I need a diode?

Found this diagram

How do I know which pins are - and + on the relay? Does it matter? The datasheet doesn’t say much.

Thanks!

See the column that has "Coil Res" in ohms? Anything under 5V/40mA = 125 ohm will smoke the arduino output pin.

As far as the contacts for the power being switched, they do not matter, no more than they do for a manually operated toggle switch.

As you say, the datasheet is light on details. Try some switching with just an ohmmeter across the NO contacts, make sure you have the coil part figured out first.

Thanks, good thing I asked first.

So will the tip120 work for this? Or the TIP42?

The diagram has diode, do i need it?

Want to make sure before i go out tomorrw in case I need to pick some up.

Thanks again.

Edit: This on says 80 for the C column, but I take it using the transistor is much safer.

I think this will work great in conjuction with the new switch. Can't wait to get started tomorrow.

Yes, you need the diode. When you stop the current flow in the delay coil, the physics of the coil will try to keep the current flowing, creating a nasty spike of voltage. The diode dissipates that spike within the coil. The TIP120 will work to drive the relay. Use a resistor of around 470 ohm to1K between the arduino pin and the base pin of the transistor.

CrossRoads: Yes, you need the diode. When you stop the current flow in the delay coil, the physics of the coil will try to keep the current flowing, creating a nasty spike of voltage. The diode dissipates that spike within the coil. The TIP120 will work to drive the relay. Use a resistor of around 470 ohm to1K between the arduino pin and the base pin of the transistor.

Oh yeah! Its like when working with a DC Motor, makes sense.

Thanks again. Going out now to get the diodes and hope to try this out this afternoon.

This is driving me nuts!!!

So I got it all wired correctly and I can get the relay to turn on using the Arduino pin. I can if test it with a 5v source to the transistor and that works, but not from the 5v on the Arduino pin....

Also what does the resistor do on the Arduino pin to the base of the transistor? What happens if that isn't there? The transistor I am using can handle 5v. I am asking because I didn't use one on my other tip120 that turns a camera on and off.

Any ideas? I have tried everything and it just won't turn on the relay from the Arduino pin. I get 1.1v with a 1k and 1.2v with a 470k. If I connect it to the Arduino 5v rail with the 1k i get 1.3v. Doesn't make sense to me. The difference on output from the rail and the pin is .05v. Shouldn't make a difference.

One more question, the relay I bought is a 5/6v and I realized that I will powering it direcly from the battery which is 3.7, is that okay? Should I have gotten a 3v relay? It did work though powering it from the battery which is 4.2v when charged. Should I worry about it or just leave it?

I have to go back to the place anyway to exchange the switch I got, didn't realize it was a momentary switch. Doesn't say on the package or I guess that is what the (on) means instead of without the ().

The relay needs current flow to turn on. With 3V you won't get that current flow, so its not likely to work. The resistor between arduino & base limits the current flow out of the arduino - try a lower value.

"I can if test it with a 5v source to the transistor and that works, but not from the 5v on the Arduino pin...." What does this mean?

CrossRoads: The relay needs current flow to turn on. With 3V you won't get that current flow, so its not likely to work. The resistor between arduino & base limits the current flow out of the arduino - try a lower value.

"I can if test it with a 5v source to the transistor and that works, but not from the 5v on the Arduino pin...." What does this mean?

If the transistor is 5v I could just not use a resistor?

If I can get the relay to "click" on with the battery then that should be fine? Since the 5v rating is nominal voltage, it will work under 5v?

If I get a 3v relay, so I can use direct to the battery would that be better? Will it be okay to be over 3v when the battery is charged at 4.2?

Thanks, just trying to get this all straight in my head.

The data sheet says the turn-on voltage is 75% of rated - so the 6Vpart should turn on with 4.5V. But you want to limit the power thru the coil to 450mW. The 3V relay has coil resitance of 20 ohm, running it at 5V would dissipate (V^2)/R watts, = 25/20 = 1.25W. The Transistor would drop 0.7V, so (4.3^2)/20 = 0.9W.

The 3V part running off 3.7V battery would be fine - (3^2)/20 = 450mW.

So when the battery is fully charged (4.2v) that is why the 5/6v relay will work, but low battery it probably won't. Well I have to go exchange the switch anyway, might as well exchange the relay.

So I tired lower resistance resistors but it still won't turn on with the Arduino pin. Even without a resistor it won't turn on from the pin.

So I have tired lots of things and get this relay to work right.

I tired with a tip120/tip42/s9013 and the pin can't control the relay.

I was thinking that the Arduino can't supply enough power to turn on the relay. So that it why I tired the tip42, but when I set it to LOW it doesn't go completely low, I can still measure 3.6v. What am I missing? Or can I not use the tip42. I figured if I switched power to the relay coil then I wouldn't need to draw anything from the Arduino pin.

????

Thanks again.

So you're saying you're wired up like this and you can't get the motor control voltage to turn off?

And if you're not wired like that, then how are you wired? I want to see a real schematic - go to www.expresspcb.com, download the software, spend a couple of minutes figuring out how to right-click to open the component manager, find a couple of basic parts like I did and show us what you have.

The PNP TIP42 won't work here.

I'll do that tomorrow, in the meant time,

I was going to order some TIP102's?

In your diagram you used 2 TIP120's? What does that do?

I meant the relay won't turn on when using the pin. So no voltage to the motor controller. For testing I don't have it connected yet.

Its not 2 - that is what a TIP120 looks like internally. Really you should be able to drive that relay with just a simple NPN transistor like a 2N2222.

We are in total sync here, I can only suspect miswiring if you can't get that relay to switch for you.

If you hook up an LED and a 220, 270, or 330 ohm resistor, is the pin you're using able to turn the LED on & off?

Here is the diagram I created with expresspcb. I couldn't figure out how to get the ground and positive symbols and if I saved as image the traces wouldn't show, so here is a screenshot.

For testing the Motor Controller isn't actually connected to the relay. If I touch the base of the transistor to the battery direcly it works.

I will try the LED when I get home.

The pin worked when I was trying without the relay and also I can measure voltage out of it. I have a command I can set the pin high and low via Xbee.

Its almost like there isn't enough current for the transistor to turn the relay on. We doesn't make sense cause it worked before.

Maybe I should order the TIP102's? Hard to find a place that can ship a few cheap. Jameco has a stupid $10 min and ebay is $14 for 10. Cheapest I found on there that is in the US.

I hope to get a proper schematic in eagle this week. If I need to order the TIP102's I want to do it today so they are here by the weekend. Going to have a friend come over and take a look as well.

Thanks again for the help.

I just realized there is a ExpressSCH!!!! Oops.

I will play with that when I get home in a few.

Yeah, I see you have the pcb layout there. Still, looks very nice :slight_smile: