Introduction: Adding Arduino Support to ESP8266 With Sample Test Code
ESP8266 packs a lot of punch. It is not just a WiFi module, it also has a decent micro-controller in built. Now the best part is the community has made programming this inbuilt micro-controller extremely easy by adding Arduino support. In this small tutorial, I will show you how easy it is to add Arduino Support and run a sample code.
Note that we will be using the inbuilt microcontroller inside ESP8266 in this example. We will be adding arduino support for ESP8266 itself. We do not need an external arduino.
Step 1: Components Required
Step 2: Open the Arduino IDE and Go to Preferences As Shown.
Before doing this step, download Arduino IDE from Arduino.cc ( 1.6.4 or greater). Then browse to File->Preferences as shown
Step 3: Add the URL
With the new version, arduino allows third party hardware to be added with a simple URL. Add the URL below to in the space provided. If you already have something there, put a comma and add then add the URL.
Step 4: Go to the Board Manager
Navigate to board Manager as shown in the Image.
Step 5: Wait for Arduino to Load the Package and Install It
You'll notice that the IDE will start downloading the package specified in the previous step. Wait for the download to complete. It will download all the required dependencies including the compiler, the libraries and various boards from different manufactures. Now is the time to Thank the ESP8266 community for doing all the hard work. Once it gives an option to install, hit it, sit back for a couple minutes and relax.
Step 6: Select the Board
All the popular ESP8266 boards will appear auto-magically. No need to restart the IDE or anything. It just works. Select the board that you've from the list shown.
Step 7: Set Up the Hardware
Depending on the board you've it might vary. I will describe the way you set up for Explore ESP8266 with a USB to serial Converter. Here are some points to remember:
- ESP8266 works on 3.3v. If you're board does not have an in built regulator, ensure that you supply 3.3v and do not fry it.
- Make the following connection from ESP to USB to Serial board
- Rx -- Tx
- Tx -- Rx
- gnd -- gnd
Step 8: Sample Test Code
Note: I have removed the attached code, please download it from the link below:
The attached piece of code is already there in the examples. What it basically does is, it powers up the ESP and scans for the nearby WiFi networks. This will ensure that it is working!
Open the terminal and you should see the available networks as shown in the image above.
What will you connect to internet next?
Let us know in the comments and we will be glad to answer any questions that you may have! Happy Hacking!
The code rendering on instructables in broken, it needs to be fixed.
Also if there was some kind syntax highlighting, it would have been nice. Isn't it?
We have a be nice policy.
Please be positive and constructive.