Atmospheric Weather Tracking Bot
This is a simple robot example based on mbed. It uses RoboticsConnection's Traxster robot chassis, an mbed for main control, Serializer 2.0 as a TTL serial H-Bridge Motor Controller, and various sensors.
The Goal for the robot is to use a simple path planning algorithm using the 4 x IR Distance Sensors and a Compass IC to search through open spaces and gather data about Weather/Atmospheric Conditions. These data samples are collected with a GPS Location and Time stamp, and are added to a text file log on the SD card.
Parts List
- mbed Micro-controller
- Traxster Robot Kit
- Serializer 2.0 (or greater)
- BR-355 GPS
- Phidget Light Sensor
- 4 x Phidget IR Distance Sensor
- Phidget Humidity/Temeprature Sensor
- SCP1000 Barometric Pressure Sensor (and Temperature)
- SparkFun Micro-SD Card Breakout Board
- SparkFun PS/2 Breakout Board
- 2GB Micro-SD Card
- DIY Various Aluminum/Acyrlic Mounting Hardware
- 7.2v Rechargeable Battery (1500Ah+)
- LD1085V50 5v DC-DC Voltage Regulator
Not implemented:
- GPS BR-355 is having some issues with TTL level serial output, so some quick testing and hardware logic may be added to correct signal
- Time/Date Stamps in Log File
- Simple Path Planning Algorithm using IR Distance and Compass (not installed, would be added as slave on the currently used SPI bus)
- Google Maps plot of data points
Atmospheric Weather Tracking Bot v0.0.3 - Code
#include "mbed.h" #include "scp1000.h" #include "SDFileSystem.h" #include "TextLCD.h" //Serial Serial pc(USBTX, USBRX); // tx, rx Serial gps(p9, p10); // tx, rx Serial serializerBoard(p28, p27); // tx, rx .. Make sure to enable TTL serial on serializer Board //SPI, I2C SDFileSystem sd(p11, p12, p13, p14, "sd"); TextLCD lcd(p21, p22, p23, p24, p25, p26, TextLCD::LCD16x2); // rs, e, d0-d3 SCP1000 scp1000(p5,p6,p7,p8); //AnalogIn AnalogIn humidty(p15); //Humidty AnalogIn light(p16); //Light AnalogIn irRear(p17); //IR Distance - Rear AnalogIn irRight(p18); //IR Distance - Right AnalogIn irLeft(p19); //IR Distance - Left AnalogIn irFront(p20); //IR Distance - Front int main() { int n = 0; //pc.baud(9600); //gps.baud(4800); //serializerBoard.baud(19200); mkdir("/sd", 0777); //Write new file or append to existing document FILE *fp = fopen("/sd/log.txt", "a"); //Append mode, adds to previous log entries if(fp == NULL) { error("Could not open file for write\n"); } //Document Header Information fprintf(fp,"\n\nAtmosphere Bot!\nv 0.0.3\n"); lcd.printf("Atmosphere Bot!\nv 0.0.3\n"); wait(2); fprintf(fp,"ECE 4180 Lab 3\n> Mike Cato\n\n"); lcd.cls(); lcd.printf("ECE 4180 Lab 3\n> Mike Cato\n"); wait(2); fprintf(fp,"<--- Begin Log --->\n"); //Sample enviromental sensors while(n<21){ //Take 20 samples before closing document lcd.cls(); lcd.printf("Today's Weather\n \n"); wait(2); //Write Data to SD Card fprintf(fp,"\nGPS Coordinate: LONG LATI ALTI\n"); //GPS Dummy Statement fprintf(fp,"Pressure: %f Pa\n", scp1000.read()); fprintf(fp,"Temperature: %f C\n", scp1000.readTemperature()); fprintf(fp,"Humidty: %f %\n", (double)((humidty))); fprintf(fp,"Light: %f lm\n", (double)(light*5*200)); //Write Data to LCD lcd.cls(); lcd.printf("GPS:\nLON LAT ALT \n"); //GPS Dummy Statement wait(2); lcd.cls(); lcd.printf("Pressure:\n%f Pa\n", scp1000.read()); wait(2); lcd.cls(); lcd.printf("Temperature:\n%f C\n", scp1000.readTemperature()); wait(2); lcd.cls(); lcd.printf("Humidty:\n%f %%\n", (double)((humidty))); wait(2); lcd.cls(); lcd.printf("Light:\n%f lm\n", (double)(light*5*200)); wait(2); //Increment Sample Count n++; //Optional Motor Drive Code Examples /* //Send Command serializerBoard.printf("blink 1:25"); //Blinks Serializer LED1 at speed 25 serializerBoard.printf("mogo 1:45 2:45"); //Drives motors 1 and 2 and speed 45 //Recieve ACK/NACK response (to verify command is accepted or declined) while(serializerBoard.readable()) { //If data response from serizler pc.putc(serializerBoard.getc()); //Send Characters to Computer } */ /* GPS Parsing Example http://www.gpsinformation.org/dale/nmea.htm http://www.gpsinformation.org/dale/nmea.htm#GGA GPS NMEA -> GGA format announcement are used for this application. This gives latitude, longitude, altitudem, and other useful information The BR-355 supports and prints out around 5 different NMEA formats So a quick script will be used to parse the input and look for the $GPGGA to appear starting by looking for '$' to appear on serial line Unfortunately this GPS has a strange output so further testing is needed before serial data can be read properly at TTL volttage levels. */ //gps.getc(); //Get Character } fprintf(fp,"\n<--- End Log --->"); //Close File fclose(fp); }
1 comment
You need to log in to post a comment
how is this a contest winner as an incomplete project?