What would make a relay even better? How about controlling a relay over the internet from anywhere in the world? Yea!
This process is made really simple using the Teleduino sketch for your ethernet enabled Arduino. Haven't heard of Teleduino? That's cool, you may want to take a look at Arduino Control via a Web Service with Teleduino to get yourself started.
This tutorial will guide you through the process of attaching a 5V relay to your Arduino, and provide some example Teleduino API calls to:
- Define the pin mode of a pin
- Turn on the relay
- Turn off the relay
- Toggle the relay
Let's get started!
Remove these ads by
Signing UpStep 1: Parts Needed and Circuit Diagram
You need the following parts to complete this tutorial:
- Breadboard (optional, but makes prototyping much easier)
- 5V Relay (the relay in the image has had legs added so that it can be connected to a breadboard)
- 1K Resistor
- 1N4001 Diode
- 2N2222 Transistor
- Some hookup wire
Circuit Diagram
Take a peak at the attached circuit diagram. It shows how the components needs to be connected. You may need to look at the datasheet for your relay to know which pins are used for the coil.
The additional image illustrates the pin layout of your 2N2222 transistor. This will help you understand what pin needs to connect to which part of the circuit.
Time to get this hooked up!




































Visit Our Store »
Go Pro Today »




Thank you both, nathanknz and Prodigal_Son. I relaxed when you said to me you can control arduino with your android app via teleduino.
Now time to make something good with these.
thanks again..
Now you can download Teleduino Controller on Google Play:
https://play.google.com/store/apps/details?id=appinventor.ai_ssslzc.Teleduino_Controller
And like the info says, if you miss any functions please contact me and I will try to add it in future releases.
I´m the one that Nathan points at.
I´we created an Android App that let´s you control your Teleduino device.
Short description for v1.0:
6 buttons for Units on (turn green when pushed = status), can control both serial and Digital out.
6 buttons for Units off (puts the On button black again when pushed), same as above.
4 Toggle-buttons, controls only Digital Pins.
Long press on any buttons opens the Button Settings. Choose label and what it shoud control.
The Settings button on main screen is used to set the Teleduino Key, Define Serial and Digital Pins. Also as Debug where the last URL sent to Teleduino is shown.
I´m about to release the app on Google Play any day now and I´ll inform you in this thread when It´s available for the public.
Firstly i have to say that it's nice work. I want to do that project with some diffrences. In addition to this project, i wanna add android interface to control it. So, i want to control my house's lights with my android phone. With your project i learned control relay with teleduino. But i dont know, can i send my commands(like turn on the lights) from my android application to arduino via teleduino? If it is possible can you give me a lead?
I am new with arduino and teleduino. But I am willing to do this project. please inform me about my question.
thanks..
Thanks for your message.
Yes it is certainly possible to make API calls from an Android application, however I haven't done any Android development (yet!) so I can't be of much help there.
I have been contacted recently by someone who has written an Android app for basic control via Teleduino. I'll let him know that you have been in touch and point him to this conversation.
Thanks,
Nathan.