Difference between revisions of "F15: Autonomous Mobile"
Proj user19 (talk | contribs) (→Hardware Interface) |
(→Grading Criteria) |
||
(86 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
+ | [[File:cmpe146_F15_autoMobile_DemoDay.gif|center]] | ||
== Abstract == | == Abstract == | ||
− | Tesla Motors just announced their own developed technology on | + | Autonomous technology in recent years has been growing in popularity and complexity. Automation softwares are written throughout innovative companies to increase productivity and save time. The goal of autonomous technology is to make life easier for humans. Recently, Tesla Motors just announced their own developed technology on October 14, 2015 - Autopilot on all of their currently supporting vehicle Model S. Using some of the top-of-the-line industrial sensor - a forward radar, a forward-looking camera, 12 long-range ultrasonic sensors, and a high-precision digitally-controlled electric assist braking system, an automated driving capabilities luxury car is being delivered. All of those feedback modules were being involved differently in the autopilot system. With a similar concept on the self-driving capability model RC car, our team is going to deliver similar technology with the knowledge on different peripheral drivers. |
== Objectives & Introduction == | == Objectives & Introduction == | ||
− | + | The goal of this project is to deliver a self-driving vehicle with GPS/compass module and Bluetooth communication. Obstacle avoidance will only be added if time is permitted. The following are the tasks we aim to deliver: Motor and Servo, GPS, Compass, and Bluetooth. | |
+ | |||
+ | '''Component's Purpose Overview''' | ||
+ | <br> | ||
+ | '''Compass:''' The compass will allow us to calculate the heading. The heading will tell us "which way the car is pointing?" relative to magnetic north. | ||
+ | <br> | ||
+ | '''GPS:''' The GPS will allow us to calculate the bearing and the distance. The GPS will allow us to know "where is the current location of the car?". The distance is used to tell "how far away are we from our destination?". | ||
+ | <br> | ||
+ | '''Bluetooth:''' The Bluetooth will allow us to efficiently send over our desired destination's coordinates to the car. | ||
+ | <br> | ||
+ | '''Motor & Servo:''' The motor and servo comes with the RC car. Both components are controlled with PWM duty cycle. We try to mimic the stock RC car's PWM signal in order for the car to drive forward, turn left, or turn right. | ||
+ | |||
+ | '''Definitions''' | ||
+ | <br> | ||
+ | '''heading:''' The compass module is placed in front of the car, away from other electronic components to reduce magnetic field interference. This is where the head of car is pointing to relative to magnetic north. | ||
+ | <br> | ||
+ | '''bearing:''' The direction from your location to the destination in degrees relative to magnetic north. The car should steer toward the bearing to arrive at its destination. | ||
+ | <br> | ||
=== Team Members & Responsibilities === | === Team Members & Responsibilities === | ||
* Kenneth Chiu | * Kenneth Chiu | ||
** B.S. Computer Engineering | ** B.S. Computer Engineering | ||
+ | ** Graduating in Fall 2016 | ||
+ | ** '''Responsibilities''' | ||
+ | *** Motor/Servo | ||
+ | *** Bluetooth | ||
* Yuyu Chen | * Yuyu Chen | ||
** B.S. Computer Engineering | ** B.S. Computer Engineering | ||
+ | ** Graduating in Fall 2016 | ||
+ | **'''Responsibilities''' | ||
+ | *** GPS | ||
+ | *** Compass | ||
+ | *** System integration | ||
+ | *** Testing | ||
== Schedule == | == Schedule == | ||
Line 33: | Line 61: | ||
| 10/23/2015 | | 10/23/2015 | ||
| 10/29/2015 | | 10/29/2015 | ||
− | | Start | + | | Start Bluetooth, connect motor controller, test motor & servo |
| Completed | | Completed | ||
| 10/28/2015 | | 10/28/2015 | ||
Line 94: | Line 122: | ||
! align="center"|Manufacturer | ! align="center"|Manufacturer | ||
! align="center"|Part Number | ! align="center"|Part Number | ||
− | ! align="center"| | + | ! align="center"|Cost |
! align="center"|Links | ! align="center"|Links | ||
|- | |- | ||
Line 135: | Line 163: | ||
== Design & Implementation == | == Design & Implementation == | ||
− | [[File:cmpe146_F15_autoMobile_carOverview.jpg|500px| | + | [[File:cmpe146_F15_autoMobile_FieldTest.gif|left]] |
+ | [[File:cmpe146_F15_autoMobile_carOverview.jpg|500px|center|thumb|car overview]] | ||
---- | ---- | ||
=== Hardware Design === | === Hardware Design === | ||
− | With the | + | With the concept of building a self-driving vehicle in place, this schematic shows how we were able to do it. With the thinking of a well-equipped self-driving car, GPS and compass module is a must to give the car itself its coordinate and steer toward its destination. Also, motor and servo are very important for the car to run freely to any direction. Additionally, a Bluetooth module can help the user transfer their desired location coordinate. Basically, with all these components together, a prototype of a self-driving vehicle is created. |
<br> | <br> | ||
+ | |||
+ | [[File:cmpe146_F15_autoMobile_carcircuit.jpg|700px|left|thumb|car circuit]] | ||
[[File:cmpe146_F15_autoMobile_boardSchematic.jpg|800px|centre|thumb|Overall hardware component schematic]] | [[File:cmpe146_F15_autoMobile_boardSchematic.jpg|800px|centre|thumb|Overall hardware component schematic]] | ||
Line 147: | Line 178: | ||
=== Hardware Components === | === Hardware Components === | ||
+ | '''Power Circuit''' | ||
+ | <br> | ||
+ | An external power circuit is needed to power on the board without an USB cable. The input voltage to the SJone board needs to be below 5.5V and 100mA, according to the electrical characteristic of LPC1758. A 5V voltage regulator is used to guarantee the voltage is less than that threshold. A current limiting resistor is also placed to drop the current below the 100mA theshold. | ||
+ | [[File:Cmpe146_F15_AutoMobile_powercircuit.jpg|600px|power circuit]] | ||
+ | |||
'''Traxxas 36054-1 Stampede: Monster Truck''' | '''Traxxas 36054-1 Stampede: Monster Truck''' | ||
<br> | <br> | ||
− | We choose this monster truck because of multiple reasons. Traxxas is a well-known brand name for a typical RC car. Their cars are very fast, durable, and high quality. Although the price might be a bit pricey, we don't have to worry about replacing broken parts or worn parts. This prototype was designed to be suitable for any kind of road conditions. You don't want to change another | + | We choose this monster truck because of multiple reasons. Traxxas is a well-known brand name for a typical RC car. Their cars are very fast, durable, and high quality. Although the price might be a bit pricey, we don't have to worry about replacing broken parts or worn parts. This prototype was designed to be suitable for any kind of road conditions. You don't want to change another vehicle if you are by the beach or hills. Monster trucks are designed to be driven offroad and capable of driving in any conditions. The car might be a bit slow onroad but the speed is not our main concern at this moment. Most importantly, this car has 1 electronic motor, 1 ESC and 1 Servo. The reason for us to choose this model is because we get to control the motor and servo separately so that a minor degree of turn can be made. The motor is to control the rear-wheel accelerate and decelerate. The servo is to provide us a control of the front wheel so the car can follow the optimal route. |
<br> | <br> | ||
[[File:Cmpe146_F15_AutoMobile_carStructure.png|512px|carStructure]] | [[File:Cmpe146_F15_AutoMobile_carStructure.png|512px|carStructure]] | ||
Line 159: | Line 195: | ||
'''BTBee Pro Bluetooth XBee''' | '''BTBee Pro Bluetooth XBee''' | ||
<br> | <br> | ||
− | We have tried couple bluetooth | + | We have tried a couple of bluetooth modules on the market and this one is by far the best that we can get. This BTBee Pro is a serial port Bluetooth module which is compatible with the shields with XBee sockets. SJone board come with a xBee shield and this is a best experience that we can have. It is designed for Bluetooth wireless transfer. It can support Slave and Master mode although we are using it as Slave mode only. When it is plugged into xBee socket, it uses UART for transparent transmission. With the build-in AT command, we can change some default settings like the module address, module name, module mode, and baud rate. |
<br> | <br> | ||
[[File:Cmpe146_F15_AutoMobile_BTBeePro.jpeg|240px|BTBeePro]] | [[File:Cmpe146_F15_AutoMobile_BTBeePro.jpeg|240px|BTBeePro]] | ||
Line 168: | Line 204: | ||
<br> | <br> | ||
The MTK3339 Ultimate GPS module from Adafruit was chosen because it provides us with more than enough functionalities. All we needed from the GPS module was the longitude and latitude from raw NMEA sentence. | The MTK3339 Ultimate GPS module from Adafruit was chosen because it provides us with more than enough functionalities. All we needed from the GPS module was the longitude and latitude from raw NMEA sentence. | ||
− | It provides an accuracy of 5-10 meters (or worse if indoors) with its 22 satellites transmitting data to the GPS module. An external antenna can be attached to improve accuracy. The GPS module can be interfaced to a | + | It provides an accuracy of 5-10 meters (or worse if indoors) with its 22 satellites transmitting data to the GPS module. An external antenna can be attached to improve accuracy. The GPS module can be interfaced to a microcontroller through UART interface with a default baud rate of 9600bps. It can be powered on with 3.3V-5VDC, which can be provided from the SJOne board. It provides an LED indicator that blinks at about 1Hz while searching for satellites and blinks once every 15 seconds when a fix is found to conserve power. The GPS module will allow us to calculate the bearing and destination from its current GPS coordinate and the destination coordinate. |
<br> | <br> | ||
[[File:Cmpe146_F15_AutoMobile_MTK3339GPS.jpg|120px|MTK3339 GPS Module]] | [[File:Cmpe146_F15_AutoMobile_MTK3339GPS.jpg|120px|MTK3339 GPS Module]] | ||
Line 176: | Line 212: | ||
'''HMC5883L Triple Axis Compass Magnetometer''' | '''HMC5883L Triple Axis Compass Magnetometer''' | ||
<br> | <br> | ||
− | The HMC5883L Triple-axis Magnetometer module from Adafruit was chosen because it | + | The HMC5883L Triple-axis Magnetometer module from Adafruit was chosen because it can provide us with heading relative to magnetic north. |
− | Most importantly, it allows us to steer toward our destination. The magnetometer has 6 data registers that can be read from which contains the 8 bit MSB or LSB x,y,z coordinates. Although the z-axis is provided, it is not used but can be useful in future projects. The magnetometer sensor uses I2C interface to communicate with a microcontroller. It can be powered on with either 3V-5VDC. There is also a Ready pin that can be used to | + | Most importantly, it allows us to steer toward our destination. The magnetometer has 6 data registers that can be read from which contains the 8 bit MSB or LSB x,y,z coordinates. Although the z-axis is provided, it is not used but can be useful in future projects. The magnetometer sensor uses I2C interface to communicate with a microcontroller. It can be powered on with either 3V-5VDC. There is also a Ready pin that can be used to indicate that the data register needs to be read to provide new data. |
<br> | <br> | ||
+ | [[File:cmpe146_F15_autoMobile_compassOverview.jpg|500px|compass overview]] | ||
[[File:Cmpe146_F15_AutoMobile_HMC5883LCompass.jpg|120px|HMC5883L Compass Module]] | [[File:Cmpe146_F15_AutoMobile_HMC5883LCompass.jpg|120px|HMC5883L Compass Module]] | ||
<br> | <br> | ||
Line 185: | Line 222: | ||
=== Hardware Interface === | === Hardware Interface === | ||
− | |||
− | |||
'''Traxxas 36054-1 Stampede: Monster Truck''' | '''Traxxas 36054-1 Stampede: Monster Truck''' | ||
Line 196: | Line 231: | ||
<br> | <br> | ||
<br> | <br> | ||
− | When the signal is high, we call this “on time”. To describe the amount of “on time” , we use the concept of duty cycle. Duty cycle is measured in percentage. The percentage duty cycle specifically describes the percentage of time a digital signal is on over an interval or period of time. This period is the inverse of the frequency of the waveform. Frequency/period are specific to controlling a specific servo. A typical servo motor | + | When the signal is high, we call this “on time”. To describe the amount of “on time” , we use the concept of duty cycle. Duty cycle is measured in percentage. The percentage duty cycle specifically describes the percentage of time a digital signal is on over an interval or period of time. This period is the inverse of the frequency of the waveform. Frequency/period are specific to controlling a specific servo. A typical servo motor is expected to be updated every 10 ms with a pulse between 1 ms and 2 ms, or in other words, between a 5 and 10% duty cycle on a 100 Hz waveform. |
<br> | <br> | ||
[[File:cmpe146_F15_autoMobile_motorServo.gif|center]] | [[File:cmpe146_F15_autoMobile_motorServo.gif|center]] | ||
Line 230: | Line 265: | ||
'''BTBee Pro Bluetooth XBee''' | '''BTBee Pro Bluetooth XBee''' | ||
<br> | <br> | ||
+ | We are using UART(Universal Asynchronous Receiver Transmitter), a simple way but very efficient, to transfer data between the Bluetooth and SJone board. As long as we set the built-in baud rate and the baud rate of our Bluetooth device, the connection between them are set. There is one wire for transmitting data (TX), and one wire to receive data (RX). We set the Bluetooth transmitter baud rate to be 115200bps during initialization, then the receiver must be listening on the other end at the same speed. | ||
With the help of the XBee shield, BTBee Pro is fully insert onto the SJ one board with no external pins connected. The following is the pins config of the XBee Bluetooth shield. | With the help of the XBee shield, BTBee Pro is fully insert onto the SJ one board with no external pins connected. The following is the pins config of the XBee Bluetooth shield. | ||
− | [[File:Cmpe146_F15_AutoMobile_BTBeePin|300px|BTBeePin]] | + | [[File:Cmpe146_F15_AutoMobile_BTBeePin.png|300px|BTBeePin]] |
{| class="wikitable" | {| class="wikitable" | ||
Line 277: | Line 313: | ||
'''MTK3339 Ultimate GPS''' | '''MTK3339 Ultimate GPS''' | ||
<br> | <br> | ||
− | The GPS module is powered on by a minimum of 3.3V and is interfaced over UART to send and receive data. The 3.3V output from the SJOne board is used to power the board and the ground pin is connected to the GND pin of the GPS. Since it is using UART interface, the TX pin from the GPS is connected to RX of the SJOne board and the RX pin of the GPS is connected to TX pin of SJOne board. Once properly connected, the baud rate is set to | + | The GPS module is powered on by a minimum of 3.3V and is interfaced over UART to send and receive data. The 3.3V output from the SJOne board is used to power the board and the ground pin is connected to the GND pin of the GPS. Since it is using UART interface, the TX pin from the GPS is connected to RX of the SJOne board and the RX pin of the GPS is connected to TX pin of SJOne board. Once properly connected, the baud rate is set to 9600bps for it to properly communicate with the SJone board. The GPS will begin outputting raw NMEA sentences by using the gets() function. The raw NMEA sentence is then filtered out by sending a packet during initialization to filter out different formats of of the raw sentences and output only $GPRMC (Recommended minimum specific GPS/Transit data). Only the latitude and longitude from the parsed NMEA sentence was needed, therefore another parser was developed to grab only the latitude and longitude data by the tokenize() function. Using the longitude and latitude, the bearing and distance can be calculated. |
<br> | <br> | ||
Example: $GPRMC,225446,A,4916.45,N,12311.12,W,000.5,054.7,191194,020.3,E*68 | Example: $GPRMC,225446,A,4916.45,N,12311.12,W,000.5,054.7,191194,020.3,E*68 | ||
Line 377: | Line 413: | ||
=== Software Design === | === Software Design === | ||
− | + | There are a total of 5 tasks created and constantly sending data over a queue to each other. FreeRTOS was used to provide scheduling and queue capability to run in a real-time fashion. Each flow chart below are individual tasks computing, decoding, or sending data. | |
+ | <br> | ||
+ | '''Motor''' | ||
+ | <br> | ||
+ | [[File:Cmpe146_F15_AutoMobile_motorFlowChart.png|500px|motor flow chart]] | ||
− | + | '''Servo''' | |
− | ''' | + | <br> |
− | + | [[File:Cmpe146_F15_AutoMobile_steerFlowChart.png|600px|steer flow chart]] | |
'''Bluetooth''' | '''Bluetooth''' | ||
− | + | <br> | |
+ | [[File:Cmpe146_F15_AutoMobile_BTFlowChart.png|500px|BT flow chart]] | ||
'''GPS''' | '''GPS''' | ||
− | |||
<br> | <br> | ||
[[File:Cmpe146_F15_AutoMobile_gpsFlowChart.jpg|500px|gps flow chart]] | [[File:Cmpe146_F15_AutoMobile_gpsFlowChart.jpg|500px|gps flow chart]] | ||
'''Compass''' | '''Compass''' | ||
− | |||
<br> | <br> | ||
[[File:Cmpe146_F15_AutoMobile_compassFlowChart.jpg|500px|compass flow chart]] | [[File:Cmpe146_F15_AutoMobile_compassFlowChart.jpg|500px|compass flow chart]] | ||
'''Geographical Unit''' | '''Geographical Unit''' | ||
− | |||
<br> | <br> | ||
[[File:Cmpe146_F15_AutoMobile_geoFlowChart.jpg|500px|geoTask flow chart]] | [[File:Cmpe146_F15_AutoMobile_geoFlowChart.jpg|500px|geoTask flow chart]] | ||
Line 404: | Line 442: | ||
=== Implementation === | === Implementation === | ||
− | |||
[[File:Cmpe146_F15_AutoMobile_taskOverview.jpg|500px|high level task overview]] | [[File:Cmpe146_F15_AutoMobile_taskOverview.jpg|500px|high level task overview]] | ||
'''motorTask''' | '''motorTask''' | ||
+ | <br> | ||
+ | The motorTask will receive the steering enumeration and moveForward enumeration to control the autonomous movement. There are 5 different kinds of steering and 2 kinds of movement as listed in geoTask. | ||
+ | <br> | ||
<br> | <br> | ||
'''Bluetooth''' | '''Bluetooth''' | ||
<br> | <br> | ||
+ | Due to limited amount of time, the idea of creating our own Android app was eliminated. However, an alternative was thought up by downloading an existing Bluetooth terminal app from the Google Play Store. The Bluetooth terminal will allow us to send messages (latitude and longitude) to our Bluetooth receiver to complete the objective. | ||
+ | |||
The Bluetooth receiver software was written so that it can receive the longitude and latitude from a device with Bluetooth capability. The Bluetooth receiver was written in terminalTask due to its easy implementation. A handler and a command line prompt was added to the terminalTask and using extern to pass the received coordinates to the gpsTask. | The Bluetooth receiver software was written so that it can receive the longitude and latitude from a device with Bluetooth capability. The Bluetooth receiver was written in terminalTask due to its easy implementation. A handler and a command line prompt was added to the terminalTask and using extern to pass the received coordinates to the gpsTask. | ||
+ | Format for the command line prompt: | ||
+ | Bluetooth lat long | ||
+ | |||
extern float lati; | extern float lati; | ||
extern float longi; | extern float longi; | ||
Line 422: | Line 467: | ||
<br> | <br> | ||
The GPSTask will parse the raw NMEA sentence for $GPRMC and get the current location of the car. The bearing and distance is then calculated from its current location and destination. The bearing and distance is then sent over a queue to the GeoTask for further processing. The calculated bearing is in degrees and the calculated distance is in meters. | The GPSTask will parse the raw NMEA sentence for $GPRMC and get the current location of the car. The bearing and distance is then calculated from its current location and destination. The bearing and distance is then sent over a queue to the GeoTask for further processing. The calculated bearing is in degrees and the calculated distance is in meters. | ||
+ | <br> | ||
+ | <br> | ||
'''CompassTask''' | '''CompassTask''' | ||
<br> | <br> | ||
− | The compassTask will compute the heading and convert it from radians to degrees. It will check the status register if there is new data available. All 6 registers must be read in order to get new data. The computed heading is then sent over a queue to the GeoTask for further processing. | + | The compassTask will compute the heading and convert it from radians to degrees. It will check the status register if there is new data available. All 6 registers must be read in order to get new data. The computed heading is then sent over a queue to the GeoTask for further processing. |
+ | <br> | ||
+ | <br> | ||
'''GeoTask''' | '''GeoTask''' | ||
<br> | <br> | ||
The geoTask computes which direction the car will steer in order to get to its destination. There are 5 different kind of steering mode: slight right, max right, slight left, max left, and forward. Depending on the distance to the destination, the car will move forward until it arrives at its destination with a error margin of 5 meters, as provided by the GPS module hardware description. The steering and motor enumeration is then sent over a queue to the motorTask to control the autonomous movement. | The geoTask computes which direction the car will steer in order to get to its destination. There are 5 different kind of steering mode: slight right, max right, slight left, max left, and forward. Depending on the distance to the destination, the car will move forward until it arrives at its destination with a error margin of 5 meters, as provided by the GPS module hardware description. The steering and motor enumeration is then sent over a queue to the motorTask to control the autonomous movement. | ||
− | == Testing | + | == Testings == |
− | + | ||
− | + | === Motor & Servo Testing === | |
+ | The motor and servo of the car were initially tested by using the 4 on-board switches to test: forward movement, backward movement, turn left, and turn right. | ||
+ | When the car was integrated with the geographical unit, spinning it on a turn-able chair verified that the compass and GPS module were able to control the steering of the car. | ||
+ | |||
+ | With the destination set, walking toward the destination will verify if the motor actually stops moving, otherwise the microcontroller will send PWM signal set to drive the car forward. | ||
+ | |||
+ | === GPS Testing === | ||
+ | Testing the GPS module was simple. It is easy to verify how accurate the GPS module by checking the GPS module's coordinates by inputting it into Google Maps. The accuracy of the GPS drops during indoor and sometimes never could find a proper fixed location. The GPS module also had a difficult time getting its location on a rainy day. The on-board LED 4 was used to indicate whether the GPS got a proper fixed location or not. The LED will light up when a fixed location is found, otherwise the LED will toggle. | ||
− | + | === Compass Testing === | |
+ | To verify the correct heading relative to magnetic north, it is possible to check it a smartphone with a compass app. This is how it is possible to check how many degrees the heading was off. The on-board LED 1 is used to indicate whether the compass module is passing the heading information to geoTask. The LED will light up if at least 1 data register is not read, which will pass incorrect data. Rigorous testing was done on the compass module due to its sensitivity. The compass was calibrated multiple times to pass sanity test. We have found that it is impossible to test the compass module in the engineering building at SJSU due to its heavy magnetic field affecting our compass reading. The source of the heavy magnetic field was most likely due to soft-iron distortion, as hard-iron calibration was already applied. The car was taken outside of the engineering building and the readings returned to normal when compared to the compass app. | ||
− | === | + | === Bluetooth Testing === |
+ | Having print statements in Hercules allowed us to check if the destination coordinates are being updated through bluetooth. TerminalTask would also provide a "Command fail" if inputting an incorrect prompt. To test if the SJone board received the correct coordinates from the Bluetooth Terminal app, LED 3 was used. LED 3 will light up if the proper coordinate is sent to the SJone board, otherwise LED 3 will toggle. The LED indicator for Bluetooth was extremely helpful for testing without plugging the SJone board to laptop to check. | ||
− | '' | + | === Car Testing === |
+ | The whole car was tested in an open area where there were not many objects to obstruct its free driving. Testing it in a confined space does not allow the car to turn because it will hit objects in its way. The car's path to its destination is unpredictable because we did not implement waypoints. All testing of the car were placing the car's nose away from the destination. This approach to testing allowed us to verify if the car was able to turn around and drive towards its destination. | ||
− | + | == Technical Challenges == | |
− | + | === Calibration of 3-axis magnetometer === | |
− | + | '''Issue:''' Need to calibrate compass because center is not at origin. Huge error of 20-30 degrees. Hard iron cause shift in x,y axis. Soft iron distort shape of circle into an ellipse. Need to keep compass on a flat surface because a tilt will affect x,y values | |
− | + | '''Resolution:'''Calibration was applied by subtracting the hard-iron offsets. Heading error reduced to range of 0-10 degrees. Ignoring soft-iron distortion because value is not constant and changes with location. | |
− | ''' | ||
− | '''Resolution:''' | + | === Compass placement === |
+ | '''Issue:''' Compass placement: The compass was first placed in front of the car, away from the motor. Thinking that it might not be affected by its magnetic field. | ||
+ | |||
+ | '''Resolution:''' The servo (front of the car) also affected the compass. The placement of the compass was placed at least 1 feet away from any other component. During test drives, the car drove smoothly. It was also best to place the compass at the front of the car because the front 2 wheels are used for turning. The compass will compute the heading relative to its position of the turn faster than placing the compass module at the back or middle of the vehicle. | ||
+ | |||
+ | === Nothing to stop it from crashing === | ||
+ | '''Issue:''' During test drives, the car will crash into objects or walls in confined space. | ||
+ | |||
+ | '''Resolution:''' The car will reach its destination without help only if it is test driven in an open space with minimal object to obstruct its driving. Object avoidance would have been a nice addition if time permitted. This would allow us to test the car in more confined areas and not limit us to just open areas. | ||
== Conclusion == | == Conclusion == | ||
− | + | Overall, the project was a success as we built a fully functional autonomous car with Bluetooth communication with just a group of 2 in 8 weeks. Many hours were spent trying to debug and test each individual modules with limited amount of time each week. From this project we were able to become more familiar with the FreeRTOS and many different driver interfaces such as: I2C and UART. The labs before the project helped us lessen the learning curve. | |
+ | Future advice to ourselves, students, or anyone in particular is to include object avoidance to their autonomous car so that it is able to roam around in confined areas. Our decision to not include object avoidance increased our frustration during testing as it crash into objects. Future improvements on this car would also include building an Android app that is able to send coordinates as well as having a "Go" or "Stop" button, and send important data to be displayed on the smartphone screen. | ||
=== Project Video === | === Project Video === | ||
Line 468: | Line 535: | ||
<br> | <br> | ||
Self Driving Field Test 2: https://www.youtube.com/watch?v=9BRb-uHcNx4 | Self Driving Field Test 2: https://www.youtube.com/watch?v=9BRb-uHcNx4 | ||
+ | <br> | ||
+ | <br> | ||
+ | Autonomous Mobile Demo Day: https://youtu.be/wpslLxH_PH4 | ||
=== Project Source Code === | === Project Source Code === | ||
Line 474: | Line 544: | ||
== References == | == References == | ||
=== Acknowledgement === | === Acknowledgement === | ||
+ | We would like to thank Dr. Ozemek and Preet Kang for the knowledge they provided us to not only succeed in CMPE146, but for the future also. | ||
− | + | === References=== | |
− | |||
Compass sensor: https://learn.adafruit.com/downloads/pdf/adafruit-hmc5883l-breakout-triple-axis-magnetometer-compass-sensor.pdf | Compass sensor: https://learn.adafruit.com/downloads/pdf/adafruit-hmc5883l-breakout-triple-axis-magnetometer-compass-sensor.pdf | ||
Motor and Servo: http://www.socialledge.com/sjsu/index.php?title=SJ_One_Board#Motor_.26_Servo_Control | Motor and Servo: http://www.socialledge.com/sjsu/index.php?title=SJ_One_Board#Motor_.26_Servo_Control | ||
− | |||
− | |||
[1] http://www.socialledge.com/sjsu/images/d/de/2012SJOneBoardSchematic.pdf | [1] http://www.socialledge.com/sjsu/images/d/de/2012SJOneBoardSchematic.pdf | ||
Line 493: | Line 561: | ||
[5] ftp://imall.iteadstudio.com/Modules/IM121115002_BTBeepro/DS_IM121115002_BTBeepro.pdf | [5] ftp://imall.iteadstudio.com/Modules/IM121115002_BTBeepro/DS_IM121115002_BTBeepro.pdf | ||
− | + | [6] https://learn.sparkfun.com/tutorials/pulse-width-modulation | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Latest revision as of 18:09, 19 December 2015
Contents
Abstract
Autonomous technology in recent years has been growing in popularity and complexity. Automation softwares are written throughout innovative companies to increase productivity and save time. The goal of autonomous technology is to make life easier for humans. Recently, Tesla Motors just announced their own developed technology on October 14, 2015 - Autopilot on all of their currently supporting vehicle Model S. Using some of the top-of-the-line industrial sensor - a forward radar, a forward-looking camera, 12 long-range ultrasonic sensors, and a high-precision digitally-controlled electric assist braking system, an automated driving capabilities luxury car is being delivered. All of those feedback modules were being involved differently in the autopilot system. With a similar concept on the self-driving capability model RC car, our team is going to deliver similar technology with the knowledge on different peripheral drivers.
Objectives & Introduction
The goal of this project is to deliver a self-driving vehicle with GPS/compass module and Bluetooth communication. Obstacle avoidance will only be added if time is permitted. The following are the tasks we aim to deliver: Motor and Servo, GPS, Compass, and Bluetooth.
Component's Purpose Overview
Compass: The compass will allow us to calculate the heading. The heading will tell us "which way the car is pointing?" relative to magnetic north.
GPS: The GPS will allow us to calculate the bearing and the distance. The GPS will allow us to know "where is the current location of the car?". The distance is used to tell "how far away are we from our destination?".
Bluetooth: The Bluetooth will allow us to efficiently send over our desired destination's coordinates to the car.
Motor & Servo: The motor and servo comes with the RC car. Both components are controlled with PWM duty cycle. We try to mimic the stock RC car's PWM signal in order for the car to drive forward, turn left, or turn right.
Definitions
heading: The compass module is placed in front of the car, away from other electronic components to reduce magnetic field interference. This is where the head of car is pointing to relative to magnetic north.
bearing: The direction from your location to the destination in degrees relative to magnetic north. The car should steer toward the bearing to arrive at its destination.
Team Members & Responsibilities
- Kenneth Chiu
- B.S. Computer Engineering
- Graduating in Fall 2016
- Responsibilities
- Motor/Servo
- Bluetooth
- Yuyu Chen
- B.S. Computer Engineering
- Graduating in Fall 2016
- Responsibilities
- GPS
- Compass
- System integration
- Testing
Schedule
The point of the schedule is for readers to assess how to pace themselves if they are doing a similar project.
Week# | Start Date | End Date | Task | Status | Completion Date |
---|---|---|---|---|---|
1 | 10/16/2015 | 10/22/2015 | Idea confirm, order project parts | Completed | 10/22/2015 |
2 | 10/23/2015 | 10/29/2015 | Start Bluetooth, connect motor controller, test motor & servo | Completed | 10/28/2015 |
3 | 10/30/2015 | 11/05/2015 | Get Compass, GPS, and Bluetooth modules working (implement drivers to output raw data) | Completed | 11/05/2015 |
4 | 11/06/2015 | 11/12/2015 | Calibrate Compass and Parse GPS data (get useful data) | Completed | 11/20/2015 |
5 | 11/13/2015 | 11/19/2015 | Integrate Compass and GPS together (heading, bearing, distance) | Completed | 11/29/2015 |
6 | 11/20/2015 | 11/26/2015 | Continue working on Integration of Compass and GPS algorithm | Completed | 11/29/2015 |
7 | 11/27/2015 | 12/03/2015 | Integrate motor with Geographical unit | Completed | 11/29/2015 |
8 | 12/04/2015 | 12/10/2015 | Test Autonomous car, work on Bluetooth integration | Completed | 12/16/2015 |
9 | 12/11/2015 | 12/17/2015 | Test Autonomous car | Completed | 12/16/2015 |
Parts List & Cost
Qty | Description | Manufacturer | Part Number | Cost | Links |
---|---|---|---|---|---|
1 | SJ One Board [1] | Preet | SJ-one | $80 | http://www.socialledge.com/sjsu/index.php?title=SJ_One_Board |
1 | Traxxas Stampede: Monster Truck [2] | Traxxas | 36054-1 | $199.95 | http://www.amazon.com/Traxxas-36054-1-Stampede-Monster-Ready-To-Race/dp/B00OK3AJWW/ref=zg_bs_166587011_6 |
1 | GPS Bee kit (with Mini Embedded Antenna) [3] | Adafruit | MTK3339 | $39.95 | http://www.adafruit.com/products/746 |
1 | Triple Axis Compass Magnetometer Sensor Module [4] | Adafruit | HMC5883L | $9.95 | http://www.adafruit.com/products/1746 |
1 | BTBee Pro Bluetooth XBee Wireless Module [5] | ITEAD Studio | BR010292 | $14.99 | https://www.bananarobotics.com/shop/BTBee-Pro-Bluetooth-XBee-Wireless-Module |
Design & Implementation
Hardware Design
With the concept of building a self-driving vehicle in place, this schematic shows how we were able to do it. With the thinking of a well-equipped self-driving car, GPS and compass module is a must to give the car itself its coordinate and steer toward its destination. Also, motor and servo are very important for the car to run freely to any direction. Additionally, a Bluetooth module can help the user transfer their desired location coordinate. Basically, with all these components together, a prototype of a self-driving vehicle is created.
Hardware Components
Power Circuit
An external power circuit is needed to power on the board without an USB cable. The input voltage to the SJone board needs to be below 5.5V and 100mA, according to the electrical characteristic of LPC1758. A 5V voltage regulator is used to guarantee the voltage is less than that threshold. A current limiting resistor is also placed to drop the current below the 100mA theshold.
Traxxas 36054-1 Stampede: Monster Truck
We choose this monster truck because of multiple reasons. Traxxas is a well-known brand name for a typical RC car. Their cars are very fast, durable, and high quality. Although the price might be a bit pricey, we don't have to worry about replacing broken parts or worn parts. This prototype was designed to be suitable for any kind of road conditions. You don't want to change another vehicle if you are by the beach or hills. Monster trucks are designed to be driven offroad and capable of driving in any conditions. The car might be a bit slow onroad but the speed is not our main concern at this moment. Most importantly, this car has 1 electronic motor, 1 ESC and 1 Servo. The reason for us to choose this model is because we get to control the motor and servo separately so that a minor degree of turn can be made. The motor is to control the rear-wheel accelerate and decelerate. The servo is to provide us a control of the front wheel so the car can follow the optimal route.
BTBee Pro Bluetooth XBee
We have tried a couple of bluetooth modules on the market and this one is by far the best that we can get. This BTBee Pro is a serial port Bluetooth module which is compatible with the shields with XBee sockets. SJone board come with a xBee shield and this is a best experience that we can have. It is designed for Bluetooth wireless transfer. It can support Slave and Master mode although we are using it as Slave mode only. When it is plugged into xBee socket, it uses UART for transparent transmission. With the build-in AT command, we can change some default settings like the module address, module name, module mode, and baud rate.
MTK3339 Ultimate GPS
The MTK3339 Ultimate GPS module from Adafruit was chosen because it provides us with more than enough functionalities. All we needed from the GPS module was the longitude and latitude from raw NMEA sentence.
It provides an accuracy of 5-10 meters (or worse if indoors) with its 22 satellites transmitting data to the GPS module. An external antenna can be attached to improve accuracy. The GPS module can be interfaced to a microcontroller through UART interface with a default baud rate of 9600bps. It can be powered on with 3.3V-5VDC, which can be provided from the SJOne board. It provides an LED indicator that blinks at about 1Hz while searching for satellites and blinks once every 15 seconds when a fix is found to conserve power. The GPS module will allow us to calculate the bearing and destination from its current GPS coordinate and the destination coordinate.
HMC5883L Triple Axis Compass Magnetometer
The HMC5883L Triple-axis Magnetometer module from Adafruit was chosen because it can provide us with heading relative to magnetic north.
Most importantly, it allows us to steer toward our destination. The magnetometer has 6 data registers that can be read from which contains the 8 bit MSB or LSB x,y,z coordinates. Although the z-axis is provided, it is not used but can be useful in future projects. The magnetometer sensor uses I2C interface to communicate with a microcontroller. It can be powered on with either 3V-5VDC. There is also a Ready pin that can be used to indicate that the data register needs to be read to provide new data.
Hardware Interface
Traxxas 36054-1 Stampede: Monster Truck
The peripheral interface of the motor and servo are using PWM(Pulse Width Modulation) signal. PWM is normally used for getting analog results with digital means. PWM allows us to vary how much time the signal is high in an analog fashion. While the signal can only be high (usually 5V) or low (ground) at any time, we can change the proportion of time the signal is high compared to when it is low over a consistent time interval. A square wave of the digital control can be represented of the signal between on and off. PWM can have many of the characteristics of an analog control system, in that the digital signal can be free wheeling. One of the parameters of any square wave is duty cycle. Below are the frequency and duty cycle of our motor and servo respectively. The ON time can be varied completely between signal being off to being fully on, 0% to 100%, and all ranges between.
When the signal is high, we call this “on time”. To describe the amount of “on time” , we use the concept of duty cycle. Duty cycle is measured in percentage. The percentage duty cycle specifically describes the percentage of time a digital signal is on over an interval or period of time. This period is the inverse of the frequency of the waveform. Frequency/period are specific to controlling a specific servo. A typical servo motor is expected to be updated every 10 ms with a pulse between 1 ms and 2 ms, or in other words, between a 5 and 10% duty cycle on a 100 Hz waveform.
void motorTask::resetAll(float val) { //motor.set(val); // neutral 15 servo.set(val); // center15 return; } void motorTask::turnLeft(float val) { servo.set(val); // left , 19.5 max return; } void motorTask::turnRight(float val) { servo.set(val); //rights 10.5 max return; } void motorTask::motorForward(float val) { motor.set(val); // 15% motor speed, 16.5 return; } void motorTask::motorBackward(float val) { motor.set(val); //13.5 return; }
BTBee Pro Bluetooth XBee
We are using UART(Universal Asynchronous Receiver Transmitter), a simple way but very efficient, to transfer data between the Bluetooth and SJone board. As long as we set the built-in baud rate and the baud rate of our Bluetooth device, the connection between them are set. There is one wire for transmitting data (TX), and one wire to receive data (RX). We set the Bluetooth transmitter baud rate to be 115200bps during initialization, then the receiver must be listening on the other end at the same speed.
With the help of the XBee shield, BTBee Pro is fully insert onto the SJ one board with no external pins connected. The following is the pins config of the XBee Bluetooth shield.
Number | BTBee Pro PIN | XBee shield |
---|---|---|
1 | VCC | VDD |
2 | DOUT | DOUT |
3 | DIN | DIN |
5 | RESET | RESET |
9 | PAIR | DTR |
10 | GND | GND |
19 | STATUS | DIO1 |
20 | MODE | DIO0 |
MTK3339 Ultimate GPS
The GPS module is powered on by a minimum of 3.3V and is interfaced over UART to send and receive data. The 3.3V output from the SJOne board is used to power the board and the ground pin is connected to the GND pin of the GPS. Since it is using UART interface, the TX pin from the GPS is connected to RX of the SJOne board and the RX pin of the GPS is connected to TX pin of SJOne board. Once properly connected, the baud rate is set to 9600bps for it to properly communicate with the SJone board. The GPS will begin outputting raw NMEA sentences by using the gets() function. The raw NMEA sentence is then filtered out by sending a packet during initialization to filter out different formats of of the raw sentences and output only $GPRMC (Recommended minimum specific GPS/Transit data). Only the latitude and longitude from the parsed NMEA sentence was needed, therefore another parser was developed to grab only the latitude and longitude data by the tokenize() function. Using the longitude and latitude, the bearing and distance can be calculated.
Example: $GPRMC,225446,A,4916.45,N,12311.12,W,000.5,054.7,191194,020.3,E*68 1 2 3 4 5 6 7 8 9 10 11 12
Number | Raw form | Description |
---|---|---|
1 | 225446 | Time of fix 22:54:46 UTC |
2 | A | Navigation receiver warning A = OK, V = warning |
3 | 4916.45 | Latitude 49 deg. 16.45 min |
4 | N | North |
5 | 12311.12 | Longitude 123 deg. 11.12 min |
6 | W | West |
7 | 000.5 | Speed over ground, Knots |
8 | 054.7 | Course Made Good, True |
9 | 191194 | Date of fix 19 November 1994 |
10 | 020.3 | Magnetic variation 20.3 deg |
11 | E | East |
12 | *68 | mandatory checksum |
if (counter == 3) {/*convert the 3trd token latitude*/ latTemp = atof(token); latTemp = convertFromNmeaSentenceToDecimalCoord(latTemp, "m"); //"m" for meridian } /*If 4th token == South multiply by -1*/ if (counter == 4) { if (*token == 'S') { latTemp *= (-1); } } latitude = latTemp;
bearing = atan2( sin(longDiff_rad)*cos(lat2_rad), cos(lat1_rad)*sin(lat2_rad)-sin(lat1_rad)*cos(lat2_rad)*cos(longDiff_rad))
Distance formula: haversine formula: a = sin^2(latDiff_rad/2) + cos(lat1_rad) * cos(lat2_rad) * sin^2(longDiff_rad/2) formula: c = 2 *atan2(sqrt(a), sqrt(1-a)) d = Radius of Earth * c
HMC5883L Triple Axis Compass Magnetometer
The compass module is powered on by a minimum of 3.3V and communicates with the SJone board via I2C interface. The compass module has 6 data registers which contains the 8 bits MSB or LSB x,y,z coordinates in 2's complemented form. The MSB and LSB values of each coordinate were combined together to provide useful data in order to calculate the heading. Only the x and y values were used to calculate the heading. The reason why the compass module is far away from other electronics is because the compass module is very sensitive to surrounding magnetic fields. Placing it away from the servo and motor increased the heading degree accuracy when comparing to compass apps from smartphones. The compass module needed to be calibrated to its environment due to the effects of hard iron and soft iron distortions. Only hard iron was taken into account because it is a constant value and is just an offset. The soft iron offset is ignored due to varying magnetic field in different environment. In the graph plot below, there is a huge difference in distortion which resulted in 30 degree error with the non-calibrated module. The calibrated module reduced the error to just 10 degrees.
float heading = (float) atan2(float(y), (float(x))); // in radian if (heading < 0) { heading += (2 * M_PI); heading *= 180 / M_PI; } else heading *= 180 / M_PI;
Software Design
There are a total of 5 tasks created and constantly sending data over a queue to each other. FreeRTOS was used to provide scheduling and queue capability to run in a real-time fashion. Each flow chart below are individual tasks computing, decoding, or sending data.
Motor
Implementation
motorTask
The motorTask will receive the steering enumeration and moveForward enumeration to control the autonomous movement. There are 5 different kinds of steering and 2 kinds of movement as listed in geoTask.
Bluetooth
Due to limited amount of time, the idea of creating our own Android app was eliminated. However, an alternative was thought up by downloading an existing Bluetooth terminal app from the Google Play Store. The Bluetooth terminal will allow us to send messages (latitude and longitude) to our Bluetooth receiver to complete the objective.
The Bluetooth receiver software was written so that it can receive the longitude and latitude from a device with Bluetooth capability. The Bluetooth receiver was written in terminalTask due to its easy implementation. A handler and a command line prompt was added to the terminalTask and using extern to pass the received coordinates to the gpsTask. Format for the command line prompt:
Bluetooth lat long
extern float lati; extern float longi;
bearing = computeBearing(latitude, longitude, lati, longi ); distance = computeDistance(latitude, longitude, lati, longi );
GPSTask
The GPSTask will parse the raw NMEA sentence for $GPRMC and get the current location of the car. The bearing and distance is then calculated from its current location and destination. The bearing and distance is then sent over a queue to the GeoTask for further processing. The calculated bearing is in degrees and the calculated distance is in meters.
CompassTask
The compassTask will compute the heading and convert it from radians to degrees. It will check the status register if there is new data available. All 6 registers must be read in order to get new data. The computed heading is then sent over a queue to the GeoTask for further processing.
GeoTask
The geoTask computes which direction the car will steer in order to get to its destination. There are 5 different kind of steering mode: slight right, max right, slight left, max left, and forward. Depending on the distance to the destination, the car will move forward until it arrives at its destination with a error margin of 5 meters, as provided by the GPS module hardware description. The steering and motor enumeration is then sent over a queue to the motorTask to control the autonomous movement.
Testings
Motor & Servo Testing
The motor and servo of the car were initially tested by using the 4 on-board switches to test: forward movement, backward movement, turn left, and turn right. When the car was integrated with the geographical unit, spinning it on a turn-able chair verified that the compass and GPS module were able to control the steering of the car.
With the destination set, walking toward the destination will verify if the motor actually stops moving, otherwise the microcontroller will send PWM signal set to drive the car forward.
GPS Testing
Testing the GPS module was simple. It is easy to verify how accurate the GPS module by checking the GPS module's coordinates by inputting it into Google Maps. The accuracy of the GPS drops during indoor and sometimes never could find a proper fixed location. The GPS module also had a difficult time getting its location on a rainy day. The on-board LED 4 was used to indicate whether the GPS got a proper fixed location or not. The LED will light up when a fixed location is found, otherwise the LED will toggle.
Compass Testing
To verify the correct heading relative to magnetic north, it is possible to check it a smartphone with a compass app. This is how it is possible to check how many degrees the heading was off. The on-board LED 1 is used to indicate whether the compass module is passing the heading information to geoTask. The LED will light up if at least 1 data register is not read, which will pass incorrect data. Rigorous testing was done on the compass module due to its sensitivity. The compass was calibrated multiple times to pass sanity test. We have found that it is impossible to test the compass module in the engineering building at SJSU due to its heavy magnetic field affecting our compass reading. The source of the heavy magnetic field was most likely due to soft-iron distortion, as hard-iron calibration was already applied. The car was taken outside of the engineering building and the readings returned to normal when compared to the compass app.
Bluetooth Testing
Having print statements in Hercules allowed us to check if the destination coordinates are being updated through bluetooth. TerminalTask would also provide a "Command fail" if inputting an incorrect prompt. To test if the SJone board received the correct coordinates from the Bluetooth Terminal app, LED 3 was used. LED 3 will light up if the proper coordinate is sent to the SJone board, otherwise LED 3 will toggle. The LED indicator for Bluetooth was extremely helpful for testing without plugging the SJone board to laptop to check.
Car Testing
The whole car was tested in an open area where there were not many objects to obstruct its free driving. Testing it in a confined space does not allow the car to turn because it will hit objects in its way. The car's path to its destination is unpredictable because we did not implement waypoints. All testing of the car were placing the car's nose away from the destination. This approach to testing allowed us to verify if the car was able to turn around and drive towards its destination.
Technical Challenges
Calibration of 3-axis magnetometer
Issue: Need to calibrate compass because center is not at origin. Huge error of 20-30 degrees. Hard iron cause shift in x,y axis. Soft iron distort shape of circle into an ellipse. Need to keep compass on a flat surface because a tilt will affect x,y values
Resolution:Calibration was applied by subtracting the hard-iron offsets. Heading error reduced to range of 0-10 degrees. Ignoring soft-iron distortion because value is not constant and changes with location.
Compass placement
Issue: Compass placement: The compass was first placed in front of the car, away from the motor. Thinking that it might not be affected by its magnetic field.
Resolution: The servo (front of the car) also affected the compass. The placement of the compass was placed at least 1 feet away from any other component. During test drives, the car drove smoothly. It was also best to place the compass at the front of the car because the front 2 wheels are used for turning. The compass will compute the heading relative to its position of the turn faster than placing the compass module at the back or middle of the vehicle.
Nothing to stop it from crashing
Issue: During test drives, the car will crash into objects or walls in confined space.
Resolution: The car will reach its destination without help only if it is test driven in an open space with minimal object to obstruct its driving. Object avoidance would have been a nice addition if time permitted. This would allow us to test the car in more confined areas and not limit us to just open areas.
Conclusion
Overall, the project was a success as we built a fully functional autonomous car with Bluetooth communication with just a group of 2 in 8 weeks. Many hours were spent trying to debug and test each individual modules with limited amount of time each week. From this project we were able to become more familiar with the FreeRTOS and many different driver interfaces such as: I2C and UART. The labs before the project helped us lessen the learning curve. Future advice to ourselves, students, or anyone in particular is to include object avoidance to their autonomous car so that it is able to roam around in confined areas. Our decision to not include object avoidance increased our frustration during testing as it crash into objects. Future improvements on this car would also include building an Android app that is able to send coordinates as well as having a "Go" or "Stop" button, and send important data to be displayed on the smartphone screen.
Project Video
Motor and Servo: https://youtu.be/AdKw1G4GNOM
Motor and Servo (updated): https://youtu.be/y9YGl9JmKUU
Geographical Unit integration with motor (compass only): https://www.youtube.com/watch?v=N3GIjYgyP60
Self Driving Field Test 1: https://www.youtube.com/watch?v=R7_ALVbJFRE
Self Driving Field Test 2: https://www.youtube.com/watch?v=9BRb-uHcNx4
Autonomous Mobile Demo Day: https://youtu.be/wpslLxH_PH4
Project Source Code
References
Acknowledgement
We would like to thank Dr. Ozemek and Preet Kang for the knowledge they provided us to not only succeed in CMPE146, but for the future also.
References
Compass sensor: https://learn.adafruit.com/downloads/pdf/adafruit-hmc5883l-breakout-triple-axis-magnetometer-compass-sensor.pdf
Motor and Servo: http://www.socialledge.com/sjsu/index.php?title=SJ_One_Board#Motor_.26_Servo_Control
[1] http://www.socialledge.com/sjsu/images/d/de/2012SJOneBoardSchematic.pdf
[2] https://traxxas.com/sites/default/files/24054-36054-37054-OM-N-EN-R02_0.pdf
[3] http://www.adafruit.com/datasheets/GlobalTop-FGPMMOPA6H-Datasheet-V0A.pdf
[4] http://www.adafruit.com/datasheets/HMC5883L_3-Axis_Digital_Compass_IC.pdf
[5] ftp://imall.iteadstudio.com/Modules/IM121115002_BTBeepro/DS_IM121115002_BTBeepro.pdf
[6] https://learn.sparkfun.com/tutorials/pulse-width-modulation