Need help with code

i need to activate a relay for 30 seconds every 6 hours. it is to run a motor in an incubator that rolls the eggs over. I understand the circuitry but i have never written a line of code and am going blind reading forums and tutorials trying to figure it out. From what i have read a simple millis() code will work but for the life of me i can't figure this out. any suggestions?

You could do this with :

In the loop section:

Do this ; Serial.print ("ive rolled the eggs"); delay (xxxx) ;

Where delay is in miliseconds.

1000 is one second. 60000 is one minute.

Arduino has examples...

Just make sure it never loses power and your set. Like a 13.1v on a tiny 12v deep cycle.

Running relays on the 5v bus of the uno with a 12v psu puts a lot of strain on the 5v bus of the arduino.

I feed my arduino using a car cell phone charger circuit. 12v -5v ... relays can be fed right off the arduino.

One of my arduino's controls a 240V 100A relay... Which is powered 120V off a 5V arduino controled relay. The whole thing works off conditions....

Im unexperimented,

But im just like you... making machines do actual work with arduino.

T

relays can be fed right off the arduino.

That is NOT a good idea. The relay can be CONTROLLED by the Arduino. It should NOT be POWERED by the Arduino.

PaulS: That is NOT a good idea. The relay can be CONTROLLED by the Arduino. It should NOT be be POWERED by the Arduino.

oops!

...R

Robin2: oops!

...R

Yeah, that was stupid. Got ahead of myself, and failed to proofread. Fixed, it, though.

Ive been using 5v 1 amp straight in to the usb port. My understanding is that the relays use that power rather than the 5v rectifier on the arduino board.

Works good and seems reliable enough.

Those car adapter are cheap enough.

T

I feed my arduino using a car cell phone charger circuit. 12v -5v ... relays can be fed right off the arduino.

A cell phone charger circuit will deliver full current (500mA) at 5V before the polyswitch (self-resetting fuse) kicks in. I'd feel safe powering a few relays with 100mA coils, reserving 300mA for the Arduino and other stuff. With USB power from a PC or hub without adapter, current might be limited to as low as 100mA or 250mA. I think the Arduino regulator can only provide 300mA-ish with 12V connected to VIN.

Don't take this as the final "word", just thought it would be of "int"rest.

As a computer tech,

Usb 2.0 is rated to 500mA off a computer.

Most phones wont pull more than 500mA of charge unless data pins are shorted through a low value resistor.

If you take your average usb car charger. You can pull over 1 A over the 5V pins.

And if you use a good one such as a samsung or apple charger, you can pull over 2500mA off the usb.

I traced the circuit.... the 5v bus on the arduino uses the same power as the usb.

No issues yet with 4 relays in continuous use.

T

These schematic snippits taken from the UNO rev3, show that if you use the USB connector, you can take advantage of the built-in polyswitch fuse (F1).