# Circuit to drive a Solid State Relay

I am looking to use an SSR on an Arduino board (5v logic) to control a standard 120v light bulb.

I've heard people say you can "just drive this from a logic pin" - but the datasheets on the SSRs don't seem to (directly) indicate this.

The SSRs I am looking at (for example) describe the input voltage as "1.4 volts" - and show a condition, like "If=20mA".

So - does this mean I treat it like any LED - i.e. If I am driving it at 5 volts, I would (in this case) need to put a 180 ohm resistor in series with the input? From: (5v - 1.4v) / 20mA

• Can you post a link to the datasheet? That's more likely to get you a complete answer. Apr 3 '13 at 20:13
• Both datasheets for the ATmega on your Arduino and for the SSR. Apr 3 '13 at 20:33
• @jippie: Alas, not all Arduinos are built on ATmegas :(. Just naming the Arduino will help, though a datasheet to the underlying chip is certainly more helpful. Apr 3 '13 at 20:34
• The Arduino Due is different, correct. It is ARM based and operates at 3V3. OP however mentions 5V logic. Apr 3 '13 at 20:36
• I haven't chosen an SSR yet - but one like: sharpsma.com/webfm_send/335 Arduino Uno with ATMega328p atmel.com/Images/doc8161.pdf
Apr 3 '13 at 21:06

20mA is the per-pin limit for an Arduino which means you could burn out the pin if you somehow exceeded the current draw even by a little. Since you are driving an AC load I'd want some isolation in case the relay burned out.

The best thing is to use a transistor or optoisolator as the switch, that way your Arduino is protected.

I suggest using this circuit: http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Widgets/SSR-Board-v10.pdf

Circuit is from this Sparkfun product: https://www.sparkfun.com/products/10684

• 40mA for the ATmega's I am aware of, hence the importance of the datasheet. Apr 3 '13 at 20:32
• On point 1, most (all?) chips that Arduino is built on do provide over-current protection, so I don't think it is true that you will "burn out your chip". Secondly, isn't "isolation" exactly what SSRs are built for? Sure two layers is more safe, and three is even safer, so where do you stop? Apr 3 '13 at 20:33
• I think the "Isolation" of the SSR is with respect to the AC vs. DC sides (or load vs. input sides) - whereas the isolation being discussed is isolating the Arduino from the input side.
Apr 3 '13 at 20:43
• @angelatlarge do you have a reference to "most (all?) chips that Arduino is built on do provide over-current protection"? Apr 3 '13 at 20:43
• The 40mA number is an "Absolute Maximum" on the ATmega328. There are all sorts of maximums you can not exceed across MULTIPLE ports and/or pins. 20mA is the "test condition" written in the datasheet. Thus, it seems I can go as high as 40 (in a pinch) if I'm not driving much on other pins (which I am not). But 20 as calculated target should be fine in this condition.
Apr 3 '13 at 20:52

I've heard people say you can "just drive this from a logic pin" - but the datasheets on the SSRs don't seem to (directly) indicate this.

SSRs differ in their input characteristics. Some are built with internal current limiting resistors. These usually have an input voltage designation such as 5 volt, 12 volt, 24 volts somewhere in their part number or printed on the device. All that means is that a series resistor has been added such that you can drive if from the nominated voltage without adding your own series limiter. If you are trying to drive it directly from a device operating at 3.3V it should work better if you are sinking current, and the LED anode voltage is 5volts rather than 3.3V

Some types have no series resistance. For these you MUST add your own limiting resistance. 1.4V is the typical led forward voltage and the 20mA refers to the nominal (sometimes maximum) allowable forward current. The spec you cite means you will measure an input voltage of 1.4V if you force 20maA into the device (limited and controlled externally).

The SSRs I am looking at (for example) describe the input voltage as "1.4 volts" - and show a condition, like "If=20mA".

So - does this mean I treat it like any LED - i.e. If I am driving it at 5 volts, I would (in this case) need to put a 180 ohm resistor in series with the input? From: (5v - 1.4v) / 20mA

Exactly - and your calcs are spot on too, provided the SSR in question is one that does not include its own internal resistor.

A handy hint is that you can use a 5 volt type with pretty much any higher voltage. If you have a 5 volt SSR and want to drive it from 12 volts, just add your own series resistor externally such that the allowed maximum forward current is not exceeded.