Wiki
jshaw / Lab10
Lab 10
Return to jshaw/Home
##Relay on a timer
No code is provided, since it's just a basic, toggled digitalWrite()
on a timer.
The interesting stuff is the 3.3v arduinos can still interface successfully with 5V Relays. The relays I have purchased are all 5V relays [I have since purchased other 3.3V relays for further examination], but the relay actuator is powered via a seperate circuit from the relay trigger. The relay trigger is an optoelectrical setup, which electically isolates the (relatively) delicate Arduino logic GPIOs from the relay (back EMF from the inductor coil, any chance of a relay shorting the high voltage line to the low voltage side, and reducing the amount of trigger current needed to trigger the relay).
The optoelectrical setup uses an opaque chip, which internaly contains an IR LED and a photoresistor (I've seen them referred to as phototransistors, since they vary their resistance based on an external input [that isn't heat]). The IR LED anode is setup to the VCC rail, and the cathode is on the GPIO pin. When the GPIO = VCC, there is no voltage potential, so the IR LED stays off. When the GPIO = GND (active low), there is a voltage potental = VCC, which activates the IR LED. When the IR LED is active, the photoresistor lets current through to a transistor, and the transistor then allows the inductor (running on another, seperate VCC rail) to complete a connection to ground (this transistor can also be part of a more traditional buffer logic implementation, as demonstrated in week 14 CpE185/EEE174 lecture).
Relay Schematic from the vendor of the Relay. While I got 3 relays from 2 different vendors, the designs are identical, with similar SPDT specs.
All of this, in addition to a couple of air gaps in the PCB between HV and LV, should allow for a reasonably safe way to control high power components using the Arudino (or Pi). However, I still need to watch out for PTH pins on the backside of the PCB - those can still be very dangerous.
Updated