This robotic system can be controlled using a GUI built using processing. The rover can be controlled by sending commands through the GUI running on the Laptop. It uses xbee series 2 modules for wireless communication. It has the ability to traverse uneven terrain and climb stairs using its servo mechanism. The rover has a LM35 temperature sensor, a MQ 2 gas sensor, and allegro hall effect sensor with neodymium magnet ring. The values from these sensors is sent to the GUI every 1 second .The GUI displays temperature, distance travelled, RPM, gas level. The GUI can also give voice alerts if level of target gas is above certain level. It also has a LED head lamp that can be used in low light conditions. The GUI can also display the feed from the on-board camera.(this feature works with wired USB camera). You can also take a screen shot. The software also logs the sensor data into an excel file that can later be used to plot graphs to analyse teh data.
Below are the steps you need to follow to make one.
what will you need to build this:
1. A robot chassis, any chassis should be fine but if you want the same as mine it can be found here:
2. Pan and tilt brackets and 2 x micro servo (http://www.robotshop.com/en/servocity-spt50-sub-micro-pan-tilt-kit-hs55-servos.html)
3. Sensors: MQ2 , LM35 and allegro hall effect sensor with neodymium rings.
4. Battery . I used li-ion 11.1v 1500mAh with peak current of 2A. (http://www.robotshop.com/en/li-ion-2200mah-battery-pack-31012.html)
5. Arduino Uno.
6. Itead XBEE Shield. (http://www.robotshop.com/en/xbee-shield-arduino.html)
7. Xbee explorer (http://www.robotshop.com/en/sfe-xbee-explorer-usb.html)
8. Xbee series2 x2 (http://www.robotshop.com/en/xbee-2mw-wire-antenna-series2-zigbee-mesh.html)
9. USB camera
11. Buck converter module (http://www.ebay.in/itm/131507325768?aff_source=Sok-Goog)
10. Custom built PCB and Miscellaneous components ( will be described in next steps)
12: 3D printed servo holder and box.
13. Hall Encoder(http://www.rhydolabz.com/robotic-parts-c-155_164/dagu-simple-encoder-kit-p-1277.html)These are included in Dagu multichassis rescue Kit. Else if you buy something else you need to buy these.
1. Arduino IDE
2. Processing IDE
Step 1: Building the Hardware
A board is needed to connect all the components like the motor driver, sensors ,servos, LED driver with arduino and distribute power to them. The schematic below shows all the connections. Due to the space constraints i could not build the buck converter in my board. For those who don't know a buck converter is a circuit used to drop voltage from high value to low value. I used a 11.1 V battery but my motors were rated for 9V. the servo needed 6V and other motor driver and LED driver (for headlamps) and sensors needed 5v. So i first dropped the voltage from 11.1 to 9v and then this 9 v is converted to different voltages as required using LM III7 and Lm1117 adj regulators. The selection of components is crucial here. Somebody may think that why not use a liner regulator instead of buck converter but here the power requirement is more and linar regulator like IC7809 would fry up. This is not the best PCB design coz i had some component and manufacturing constraints. Would be glad if somebody could enhance it.
The files and gerbers are given below. You can just print the board and enjoy. This design is tried and tested.
This section explains the working of Motor Driver and LED driver circuit if you haven't worked with such circuits before.
The motor driver used is L298 as it can provide voltage upto ~40v and current of 2A . Another cheaper option can be l293D which is cheaper but operates at lower specs.
Refer to the motor driver picture and Motor driver input output chart while reading this section:
If input 1 is high and input 2 is low the motor will rotate in one direction while if input 1 is low and input 2 is high it will rotate in other direction. similarly for input 3 and input 4. Input 1 and input 2 are for controlling motor 1 and input 3 and input 4 are for controlling motor 2
The EN1 and EN2 pins should be high for the two motor channels to be active if any of these is low the respective motor ouputs Output 1 and Output2 or Output 3 and Output 4 will not work irrespective of the inputs at INPUT1, INPUT2, INPUT3, INPUT4.
Also the SEN_A and SEN_B pins should be grounded using a resistor of appropriate value as shown. The diodes are used to stop the back emf which is generated when motors rotate. The capacitors are for providing clean input voltage.
VCC(Pin9) is the voltage needed by the IC for its operation and logic. Vs(Pin 4) is the voltage at which you want to operate the motors.
In this design a constant current LED driver is implemented to power the LED for head lamp. This design configuration gives much better performance as compared to merely connecting the LED to power . The Resistance R3 determines the amount of current that will pass through the LED. Thus gives the flexibility to set the intensity as per your need by changing the value of R3. When the value of current tends to increase the drop across the R3 turns on the transistor T1 thus grounding extra current. The transistor T2 is turned off through pin 13 of arduino. When T2 is on the headlamp will be off. When T2 will be off Headlamp will be ON.
Download the Eagle Board files and Gerbers.CustomShieldBoardFiles
It would be great if on Remixing/improving you could could atttribution provide a link in comments for using the same
Step 2: Building the Software
The system works with the help of 2 softwares:
1. Arduino Code. 2. Processing Code.
Before looking at the code lets discuss a few important things.
Xbee modules are used for communication between the robot and the laptop. But xbee are half duplex transceivers i.e they can either send data or receive data at a particular instant of time. So we need to device a way so that the transmission and reception can work seamlessly. The Arduino will be receiving the commands and executing the corresponding actuation. It also needs to monitor and process the sensor values.After every 1 second the arduino will be sending the sensor data to the Laptop where it will be displayed. And all these things should happen simultaneously. We are going to make use of interrupts timers and other functions to make it kind of simultaneous.
To understand the code well we need to understand a few things about the sensors that we are using.
Understanding Sensors and their usage
The arduino has a 10 bit ADC. It first reads the analog input then converts it into meaning ful temperature value.
The ADC on the arduino gets a 5v as reference if you dont change it
First thing we have done here is we have calculated the step size Stepsize= Vref/2^n n=no of bits here we have a 10bit
ADC on arduino. stepsize= 5/1024 =0.0048828 = 4.88mV
from data sheet of LM35 we know for every 1 degree C rise there is increase of 10mv in the output.
temperature= (analogRead(A0)*4.88mV.)/10mv. You will find this in the code.
RPM and TRIP
The rover uses a hall effect sensor and a ring which is connected to the shaft of motor when the motor rotates the ring also rotates. The ring has 8 neodymium magnets. North and south pole placed alternatively. There is a sensor which is placed next to the ring. Look at the picture uploaded here. When the ring rotates the north and south pole alternatively comes in front of the sensor. It makes the output of the sensor go high and low. I monitor this change using interrupt. Every time there is change a Interrupt service routine is called and some tasks are performed to determine if 1 complete rotation has happened or not.. In one rotation there are 8 changes. So when 8 changes occur we get to know i rotation has happened.
Now Circumference of tyre can be found by = 2*3.14*R R is the radius of the wheel. This gives us the distance travelled in 1 rotation. Also S=D/T. The code checks the number of rotations after every one second.
Using this data we calculate the RPM. more will be clear in the code.
GAS SENSING MQ2:
It is suitable for detecting H2, LPG, CH4, CO, Alcohol, Smoke or Propane.The real challenge in dealing with the Gas sensors is the calibration,if you just want to use the gas sensor to know between high concentration of gas and low concentration and then do something based on this ,for this much whatever we have seen so far is sufficient enough. But when you precisely want to know that what ppm of gas is there it is very important to correctly calibrate the sensor. For MQ2 it is recommended to expose the sensor to know value of target gas say 1000ppm and then observe the output and then with this data an algorithm is made to calculate the exact concentration of gas. But the problem is how to create an environment with known value of a gas. This would require a Lab with all the necessary equipments.There are other factors that may also impact the sensor reading like humidity and temperature. Also there is a concept of burn in time which says that the sensor should be made to run for of 18 to 24 hours after which it starts giving reliable readings.
So in this project we will send a trigger to the laptop every time the concentration of smoke goes above a particular value. Based on this value received the processing code will voice alerts.
The code indentation gets messed on pasting it here. :( I wish instructable use something like the processing forums. The code has been commented to aid in understanding
Download the ARDUINO software Here on GitHUB Arduino Codeand upload it to Arduino
About The Processing Code.
The processing code provides an interface where the user can view the data coming from rover and can send commands to the rover. You need to connect an xbee explorer to your laptop. Install the drivers and select the COM port on which it is connected in the processing software before you can use the software. You can go to device manager to know the COM on which the explorer is connected.
The code is attached below. It has been commented to aid the understanding. You need to download processing before you run the code. Go to www.processing.org to download.
you will also need to install minim and controlIP5 processing libraries. Look at the picture above to know how to install it. Also you should have the fonts and audio and image files in the data folder which should be located inside the same folder as your code. Keep visiting the repository for new updates in the code
The code has been commented appropriately to aid in understanding. You can post a comment if you need more explanation
Download the PROCESSING Code Here on GitHUB Processing Code
Step 3: Building Enclosers and Assembling It
Finally you need to enclose the electronics in an encloser and fit it over the rover. Here is where the 3D printing comes into action. To enclose the electronics and battery i have built a simple box. There is also a servo holder that holds the servo. Both of these parts are fixed on the top of rover. Video above describes the parts and how to fix them on the rover .
Download the STL files from 3D PARTS
It would be great if you could share about any improvement that you made to the codes or board files or 3D printed parts. Happy Making