Internet controlled LED using Arduino and ESP8266 | Part 1

Internet controlled LED using Arduino and ESP8266 | Part 1

last week I've been into some IoT projects and thought of sharing them with you. Well this one contains very basic stuff about controlling hardware through a web server. I'll start from the beginning and continue to some real home automation projects step by step.
Stuff we are gonna need.
  1. Arduino development board
  2. ESP 8266 Module
  3. USB to TTL converter.
  4. 3.7v Lithium polymer Battery.
  5. A web server (000webhosting is a good free service)
  6. Jumper Wires
Note: If you are not using a battery, use a step down regulator. You can find one here. So you can directly get power from your computer’s USB port.
This is how it works.
DFEGFS.jpg
On the user side (or client side) there are two buttons. “Lights On” and “Lights Off.” Light On button sends a “on” value and Light Off button sends a “off” value  to the json file that will be hosted on your server.
The ESP8266 module will be connected to home wifi and it reads the json file on web server. If it sees “on” value, the module turns on the LED and of it reads “off”, it turns off the LED.
Important: ESP8266 is a SoC (Syatem on Chip) module. So you need to flash your source code first and then remove the wiring and rewire so It can standalone. 
Step 1: Hook up the modules for flashing.
wewe.jpg
Note: GND and VCC pins has more than 1 pins connecting together. You can use a breadboard for that. Or, if you are not into breadboards, solder some male headers to a dot board and solder them together. Like this.
asa.jpg
Now when GPIO0 is connected to the GND, ESP8266 will startup in bootloader mode. This is when you can flash the module.
Now we are done with wiring. Now lets take a look at the Arduino Code.
Step 2: Arduino IDE Setup
For this you need Arduino IDE 1.6.4 or higher. Then open the Arduino IDE. Then we need to install Arduino package for ESP2866. For that, go to Arduino IDE and from the toolbar, navigate to File >> Preferences. Down the screen you can find a textbox named “Additional Boards Manager URL”. Paste this URL in the textbox and click OK. Then the board manager will popup and select “esp8266 by esp8266 community ” and click Install.
Make sure you are connected to internet while doing this.
Now restart Arduino. Navigate to tools >> board >> Generic ESP8266 Module. Now plug in the TTL Converter to your PC and select the serial port from tools >> port.
Here’s some additional settings I’ve used.
  • Debug port : serial
  • Flash Size : 4M
  • Upload speed : 115200
  • Programmer: AVRISP mkll
Navigate to File >> Examples >> esp8266 >> blink. Upload the blink example and see if the LED is blinking or not. If yes, You are good to go. If not check your soldering and wiring connections and try again.
Now you have made the basic preparations for the project. In the next part I'll discuss how I setup my web server.


Suvin Nimnaka
Suvin is our new author.

Comments

Popular posts from this blog

Best Android Libraries..

Java Database Connection by- Suvin Nimnaka