There are many models for wireless controlled robotic vehicles. Usually such robots are connected to a remote control through RF module, Bluetooth, Wi-Fi or Mobile phones. All these wireless technologies have their own limitations and are restricted to specific ranges. Like if the robotic vehicle is connected with the remote control via Bluetooth module (Like HC-05 Bluetooth Module), it can have maximum operational range up to a distance of 10 metre. If the robotic vehicle is connected with the remote control via RF module, it can have maximum operational range up to a distance of 50 to 60 metre. In this project, an internet controlled robotic vehicle is designed which will be controlled by a webpage. The webpage could be opened on any desktop, laptop or mobile. The robotic vehicle could be at any place with internet access and it can be remotely controlled from anywhere.
The robotic vehicle is designed on Particle Photon. For making the vehicle, two DC motors are interfaced to the Particle board via L293D motor driver IC. A temperature and humidity sensor DHT-11 and LDR sensor are also interfaced to the board to keep track of the physical environment around the robotic car. Particle Photon is an IOT board with Wi-Fi and Bluetooth modules on board. The board operates over the air by connecting to a Wi-Fi connection. The board connects with the Particle’s Cloud service automatically and can be controlled over internet by sending data through the company’s cloud service.
Particle Photon is an Arduino compatible IOT board. For writing the program code for any Photon, developer needs to create an account on Particle website and register the Photon board with his user account. The program code then can be written on Web IDE at the Particle’s website and transferred to a registered IOT board over the internet. If the selected Particle board, Photon here, is switched on and connected to cloud service of the Particle, the code is burnt to the selected board over the air via internet connection and the board starts operating according to the transferred code.
For controlling board over internet, a webpage is designed which uses Ajax and JQuery to send data to the board using HTTP POST method. The webpage identifies the board by a device ID and connects to the Particle’s Cloud Service through an access token.
Components Required –
Receiver Side:
1. Particle Photon.
2. DHT11 sensor.
3. LDR sensor.
4. Home Wi-Fi connection.
5. L293D Motor Driver IC
9. DC Motors
Transmitter Side:
1. Web Page (EngineersGarageIoT.html)
Block Diagram –

Fig. 1: Block Diagram of Particle Photon based Internet Controlled Robot Car
Circuit Connections –

Fig. 2: Prototype of Particle Photon based Internet Controlled Robot Car
The motor driver IC and the sensors are interfaced to the Particle Photon. The circuit is assembled in the following manner –
Power Supply – In the circuit, Photon and other ICs need a 5V regulated DC for their operation. An 18V battery is used as the primary source of power. The supply from the battery is regulated to 5V and 12V using 7805 and 7812 ICs. The pin 1 of both the voltage regulator ICs is connected to the anode of the battery and pin 2 of both ICs is connected to ground. The respective voltage outputs are drawn from pin 3 of the respective voltage regulator ICs. An LED along with a 10K Ω pull-up resistor is also connected between common ground and output pin to get a visual hint of supply continuity.
DHT-11 Temperature and Humidity Sensor – The DHT -11 sensor reads the ambient temperature and humidity and relays the data to microcontroller as digital data. The data pin of temperature and humidity sensor DHT11 is connected to pin A0 of the Particle Photon and VCC and ground are connected to the common VCC and ground.
LDR Sensor – The LDR is used to sense the intensity of light. The sensor is connected to the A1 pin of Particle Photon. The sensor is connected in a potential divider circuit. The LDR provides an analog voltage which is converted to digital reading by the in-built ADC.
L293D DC Motor Driver IC – The L293D is the motor control driver IC. It has 16 pins with following pin configuration:

Fig. 3: Table listing pin configuration of L293D Motor Driver IC
There are two DC motors used for making the robotic car. The DC motors are interfaced between pins 3 and 6 and pins 14 and 11 of the motor driver IC.
The L293D IC controls the DC Motors according to the following truth tables:

Fig. 4: Truth Table of L293D Motor Driver IC

Fig. 5: Truth Table of L293D Motor Driver IC
The pin 4, 5, 13 and 12 of the L293D are grounded while pin 1, 16 and 9 are connected to 5V DC and pin 8 is connected to 9V DC. The pins 15, 2, 7 and 10 of the motor driver IC are connected to pins D3, D2, D1 and D0 of Particle Photon.
How the circuit works –

Fig. 6: Image of of Particle Photon based Internet Controlled Robot Car
Once the program code is transferred to Particle Photon, it starts operating according to it. The Particle Photon should be connected to any internet hotspot via Wi-Fi. The Arduino compatible code on Photon initially sends a LOW logic at all the data pins pausing both the motors and starts fetching data from the sensors.
DHT11 Temperature and Humidity Sensor is a digital sensor with inbuilt capacitive humidity sensor and Thermistor. It relays a real-time temperature and humidity reading every 2 seconds. The sensor operates on 3.5 to 5.5 V supply and can read temperature between 0° C and 50° C and relative humidity between 20% and 95%. The DHT 11 Sensor sends data in the digital form to a controller pin on one-wire protocol which must be implemented on firmware side. First the data pin is configured to input and a start signal is sent to it.
The start signal comprises of a LOW for 18 milliseconds followed by a HIGH for 20 to 40 microseconds followed by a LOW again for 80 microseconds and a HIGH for 80 microseconds. After sending the start signal, the pin is configured to digital output and 40-bit data comprising of the temperature and humidity reading is latched out. Of the 5-byte data, the first two bytes are integer and decimal part of reading for relative humidity respectively, third and fourth bytes are integer and decimal part of reading for temperature and last one is checksum byte. The one-wire protocol is implemented on the firmware using an open-source library available for Photon.
The IR sensor output an analog voltage at the interfaced controller pin. The analog voltage is read and digitized using in-built ADC channel. The analogRead() function is used to read analog voltage at the controller pin.
The read sensor data is passed to the Particle Cloud via Wi-Fi connection and the board waits for command to move the vehicle. The user is displayed sensor data on the webpage and have buttons to move and turn the car on the same webpage. As the user taps a button, the command in the form of string is transferred over the internet via Particle’s Cloud service. The strings are received via HTTP POST method by the Particle Photon. On detecting command, the board changes the digital logic at the data pins rotating the motors in clockwise or anti-clockwise direction.
In the robot circuit considering the two-wheel drive either front or rear possible drive, right hand side (RHS) motor is connected between pins 3 and 6 and left hand side (LHS) motor is connected between pin 11 and 14 of the L293D. The RHS motor is controlled by pin 2 and 7 of the L293D while LHS motor is controlled by pin 10 and 15 of L293D. Hence, to move robot in different direction following digital outputs are required at the L293D pins:

Fig. 7: Logic Table of L293D Motor Driver IC for IoT Photon Based Robotic Car
So to drive robot forward in this two-wheel drive, RHS motor needs to be rotated clockwise and LHS motor needs to be rotated anticlockwise. This is done by passing LOW signals to pin 2 and 15 of L293D and HIGH signal to pin 7 and 10 of L293D according to the truth table. To drive robot backward (applicable to two wheel drive) RHS motor needs to be rotated anti-clockwise and LHS motor needs to be rotated clockwise. This is done by passing LOW signals to pin 7 and 10 of L293D and HIGH signal to pin 2 and 15 of L293D according to the truth table.
To turn the robot right, RHS motor has to be stopped and LHS motor needs to be rotated anti-clockwise. This is done by passing LOW signals to pin 2, 7 and 15 of L293D and HIGH signal to pin 10 of L293D according to the truth table. To turn the robot left, LHS motor has to be stopped and RHS motor needs to be rotated in clockwise direction. This is done by passing LOW signals to pin 2, 10 and 15 of L293D and HIGH signal to pin 7 of L293D according to the truth table. The motors are stopped in the project by giving both control inputs of L293D for each motor a LOW logic.
Check out the photon code to learn how the Arduino compatible code detects command over the air and reads data from sensors and publish it on the linked data logging URL. Learn how the string of the command is manipulated to change digital logic at pins connecting to the L293D motor driver IC.
Programming Guide –
Photon Code
First of all the library for DHT sensor is imported. The library is automatically added by the particle’s Web IDE. A constant is defined to denote pin to which DHT 11 sensor is interfaced and a constant is defined to denote variant of DHT sensor. Variables to hold value of temperature, humidity and light intensity are declared. Variables denoting motor control logic are declared and assigned microcontroller pins. An object of DHT type is declared.
A character array is declared to hold the sensor data to be sent to the webpage.
The setup() function is called in which pin connected to L293D are declared output pin using pinMode() function and set to LOW by default using digitalWrite() function. The DHT sensor is initialized by calling begin() method on the dht object. A variable getpos and function setpos are exposed from the cloud and retrieved through POST method by calling Particle.variable and Particle.function methods. The setup() function is run only once at the start of the code.
The loop() function is called which iterates infinitely. In the loop() function, the data from the DHT sensor is fetched using getTempCelcius() and getHumidity() methods on the dht object. The data from LDR sensor is fetched by calling analogRead() method and converted to light intensity using standard formulae. The data from different sensors is stored in variables, wrapped in proper strings and sent to the data logging URL using publish() method on Particle object.
The ledToggle() function manipulate the command string. The string is converted to integer and compared with 1 to 4 for changing the logic at L293D motor input pins.

Fig. 8: Screenshot of ledToggle() function from Particle Photon Code for the Internet controlled Robotic Car
This completes the program code on Photon for Internet controlled Robotic Vehicle.
HTML Code
For controlling the robot over internet, a webpage needs to be created.
Fig. 9: Screenshot of Source Code of Webpage controlling Robotic Car
The doctype is declared for setting the page to HTML 5 version and head element is added. Inside the head element, character set is defined utf-8 and the webpage is set to span over entire window. The bootstrap for CSS and Javascript is included from CDN using the link element.
The body element is declared and an additional division element is declared to hold the content of webpage. The webpage is structured through other division elements and some headers paragraph and buttons elements are added.
The javascript is embedded in which the device ID and accesstoken are declared as variables and a function switchLED is created to format the command string to be passed to the Particle board. The command string contains a number between 1 to 4. The elements on the page are accessed through JavaScript function getElementbyID. The sensor data is fetched using JSON.parse() method and embedded to HTML elements using innerHTML method. The $.Post method is used to retrieve data from the cloud using HTTP POST method.
This is HTML file that needs to run for sending data to Particle’s Cloud service. The cloud service automatically connects to the Photon and Code on Photon operates according to the data received from cloud.
You may also like:
Project Source Code
###
//Program to // This #include statement was automatically added by the Particle IDE. #include// DHT parameters #define DHTPIN A0 #define DHTTYPE DHT11 // Variables int temperature; int humidity; int light; int light_sensor_pin = A1; int uv = A3; int pos = 0; int value; // Pins int motor0 = D0; int motor1 = D1; int motor2 = D2; int motor3 = D3; // DHT sensor DHT dht(DHTPIN, DHTTYPE); // publishjson.ino -- Spark Publishing Example unsigned long lastTime = 0UL; char publishString[64]; void setup() { Serial1.begin(9600); pinMode(motor0,OUTPUT); pinMode(motor1,OUTPUT); pinMode(motor2,OUTPUT); pinMode(motor3,OUTPUT); digitalWrite(motor0,LOW); digitalWrite(motor1,LOW); digitalWrite(motor2,LOW); digitalWrite(motor3,LOW); dht.begin(); // We are also going to declare a Particle.function so that we can turn the LED on and off from the cloud. Particle.function("led",ledToggle); } void loop() { // Temperature measurement temperature = dht.getTempCelcius(); // Humidity measurement humidity = dht.getHumidity(); // Light level measurement float light_measurement = analogRead(light_sensor_pin); light = (int)(light_measurement/4096*100); unsigned long now = millis(); //Every 5 seconds publish uptime if (now-lastTime>5000UL) { lastTime = now; sprintf(publishString,"{"Temperature": %u, "Humidity": %u, "Light": %u}",temperature,humidity,light); Particle.publish("Uptime",publishString); digitalWrite(motor0,LOW); digitalWrite(motor1,LOW); digitalWrite(motor2,LOW); digitalWrite(motor3,LOW); } } int ledToggle(String command) { value = command.toInt(); if (value == 1) { digitalWrite(motor0,HIGH); digitalWrite(motor1,LOW); digitalWrite(motor2,HIGH); digitalWrite(motor3,LOW); return 1; } else if (value == 2) { digitalWrite(motor1,HIGH); digitalWrite(motor0,LOW); digitalWrite(motor3,HIGH); digitalWrite(motor2,LOW); return 1; } else if(value == 3){ digitalWrite(motor0,HIGH); digitalWrite(motor1,LOW); digitalWrite(motor2,LOW); digitalWrite(motor3,HIGH); return 1; } else if(value == 4){ digitalWrite(motor0,LOW); digitalWrite(motor1,LOW); digitalWrite(motor2,HIGH); digitalWrite(motor3,LOW); return 1; } else { digitalWrite(motor0,LOW); digitalWrite(motor1,LOW); digitalWrite(motor2,LOW); digitalWrite(motor3,LOW); return 0; } } ###
Circuit Diagrams
Project Video
Filed Under: Electronic Projects
Filed Under: Electronic Projects
Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.