Difference between revisions of "S14: Anti-Crash Car"
Proj user22 (talk | contribs) (→My Issue #3) |
Proj user22 (talk | contribs) (→Acknowledgement) |
||
Line 386: | Line 386: | ||
== References == | == References == | ||
− | === | + | === Acknowledgements === |
We would like to thank Dr. Ozemek for giving us detail knowledge of how circuits and components works. | We would like to thank Dr. Ozemek for giving us detail knowledge of how circuits and components works. | ||
We would like to thank Preetpal Kang for teaching us how to use microcontroller and freerots. | We would like to thank Preetpal Kang for teaching us how to use microcontroller and freerots. | ||
− | We would like to thank James Loo for guiding me through out this whole project. Making sure our project is getting done correctly. | + | We would like to thank James Loo for guiding me [Koko] through out this whole project. Making sure our project is getting done correctly. |
=== References Used === | === References Used === |
Revision as of 20:27, 22 May 2014
Contents
- 1 Grading Criteria
- 2 Anti-Crash Car
- 2.1 Abstract
- 2.2 Objectives & Introduction
- 2.3 Schedule
- 2.4 Parts List & Cost
- 2.5 Design & Implementation
- 2.6 Testing & Technical Challenges
- 2.6.1 Test Stage 1: Individual Peripherals
- 2.6.2 Test Stage 2: System State Cases
- 2.6.3 Test Stage 3: State Cases with Peripherals
- 2.6.4 Test Stage 4: Field Testing
- 2.6.5 My Issue #1
- 2.6.6 My Issue #2
- 2.6.7 My Issue #3
- 2.6.8 My Issue #3
- 2.6.9 My Issue #3
- 2.6.10 My Issue #3
- 2.6.11 My Issue #3
- 2.6.12 My Issue #3
- 2.6.13 GPS Issues
- 2.6.14 Car Response Time
- 2.7 Conclusion
- 2.8 References
Grading Criteria
- How well is Software & Hardware Design described?
- How well can this report be used to reproduce this project?
- Code Quality
- Overall Report Quality:
- Software Block Diagrams
- Hardware Block Diagrams
- Schematic Quality
- Quality of technical challenges and solutions adopted.
Anti-Crash Car
Abstract
The project involves a GPS controlled car that drives to a user determined destination and automatically stops or slows down when an obstacle is in its way in order to prevent itself from crashing. Any command that can potentially damage the car is disabled (e.g. moving forward when the obstacle is in front).
Objectives & Introduction
Show list of your objectives. This section includes the high level details of your project. You can write about the various sensors or peripherals you used to get your project completed.
The objectives of the lab included putting together a
NEED TO BE DONE
Team Members & Responsibilities
- Geff Lozano
- Infrared Sensor Module
- GPS Module
- Parser
- Information Processing
- System State Machine
- Koko Maung
- Car Kit Assembly
- Infrared Sensor Module
- Sonar Sensor Module
- Compass Module
- Servo / Wheels Motor
- State Machine
- Matthew Pham
- GPS Module
- UART Interface
- Parser
- Information Processing
- System State Machine
- GPS Module
Schedule
Week# | Date | Task | Description |
---|---|---|---|
1 | 3/23 | Planning | Top-Level System Drafting |
2 | 3/30 | Top-Level System Design | Went through many drafts |
3 | 4/6 | Order Parts | Ordered GPS/compass unit, sonar sensor, IR sensor, and necessary accessories. |
4 | 4/13 | Assign peripheral responsibilities | Divided the work. |
5/6 | 4/20 | Peripheral Interfacing | GPS, Infrared, Sonar; No communication with GPS; Burned GPS; |
7 | 4/27 | System State Machine Implementation | Redrafted Original State Machine |
8 | 5/4 | Implementing | Started implementing State Machine with Peripheral devices together. Figured out that we purchased incorrect GPS / compass device. |
8 | 5/11 | Implementing | State machine and peripheral devices are working the we we predicted. Except compass. Order new compass |
8 | 5/18 | Implementing / Testing | Implementing State machine with compass. Did field testing. |
8 | 5/22 | Demo |
Parts List & Cost
Qty | Part | Price |
---|---|---|
1 | RC Rock Crawler | $200.86 |
1 | SRF08 Ultrasonic Range Finder | $54.30 |
4 | Sensor Housing MPSH-01 | $19.8 |
3 | GP2Y0A21YK0F IR Sensor - 10cm to 80cm | $59.4 |
3 | SIRC-01 Sensor Cable | $5.85 |
1 | 3DR GPS Module w/ Compass | $53.35 |
1 | Battery | $25.00 |
1 | FTDI Cable | $14.97 |
1 | GPS Receiver - LS20031 5Hz (66 Channel) | $59.95 |
1 | Compass Module 3-Axis HMC5883L | $15.99 |
Total | $509.47 |
Design & Implementation
The design section can go over your hardware and software design. Organize this section using sub-sections that go over your design and implementation.
Hardware Design
- SJ-one Board
- Rock Crawler
- IR sensor
- Sonar sensor
- GPS module
- Compass module
System Schematic
Hardware Interface
In this section, you can describe how your hardware communicates, such as which BUSes used. You can discuss your driver implementation here, such that the Software Design section is isolated to talk about high level workings rather than inner working of your project.
Software Design
Design Flow
Implementation
This section includes implementation, but again, not the details, just the high level. For example, you can list the steps it takes to communicate over a sensor, or the steps needed to write a page of memory onto SPI Flash. You can include sub-sections for each of your component implementation.
State machine
Our State machine is designed with
STOP : Forever stop loop START: Car turned on / reset button is pressed CURRENT: 1. current location is collected from GPS 2. set L,M,R = 0,0,0 3. ( destination == current) ? if true : stop ; else : compass COMPASS: 1. check head direction 2. check where the coordinate of destination 3. set L,M,R bits accordingly 4. move to decision DECISION: 1. depending on the L,M,R bit it will make decision on which sensor to check 2. ( Object )? if : next sensor; else move MOVE : 1. move accordingly 2. move back to current
Servo and Wheel motor Communication (PWM)
Servo and Wheel motor communication is done by using PWM communication. Interface for PWM is already given by Professor Preet.
1. We must set the pin that we want to use with the waveform period
2. set percentage of waveform to be stay at high.
eg.PWM pwm1(PWM::pwm1, 50); // pw1 = p0.0, period = 50 pwm1.set(10); // percent = 10 1/5 of the time signal gonna be high
Sonar and Compass Communication (I2C)
Sonar and Compass communication is done by using I2C communication. Interface for I2C is already given by Professor Preet. Since I2C module already take care of turning the LSB to high and low accordingly, we don't have to worry about it.
1. Get device address from datasheet.
2. If device requires commands to perform operation, write command to appropriate register.
3. Read information from appropriate register.
notice : If you try to read value before its ready, you will get zero.
eg. i2c.writeReg(0xE0,0x00,0x50); //writing: device address = 0xE0, register address = 0x00, writing value = 0x50; char high_byte = i2c.readReg(0xE0, 0x02); // reading: device address = 0xE0, register address = 0x02 char low_byte = i2c.readReg(0xE0, 0x03); // register address = 0x02
Infrared Communication (ADC)
Infrared communication is done by using ADC communication. Interface for ADC is already given by Professor Preet.
1. set a pin for ADC
2. select mode
3. initialize the pin
4. read value at appropriate time.
// initialization eg. LPC_PINCON -> PINSEL1 |= ( 1 << 20 ); // P0.30 LPC_PINCON -> PINMODE1 |= ( 2 << 20 ); // output mode adc0_init(); // initilize // reading IR_Left_distance = adc0_get_reading(4);
GPS Communication (UART)
The GPS Receiver communicates with the SJ One board through UART via NMEA sentences.
Examples:
- The user can configure the update (baud) rate of the GPS module with the following example commands:
- 38400bps - $PMTK251,38400*27<CR><LF>
- 57600bps - $PMTK251,57600*2C<CR><LF>
- The user can filter out unwanted NMEA sentences with the following example commands:
- Only RMC at 1Hz - $PMTK314,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29<CR><LF>
- Only GGA at 1Hz - $PMTK314,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29<CR><LF>
Pin Configuration
Pin | Name | Description |
---|---|---|
1 | VCC | Power input |
2 | RX | Data input (TTL level) |
3 | TX | Data output (TTL level) |
4 | GND | Ground |
5 | GND | Ground |
Testing & Technical Challenges
Describe the challenges of your project. What advise would you give yourself or someone else if your project can be started from scratch again? Make a smooth transition to testing section and described what it took to test your project.
Include sub-sections that list out a problem and solution, such as:
Test Stage 1: Individual Peripherals
In the first stage of testing, each individual peripheral was tested separately.
GPS Module
- Checked for UART communication
- The console for the SJ One board should at least read characters (unreadable or unrecognized characters are a result of mismatched (GPS Receiver)<->(SJ One) baud rates)
- Checked for data consistency and reliability
- The GPS Receiver must first be able to detect any nearby satellites
- No LED blinking or inconsistent blinking rates are a result of satellites not being detected.
- GPS Receiver was tested in open outdoors (The GPS Receiver was moved around EAST, WEST, NORTH, and SOUTH to check for change of data.)
Infrared Sensors
- Checked for correct functionality
- Checked whether sensor detected objects in front by analyzing converted values
- Checked whether values sent to board are consistent with proximity of objects in front of sensors
Sonar
Compass
- placeholder
Motors
Test Stage 2: System State Cases
Checking state machine
Test Stage 3: State Cases with Peripherals
Test Stage 4: Field Testing
My Issue #1
PWMs : I found out PWMs for servo and wheels motor must run at 50Hz even though motor is capable of handling faster frequency. When we use other frequency, the hand shake between PWMs and motor will not sync correctly.
Solution : We end up using 50Hz and we had to operate motor at slower speed.
My Issue #2
Interrupt : When we had 2 interrupts and functional calls involve together, our code will not perform the way we expected. The system get crash or freeze time to time.
Solution : We end up putting sensor, gps, motor and state machine code in tasks.
My Issue #3
Sensors : We found out that if we try to read value too fast, we ended up getting zero.
Solution : We wrote a case when the value is zero, we keep the previous value for one time.
My Issue #3
SJSU-One board : We were not able to power directly from power socket.
Solution : We cut off the USB cable and used it to power the board.
My Issue #3
My Issue #3
My Issue #3
My Issue #3
GPS Issues
Problems:
- The ordered GPS Receiver (LS20031) was not the one received (LS23060).
- There were no specific datasheets for the acquired model (LS23060).
- The datasheet for LS20031 was used instead. NOTE: Use LS20031 specifications with caution.
- The baud rate specified in the datasheet (57600bps) did not match the baud rate of the acquired GPS Receiver (38400bps).
- Communication between the GPS Receiver and the SJSU development board was not possible due to mismatched baud rates. The GPS Receiver baud rate cannot even be set to a desired baud rate through PTMK commands without being in sync with the command sender in the first place.
Solution:
The solution was to use an FDTI cable (UART to USB) with Realterminal (http://realterm.sourceforge.net/index.html#downloads_Download) for synchronization.
- Using Realterminal, users can determine the baud rate of the GPS Receiver through trial and error--changing the port baud rate until NMEA sentences are displayed.
- e.g. $--GGA,hhmmss.ss,llll.ll,a,yyyyy.yy,a,x,xx,x.x,x.x,M,x.x,M,x.x,xxxx.
- See GPS - NMEA sentence information for more examples.
- Only until the Port is initially synced with the GPS Receiver, users cannot set the GPS Receiver to a desired baud rate. When the port is in sync, the following actions can be taken:
- With Realterminal open, click the Send Tab and check "+CR" and "+LF" flags.
- Send the string "$PMTK314,-1*04" as ASCII to reset the GPS to its default configuration. The baud rate will then be reset to 38400bps.
- Now the SJSU development board can communicate through PTMK commands at UART - 38400bps.
Car Response Time
Problem
Conclusion
Conclude your project here. You can recap your testing and problems. You should address the "so what" part here to indicate what you ultimately learnt from this project. How has this project increased your knowledge?
Project Video
Upload a video of your project and post the link here.
Project Source Code
Send me your zipped source code and I will upload this to SourceForge and link it for you.
References
Acknowledgements
We would like to thank Dr. Ozemek for giving us detail knowledge of how circuits and components works.
We would like to thank Preetpal Kang for teaching us how to use microcontroller and freerots.
We would like to thank James Loo for guiding me [Koko] through out this whole project. Making sure our project is getting done correctly.
References Used
For datasheet
http://www.robotshop.com/en/devantech-ultrasonic-range-finder-srf08.html
http://www.robotshop.com/en/devantech-tilt-magnetic-compass.html
https://www.sparkfun.com/products/8975
Appendix
You can list the references you used.