Introduction: Automatic Air Quality Monitoring Cruise Robot

Picture of Automatic Air Quality Monitoring Cruise Robot

Overall

I made a four-wheel automatic cruise robot using Arduino and kinds of sensors. Then I added wireless remote
control to it. In the end, I even built an air quality monitoring machine on the robot and it turned to be very useful.

Please vote for me and thanks a lot!

Material

Main: Arduino mega2560; 4wheel car; four DC motors with reduction gear; L298N driver circuit board; apc-220 RF modules (RF communication); four ultrasonic distance sensors; infrared ray distance sensor; 3s(11.1v) li-battery; air quality sensor(I used SHARP GP2Y1010); 1602 LCD; SD card module

Else: breadboard; wire; computer;

Software: Arduino IDE; office excel; serial assistant;

Step 1: Step One:

Picture of Step One:

Assemble a four-wheel car. Any kind is ok and mine is a 32cm*26cm*13cm one and its 13cm wheels make it easy to step overobstacles encountered.

Step 2: Step Two:

Picture of Step Two:

Connect the wheels with DC motors using reduction gear.

The slower the wheels’ speed, the larger the torque gained. So choosing a suitable reduction gear is of vital
importance.

Step 3: Step Three:

Picture of Step Three:

Connecting four motors with L298N board. 4*2=8 wires in total

L298N is a driver board for DC motors. It allows larger current (Arduino I/O only has 40ma per pin) and uses three wires for controlling a motor (two for rotation direction and one for speed).

Motors-L298N board: 4*2=8 wires in total

L298N borad-arduino: 4*3=12 wires in total

DC battery-L298N board: 2 wires in total

Attention one: L298N board needs a common GND with Arduino

Attention two: L298N’s speed control pins
should connect with Arduino’s digital pin which is able to give PWM signal. (Different Arduino board is different)

Step 4: ​​Step Four

Picture of ​​Step Four

Make a stand for fixing four ultrasonic distance sensors and attach them on the stand. The side-to-side width is
supposed to be the same with car’s width.

Connect ultrasonic distance sensors with Arduino digital pin.

In my case, I connect VCC to 3.3V output; GND to GND; trig pin and echo pin to any digital pins of Arduino.

Thatis 4*4=16 wires in total.

Step 5: Step Five

Picture of Step Five

Because relying on four ultrasonic distance sensors is not a perfect idea. The car still misses some small obstacle in reality so I test and add an infrared ray distance sensor. It is also a distance sensor and if faced with some obstacle it can give a low voltage feedback.

It has only three pins: VCC, GND, SIGNAL and the signal pin should be connected to one
of Arduino’s interrupt pin. (can look up on www.Arduino.cc for a specific Arduino board)

Step 6: Step Six (remote Control and Communication.This Part Is Optional)

Picture of Step Six (remote Control and Communication.This Part Is Optional)

I used APC-220 module, a RF module ranging from 400MHZ to 490MHZ, for this function. Use the USB converter to connect two modules with computer and set their frequencies and baud rate for same.

APC-220 uses 5V as power and serial communication with Arduino (pin RX and TX) so it is kind of easy. And just
including ”serial.begin (9600)” in your Arduino program’s setup enables you to remote control the car and even get the sensors’ data you want.

Step 7: Step Seven

Picture of Step Seven

Assemble the air quality monitoring sensor (SHARP GP2Y1010) with Arduino.

The connection instruction is illustrated in the figure.

It is an air sensor based on the particles’ reflection, which makes the air quality a visible measurement. You just read and analyze the voltage it feeds back and each voltage corresponds to a specific particle density.

The code of handling the voltage feedback is below.

#include <Wire.h>


#include <LiquidCrystal_I2C.h>


int measurePin = A0; //Connect dust sensor to Arduino A0 pin
int ledPower = 2; //Connect 3 led driver pins of dust sensor to Arduino D2

int samplingTime = 280;
int deltaTime = 40;
int sleepTime = 9680;
int i=0;

float voMeasured = 0;
float voMeasuredReal = 0;
float voMeasuredLast = 123.0;
float calcVoltage = 0;
float dustDensity = 0;
LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line display

void setup(){
// Serial.begin(9600);
pinMode(ledPower,OUTPUT);
pinMode(A0,INPUT);
lcd.init(); // initialize the lcd
lcd.init();
lcd.backlight();
//lcd.home();
}

void loop(){
// 0 - 5V mapped to 0 - 1023 integer values
//calcVoltage = voMeasured/5.0*5.5;
//dustDensity = 0.17 * calcVoltage - 0.1;

digitalWrite(ledPower,LOW); // power on the LED
delayMicroseconds(samplingTime);
voMeasured=analogRead(measurePin); // read the dust value via pin 5 on the sensor
voMeasuredReal=voMeasured;
delayMicroseconds(deltaTime);
digitalWrite(ledPower,HIGH); // turn the LED off

//smooth noise
voMeasured=voMeasuredLast+(voMeasured-voMeasuredLast)/10.0;

if(voMeasured<150)
dustDensity=0.15*(voMeasured-130.0);
else if(voMeasured<160)
dustDensity=3+1.7*(voMeasured-150.0);
else if (voMeasured<220)
dustDensity=5* (voMeasured-150.0);
else
dustDensity=voMeasured-220.0;

//if (dustDensity<0) dustDensity=0.0;
if (dustDensity>600) dustDensity=600.0;

lcd.clear();
lcd.setCursor(0, 0);
lcd.print("ASY-02012317-SEU");
lcd.setCursor(0, 1);
lcd.print("PM2.5 ");
lcd.setCursor(10, 1);
lcd.print(dustDensity);


voMeasuredLast=voMeasured;
delay(2000);
// delayMicroseconds(sleepTime);
// if (i<=30)delay(1000);
// else delay (5000);
// i++;
// if (i>1024) i=31;

Step 8: Step Eight (LCD and SD Card. Also Optional)

Picture of Step Eight (LCD and SD Card. Also Optional)

Only getting the air quality is not enough, I need to get these data.

There are many ways to achieve this. For example, apc-220 remote communication, LCD showing, SD card save and so on. And this time I will show how to use a 1602 LCD to show the information.

My 1602 LCD has for pins because it is already combined with a module which enables the LCD using I2C to communicate with Arduino.

The four pins are VCC, GND, SDA, SCL in respect. Though Arduino boards are different, they all have analog pin4 and pin5, which can be used as I2C. Just connecting the SDA to A4 and SCL to A5 and all is done.

There is already LiquidCrystal_I2C library file for Arduino. Put this library file to your computer Arduino IDE’s folder and you can use the LCD easily.

Step 9: Result

Picture of Result

First of all, my car can automatic cruise avoiding obstacles due to its ultrasonic distance sensors and infrared ray distance sensor (as emergency interrupt).

Then, I can remote control (around 800m) my car and even make it cross stairs and other tough obstacles.

Next, it can monitor the local air quality. Though it is probably not as accurate as the Meteorological monitoring department, it does tell you a relatively air quality just where and when it is. I think this is also brilliant.

Finally, I collect some samples and plot them in execl. It is a lot of fun.

Thanks for your reading and really wish your appreciation and vote.

If any question, please feel free to ask, either comment or email is ok. (aaaaasy@gmail.com)

Comments

chocolatepie (author)2017-11-09

is there any option to convert this bot into voice controlled one

pacowang (author)2014-11-27

Nice. Well done tutorial. answered some questions that I have had. Thank you!

craftclarity (author)2014-05-23

Thing looks super-rugged....!

About This Instructable

5,995views

41favorites

License:

More by asygoogle:Automatic air quality monitoring cruise robotLamp decorated with portrait and poem
Add instructable to: