Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe

A Bluetooth-controlled datalogger robot

By engineersgarage January 10, 2021

Robots are supporting human behaviors, activities, and jobs in several notable ways. From robotic arms and hands to robots that provide surveillance and maintenance tasks, this technology is rapidly advancing to assist in ways that make certain tasks safer, quicker, or more accessible. 

Such robots are either automatic — meaning they can operate automatically without any human intervention — or controlled remotely, so that they operate manually from a remote location. Remote-controlled robots are typically wireless. 

Examples of remote-controlled robots include: 

  • Snake robots – can enter into extremely narrow or small tunnels or pipelines, these robots are mainly used to find problems (such as a leak in a pipeline) but can also be used for search and rescue operations.
  • Fire-fighting robots – are used as a fire extinguisher that sprays water or CO2 on a fire. An operator controls this robot from a safe place and tries to extinguish the fire so that a firefighter does not have to put his or her life in danger.
  • Mine diffusing robots – are used to diffuse live bombs or mines in a battlefield. An operator can control its movements from a remote and safe distance, diffusing bomb (or mine) without risking a life.

The Bluetooth-controlled robot
As robots advance, so is the ability to communicate with them. Today’s remote-controlled robot are often wireless, which is typically done by using a smartphone via Bluetooth communication. This means anyone can control the robot’s movements with the touch of the fingers. 

One industry that has benefitted from robotic support is the agricultural sector. These robots can be wirelessly controlled or programmed to automate slow or repetitive tasks for farmers, allowing them instead to focus more on improving overall production yields. Some of the most common robots in agriculture are used for seeding, spraying, harvesting, picking, and weed control.

The project
For our purposes, let’s build a robot that can help with basic plant growth. Four conditions must be ideal for a plant to grow healthy. 

1. Temperature
2. Humidity
3. Soil moisture
4. Ambient light (light intensity).

Three sensors will be used in our robot to monitor those conditions.

Additionally, for this project, the operator will be: 

  • Capable of maneuvering the robot in a radius of 10-30 meters while taking measurements and selecting the ideal best place for plantation.
  • Able to attain the measurements of temperate, humidity, soil moisture, and ambient light after plantation. 
  • Able to take corrective actions to alter either of those four conditions.

Although this robot will be built for plant care, it’s important to note that the concept could easily be used for different applications by altering the sensors. For example, if we equipped the robot with MQ2, MQ3, or a similar gas sensor, the robot could be used to detect gas leakage of any GAS like CO2, CO, LPG, etc.

But, for now, let’s concentrate on developing a robot for plant care.  

The system block diagram
The major building blocks of the system are three sensors for:

1. Soil moisture: used to measure moisture content in soil and provides the analog voltage output as per the measured moisture level. Its output voltage decreases as the moisture content increases. 

2. DHT11-temperature and humidity sensor: measures atmospheric temperature and humidity. It gives direct digital values for temperature in Celcius and for humidity in % RH. It is a smart sensor.  

 3. LDR, Arduino UNO development board, Bluetooth module, two DC motors, and motor-driver chip.

The Bluetooth module is used for command purposes (to move the robot forward, reverse, left, and right) from a smartphone. It provides this data, serially, to the Arduino UNO microcontroller.

The Arduino UNO board performs the following tasks:

  • Reads analog output voltage from the soil moisture sensor and converts it to digital. Then, it calibrates it between a 0 – 100% moisture level.
  • Reads the temperature and humidity values from the DHT11 sensor.
  • Reads the analog voltage output from the LDR and calibrates the light intensity between 0-100%.
  • Gets different commands from the Bluetooth module and rotates the two DC motors to move the robot forward, reverse, left, or right.
  • Sends (transmits) these readings of all three of the sensors to a smartphone via the Bluetooth module.

The motor driver provides sufficient voltage and current to both motors to rotate them. It also amplifies the output of the Arduino board and drives the motors.

The DC motors drive the left and right wheels of the robot and move the robot forward, reverse, left and right.   

Now, let us see how the circuit is built from this block diagram.

The circuit diagram

The circuit description

  • The HC-05 module operates on the 5V that’s provided by the Arduino board. It communicates with the Arduino board with the USART pins Tx-Rx. This means its Tx pin is connected with the Rx pin of the Arduino board and vice versa.
  • The DHT11 sensor also provides the 5V supply from the Arduino board. Its digital output is connected to digital pin D7 of the Arduino board.
  • The analog output of the soil-moisture sensor is connected to the analog input pin A1 from the Arduino board. It requires 5V biasing voltage from the Arduino board.
  • The LDR is configured in the pull-down mode with the 10 KΩ pull-down resistor. Its analog output is given to the analog input pin A0.
  • the digital pins D8, D9, D10, and D11 drive the two DC motors using the L293D chip. These pins are connected to the inputs of L293D and the two motors are connected with the output of the chip.
  • The motor supply pin Vss of L293D (pin num 8) receives 12V from the battery.
  • The Arduino board also receives 12V input to its Vin pin from the battery. It gets 12V input and provides 5V of output to all of the other components. 

Circuit working and operation
The circuit operation starts when the 12V battery is connected with the Arduino UNO board and the L293D chip.

  • Initially, both motors are stopped and the robot is also at rest.
  • To move the robot in any direction, we have to give commands from the smartphone through the Bluetooth-based Android application.
  • To do this, we have to open (start) the Bluetooth Android application in the smartphone and then search for the HC05 Bluetooth module. Once the smartphone detects the HC05 module, it’s required to pair the module with the application so that it can send commands from the smartphone via the Bluetooth to the HC05 module (note: it’s required to enter the passkey “1234” the first time to pair with the HC05 module).
  • Now, we can send commands to the robot to move forward, reverse, left, or right via the smartphone through the application.

These commands are used to move the robot (all these commands are set in the Android application):

  • When any of the above commands are sent (by sending direct character or pressing the button in the application), it’s received by the HC05 module. The module further gives this command to Arduino, serially, through the Tx-Rx pins.
  • Arduino receives this command and compares it with the set commands. If it finds a match, it will rotate the left and right motors accordingly to move the robot in any of the appropriate four directions.
  • Once the robot starts its motion, it will continuously move until we send the command ‘S’ to stop.
  • When the robot stops, it will start reading the sensor values from the DHT11, soil moisture, and LDR. It will read the analog voltage output from the soil moisture sensor and the LDR, and convert it in a range of 0 – 100%. It will also read the digital values of the temperature and humidity from the DHT11 sensor.     
  • Then it transmits all four values of soil moisture, light intensity, temperature, and humidity to the smartphone via the Bluetooth module, it will continuously transmit these four values after every two seconds until it is stopped.
  • When given the command to start moving again, it will stop transmitting the values.
  • The operator can take this robot to the required place and measure these four conditions. He or she will get the readings on his or her smartphone while moving the robot with the touch of a finger. 
  • It should be easy to program the ambient conditions of temperature, humidity, soil moisture, and light intensity in the nearby area  

The software program
The program is written in C / C++ language using the Arduino IDE software tool. It’s also compiled and downloaded in the internal memory (FLASH) of the ATMega328 microcontroller using this same software.

Here’s the program code:

#include <Servo.h>
#include <LiquidCrystal.h>
#include “DHT.h”
#define LDR_pin A0
#define soil_moisture_sensor_pin A1
#define DHTPIN 2
#define DHTTYPE DHT11
Servo soil_moisture_servo;
int light_intensity, soil_moisture;
LiquidCrystal lcd(12, 13, 8, 9, 10, 11);
DHT dht(DHTPIN, DHTTYPE);
int motor1Pin1 = 4; // pin 2 on L293D IC
int motor1Pin2 = 5; // pin 7 on L293D IC
int motor2Pin1 = 6; // pin 10 on L293D IC
int motor2Pin2 = 7; // pin 15 on L293D IC
int moisture_sensor_servo_pin = 3;
int state;
int stopflag = 0;
void setup()
{
  // sets the pins as outputs:
  pinMode(motor1Pin1, OUTPUT);
  pinMode(motor1Pin2, OUTPUT);
  pinMode(motor2Pin1, OUTPUT);
  pinMode(motor2Pin2, OUTPUT);
  soil_moisture_servo.attach(moisture_sensor_servo_pin); 
  soil_moisture_servo.write(0);
  Serial.begin(9600);
  lcd.begin(16, 2);
  lcd.clear();
  lcd.setCursor(2, 0);
  dht.begin();
  lcd.print(“Data logger”);
  lcd.setCursor(6, 1);
  lcd.print(“Robot”);
  delay(5000);
  lcd.clear();
  lcd.print(” t*C H % L % M %”);
}
void loop()
{
  int h = dht.readHumidity();
  int t = dht.readTemperature();
  light_intensity = analogRead(LDR_pin);
  light_intensity = map(light_intensity, 750, 50, 5, 100);
  lcd.setCursor(9, 1);
  lcd.print(light_intensity);
  lcd.setCursor(1, 1);
  lcd.print(t);
  lcd.setCursor(5, 1);
  lcd.print(h);
  if (stopflag == 1)
  {
    soil_moisture = analogRead(soil_moisture_sensor_pin);
    soil_moisture = map(soil_moisture, 1015, 100, 0, 100);
    lcd.setCursor(13, 1);
    lcd.print(soil_moisture);
    Serial.print(“Humidity:”);
    Serial.println(h);
    Serial.print(“temp:”);
    Serial.println(t);
    Serial.print(“light:”);
    Serial.println(light_intensity);
    Serial.print(“moisture:”);
    Serial.println(soil_moisture);
    delay(1000);   
  }
  if (Serial.available() > 0)
  {
    state = Serial.read();
    // if the state is ‘1’ the DC motor will go forward
    if (state == ‘1’)
    {
      digitalWrite(motor1Pin1, HIGH);
      digitalWrite(motor1Pin2, LOW);
      digitalWrite(motor2Pin1, HIGH);
      digitalWrite(motor2Pin2, LOW);
      stopflag = 0;    
      soil_moisture_servo.write(0);     
    }
    else if (state == ‘2’)
    {
      digitalWrite(motor1Pin1, HIGH);
      digitalWrite(motor1Pin2, LOW);
      digitalWrite(motor2Pin1, LOW);
      digitalWrite(motor2Pin2, LOW);
      stopflag = 0;     
      soil_moisture_servo.write(0);
    }
    // if the state is ‘3’ the motor will Stop
    else if (state == ‘3’)
    {
      digitalWrite(motor1Pin1, LOW);
      digitalWrite(motor1Pin2, LOW);
      digitalWrite(motor2Pin1, LOW);
      digitalWrite(motor2Pin2, LOW);
      stopflag = 1;
      delay(500);
      soil_moisture_servo.write(90);
      delay(500);
    }
    // if the state is ‘4’ the motor will turn right
    else if (state == ‘4’)
    {
      digitalWrite(motor1Pin1, LOW);
      digitalWrite(motor1Pin2, LOW);
      digitalWrite(motor2Pin1, HIGH);
      digitalWrite(motor2Pin2, LOW);
      stopflag = 0;     
      soil_moisture_servo.write(0);
    }
  }
}

You may also like:


  • Understanding the degree of freedom in robots

  • What are different types of industrial robots?

  • What battery chemistries are used in electric vehicles?

  • What are the different types of EV charging connectors?

  • What are the components of robotic arms and industrial robots?

  • Choosing Batteries for Robots

Filed Under: Electronic Projects, Featured Contributions, Microcontroller Projects
Tagged With: Arduino
 

Next Article

← Previous Article
Next Article →

Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

EE TECH TOOLBOX

“ee
Tech Toolbox: 5G Technology
This Tech Toolbox covers the basics of 5G technology plus a story about how engineers designed and built a prototype DSL router mostly from old cellphone parts. Download this first 5G/wired/wireless communications Tech Toolbox to learn more!

EE Learning Center

EE Learning Center
“engineers
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


RSS EDABOARD.com Discussions

  • Getting different output for op amp circuit
  • Discrete IrDA receiver circuit
  • No Output Voltage from Voltage Doubler Circuit in Ansys Nexxim (Harmonic Balance Simulation)
  • How do loop recording and G-sensors work on front and rear dash cams?
  • Resistor Selection for Amplifier Layout

RSS Electro-Tech-Online.com Discussions

  • Saga 1400sv vinyl cutter motherboard issue
  • PIC KIT 3 not able to program dsPIC
  • Wideband matching an electrically short bowtie antenna; 50 ohm, 434 MHz
  • using a RTC in SF basic
  • Relay buzzing after transformer change?

Featured – RPi Python Programming (27 Part)

  • RPi Python Programming 21: The SIM900A AT commands
  • RPi Python Programming 22: Calls & SMS using a SIM900A GSM-GPRS modem
  • RPi Python Programming 23: Interfacing a NEO-6MV2 GPS module with Raspberry Pi
  • RPi Python Programming 24: I2C explained
  • RPi Python Programming 25 – Synchronous serial communication in Raspberry Pi using I2C protocol
  • RPi Python Programming 26 – Interfacing ADXL345 accelerometer sensor with Raspberry Pi

Recent Articles

  • GigaDevice launches GD32C231 MCU series with 48MHz Cortex-M23 core and 64KB Flash
  • Advanced Energy releases 425 W CF-rated medical power supply in 3.5 x 6 x 1.5-inch format”
  • LEM combines shunt and Hall effect sensing in 2000 A current measurement unit
  • What is AWS IoT Core and when should you use it?
  • AC-DC power supply extends voltage range to 800 V DC

EE ENGINEERING TRAINING DAYS

engineering

Submit a Guest Post

submit a guest post
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • EV Engineering
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • Subscribe to our newsletter
  • About Us
  • Contact Us
  • Advertise

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy

Search Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe