background preloader

Using Relays with Arduino – Turning on the Lights

Using Relays with Arduino – Turning on the Lights
Warning!!! This project deals with AC electricity which is dangerous if you don’t know how to treat it safely. You must treat electricity with caution. There are many books and websites about electrical safety procedures and if you’re not sure how to be safe you should read that information. The most basic advice I can give is always assume any exposed wires are live and touching them will hurt a lot at best and kill at worst. Microcontrollers are good at controlling small devices, but frequently we DIY-ers want to use them to control things that aren’t so micro. The first thing you need is a cheap extension core that you are willing to cut in half. I spliced the relay into the black wire on my power cord. The last step and the one that makes this project useful is getting the microcontroller to control this relay. In this circuit the transistor acts as a switch and it allows you to turn on the relay. Credits Related:  Smart Switch

Relay Using GPIO on Raspberry Pi Controllable Power Outlet In this tutorial we will discuss a small relay board to control the power to a normal AC outlet using 5VDC control. All the usual warnings apply: Main voltage (120VAC or 220VAC) can kill you. This project, done incorrectly, could certainly burn down your house. You can get the Eagle files for the control board here. What’s a relay? A relay is a large mechanical switch. In this example we are going to talk about the simplest version of a relay. The other half the relay is called the coil. It is important to note the coil is physically isolated from the paddles. The paddles are capable of carrying very large currents. The relay that we will be working with, in this tutorial, is a beefcake in my opinion. Like we do with capacitors, we under-rate the relay so that we mitigate the risk of relay failure. The Outlet The goal is the get a GFCI outlet into some sort of a housing, with a power cord, the relay, and control circuitry. Materials: The Inline Power Control Board The Build Enjoy!

Yet Another Arduino 110v Power Controller Tools Needed: Needle Nose Pliers Wire Cutters and strippers Screw driver Soldering Iron Multimeter Materials: Deep metal 4 gang output box and cover Wire clamps Two 15Amp outlets Four 5v 10Amp relays (such as Jameco’s 843155) A ULN2803A (such as Jameco’s 34315) A 5volt – 500ma Wall Wart (such as Jameco’s 164101) A length of 5-conductor wire (I used Cat5 cable) Household current rated wire with a male three-prong connector at one end. Miscellaneous wire and solder 5 minute epoxy Wire Nut Theory of Operation: The electricity flow to each outlet of a four-outlet household current box is controlled via TTL level signals (such as the output pins of an Arduino). Five wires are connected from the Arduino to the outlet box, four wires being connected to four Arduino output pins and the fifth to the Arduino’s ground pin.

Fritzing Download Downloaded 4609353 times. See what's new and the known issues. Read the installation instructions below. This version includes translations for: Deutsch (German), English, Español (Spanish), Français (French), Italiano (Italian), Nederlands (Dutch), Português (eu) (Portuguese EU), Português (br) (Portuguese BR), 日本語 (Japanese), 中文 (简体) (Chinese Simplified), 正體中文 (繁體) (Chinese Traditional), Русский (Russian), Čeština (Czech), 한국어 (Korean), Ελληνικά (Greek), slovenčina (Slovak), română (Romanian), Türkçe (Turkish), Български (Bulgarian), বাংলা (Bengali).

hardware - Can I switch mains devices on/off? There's an American product called a PowerSwitch Tail which is basically an optically isolated relay in a box. They make a complete unit for 120V, but only kits for 240V supplies. The kit assembly looks pretty straightforward (even for a beginner). While it is more expensive ($18) than a cobbled together circuit with a relay, it's a lot more convenient and (most likely) a lot safer too. Arduino Controlled Relay Box The great thing about this project is that there aren't a lot of parts that you need to get started. You probably have most of the parts lying around your junk box and the rest you can order directly from SparkFun or your favorite supplier. I've made a list of parts available on my wiki. SparkFun can supply the relay and PCB and your local hardware store will have your GFCI Outlet and electrical housing. Now a brief note about safety.

PowerSwitch Tail II and Arduino Summary Example of controlling the PowerSwitch Tail II, using an Arduino. Description This is an example of controlling the PowerSwitch Tail II, using an Arduino. The PowerSwitch Tail II is a relay that is enclosed in a case. Why? Because we can easily control physical devices. Before We Begin PowerSwitch Tail II This example uses using the PowerSwitch Tail II, you can find the product here: Arduino This example uses the Arduino Duemilanove version of the Arduino board. Upload Code to Arduino If you don't have the Arduino environment, download it from the Arduino site ( Hooking it up Simply enough here's how this works. In my example, pin 13 of the Arduino is connected (by the orange line) to the PowerSwitch "1: +in"In my example, Gnd of the Arduino is connected (by the black line) to the PowerSwitch "2: -in" The Code char incoming_char=0;

Arduino – Analog Read Potentiometer to Digital Out LED + Bonus Photoresistor to LED The analog to digital sketches have been covered a million ways from Sunday with every conceivable part but in order for us to move on to more complex circuits and concepts I need to be sure you know these simpler ones. This tutorial wont be quite as in depth as the others because frankly there just isn’t much code. Without further delay I give you the wiring diagram. Arduino Analog Potentiometer to Digital LED Another very simple circuit diagram, by the way if you have been wondering what program I am using for these diagram and its actually the most widely used program for diagramming Arduino circuits, its called Fritzing and you can get it here. As shown above the Analog signal is positive and as the positive input increases the digital output increases as well. /* Analog Potentiometer to Digital LED Sketch By: David M. void setup(){ pinMode(LEDPin, OUTPUT); //Set Pin 6 as an Output } So simple isn’t it? void setup(){ pinMode(LEDPin, OUTPUT); // Set Pin 6 as an Output }