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

Tutorials / Using a transistor to control high current loads with an Arduino In this tutorial, you'll learn how to control a high-current DC load such as a DC motor or an incandescent light from a microcontroller. (:toc Table of Contents:) Parts You will need the following parts for this tutorial. Solderless breadboard 22-AWG hookup wire Arduino Microcontroller module 10Kohm potentiometer power diodes (for DC Motor version only) DC power supply TIP120 transistor DC Motor - or - Incandescent lamp and socket (Diagram made with Fritzing) Add a potentiometer Connect a potentiometer to analog in pin 0 of the module: Connect a transistor to the microcontroller The transistor allows you to control a circuit that's carrying higher current and voltage from the microcontroller. Pinout of a TIP-120 transistor, from left to right: base, collector, emitter. Note: you can also use an IRF510 or IRF520 MOSFET transistor for this. The schematic symbol of an NPN transistor where B is the base, C is the collector, and E is the emitter. click the image to enlarge Connect a motor and power supply Notes

Relay Using GPIO on Raspberry Pi The Internet of Things leads to yet another Growduino We are on the verge of the Internet of Things, where simple devices can now automatically and intelligently trigger an action in the real physical world. It’s going to be a pretty neat transition, as big as the invention of the computer mainframe in the 50's, the PC 30 years ago, and the opening of the Internet to the general public in the 90’s. How big is that? Check out the full Hammersmith report if you like, but if you really want to experience the future of the Internet of Things, begin your search at the Pachube site and maybe pick yourself up an arduino from Lady Ada. Here's my arduino-pachube project - an attempt to grow the spiciest of all peppers, the Bhut Jolokia: An arduino was used to collect information from various plant sensors (lighting level, temperature, soil moisture, and humidity) and control a bank of A/C electrical outlets. Sensors were soldered to the ends of phone cables so they could easily be jacked into the Growduino enclosure.

PowerSwitch Tail II A power cord that switches 120vac power directly from a microcontroller I/O pin (3-12vdc, 3-30ma) "The easiest way to control an AC device with an Arduino, Raspberry Pi, Beaglebone or any other DIY controller." *** Either unit can be field rewired for normally open (NO) or normally closed (NC) operation. Soldering required. No exposed 120vac voltages and no dangerous 120vac wiring required.Plugs into standard 120vac 3-prong household outlets, power strips, and extension cords.Eliminates the exposure of hazardous voltages in DIY projects, classrooms, and on development workbenches.No special 120vac wiring when deploying new products and custom solutions. 5300vrms isolation from the 120vac circuit.

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.

Arduino Interrupts Often when working on microcontroller projects you need a background function to run at regular intervals. This is often done by setting up a hardware timer to generate an interrupt. The interrupt triggers an Interrupt Service Routine (ISR) to handle the periodic interrupt. In this article I describe setting up the 8-Bit Timer2 to generate interrupts on an Arduino ATMega168. I walk through steps required for setup and inside the ISR function. If you are following the Arduino sound articles this one will be important to read as well. The Arduino default processor is an ATMega168 (datasheet link). Interrupts? Interrupts Links When a new character arrives the UART system generates an interrupt. If you have lots of interrupts firing or fast timer interrupts your main code will execute slower because the microcontroller is spreading it’s processing time between your main code and all the ISR functions. With an interrupt you don’t have to keep checking to see if a character has arrived.

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. Tutorial Series for Arduino: It begins. This video was featured on the Adafruit Blog on 01/06/11 This tutorial was featured on the official Arduino blog on 3/9/2011 This video was featured on the DIYFilm Blog on 03/19/11 Thanks to a generous sponsorship from element14, I’m putting together a tutorial series on using the arduino microcontroller platform! The arduino is a platform that I’ve done several projects with, and I think it is the best possible way for beginners to get acquainted with electronics. You can download the files associated with this episode here: Distributed under the GNU General Public (Open-Source) License. Arduino Project Contest! Start thinking about your arduino projects, because element14 will be sponsoring a contest where you can win a prize if your arduino project gets the most votes.

Related:  arduinoarduino projects