Hi i want to light up a 12 volt LED strip and need to use a uln 2003 a and a 6volt relay and a capacitive sensor to control the light. When i once touch it it switches on, and when i touch it again it switches off. Along with arduino uno. Karena arus yang mengalir melalui kolektor di seri dengan relay, maka relay akan ikut aktif. Aktifnya relay bisa kita manfaatkan untuk menghidupkan lampu dari PLN, atau dalam simulasi yang kami lakukan yaitu untuk menghidupkan led dengan baterai. Berikut adalah komponen yang siap dirakit + (baterai, led merah, dan resistor 1K untuk simulasi).
This post shows how to build an Arduino Ethernet web server that controls a relay that is attached to a lamp.
You can access your web server with any device that has a browser and it’s connected to the same network.
Recommended resources:
If you like Arduino projects and you want to build more, I recommend getting my Arduino Step-by-step Projects – Build 25 Projects course.
![]()
Build 25 cool Arduino projects with our course even with no prior experience DOWNLOAD »
Build 25 cool Arduino projects with our course even with no prior experience DOWNLOAD »
Note: if you’re not comfortable dealing with mains voltage, but you still want to try to do the project, you can replace the relay module with an LED, for example. The code and the schematics are very similar.
Ethernet shield
The Arduino Ethernet shield connects your Arduino to the internet in a simple way. Just mount this module onto your Arduino board, connect it to your network with an RJ45 cable and follow a few simple steps to start controlling your projects through the web.
Note: you must connect an Ethernet cable from your router to your Ethernet shield as shown in the following figure.
Pin usage
When the Arduino is connected to an Ethernet shield, you can’t use Digital pins from 10 to 13, because they are being used in order to establish a communication between the Arduino and the Ethernet shield.
Relay module
A relay is an electrically operated switch. It means that it can be turned on or off, letting the current going through or not. The relay module is the one in the figure below.
![]()
This particular relay module comes with two relays (those blue cubes).
About mains voltage, relays have 3 possible connections:
Relating this project, it is better to use a normally open circuit, because we want to light up the lamp occasionally. Read this tutorial to learn more about using a relay module with the Arduino board.
The connections between the relay and the Arduino are really simple:
Parts required
Here’s a complete list of the components you need for this project:
You can use the preceding links or go directly to MakerAdvisor.com/tools to find all the parts for your projects at the best price!
Code
Copy the following code to your Arduino IDE and before uploading it to your Arduino board read the “Configuring your network” section below.
Configuring your network
Take a look at the configuring your network code snippet:
Important: you actually might need to replace that variable highlighted in red with appropriate values that are suitable for your network, otherwise your Arduino will not establish a connection with your network.
Replace the following line with an IP that is available and suitable for your network:
In my case, my IP range is 192.168.1.X and with the software Angry IP Scanner I know that the IP 192.168.1.111 is available in my network, because it doesn’t have any active device in my network with that exact same IP address:
Schematics
Wire you circuit accordingly to the schematic below:
Demonstration
Your Arduino Web Sever looks like the figure below:
Here’s a demonstration showing what you have at the end of this project:
Wrapping up
With this project you built an Arduino web server that turns a relay on and off.
Now, you can use this project to control any electronics appliance you want.
This project is a simplified version of one of my projects in the Arduino Step-by-step Projects. If you liked this project make sure you check out the course that includes 23 Arduino projects.
Thanks for reading,
Rui and Sara
This post shows how to build an Arduino Ethernet web server that controls a relay that is attached to a lamp.
You can access your web server with any device that has a browser and it’s connected to the same network.
Recommended resources:
If you like Arduino projects and you want to build more, I recommend getting my Arduino Step-by-step Projects – Build 25 Projects course.
Build 25 cool Arduino projects with our course even with no prior experience DOWNLOAD »
Build 25 cool Arduino projects with our course even with no prior experience DOWNLOAD »
Note: if you’re not comfortable dealing with mains voltage, but you still want to try to do the project, you can replace the relay module with an LED, for example. The code and the schematics are very similar.
Ethernet shield
The Arduino Ethernet shield connects your Arduino to the internet in a simple way. Just mount this module onto your Arduino board, connect it to your network with an RJ45 cable and follow a few simple steps to start controlling your projects through the web.
Note: you must connect an Ethernet cable from your router to your Ethernet shield as shown in the following figure.
Pin usage
When the Arduino is connected to an Ethernet shield, you can’t use Digital pins from 10 to 13, because they are being used in order to establish a communication between the Arduino and the Ethernet shield.
Relay module
A relay is an electrically operated switch. It means that it can be turned on or off, letting the current going through or not. The relay module is the one in the figure below.
This particular relay module comes with two relays (those blue cubes).
About mains voltage, relays have 3 possible connections:
Relating this project, it is better to use a normally open circuit, because we want to light up the lamp occasionally. Read this tutorial to learn more about using a relay module with the Arduino board.
The connections between the relay and the Arduino are really simple:
Parts required
Here’s a complete list of the components you need for this project:
You can use the preceding links or go directly to MakerAdvisor.com/tools to find all the parts for your projects at the best price!
Code
Copy the following code to your Arduino IDE and before uploading it to your Arduino board read the “Configuring your network” section below.
Configuring your network
Take a look at the configuring your network code snippet:
Important: you actually might need to replace that variable highlighted in red with appropriate values that are suitable for your network, otherwise your Arduino will not establish a connection with your network.
Replace the following line with an IP that is available and suitable for your network:
In my case, my IP range is 192.168.1.X and with the software Angry IP Scanner I know that the IP 192.168.1.111 is available in my network, because it doesn’t have any active device in my network with that exact same IP address:
Schematics
Wire you circuit accordingly to the schematic below:
Demonstration
Your Arduino Web Sever looks like the figure below:
Here’s a demonstration showing what you have at the end of this project:
Wrapping up
With this project you built an Arduino web server that turns a relay on and off.
Now, you can use this project to control any electronics appliance you want.
This project is a simplified version of one of my projects in the Arduino Step-by-step Projects. If you liked this project make sure you check out the course that includes 23 Arduino projects.
Thanks for reading,
Rui and Sara
Comments are closed.
|
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |