Transmitter

The transmitter module is comprised of three components: a GPS unit, an Arduino Uno, and a radio modem.

The transmission process starts with the GPS unit acquiring a shuttle’s coordinates. The GPS can retrieve coordinates several times a second, but not all of the coordinates are sent to the receiver module. Transmitting too much data will clog the system and make it very inefficient because the radio modems are not as fast with sending and receiving data as the GPS unit is with acquiring coordinates. Therefore, the transmitter module will only send data if it is within one of the predetermined checkpoints. (The checkpoints were where the shuttle typically experienced traffic or delays.)

Every time the GPS acquires a coordinate, the arduino calculates how far away the shuttle is from any of the checkpoints. As soon as the shuttle enters and leaves the radius of a given checkpoint, a packet is sent to the transmitter on campus. (The radius of a checkpoint was set so that regardless of which lane the shuttle is on, it will still be detected.)

The packet tells the receiver which shuttle the data packet is coming from, the checkpoint the shuttle just left, and if the shuttle is heading to the campus or Bart stop.

Distance Calculation
The distance between the shuttle’s current GPS coordinates and a checkpoint’s coordinates is calculated using the Havershine formula:

   a = sin2(dφ)/2) + cos(φ1)cos(φ2)sin2(dλ)/2)
   c = 2*atan2(√a, √(1-a))
   d = 6371 * c

   where φ is latitude, λ is longitude, and 6371km is the Earth’s radius.

The calculated d, gives the straight-line distance between two GPS coordinates in kilometers. This method of calculating the distance works for the shuttle’s routes because it is fairly linear. Correct distance that takes into account the roads and hills is also unnecessary because the transmission system only cares if a shuttle is near a checkpoint.

Thus, the only source of error from the transmission module calculations is the accuracy of the GPS itself which is 10m. The inaccuracy of the GPS can cause some consistency issues. Even when the shuttle is stationary inside a checkpoint radius, a random GPS error can cause the transmitter module to think that the shuttle is outside the radius(even when it is not) and prematurely transmit a packet.

Figures
The flowchart below demonstrates the whole transmission process.

The image below is our checkpoint guide. It shows what packet is sent at any of the checkpoints.

NOTE: In order to not have too many checkpoints along the route, the direction the shuttle is travelling is sometimes used. For example, if a shuttle is generally travelling northbound, then it must be heading to the SFSU campus.

Comments are closed.