Introduction: ARDUINO IOT
Nowadays a new emerging technology is Internet of Things (IoT): this post describes how to create Internet of things with Android and Arduino. In IoT project, all the physical objects (things) are connected together using internet infrastructure. Arduino borard is one of the most important object in this ecosystem.
This instructable describes how to create an Internet of things with Arduino uno.
Project: HTML WEB PAGE to control LED VIA WIFI MODULE (IOT) .
Step 1: What We Need Is:
1. Arduino uno
3. 3.3v voltage regulator
4. 10k resistances (3x)
5. connectors,wires,button,leds and bread board,general purpose pcb.
Step 2: Make a Breakout Board for ESP 8266-01:
it's my own design
note: 1. rx pin is connected with Arduino or ttl tx pin. 2.tx pin is connected with Arduino or ttl rx pin. In the schematic.The ESP's VCC pin is powered by the 3.3V output pin of the voltage regulator (AMS1117). The . The CH_PD and RST pin must also be connected to 3.3V. The GND pin is obviously connected to ground. The ESP's TXD pin can be connected directly to the RX pin of Arduino The ESP's RXD pin is connected to the TX pin through the level shifter.This allows to have a more fast and reliable communication link between the Arduino board and the ESP-01 module.
For complete design click on my another instructable :
Step 3: WEB PAGE(HTML,JAVA SCRIPT)
- ESP8266 LED Control
IOT WORLD BY ALOK
LED PUSH BUTTONS
- HTML Code Used to Send Data to The ESP8266-Arduino Circuit
DOWNLOAD HTML FILE . To save the file as an HTML file using Notepad, go to File->Save As then in “Save as Type” select “All Files”, the file name can be anything you wish but make sure you put “.html” at the end. For example if you would like to name your file myesp8266control, then your file name will have to be myesp8266control.html
Step 4: CODE(ARDUINO UNO)
Arduino Code Explanation
For those interested, here is how the Arduino Sketch works: Whenever you click on a button in the HTML page a GET request is sent to the ESP8266
+IPD,0,345:GET /?pin=13 HTTP/1.1
User-Agent:Moila/.0(inow N 61;WO64 AplWeKi/57.6(KTM, ik Gco)Chom/3.0211.5 afri53.3
To know when request is in progress, the Arduino looks for the string “+IPD,” in the Serial buffer using Serial.find
The code then reads the next character (the connection id, 0 in the example request above). The connection ID is needed to know which connection to close (different simultaneous requests have a different ID).
Next we get the pin number by looking for the string “?pin=” in the serial buffer, once again using Serial.find
Now that we have the pin number we know which pin to toggle
#define DEBUG true
esp8266.begin(9600); // your esp's baud rate might be different
sendData("AT+RST\r\n",2000,DEBUG); // reset module
sendData("AT+CWMODE=2\r\n",1000,DEBUG); // configure as access point
sendData("AT+CIFSR\r\n",1000,DEBUG); // get ip address
sendData("AT+CIPMUX=1\r\n",1000,DEBUG); // configure for multiple connections
sendData("AT+CIPSERVER=1,80\r\n",1000,DEBUG); // turn on server on port 80
if(esp8266.available()) // check if the esp is sending a message
delay(1000); // wait for the serial buffer to fill up (read all the serial data)
// get the connection id so that we can then disconnect
int connectionId = esp8266.read()-48; // subtract 48 because the read()
// the ASCII decimal value and 0
esp8266.find("pin="); // advance cursor to "pin="
int pinNumber = (esp8266.read()-48)*10;
pinNumber += (esp8266.read()-48);
digitalWrite(pinNumber, !digitalRead(pinNumber)); // toggle pin
// make close command
String closeCommand = "AT+CIPCLOSE=";
closeCommand+=connectionId; // append connection id
sendData(closeCommand,1000,DEBUG); // close connection
String sendData(String command, const int timeout, boolean debug)
String response = "";
esp8266.print(command); // send the read character to the esp8266
long int time = millis();
while( (time+timeout) > millis())
// The esp has data so display its output to the serial window
char c = esp8266.read(); // read the next character.
Step 5: FINAL STEPS:
- Connect the wires according to the fig1.1
- Connect your wi fi module with the internet as shown in fig 1.2
- Now reset your Arduino uno and open the serial monitor (fig 1.3)
- Open your HTML WEBPAGE(fig 1.4)
- All sets congratulation now u r able to control your led via IOT (fig 1.5)
NOTE: Another application of this instructable is HOME AUTOMATION VIA IOT
Step 6: VIDEO
project is ready to work thank u everyone for watching my instructable. If u like my work then follow me and hit the favorite button :)
We have a be nice policy.
Please be positive and constructive.