PDA

View Full Version : General question about powering an arduino



SXRguyinMA
07-21-2010, 09:05 PM
Ok so for my setup in Tempest SXR I plan on having a separate adapter so the Arduino will be powered on when the computer is off (unless I can figure something else out - I'll get into that later). If I have the 5v socket hooked up and the USB (I'll need the USB hooked up for a bit once it's first installed to adjust the coding) will it automatically switch to the best power source or will it fry something?

Also, can I build a circuit that will take 5v from the PSU and store it in a capacitor so the arduino will have 4 or 5 seconds of power after the computer is off so I don't have to keep it plugged into a separate power source all the time? I need it to stay on after the computer shuts off so that it will close the louvers. If I just power it off the PSU, the same 5v line controls the loop in the code, so it'll power down before it has time to shut the louvers. But when I power it on it'll work just fine.

So after typing all this, I think I'd like to go the capacitor route and just supply 5v to the arduino for 5 seconds or so after the computer is off. Can anyone suggest how I might do this or point me in the right direction?

Trace
07-22-2010, 12:57 AM
Well, you could have the shutdown commands of Windows send teh command to teh arduino and have the louvers shut before the computer shuts off.

Check out Renderman's Motorized Madness (http://www.thebestcasescenario.com/forum/showthread.php?t=10192) mod to see this in action (not necessarily with an arduino)

I see I put teh instead of the. I'm in a teh mood apparently (none of them were typed on purpose except for this line)

crenn
07-22-2010, 01:53 AM
In the main ATX power to the motherboard, there is a 5v standby line, you might like to use that.

x88x
07-22-2010, 02:57 AM
In the main ATX power to the motherboard, there is a 5v standby line, you might like to use that.

I would use this if it provides enough current. Maybe, have the main power for the arduino be this, and have one of the I/O pins be monitoring the power on a regular 5V line. When the regular 5V line no longer registers, then start shutting the louvers.

crenn
07-22-2010, 03:28 AM
I would use this if it provides enough current. Maybe, have the main power for the arduino be this, and have one of the I/O pins be monitoring the power on a regular 5V line. When the regular 5V line no longer registers, then start shutting the louvers.
The code he has currently already does this. Maybe have a capacitor so that the servo has enough power without relying on the standy line. Ideally putting the arduino into sleep mode until the computer turns back on.

SXRguyinMA
07-22-2010, 07:42 AM
exactly what I was thinking. the 5v from the psu stops @ the same time the computer shuts down, so the computer will shut off leaving the louvers open

SXRguyinMA
07-22-2010, 11:28 AM
I'd like to make a circuit with a capacitor so like crenn said it will supply a few secodns worth of juice to the Arduino once the computer powers off just so it will shut the louvers. I can then hook it to the 5v psu power so while the computer is on it will charge the capacitor.

I'm also thinking of making a custom board to mount the ATMega chip frmo the arduino so I can continue to use the adruino in other projects, and maybe combine this capacitor circuit into the same board. Anyone have any ideas? :?

SXRguyinMA
07-22-2010, 11:49 AM
I think I've found the solution

http://arduino.cc/en/Main/ArduinoBoardFio

x88x
07-22-2010, 11:54 AM
exactly what I was thinking. the 5v from the psu stops @ the same time the computer shuts down, so the computer will shut off leaving the louvers open

As long as you don't turn off the switch on the back of the PSU, the 5V standby line will stay on. That's kinda it's whole point. So, if you just use that line and just don't throw that switch until after the louvers are closed, you shouldn't have a problem.

Alternately, if you want to go with a cap, try experimenting with a few different high capacitance caps to find out what you need. As long as you're only feeding it a straight 5V charging line it'll only charge to 5V, so you shouldn't have to worry much about the voltage rating of the capacitor.

SXRguyinMA
07-22-2010, 12:03 PM
well I never shut off the psu itself so I don't need to worry about that. you're talking about the green wire on the 24-pin connector right? will that have enough current to run the servo though?

optionally I can make one of these (http://cgi.ebay.com/2-PCS-9V-2-5mm-Battery-Adapter-Arduino-MCU-/150466664305?cmd=ViewItem&pt=LH_DefaultDomain_0&hash=item2308831771) and just keep an eye on the battery. The thing is that the Arduino doesn't need power after the 3 or 4 seconds it needs to shut the louvers, so I wouldn't want it to sit and drain the 9v all night while the computer is off, hence the capacitor route.

As far as that goes, what if any special circuitry would I need for it? Or would I just hook a 5v line to the cap (presumably with a diode) and hook the cap right to the power and ground pins on the arduino? Or hook it to the arduino without the extra 5v line and let it charge from the 5v power on the arduino itself?

SXRguyinMA
07-22-2010, 12:06 PM
or this maybe? (http://cgi.ebay.com/Arduino-Li-ion-Battery-Shield-/280531339347?cmd=ViewItem&pt=LH_DefaultDomain_0&hash=item4150f88853)

x88x
07-22-2010, 12:11 PM
you're talking about the green wire on the 24-pin connector right?

No, no, no, I see the confusion now. There's a special 5V 'standby' line, I think usually blue. Basically it lets the MBB check that the PSU is actually functioning or something.

As for the capacitor, I think if you just put the cap in parallel with the arduino and put a diode between the PSU and the cap (so the cap doesn't discharge into the PSU), that should work. I would try it first on some other 5V device that doesn't matter if it gets burned out, just to make sure I'm not full of crap. :P

SXRguyinMA
07-22-2010, 12:42 PM
lmao sounds good. also, The only caps I'm finding are 35v or 50v. If I only hook a 5v line to it will it only charge 5v up to its rated uf capacity? or shoudl I try to find a 5v cap?

x88x
07-22-2010, 12:58 PM
Correct. No matter what the voltage rating (as long as it's >=5V), any cap just hooked up to a straight 5V line will only charge to 5V. To get it higher than the source voltage you would need a DC-DC boost circuit like in my coilgun thread.

crenn
07-22-2010, 01:08 PM
http://www.sparkfun.com/commerce/product_info.php?products_id=746

x88x
07-22-2010, 03:08 PM
If you're looking for something a little cheaper, there's also this:
0.47F 5.5V : $1.49
http://www.goldmine-elec-products.com/prodinfo.asp?number=G16573

As opposed to the one crenn linked
10F 2.5V : $4.95
http://www.sparkfun.com/commerce/product_info.php?products_id=746

You could combine two of the 10F ones in series to get a 5F 5V cap bank for $10, and that's definitely a great price for that, but idk if you need 5F of capacity. I'm also not sure how you would go about calculating that. With the smaller ones off Electronics Goldmine, you could run as many as you need in parallel, for any multiple of 0.47F. So if you only need, say, 2F of capacitance to run the arduino and servo for the time needed, you could hook up 5 of the 0.47F ones in parallel for $7.50. ...and, actually, now that I type that all out, I would just go with two of the one that crenn linked, but I'm not gonna delete all that because..yeah. :P

SXRguyinMA
07-22-2010, 03:24 PM
lol I ended up getting the ones crenn linked only because sparkfun had a few other misc goodies (switces, RS232 to USB converter) that I wanted, so it was easier. Should hopefully see them in a week or so! then I can get cracking on this!

Even if the 5F ends up being too much that just means the Arduino will run longer than I need until the caps are drained right?

x88x
07-22-2010, 03:51 PM
Right. Think of a cap kinda like a bucket of water with a hole in the bottom. The capacitance rating determines the size of the bucket, the voltage determines the size of the hole. So, you fill up the 'bucket' with 5V, and when that input voltage goes away it puts out 5V until it's empty.

SXRguyinMA
07-22-2010, 04:37 PM
cool thanks!

I'm pretty knowledgeable about some electrical stuff, but when it gets into trasistors and capacitors and the like I'm a little lost :?

SXRguyinMA
07-23-2010, 11:11 AM
crenn, I had a guy over on the arduino furms say those caps you suggested probably won't work because they're too high resistance (40 ohms each). He suggested these ones, but then I'd need 10 of them (~$40) in parallel for 4.7F, and they are .5ohm each

http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=283-3014-ND

any suggestions? I've already got the ones from sparkfun coming, so I'll give it a shot. he thinks it might be too much resistance (80 ohms total) to run the servo properly

here's the thread from arduino forums

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1279813240/0

crenn
07-23-2010, 12:02 PM
I'm only guessing since it's been a while since I've done analog electronics, but my guess would be there is just enough current to move the servo to the correct position.

I could be completely wrong, so take this with a grain of salt (maybe half a grain). If you apply ohms law (V=IR) to it to get current, you get 5V with 80 Ohms which theoretically produces 625mA. But there are a lot of varibles to that. Especially since capacitors aren't ohmic.

It's probably safest to try his route (in terms of circuitry) and see what happens. Mean while... I think I'm going to find my textbook again to study.

SXRguyinMA
07-23-2010, 04:26 PM
lol thanks again for all your help on this project crenn! Once I get them caps in I'll breadboard it up and test it. now, can I just hook it (with diode) to the 5v and gnd pins on the arduino?

Oneslowz28
07-23-2010, 10:46 PM
You need something like a super cap to store enough energy so the duino can power the servo long enough to close the louvers.

SXRguyinMA
07-23-2010, 10:49 PM
even for the ~1 second it needs to move?

x88x
07-24-2010, 03:33 AM
You need something like a super cap to store enough energy so the duino can power the servo long enough to close the louvers.

That's what the caps that he's using are for. Do you not think 5F would be enough? Actually, SXR, is there a power rating on the servo?

crenn
07-24-2010, 04:02 AM
That's what the caps that he's using are for. Do you not think 5F would be enough? Actually, SXR, is there a power rating on the servo?
Servos current depends on the load. For a normal servo, it could be upto 1A but it is dependant on the individual servo. Also you need to remember that the more current you draw, the less time you have due to the capacitor's discharge cycle.

SXRguyinMA
07-24-2010, 07:08 AM
this is the servo I'm using:

http://www3.towerhobbies.com/cgi-bin/wti0001p?&I=LXXF84

the specs they list:

SPECS: Length: 1.6" (40.5mm)
Width: .8" (20.5mm)
Height: 1.43" (36mm)
Torq: 80 oz/in
Weight: 1.58oz (45g)



And there's hardly any load on this thing at all. The louvers have a little bit of weight and resistance, but if it will be closing them gravity will be working with the servo and not against it

crenn
07-24-2010, 11:12 AM
Got a multi meter handy?

SXRguyinMA
07-24-2010, 12:59 PM
not atm, but I'll be home from work in ~4.5 hours, what do you want me to check?

crenn
07-24-2010, 01:13 PM
The current to the servo!

SXRguyinMA
07-27-2010, 11:30 AM
alright I go tmy caps in today, Is hould be able to get this breadboarded tonight. Now I know I can hook it to the 5v pin on the arduino to get power, but will this pin also pwoer the arduino or only the USB or jack?

crenn
07-27-2010, 12:16 PM
Wait a bit because I think we need a couple of extra components.

SXRguyinMA
07-27-2010, 06:57 PM
k

SXRguyinMA
07-27-2010, 09:55 PM
well I ended up breadboarding it up anyways and it works! I don't see the point in the resistor from the cap + to board + though, it seems to just make the caps take longer to charge. I let it run until both caps read about 2.5v, then unplugged the power supply. I cycled the servo back and forth several times and it worked fine

crenn
07-28-2010, 02:51 AM
The reason for the resistor is to reduce the current drawn from the PSU, the other thing I wanted to do was make sure when the system was off, that the current wouldn't leak back into the computer.

SXRguyinMA
07-28-2010, 02:56 AM
this is now I've got it hooked up, but with the 2 10F caps instead of the .47F one
http://ruggedcircuits.com/images/sch23.png

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1279813240/0

crenn
07-28-2010, 03:13 AM
A 5v zener diode?

Also, how long does it take to charge the circuit?

SXRguyinMA
07-28-2010, 03:21 AM
yes 5v, seems to take about 4 or 5 mins to fully charge both. I hooked my multimeter to them and watched it creep up ever so slowly, but one got to 2.497v and the other to 2.502 and seemed to stabilize there

crenn
07-28-2010, 03:37 AM
Got a model number for that zener? I'm guessing the capacitor at 2.497v was closer to ground?

I'm currently fiddling with the simulator.

SXRguyinMA
07-28-2010, 11:11 AM
actually the lower voltage one was the one hooked to the diode, resistor adn 5v, the higher voltage one was on the ground side.

This is the diode I used:

http://www.radioshack.com/product/index.jsp?productId=2049726&filterName=Type&filterValue=Diodes

crenn
07-28-2010, 11:28 AM
What voltage is the capacitors providing to the micro just after being fully charged?

This is what I have currently:


$ 1 4.9999999999999996E-5 105.18789638808724 50 5.0 50
z 384 272 384 176 1 1.2 5.1
r 320 272 320 176 0 15.0
r 544 192 544 384 0 100.0
c 352 272 352 320 2 10.0 2.4298641778297494
c 352 320 352 384 2 10.0 2.4298641778297494
w 352 384 448 384 0
w 448 384 544 384 0
w 544 192 544 176 0
g 448 384 448 432 0
w 384 272 352 272 0
w 352 272 320 272 0
w 320 176 352 176 0
w 352 176 384 176 0
R 432 80 432 32 0 0 40.0 5.0 0.0 0.0 0.5
w 384 176 544 176 0
s 352 112 432 112 0 0 false
w 544 144 544 176 0
178 432 80 544 80 0 1 0.2 0.011428571428571427 0.05 1000000.0 0.0114 1050.0
w 432 128 432 304 0
w 432 304 448 304 0
w 448 304 448 384 0
w 544 96 544 144 0
R 352 112 304 112 0 0 40.0 12.0 0.0 0.0 0.5
o 3 64 0 35 2.5 0.05 0 -1
o 2 64 0 35 5.0 0.05 1 -1
The switch represents the computer being turned on and off. But this circuit currently prevents the capacitors trying to power everything in the computer via the relay. I've lowered the charging resistor from 100 ohms to 15 ohms to charge it a little faster. The other resistor represents the load on the system. I have another idea on how to get things working better... but I'm unsure on how to do it.

EDIT: Simulator is showing me that each capacitor is charging to 2.27v in 3 minutes. There could be another way of cutting the power to the arduino and servo after it finishes it's power down sequence using another relay if you're interested.

SXRguyinMA
07-28-2010, 01:49 PM
I see what you're saying. this is what I sketched up and breadboarded:


$ 1 5.0E-6 382.76258214399064 99 5.0 50
r 192 112 240 112 0 100.0
w 192 112 192 160 0
d 192 160 240 160 1 0.805904783
w 240 112 240 160 0
w 192 160 192 240 0
w 240 112 304 112 0
c 192 240 192 288 0 10.0 0.23950676780649208
c 192 288 192 336 0 10.0 0.23950676780649208
w 192 336 304 336 0
g 304 336 368 336 0
s 304 112 368 112 0 0 false
R 384 112 464 112 0 0 40.0 5.0 0.0 0.0 0.5
w 384 112 368 112 0
181 304 256 304 208 0 2779.341976072886 100.0 5.0 0.4 0.4
w 304 256 304 336 0
w 304 208 304 112 0
o 6 64 0 35 0.3125 0.05 0 -1

SXRguyinMA
07-28-2010, 04:04 PM
What voltage is the capacitors providing to the micro just after being fully charged?

I'll find out tonight :up:


EDIT: Simulator is showing me that each capacitor is charging to 2.27v in 3 minutes. There could be another way of cutting the power to the arduino and servo after it finishes it's power down sequence using another relay if you're interested.

It doesn't matter to me if the caps drain fully afterwards, my computer is always on for at least 3 mins anways lol. As long as it's got enough juice to move the servo closed it can sit like that until they're drained. Caps don't have a memory like batteries do they? or a certain number of charge/discharge cycles?

crenn
07-28-2010, 05:11 PM
I'm not 100% sure about super capacitors. But normal capacitors don't have an issue with memory, and it's not really a defined number of cycles, just how old they are it seems.

SXRguyinMA
07-28-2010, 09:23 PM
They put out 5.02v total when fully charged. One was 4.999v and the other was 5.024v. I unhooked it and cycled the servo with its sensor pin (7) about 5 or 6 times before it didn't have enough juice to move it, so that will be more than enough.

The only problem I find is that it still feeds power back through the PSU. I had the sensor hooked to the 5v on the floppy connector and the arduino hooked to the 5v on a molex, and even when I unplugged the PSU the servo didn't move until I unplugged the sensor wire from the PSU. This may be the need to set it up with a relay like you suggested

crenn
07-28-2010, 11:54 PM
Yeah, I was afraid about that happening so that's why I tried a transistor and eventually a relay. I didn't power the relay with 5v because the power would still feed back into the system, so that's why it's powered with 12v. If you want, we can still discuss giving the design 2 relays so that it can disconnect itself (and hopefully save charging time next cycle).

btw, took a look at your design in the simulator. You placed a diode where the zener diode should have been.

SXRguyinMA
07-29-2010, 12:01 AM
whats the difference between a regular diode and a zener? I see the ones that I bought were in fact zener diodes.

I'm going to try hooking the signal wire to 12v, that may work just as well

crenn
07-29-2010, 12:32 AM
Don't hook it upto 12v... you'll damage the pin on the micro.

The different is a zener is designed for a specific reverse break-down voltage (in your case 5.1) but can work as a normal diode as well.

SXRguyinMA
07-29-2010, 07:41 AM
ah ok. so it looks like a relay is the way to go then. have the 12v trigger the relay, so when the 12v shuts off the relay will open and shut off any 5v to the sensor pin

crenn
07-29-2010, 08:09 AM
ah ok. so it looks like a relay is the way to go then. have the 12v trigger the relay, so when the 12v shuts off the relay will open and shut off any 5v to the sensor pin
Actually it won't shut off 5v to the sensor pin directly. It isolates the system so it's not feeding back into the PSU (and then the sensor pin).

SXRguyinMA
07-29-2010, 08:21 AM
well yea that's what I meant lol. I'll snap up a small relay @ radio shack after work and try it out tonight

SXRguyinMA
07-29-2010, 08:22 AM
something like this should work right?

http://www.radioshack.com/product/index.jsp?productId=2062479&filterName=Type&filterValue=SPST

crenn
07-29-2010, 08:33 AM
I think something more like this: http://www.radioshack.com/product/index.jsp?productId=2062481

You need it to handle the current of charging the capacitor and also for the arduino and servo to work.

SXRguyinMA
07-29-2010, 09:39 AM
it doesn't need to be a SPDT does it? They have this 1A SPST as well.

http://www.radioshack.com/product/index.jsp?productId=2062478&filterName=Type&filterValue=SPST

:EDIT: that SPST 1A is only a 5v relay, so I will need that one you listed

:EDIT 2: they're got it in stock at my local store, I'll scoop it up after work tonight :up:

SXRguyinMA
07-29-2010, 09:57 AM
crenn, here is the datasheet for that relay:

http://relays.tycoelectronics.com/datasheets/OUAZ.pdf

what would be the best way to wire it up? I was thinking the 12v would go to the switching pins (bottom left 2), 5v from PSU to bottom right pin, 5v sense wire to top right pin. This would close the 5v circuit when 12v is applied (computer on), and take away 5v when the computer is off. the 5v charge I was going to hook directly to the PSU as it is breadboarded now, or would this cause problems?

SXRguyinMA
07-29-2010, 10:13 AM
ok here's what I've got. Obviously the 5v and 12v will be switched together, but to do that in this program would make it look complicated and messy


$ 1 5.0E-6 1.7725424121461644 99 5.0 50
c 112 240 112 288 0 10.0 0.002935472230715953
c 112 288 112 336 0 10.0 0.002935472230715953
178 384 224 400 224 0 1 0.2 0.03749999999999956 0.05 1000000.0 0.0375 320.0
x 445 258 554 261 0 10 5v sense pin to arduino
x 364 144 423 147 0 10 5v from PSU
x 249 283 314 286 0 10 12v from PSU
x 159 201 196 204 0 10 Arduino
s 320 256 352 256 0 0 false
g 256 336 304 336 0
w 256 304 256 336 0
w 256 336 224 336 0
s 272 112 304 112 0 0 false
w 112 336 224 336 0
w 384 256 352 256 0
w 288 256 320 256 0
w 112 160 112 240 0
w 112 112 112 160 0
w 160 112 224 112 0
w 160 112 160 160 0
w 224 112 224 208 0
w 224 256 224 336 0
w 336 112 304 112 0
w 384 304 256 304 0
w 384 272 384 304 0
w 400 240 480 240 0
w 272 112 272 224 0
w 272 224 384 224 0
w 224 112 272 112 0
181 224 208 224 256 0 1906.636257543845 100.0 5.0 0.4 0.4
z 112 160 160 160 1 0.805904783 5.6
r 112 112 160 112 0 100.0
R 336 112 400 112 0 0 40.0 5.0 0.0 0.0 0.5
R 288 256 272 256 0 0 40.0 12.0 0.0 0.0 0.5
o 0 64 0 35 0.009765625 0.05 0 -1
o 1 64 0 35 0.009765625 0.05 1 -1
o 31 64 0 35 5.0 25.6 2 -1
o 32 64 0 35 20.0 0.05 3 -1

crenn
07-29-2010, 10:18 AM
You can hook the 5v directly to the sense pin on the arduino. Then connect the closed position (ie when the 12v is applied) to the voltage supply of the arduino and charging circuit. So when the computer turns off, the arduino, servo and capacitor is isolated from the rest of the system and the arduino still can sense when the computer has turned off as the 5v supply will disappear from the sense pin.

EDIT: Goto Page 5 and my top post. That's more accurate to what you want.

SXRguyinMA
07-29-2010, 10:23 AM
I just edited the code again

:EDIT: I'll cehck what you've got on pg 5 :up:

SXRguyinMA
07-29-2010, 10:39 AM
ok I took your pg5 code and edited it so it wouldn't send voltage from the caps back through the 5v sense pin


$ 1 4.9999999999999996E-5 1.6308177459886661 50 5.0 50
z 224 272 224 176 1 1.2 5.1
r 160 272 160 176 0 15.0
c 192 272 192 320 2 10.0 1.5976931634448988
c 192 320 192 384 2 10.0 1.5976931634448988
w 192 384 288 384 0
w 288 384 384 384 0
w 384 192 384 176 0
g 288 384 288 432 0
w 224 272 192 272 0
w 192 272 160 272 0
w 160 176 192 176 0
w 192 176 224 176 0
R 272 80 272 32 0 0 40.0 5.0 0.0 0.0 0.5
w 224 176 384 176 0
s 192 112 272 112 0 1 false
178 272 80 384 80 0 1 0.2 0.0 0.05 1000000.0 0.0375 320.0
w 272 128 272 304 0
w 272 304 288 304 0
w 288 304 288 384 0
R 192 112 144 112 0 0 40.0 12.0 0.0 0.0 0.5
x 421 292 458 295 0 10 Arduino
z 384 128 384 176 1 0.805904783 5.6
w 384 96 384 128 0
x 461 115 531 118 0 10 5v to sense pin
g 480 96 512 96 0
r 384 96 480 96 0 1000.0
181 384 256 384 272 0 1462.1431707282563 100.0 4.0 0.4 0.4
w 384 192 384 256 0
w 384 272 384 384 0
o 2 64 0 35 2.5 51.2 0 -1
o 3 64 0 35 5.0 51.2 1 -1
o 26 64 0 35 5.0 51.2 2 -1

crenn
07-29-2010, 10:49 AM
You can remove that zener diode as the sense pin should be connected before the relay (aka directly from the PSU itself). I'll draw up an accurate representation before I go to bed.

SXRguyinMA
07-29-2010, 10:55 AM
ahhh ok. Thanks again crenn, without you I don't know if this project would have even gotten off the ground!! +rep

SXRguyinMA
07-29-2010, 11:02 AM
like this then?


$ 1 4.9999999999999996E-5 1.6308177459886661 50 5.0 50
z 224 272 224 176 1 1.2 5.1
r 160 272 160 176 0 15.0
c 192 272 192 320 2 10.0 0.0034025929640006517
c 192 320 192 384 2 10.0 0.0034025929640006517
w 192 384 288 384 0
w 288 384 384 384 0
w 384 192 384 176 0
g 288 384 288 432 0
w 224 272 192 272 0
w 192 272 160 272 0
w 160 176 192 176 0
w 192 176 224 176 0
R 272 80 272 32 0 0 40.0 5.0 0.0 0.0 0.5
w 224 176 384 176 0
s 192 112 272 112 0 0 false
178 272 80 384 80 0 1 0.2 0.037499999999999964 0.05 1000000.0 0.0375 320.0
w 272 128 272 304 0
w 272 304 288 304 0
w 288 304 288 384 0
R 192 112 144 112 0 0 40.0 12.0 0.0 0.0 0.5
x 421 292 458 295 0 10 Arduino
x 461 115 531 118 0 10 5v to sense pin
g 480 96 512 96 0
181 384 256 384 272 0 1045.742863484448 100.0 4.0 0.4 0.4
w 384 192 384 256 0
w 384 272 384 384 0
w 384 96 384 176 0
w 480 96 416 96 0
w 416 96 416 32 0
r 416 32 352 32 0 1000.0
w 352 32 272 80 0
o 2 64 0 35 0.009765625 1.6 0 -1
o 3 64 0 35 0.009765625 1.6 1 -1
o 23 64 0 35 5.0 102.4 2 -1

crenn
07-29-2010, 11:06 AM
This is what I came up with, I'll look at yours in 2 ticks:


$ 1 4.9999999999999996E-5 1.6308177459886661 50 5.0 50
z 336 320 336 224 1 1.2 5.1
r 272 320 272 224 0 15.0
r 496 240 496 432 0 100.0
c 304 320 304 368 2 10.0 2.410060209449615
c 304 368 304 432 2 10.0 2.410060209449615
w 304 432 400 432 0
w 400 432 496 432 0
w 496 240 496 224 0
g 400 432 400 480 0
w 336 320 304 320 0
w 304 320 272 320 0
w 272 224 304 224 0
w 304 224 336 224 0
w 336 224 496 224 0
178 384 128 496 128 0 1 0.2 0.011428027236798245 0.05 1000000.0 0.0114 1050.0
R 128 144 80 144 0 0 40.0 12.0 0.0 0.0 0.5
x 533 340 570 343 0 10 Arduino
x 549 74 619 77 0 10 5v to sense pin
w 496 144 496 224 0
178 272 64 320 64 0 1 0.2 0.30000000000000004 0.05 1000000.0 0.02 20.0
178 272 144 320 144 0 1 0.2 0.30000000000000004 0.05 1000000.0 0.02 20.0
R 128 64 80 64 0 0 40.0 5.0 0.0 0.0 0.5
w 128 64 176 64 0
w 176 64 272 64 0
w 320 80 384 80 0
w 320 160 352 160 0
w 352 160 384 160 0
w 128 144 272 144 0
w 128 144 128 176 0
s 128 176 208 176 0 0 false
w 208 96 208 176 0
w 208 96 272 96 0
w 272 112 240 112 0
w 240 112 240 176 0
w 240 176 272 176 0
w 384 48 432 48 0
r 432 48 512 48 0 100.0
g 512 48 560 48 0
x 237 36 353 39 0 10 Representation of a PSU
x 139 197 205 200 0 10 On/Off Switch
w 272 192 224 192 0
w 384 176 320 176 0
w 320 176 320 208 0
w 320 208 224 208 0
w 224 192 224 208 0
g 224 208 224 240 0
w 384 48 384 80 0
w 384 80 384 128 0

Like that, I'm not sure why yours isn't working fully (voltage on the bulb wasn't 5V straight away) however that's pretty much the setup.

SXRguyinMA
07-29-2010, 06:34 PM
alright so i got it boarded up...and it doesn't work. it's losing too much voltage through the relay apparently. I've got 5.01v out of the PSU, and only ~3.6v out of the relay, and thats not enough to power the arduino. I'm going to keep messing with it and see what I can do. maybe put 12v into the relay instead of 5 and use a resistor after the relay to et it to ~4 or ~5v?

crenn
07-29-2010, 07:13 PM
I'd say too dangerous. The voltage drop over the relay should be minimal :/

SXRguyinMA
07-29-2010, 07:40 PM
I think you were right...I think I fired my atmega328 chip. It won't run any loop and won't let me upload anything. the power led is on and everything though

and another strange problem arose...when I disconnected the PSU the relay didn't turn off until I unhooked either the 5v or 12v ground :?

SXRguyinMA
07-29-2010, 08:15 PM
ok well upon further testing, it would seem that with anything over 4.5v total in the caps the relay won't close. I hooked up my multimeter, and with the caps charged to 4.6v I shut off the psu. it dropped to 4.53 before the relay shut. I charged the caps to 4.75, and it went to 4.5 before the relay shut. :? it's shutting though, and 4.5v should still be more than adequate to move the servo to the closed position

crenn
07-29-2010, 08:23 PM
If you power the arduino from USB, does it still work?

SXRguyinMA
07-29-2010, 08:28 PM
the power light comes on but it won't do anything. I tried USB, the 2.5mm jack and the 5v and gnd pins on the board. I'm hoping it's just the chip that's fried and not the whole board :think:

SXRguyinMA
07-30-2010, 08:33 PM
alright crenn I soldered up and tested it and it works great! I charged the caps up to full voltage (5.02) and shut off the PSU. The voltage trickled down from 5.02 to 3.37 before the relay finally clicked off. I'll have to wait for my new atmega328 to see if it'll be enough to move the servo. Maybe the draw of the servo itself will make the relay work right, who knows. I was thinking of working in a 5v relay that runs off the main relay and see if that will kill the 5v instantly. I'm not sure yet. oh well. I'll see what happens when I get my new chip in

crenn
07-30-2010, 11:26 PM
Are you getting a raw ATMega328P or a preprogrammed ATMega328P with the Arduino bootloader?

SXRguyinMA
07-30-2010, 11:29 PM
preprogrammed. I could have gotten either though as you can burn the bootloader through the arduino and it's software

crenn
07-30-2010, 11:37 PM
You need an ISP programmer to burn the bootloader, you can't with just the arduino and it's software (however there is ways around that).

SXRguyinMA
07-31-2010, 12:28 AM
Well I've got a programmer that will do ICs from 8-pins and up, I used it to write and program my lighting sequences to my PIC 12F683 on my RGB controller. But either way, I got one with the bootloader in it, so I'm all set. I just gotta try to figure out this funky relay thing. It's like it's leaking voltage backwards through the ground, through the PSU and then back through the 12v line and keeping the relay open. I may get a 5v relay and use the 12v to turn on the 5v and go that way, we'll see though.

crenn
08-03-2010, 10:36 AM
The only solution I can think about is to use a 5v regulator to try to solve the problem, but I'm not sure how well that will work.

SXRguyinMA
08-05-2010, 07:04 PM
alright I got my new chip in today and all is good. now I'm going to do some more sketching with that circuit simulator and figure out how to work in that 5v relay

SXRguyinMA
08-05-2010, 10:38 PM
alright crenn what do you think about this instead? I'd need to get another diode but that's no biggie. could I use a transistor in this circuit instead maybe?


$ 1 4.9999999999999996E-5 1.6308177459886661 50 5.0 50
z 224 288 224 192 1 1.2 5.1
r 160 288 160 192 0 15.0
c 192 288 192 336 2 10.0 2.0885785848445715
c 192 336 192 400 2 10.0 2.0885785848445715
w 192 400 288 400 0
w 288 400 384 400 0
w 384 208 384 192 0
g 288 400 288 448 0
w 224 288 192 288 0
w 192 288 160 288 0
w 160 192 192 192 0
w 192 192 224 192 0
w 224 192 384 192 0
178 272 96 384 96 0 1 0.02 0.015625 0.05 1000000.0 0.0010 320.0
x 414 344 451 347 0 10 Arduino
x 437 42 507 45 0 10 5v to sense pin
w 384 112 384 192 0
R 224 128 176 128 0 0 40.0 5.0 0.0 0.0 0.5
r 384 64 464 64 0 10000.0
g 464 64 512 64 0
s 224 128 272 128 0 0 false
w 272 144 272 384 0
w 272 384 288 384 0
w 288 384 288 400 0
181 384 208 384 400 0 1205.7972822685413 100.0 5.0 0.4 0.4
w 272 96 272 64 0
w 272 64 384 64 0
d 272 128 272 96 1 0.805904783
o 2 64 0 35 5.0 102.4 0 -1
o 3 64 0 35 5.0 102.4 1 -1
o 24 64 0 35 5.0 204.8 2 -1

SXRguyinMA
08-05-2010, 10:54 PM
or how about this? why do I even need the resistor and diode on the caps?


$ 1 4.9999999999999996E-5 23.47059216675035 54 5.0 50
c 192 272 192 320 2 10.0 2.440884490230046
c 192 320 192 384 2 10.0 2.440884490230046
w 192 384 288 384 0
w 288 384 384 384 0
w 384 192 384 176 0
g 288 384 288 432 0
w 192 176 224 176 0
w 224 176 384 176 0
178 272 80 384 80 0 1 0.02 0.015625 0.05 1000000.0 0.0010 320.0
x 414 328 451 331 0 10 Arduino
x 437 26 507 29 0 10 5v to sense pin
R 224 112 176 112 0 0 40.0 5.0 0.0 0.0 0.5
r 384 48 464 48 0 10000.0
g 464 48 512 48 0
s 224 112 272 112 0 0 false
w 272 128 272 368 0
w 272 368 288 368 0
w 288 368 288 384 0
w 272 80 272 48 0
w 272 48 384 48 0
w 384 96 384 176 0
162 384 192 384 384 1 5.0 1.0 0.0 0.0
w 192 176 192 272 0
z 272 112 272 80 1 0.1 4.9
o 0 64 0 35 2.5 0.8 0 -1
o 1 64 0 35 2.5 0.8 1 -1
o 21 64 0 35 5.0 0.8 2 -1

crenn
08-05-2010, 11:58 PM
1st circuit: Won't work due to all the current passing through a single diode. That diode is going to have a voltage drop of at least 0.7 depending on the construction of the diode, if you can find a diode which can handle the current (around 1-1.5A) has a voltage drop lower than 0.3v, that will work (remember, you have to give the arduino at least 4.5v to work and the servo may require a little more.

2nd circuit: If your power supply can support a surge of 60+ amps on the 5v line, then the only problem would be the diode as it would be very unlikely to support 60+ amps.

SXRguyinMA
08-06-2010, 08:22 AM
1st circuit: Won't work due to all the current passing through a single diode. That diode is going to have a voltage drop of at least 0.7 depending on the construction of the diode, if you can find a diode which can handle the current (around 1-1.5A) has a voltage drop lower than 0.3v, that will work (remember, you have to give the arduino at least 4.5v to work and the servo may require a little more.

2nd circuit: If your power supply can support a surge of 60+ amps on the 5v line, then the only problem would be the diode as it would be very unlikely to support 60+ amps.

ok so is that why I need the resistor and diode in before the caps? what if I put in just the 15ohm resistor and no diode? In the diagrams the diode doesn't seem to do much anyways, it all goes through the resistor :?

SXRguyinMA
08-06-2010, 07:06 PM
ok so I was trying to figure out how to make the circuit with 12v power and using a 5v regulator, but the simulator doesn't have a LM7805 regulator in it! hmmm....

SXRguyinMA
08-06-2010, 07:59 PM
alright I came up with this. Except I'll be replacing the 5 ohm resistor with a 5v regulator. what do you think?


$ 1 0.0050 1.0751013186076355 40 10.0 62
g 208 96 160 96 0
R 208 32 160 32 0 0 40.0 12.0 0.0 0.0 0.5
w 368 176 368 208 0
w 368 208 464 208 2
r 448 288 448 336 0 15.0
s 208 32 288 32 0 0 false
z 416 336 416 288 1 0.805904783 5.6
w 416 288 448 288 0
w 448 288 512 288 0
c 416 336 416 384 0 10.0 0.20502644242779824
c 416 384 416 432 0 10.0 0.20502644242779625
w 416 432 464 432 0
w 416 336 448 336 0
w 464 432 512 432 0
178 352 48 400 48 0 1 0.2 0.6 0.05 1000000.0 0.02 20.0
w 352 80 288 80 0
w 288 80 288 32 0
w 352 96 208 96 0
w 512 288 512 208 0
w 512 208 464 208 0
w 400 128 368 128 0
r 368 128 368 176 0 5.0
w 416 432 224 432 0
w 224 432 208 96 0
162 512 288 512 432 1 5.0 1.0 0.0 0.0
w 352 48 352 80 0
z 400 64 400 128 1 0.805904783 5.6
o 9 64 0 35 0.625 0.4 0 -1
o 10 64 0 35 0.625 0.4 1 -1
o 24 64 0 35 10.0 6.4 2 -1

crenn
08-06-2010, 09:55 PM
My understanding is that it's using the reverse breakdown voltage to disrupt a voltage divider that could occur.

EDIT: That will work, just you don't need a zener diode before the simulated 'voltage regulator' if I'm correct.

SXRguyinMA
08-06-2010, 09:59 PM
I have no idea what you're saying there lol. did some more messing though and came up with this:


$ 1 0.0050 0.625470095193633 43 10.0 62
g 208 96 160 96 0
R 208 32 160 32 0 0 40.0 5.0 0.0 0.0 0.5
w 368 176 368 208 0
w 368 208 464 208 2
r 448 288 448 336 0 15.0
s 208 32 288 32 0 0 false
z 416 336 416 288 1 0.805904783 5.6
w 416 288 448 288 0
w 448 288 512 288 0
c 416 336 416 384 0 10.0 9.9810148918879E-4
c 416 384 416 432 0 10.0 9.98101489188794E-4
w 416 432 464 432 0
w 416 336 448 336 0
w 464 432 512 432 0
178 352 48 400 48 0 1 0.2 -3.653919108052395E-20 0.05 1000000.0 0.02 20.0
w 352 80 288 80 0
w 288 80 288 32 0
w 352 96 208 96 0
w 512 288 512 208 0
w 512 208 464 208 0
w 400 128 368 128 0
w 416 432 224 432 0
w 224 432 208 96 0
w 352 48 352 80 0
w 368 128 368 176 0
d 400 64 400 128 1 0.205904783
181 512 288 512 432 0 300.0037876461304 0.025 5.0 0.4 0.4
w 352 48 352 16 0
w 352 16 448 16 0
r 448 16 448 64 0 10000.0
g 448 64 448 96 0
x 468 86 538 89 0 10 5v to sense pin
x 573 362 610 365 0 10 Arduino
x 45 149 190 155 0 24 IMPORTANT!
x 91 176 183 179 0 10 Combined grounds!
o 9 64 0 35 2.5 0.1 0 -1
o 10 64 0 35 2.5 0.1 1 -1
o 26 64 0 35 5.0 0.025 2 -1


Now if you take out the diode right after the relay and replace it with wire, you'll see how the relay stays open until voltage drops enough for it to close. Not that it only does this when you connect the relay ground and capacitor grounds together (as is the setup in a normal psu - common grounds) If you make each have it's own ground it won't do it

:EDIT: the grounds don't have to be combined - it still does it without the diode

crenn
08-06-2010, 10:06 PM
Look up above again. But I just thought of something, give the 12v rail a diode after it passes through the relay. That should disrupt the circuit.

SXRguyinMA
08-06-2010, 10:31 PM
like this?

:EDIT: just saw the part about the zener. but if I take it out the relay won't shut. will that possibly change with the vreg in place?


$ 1 0.0050 0.30802168489180315 61 10.0 62
g 208 96 160 96 0
R 208 32 160 32 0 0 40.0 12.0 0.0 0.0 0.5
w 368 176 368 208 0
w 368 208 464 208 2
r 416 288 416 336 0 15.0
s 208 32 288 32 0 1 false
w 448 288 512 288 0
c 416 336 416 384 0 10.0 9.999999728595806E-4
c 416 384 416 432 0 10.0 9.999999728595758E-4
w 416 432 464 432 0
w 464 432 512 432 0
178 352 48 400 48 0 1 0.2 1.973851188894976E-9 0.05 1000000.0 0.02 20.0
w 352 80 288 80 0
w 288 80 288 32 0
w 352 96 208 96 0
w 512 288 512 208 0
w 512 208 464 208 0
w 400 128 368 128 0
r 368 128 368 176 0 5.0
w 416 432 224 432 0
w 224 432 208 96 0
162 512 288 512 432 1 5.0 1.0 0.0 0.0
w 352 48 352 80 0
z 400 64 400 128 1 0.805904783 5.6
w 448 288 416 288 0
o 7 64 0 35 2.5 0.4 0 -1
o 8 64 0 35 2.5 0.4 1 -1

crenn
08-06-2010, 10:56 PM
Yes, because I don't think 5V or lower can pass back through the voltage regulator.

SXRguyinMA
08-06-2010, 11:37 PM
ahh I see. I'll breadboard it up tomorrow after work and check it out!!

SXRguyinMA
08-07-2010, 09:27 AM
alright, since I ruined my 12v relay de-soldering it, all I'm left with is the 5v (and don't feel like another trip to RS to pick up another 12v one lol). This is what I'm going to breadboard up this afternoon after work:


$ 1 0.0050 1.6308177459886661 40 10.0 62
g 128 96 80 96 0
R 128 32 80 32 0 0 40.0 12.0 0.0 0.0 0.5
w 288 176 288 208 0
w 288 208 384 208 2
r 368 288 368 336 0 15.0
s 112 64 192 64 0 1 false
z 336 336 336 288 1 0.805904783 5.6
w 336 288 368 288 0
w 368 288 432 288 0
c 336 336 336 384 0 10.0 0.0010010099896179414
c 336 384 336 432 0 10.0 0.0010010099896179475
w 336 432 384 432 0
w 336 336 368 336 0
w 384 432 432 432 0
178 272 48 320 48 0 1 0.2 0.0 0.05 1000000.0 0.02 20.0
w 272 80 208 80 0
w 272 96 128 96 0
w 432 288 432 208 0
w 432 208 384 208 0
w 320 128 288 128 0
r 288 128 288 176 0 5.0
w 336 432 144 432 0
w 144 432 128 96 0
162 432 288 432 432 1 5.0 1.0 0.0 0.0
z 320 64 320 128 1 0.805904783 5.6
R 112 64 80 64 0 0 40.0 5.0 0.0 0.0 0.5
w 208 80 208 64 0
w 208 64 192 64 0
w 128 32 272 32 0
w 272 32 272 48 0
x 467 359 550 365 0 24 Arduino
x 320 152 572 155 0 10 diode and resistor will be replaced with a 5v regulator
x 259 66 296 69 0 10 5v relay
o 9 64 0 35 5.0 0.05 0 -1
o 10 64 0 35 5.0 0.05 1 -1
o 23 64 0 35 10.0 1.6 2 -1
o 4 64 0 35 1.25 0.05 3 -1
o 6 64 0 35 1.25 0.0015625 4 -1

SXRguyinMA
08-07-2010, 04:28 PM
well I'm happy to report that it works perfectly!! thanks again crenn for all your help!!

crenn
08-07-2010, 09:35 PM
Awesome!

SXRguyinMA
08-08-2010, 12:33 AM
well so I thought lol. It worked perfectly in the breadboard. then I soldered it up, and now when I turn off the psu (or unplug it) it doesn't take 5v away from the sense pin again, but it worked perfectly in the breadboard! :? I've gotta mess with it this weekend and see if I can figure out why :?

SXRguyinMA
08-08-2010, 02:27 PM
got it. stupid error on my part lol. I had an extra 5v line going to the arduino power from the 5v psu line. this was keeping voltage flowing through the relay. all set :D