Introduction: Track Your Bus and Reserve a Seat for You BOLT IoT TECHNICHE
Here is an intresting project "Bus trackning system" embedded with internet of things .This gives ,the user an opurtunity to track his bus and check seat availabilty.we get the position ofthe bus by gps module (gy gps-6mv.2) in terms of latitude and longitude. This also gives user an opurtunity to locate the bus using google maps. we used proximity sensor and a switch to confirm the passenger sitting in the bus of a particular seat.
Step 1: Setting Up GPS Module
GPS module works by communicating with more than 3 GPS satellites and then it gets the distance from each of them and then it performs some fancy maths and gets the relative location from the GPS satellites.
You can easily set the GPS module with some good libraries like tinygps,etc. after getting just make sure that your Softwareserial.h header file is included .and rx and tx pins of GPS are properly connected.
then you can see the lattitude and longitude on serial monitor.
Step 2: Materials Which Are Used
1. GPS module (gy-gps 6v2)
2. proximity sensor
3. arduino microcontroller
4. BOLT IoT module
5. led
6. some jumper wires
Step 3: Transfering Data From Aurduino to BOLT IoT
You can use the softwareserial library to create virtual Rx and Tx pins .Then connect the Rx pins of arduino to Tx pin of Bolt Iot and vice versa.
Make sure that the serail data is transmitting propely from virtual Rx and TX pins.then with html,javascript BOLT IoT module to transmit value to server. and now any one can acess to the server and get the data.
Step 4: Connecting Arduino to BOLT IOT
You can use the softwareserial library to create virtual Rx and Tx pins .Then connect the Rx pins of arduino to Tx pin of Bolt Iot and vice versa.
Make sure that the serail data is transmitting propely from virtual Rx and TX pins.
Step 5: PROXIMITY SENSOR
We keep proximity sensor in the facing seat so that it can detect if an obstacle is there infront of it or not.Ans, according to that we will be marking our seats in green or red colour.
Step 6: AND FINALLY!!!!CONNECTING THE DATA FROM PROXIMITY SENSOR TO WEB PAGE.
We have created a html page so the it takes the value from proximity sensor. And thus changes the colours of the seats. We will be doing for 1 seat as a prototype as we only have one proximity sensor. And the people also get to know the real time position of the bus in terms of latitude and longitude(which can later be converted into the place name).
And finally , I here by thank you all the people who took the hardship of reading this and giving their valuable comments.
Step 7: And Here Comes the Entire Code.
for the one without style and which loads faster
Check availability of seat 1 LED_stat
GPS_DATA
SEND_DATA
RECV_DATA
INITIAL DATA
AND THE ONE WITH STYLE AND TAKES TIME FOR THE IMAGES TO LOAD SINCE GPS TAKES CONSIDERABLES AMOUNT OF INTERNET WHICH MAKES IT TOO SLOW
And the arduino program which we serial computed with the iot is
#include
SoftwareSerial mySerial(10, 11); // RX, TX
#include
#include
#define TRIGGER_PIN 6 // Arduino pin tied to trigger pin on the ultrasonic sensor.
#define ECHO_PIN 5 // Arduino pin tied to echo pin on the ultrasonic sensor.
#define MAX_DISTANCE 200 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.
int pin2=2;
int pin9=9;
NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance.
/* This sample code demonstrates the normal use of a TinyGPS object.
It requires the use of SoftwareSerial, and aSerialumes that you have a
4800-baud serial GPS device hooked up on pins 4(rx) and 3(tx).
*/
TinyGPS gps;
;
void setup()
{
Serial.begin(9600
);
Serial.begin(9600);
Serial.begin(9600); //Serial monitor
mySerial.begin(9600); //Bolt Rx-Tx
pinMode(13, OUTPUT);
pinMode(pin2,OUTPUT);
pinMode(pin9,INPUT); //Serial.begin(115200); // Open serial monitor at 115200 baud to see ping results.
}
char x;
String cmd;
void loop()
{
Serial.println(sonar.ping_cm());
if(((int)sonar.ping_cm())< 15 && ((int)sonar.ping_cm()) > 0 )
{
{ digitalWrite(pin2,HIGH);
}
}
else
{
digitalWrite(pin2,LOW);
}
if (mySerial.available() > 0)
{
cmd = "";
while (mySerial.available() > 0)
{
x = mySerial.read();
Serial.println(x);
cmd += String(x);
}
float flat, flon;
unsigned long age;
gps.f_get_position(&flat, &flon, &age);
mySerial.print((String)flat +" " +(String)flon);
cmd.trim();
cmd.toLowerCase();
}
bool newData = false;
unsigned long chars;
unsigned short sentences, failed;
//For one second we parse GPS data and report some key values
for (unsigned long start = millis(); millis() - start < 1000;)
{
while (Serial.available())
{
char c = Serial.read();
// Serial.write(c); // uncomment this line if you want to see the GPS data flowing
if (gps.encode(c)) // Did a new valid sentence come in?
newData = true;
}
}
if (newData)
{
float flat, flon;
unsigned long age;
gps.f_get_position(&flat, &flon, &age);
Serial.print("LAT=");
Serial.print(flat == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flat, 6);
Serial.print(" LON=");
Serial.print(flon == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flon, 6);
Serial.print(" SAT=");
Serial.print(gps.satellites() == TinyGPS::GPS_INVALID_SATELLITES ? 0 : gps.satellites());
Serial.print(" PREC=");
Serial.print(gps.hdop() == TinyGPS::GPS_INVALID_HDOP ? 0 : gps.hdop());
}
gps.stats(&chars, &sentences, &failed);
Serial.print(" CHARS=");
Serial.print(chars);
Serial.print(" SENTENCES=");
Serial.print(sentences);
Serial.print(" CSUM ERR=");
Serial.println(failed);
if (chars == 0)
Serial.println("** No characters received from GPS: check wiring **");
}
By,
facchas of IIT GUWAHATI , prudhvi, vamsi krishna, vikas , mouli