Remote LED control with Arduino + Ethernet shield

details

This Project shows how to control the set-up remotely over the Internet.

Google search for “control Arduino from the Internet” shows you several “easy” ways – Web-services.

But of course, it does not count as DIY, and not at all fun.

 

Connectivity schematic

CONCEPT :

In order to achieve truly global control over the Internet, the Arduino+Ethernet shield are set up as a Web-client that receives commands from the Web-server. A user can connect to the Web-server using any device capable of web-browsing (a desktop, laptop or a smart phone) and change the LED status with a click of a button. This change is then sent to the Arduino. One has to get a web-hosting service to be able to do this, but it is relatively cheap and usually offer services such as mySQL and PHP.

In this example, the status of 8 LEDs is stored in the mySQL database on the server; PHP scripts facilitate communication between Arduino and the database.

 

Breadboard wiring

HARDWARE :

Arduino is first stacked with the Ethernet shield, which uses digital pins 10 through 13 for communication + pin 4 for the optional SD card reader. With only 3 pins, the set-up depicted here allows one to control 8 outputs (more can be added by simply connecting additional shift registers). Pin 2 serves as the data pin, pins 3 and 5 are clock and latch inputs, respectively. Additional LED on pin 6 is used to indicate that the connection to server has been established successfully.

 

Assembled set-up

CODING :

Ethernet shield is configured using DHCP. (Please refer to Ethernet-shield example for simple web-client).
In order to communicate with the SQL database, each Arduino is pre-programmed with unique identifiers: device ID (1 character, ‘a’ for Arduino), device serial number (8 bit, ex. 00000001), and unique password for the mySQL database (8 characters). These values are stored in EEPROM, and are read using EEPROM.read() function in the set-up part of the code. Data-base name is constructed as “db_” + deviceID + deviceSN. For example, the first Arduino reads LED values from the database named “db_a00000001”. Password and device properties (ID and SN) are then sent using GET request to the www.fhilitski.com/arduino/updatedevice.php. Response by the php-script has form “LEDxxxxxxxx” (for example, “LED00000001” or “LED10101010”). The code looks for letters “LED” in the response and then reads out all eight LED values. The entire main part is enclosed into the infinite loop which takes care of sending requests and analysing the response.

 

Blog : https://www.fhilitski.com/arduino/control8db.php

code view : https://www.fhilitski.com/arduino/arduino_code.html

code : https://www.fhilitski.com/arduino/ino_files/Remote_LED_control.ino

This Project shows how to control the set-up remotely over the Internet.

Google search for “control Arduino from the Internet” shows you several “easy” ways – Web-services.

But of course, it does not count as DIY, and not at all fun.

 

Connectivity schematic

CONCEPT :

In order to achieve truly global control over the Internet, the Arduino+Ethernet shield are set up as a Web-client that receives commands from the Web-server. A user can connect to the Web-server using any device capable of web-browsing (a desktop, laptop or a smart phone) and change the LED status with a click of a button. This change is then sent to the Arduino. One has to get a web-hosting service to be able to do this, but it is relatively cheap and usually offer services such as mySQL and PHP.

In this example, the status of 8 LEDs is stored in the mySQL database on the server; PHP scripts facilitate communication between Arduino and the database.

 

Breadboard wiring

HARDWARE :

Arduino is first stacked with the Ethernet shield, which uses digital pins 10 through 13 for communication + pin 4 for the optional SD card reader. With only 3 pins, the set-up depicted here allows one to control 8 outputs (more can be added by simply connecting additional shift registers). Pin 2 serves as the data pin, pins 3 and 5 are clock and latch inputs, respectively. Additional LED on pin 6 is used to indicate that the connection to server has been established successfully.

 

Assembled set-up

CODING :

Ethernet shield is configured using DHCP. (Please refer to Ethernet-shield example for simple web-client).
In order to communicate with the SQL database, each Arduino is pre-programmed with unique identifiers: device ID (1 character, ‘a’ for Arduino), device serial number (8 bit, ex. 00000001), and unique password for the mySQL database (8 characters). These values are stored in EEPROM, and are read using EEPROM.read() function in the set-up part of the code. Data-base name is constructed as “db_” + deviceID + deviceSN. For example, the first Arduino reads LED values from the database named “db_a00000001”. Password and device properties (ID and SN) are then sent using GET request to the www.fhilitski.com/arduino/updatedevice.php. Response by the php-script has form “LEDxxxxxxxx” (for example, “LED00000001” or “LED10101010”). The code looks for letters “LED” in the response and then reads out all eight LED values. The entire main part is enclosed into the infinite loop which takes care of sending requests and analysing the response.

 

Blog : https://www.fhilitski.com/arduino/control8db.php

code view : https://www.fhilitski.com/arduino/arduino_code.html

code : https://www.fhilitski.com/arduino/ino_files/Remote_LED_control.ino

COMMENTS

Please Login to comment
  Subscribe  
Notify of