Controlling a lightbulb

Before starting to wire the circuit, keep in mind that you'll be using 220 V AC and there's a risk of electrocution. It can be very dangerous to use high voltages if some precautions aren't taken into consideration.

During the whole wiring process, ensure that your circuit is not connected to the wall socket.

Note

Always keep your circuit disconnected from the wall socket when wiring or changing the circuit.

Isolate the AC part of the circuit. It is the best way to avoid touching exposed wires accidently.

Note

Be extremely careful when wiring the AC component of the circuit. Use the Y terminals to connect the wires to the relay and do not let there be any exposed wire that you may accidently touch.

If you have any doubt or you are not sure what to do, ask a more experienced person for help.

Note

If you want to read more about solid state relay safety precautions, visit at http://www.omron.com/ecb/products/pdf/precautions_ssr.pdf.

Keeping this in mind, let's start assembling our circuit:

Controlling a lightbulb

Wiring the solid state relay to the Galileo and the lightbulb socket

The blue wire in the diagram represents the neutral. You should connect it to the neutral connector of the lightbulb socket, which should be located at the bottom of the bulb socket. Connect the other end of the wire to the power plug.

The two brown wires in the diagram represent the hot. Connect the first brown cable between the lightbulb socket's hot connector and the relay connector number 2, in the AC component of the relay. Connect the second brown cable between the power plug and the relay connector number 1, also in the AC part of the relay.

Grab your Galileo board. Connect one jumper wire from pin 13 to the solid state relay connector number 3 (plus sign) in the DC component and the Galileo's ground to the relay's connector 4 (minus sign).

Be sure that you have your circuit similar to the preceding schematic image, especially the AC components.

Note

You'll need to be extremely careful when using the circuit. Don't ever touch it when the power plug is connected to the wall socket. If you need to do adjustments, first disconnect it from the wall socket.

With your AC circuit disconnected from the wall socket, open the Arduino IDE. To test our circuit, let's use the Blink sketch. Open the sketch by navigating to File | Examples | Basics | Blink. As you've seen earlier, this sketch changes the pin status to its complement every second. Since this pin is now connected to the solid state relay, setting the pin value to HIGH will activate the relay, turning the lightbulb on. Setting the pin value to LOW will deactivate the relay, turning the lightbulb off.

In the sketch code, confirm that you are using pin 13:

int led = 13;

Connect your power plug to a wall socket and upload the sketch to your Galileo. You should now see your lightbulb blinking. The relay only supports the on and off status; don't try to fade the lightbulb as it won't work.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.120.133