Introduction: WiFi Controlled Robot Using Esp8266
In this Instructable I will be sharing how to make a simple Robot using ESP8266 as the brain.
This robot can be remotely controlled using Android Remote LITE app or using a web browser.
We will be using RemoteMe servers to achieve remote connection. As always I will try to keep it as simple as possible.
Check out the Mini WiFi Robot ebook to get more details about CAD and coding about this project.
I recommend you read this post to lean about RemoteMe.
So lets get started...
Step 1: What We Need :-
Buy the components from Banggood and use code "aff7off" at checkout to get 7% OFF
Hardware Components :-
- ESP8266 dev board..........(Amazon US / Amazon EU / Banggood)
- L298N Motor Driver...........(Amazon US/ Amazon EU / Banggood)
- 2 x DC Geared motor........(Amazon US/ Amazon EU / Banggood)
- 9 -12v Battery....................(Amazon US / Amazon EU / Banggood)
- Mini Breadboard................(Amazon US / Amazon EU / Banggood)
Software Components :-
For the chassis of the robot I have used foam board.
If you want you can use readily made chassis :-
Step 2: Designing the Chassis :-
As mentioned before, I made the base for robot using foam board. Below I have provided the Sketchup file for the robot. You can download it and view it using Sketchup. It is a paid software but you can use it for free if you download it for educational use.
Or you can buy the chassis available online.
Step 3: Set Up :-
Now we have to set up the environment to control our robot.
First of all go ahead and download Arduino Remote LITE app from playstore.
Now open the installed app and Goto >> RemoteMe and sign in with your RemoteMe account.
If you don't already have an account then Goto >> RemoteMe.org and create a new account.
Once you sign in into the app, head over to RemoteMe.org , sign in with your account.
Now we have to create 2 devices a web device which will help us control the robot using web-browser, a networking device which will generate a code for our ESP board and connect it to the server.
Make Web Controller :-
- So first move on to "Devices" (You can find it in the menu on left hand side).
- Now create a new device , Goto >> New Device >> New Web Page.
- A pop up will appear, here we will name the device and give it a unique ID.
- Let us name it "Web_Controller", Device ID can be "3". (The name and device ID can be anything you want but for this tutorial keep it same my values)
- Now keep the template as it is and submit. This will create a new device.
- It's time to edit the device , For that first click on the device and then clink on Index.html.
- You will see a drop-down list, here select "Edit with wizard".
- Now goto "Component Starter" , In here you will select the component "status" from the list, In the configuration toggle on "webSocket" and "directConnection". Insert the component.
- Now make another component, This time select "joystick" now make the changes as follows :-
Name : xy2
xrange : 1023
yrange : 1023
and insert the component. That's all.
Make Network Device :-
- Create a new device as before but this time select "New Network Device" now name it "Controller" and device ID "4".
- Now on the device created, Click on the burger menu and select "Code Generator Wizard"
- Now select the variables as shown in the image and click next.
- Enter your WiFi name and password click next.
- Now make sure you enable the direct connection.
- Next you can enable the debugging option if you want. It will display values on serial monitor.
- Now you can download the code.
With that been done, we can move on to edit the code.
To use the the web controller just click on the "Index.html" file and open in new tab.
Or you can get the anonymous link. It will give you a link and a QR code. Which when scanned using a smartphone, opens the web controller so you can control the device using Mobile browser.
Step 4: Editing & Uploading Code :-
The downloaded code can be uploaded to the ESP directly, but it won't make our robot move.
To use it with our robot or any other applications you want, it needs to perform some actions when a certain button is pressed or value is generated. For this we need to edit the code.
I have provided an edited code below. You can just download it, add your WiFi name and password, also your token. The code is fairly simple so I don't think any exceptional information is needed here.
Yet if you have trouble understanding feel free to ask questions :)
NOTE :- Before uploading the code make sure to update the libraries.
Step 5: Circuit :-
Follow the picture above for connections. I have also provided file for Fritzing below.
Follow the connections :-
- ENA = D3
- IN1 = D4
- IN2 = D5
- IN3 = D6
- IN4 = D7
- ENB = D8
To power the robot, you can either use two 9v batteries and power the ESP and Motor drive separately,
or you can power the motor drive with 12v and then connect the 5V terminal of driver to Vin pin of ESP.
In either case, Make sure to connect the Gnd of the ESP to Gnd terminal of motor drive.
After the connections are made, Double check everything and power up the robot.
Step 6: Testing :-
Once everything is done and the robot is powered, It will connect to your WiFi network. Now you can control the robot using Computer's browser, Android app or Mobile browser.
- To control the bot using your computer's browser. Just open the RemoteMe website, Login to your account and goto Devices. Select the web device and click on "index.html". Now select "Open in new tab". A new tab will open with joy stick which will control the bot.
- To control it using Android Remote LITE app. Open the app, Goto controller and you can use the arrow buttons to control robot's movements.
- Now for using the mobile browser you can either goto RemoteMe website and go through the same process as for computer's browser.
Or another easy way is using anonymous link. To use this feature again click on the "index.html" file and select "Anonymous Link". You can either goto the link or click the small square icon next to it. This icon will give a QR code which can be scanned using any QR scanner, It will redirect you to the webpage having the joystick.
So using the above methods you can control the robot.
That's all for this tutorial. You can now try it yourself and add more features if you like.
Let me know if you like this and ask questions if you come across any doubts.
Also if you are interested in robotics and want a course check out this e-course.