Home Chapter 9 Maxuino/Arduino solid state relay

Site Search

GTranslate

Chinese (Simplified) French German Italian Portuguese Russian Spanish
Maxuino/Arduino solid state relay


In this lesson, you will first learn to use the SSR to flash an AC bulb on and off using your Arduino UNO. You will then employ a 5-volt PIR sensor to activate the bulb into varying flashing behaviors. You will use a metro object in MAX MSP and Jitter for the Arduino.

Solid State Relay (SSR): Controlling AC Voltages

With the SSR, you can use a 5-volt DC voltage at 20 mA to control a 120-volt AC circuit. Now the power of sequencing begins to come to “light”. You can sequence, control, and switch most voltages as long as you select the right SSR for the job. SSRs, like their electromagnetic cousins, need a certain control voltage and amperage in order to switch much larger voltages. SSRs are available to match most controlling voltages and they function with the logic level (0-5 volts) available with most microprocessors.

 

Kyotto Solid State Relay. Control pins are 1 and 2 and require 3--32 volts. Switched output pins are 3 and 4. The maximum rating for these pins is 2 Amps at any voltage between 24 and 280 volts AC


One major benefit of using SSRS is that they do not create electromagnetic noise because they use optical photo couplers to switch the signals on. This allows high speed and high-frequency switching, but if you require very high-speed SSR switching, be sure to seek out the data sheet and specifications of the part you choose.

Because SSRS have no mechanical parts, they will last longer than electromechanical relays. Using light, as a switching agent does not create the noise associated with electromechanical relays. This is a benefit as the electromagnetic noise created with electromagnetic relays can cause noise in the circuits

Inside each SSR, are an LED, which creates light and a light receiver, looking for that light. When the light inside the SSR turns on the receiver also turns on and this allows you to use a light to switch the device on an off. This isolates the larger voltage you are switching with the much smaller voltage necessary to turn the small LED on inside the SSR. This method also protects the microprocessor from the electromagnetic field that surrounds most relays.

 

Kyoto KB20C02A In this diagram, the number 1 is the circuit that turns the LED inside the plastic case on. The + goes to the signal from your Arduino UNO pin 13 show the internal switching circuits inside the plastic case. The area at 4 shows a sine wave. This refers to the AC signal.

 

There are many different mounting possibilities for SSRs, depending on the physical package needs, the voltage, and the current switching capabilities you require. Jameco Inc. has a nice selection of small pictures that may help to decode the many mounting and form factors that exist for SSRs.

You can also do a web search the part and often find what you are looking for. The important thing is to select the proper SSR from the start. SSRs, like many devices, also have absolute maximum ratings and pay strict attention to this fact.

The main considerations when selecting an SSR is: 1) How much voltage and amperage does your microprocessor provide for switching on and off, and 2) What are the maximum voltages and amperage you will be switching? Is it going to switch AC or DC and how many volts can it switch?

For example: if you need to switch 200 volts AC at 30 amps, then make sure the SSR you choose is rated in excess of 200 volts AC, and that it can also handle the 30 amps. The Basic Stamp 2 can source (provide) up to 25 mA output per pin, so if you purchase other SSRs, be aware of the required switching volts and amps to allow the circuit to function and ALWAYS confirm these voltages before purchasing future SSRs.

Manufacturers often publish data sheets about their parts on the web as PDF documents. Most electronic catalogs also publish absolute maximum ratings in their catalogs.

 

Data Sheets are technical specification sheets that list ratings such as absolute maximum voltage and amperage for the part.

 

Building the Circuit

To build the circuit, first, unplug all the previous circuits you have been prototyping on your breadboard.

The SSR in your kit comes with a power cord and extension cord outlet already soldered. Look for the red wire into PIN 1 on the Board. The blue wire goes into ground (VSS).

 

Warning! AC can KILL you. Handle AC with care and be around to celebrate your inventions. Always unplug and turn off any circuitry you are working on. Double check that you have the AC extension cord unplugged when you are screwing in your AC bulb and building and programming this activity.

 

Parts Required

One Solid-state relay with extension cord soldered in line with the SSR. Parts supplier Jameco’s part number is 176698CG and the manufacturers part number is (KYOTO) KB20C06A-R
One AC socket with plug soldered in line and attached. local hardware store is the best source for an AC 100-watt bulb. Keep in mind that as bulbs are now changing from filament based incandescent to fluorescent bulbs the ability to switch them off and on quickly is limited and can damage the circuit and bulb.

To create this project using the Arduino you can use the same pinout and lesson plan described in activating an LED out of pin number 13. The circuit design for the Arduino UNO should work just fine.

If you look carefully at the SSR above, you can see the extension cord, you can see that the device is just acting as an LED switch to allow the AC to be activated and turn the light bulb on. Of course, the AC cord is providing the power for the bulb and the Arduino is providing power for the LED inside the solid state relay.

 

 

Solid-state relay with light socket and light bulb


You can also purchase relatively inexpensive solid state relay boards that can be driven directly off the Arduino UNO such as this one from Comfile Inc. Keep in mind with the one below that you would then have to dedicate 8 output line to drive 8 loads, however, you can still only use 1 or 2 or as many as 8 of these SSR's if you need for your application.

 

Relay 8 Board - 5A MATSUSHITA PA Relay - DIN-Rail Attachable

User Manual can be found online here: http://comfiletech.com/embedded-controller/cubloc/accessories/relay4-board/

You can use an Array to control the sequence of the SSR;

/*

Arrays


Demonstrates the use of  an array to hold pin numbers

in order to iterate over the pins in a sequence.

Lights multiple LEDs in sequence, then in reverse.


Unlike the For Loop tutorial, where the pins have to be

contiguous, here the pins can be in any random order.


The circuit:

* LEDs from pins 2 through 7 to ground


created 2006

by David A. Mellis

modified 30 Aug 2011

by Tom Igoe


This example code is in the public domain.


http://www.arduino.cc/en/Tutorial/Array

*/


int timer = 100;           // The higher the number, the slower the timing.

int ledPins[] = {

2, 7, 4, 6, 5, 3

};       // an array of pin numbers to which LEDs are attached

int pinCount = 6;           // the number of pins (i.e. the length of the array)


void setup() {

// the array elements are numbered from 0 to (pinCount - 1).

// use a for loop to initialize each pin as an output:

for (int thisPin = 0; thisPin < pinCount; thisPin++) {

pinMode(ledPins[thisPin], OUTPUT);

}

}


void loop() {

// loop from the lowest pin to the highest:

for (int thisPin = 0; thisPin < pinCount; thisPin++) {

// turn the pin on:

digitalWrite(ledPins[thisPin], HIGH);

delay(timer);

// turn the pin off:

digitalWrite(ledPins[thisPin], LOW);


}


// loop from the highest pin to the lowest:

for (int thisPin = pinCount - 1; thisPin >= 0; thisPin--) {

// turn the pin on:

digitalWrite(ledPins[thisPin], HIGH);

delay(timer);

// turn the pin off:

digitalWrite(ledPins[thisPin], LOW);

}

}

 

Using MAX MSP AND Jitter to control an SSR.

Code for running the SSR is going to be the same as running an LED. Remember to use the SimpleStartPatch covered in Chapter 6.

Copyright Ken Rinaldo