Difference between revisions of "F13: Remote Control Car"

From Embedded Systems Learning Academy
Jump to: navigation, search
(TX Board Overview)
(Project Source Code)
 
(67 intermediate revisions by 2 users not shown)
Line 1: Line 1:
=== Grading Criteria ===
 
<font color="green">
 
*  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.
 
</font>
 
 
 
== Remote Control Car ==
 
== Remote Control Car ==
Using two SJSU development board to control a Remote Control Car.
 
  
 
== Abstract ==
 
== Abstract ==
IN-WORK: This section should be a couple lines to describe what your project does.
+
The goal of this project is to use 2 SJSU Development boards to control a remote control car.  The first board will act as the controller using motion for control (throttle and steering).  The second board will be mounted on the car and control the servo and motor controller with a front proximity sensor.
  
 
== Objectives & Introduction ==
 
== Objectives & Introduction ==
Line 25: Line 12:
 
[[File:CmpE240_F13_RCCAR_CarHardware.jpg]]
 
[[File:CmpE240_F13_RCCAR_CarHardware.jpg]]
  
 +
The RX board provides:
 +
* Receives wireless commands from transmitter board
 +
* Control for steering servo and speed throttle control
 +
* Car On/Off button
 +
* Proximity Sensor for front obstacle avoidance
 +
* Stability control to self-correct if starting to flip over
  
 
=== TX Board Overview ===
 
=== TX Board Overview ===
 
[[File:CmpE240 F13 RCCAR CtlHardware.JPG]]
 
[[File:CmpE240 F13 RCCAR CtlHardware.JPG]]
 +
 +
The TX board provides:
 +
* Wireless control of R/C using tilt detection (2-channel)
 +
* Car On/Off button
 +
* Front Proximity Sensor On/Off button
  
 
=== Team Members & Responsibilities ===
 
=== Team Members & Responsibilities ===
Line 40: Line 38:
 
*** Develop RX board software to control RC car
 
*** Develop RX board software to control RC car
 
*** Develop front proximity sensor detection software
 
*** Develop front proximity sensor detection software
 
IN-WORK: 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.
 
  
 
== Schedule ==
 
== Schedule ==
Line 47: Line 43:
 
|-
 
|-
 
! scope="col"| Week#
 
! scope="col"| Week#
! scope="col"| Date
 
 
! scope="col"| Task
 
! scope="col"| Task
 +
! scope="col"| Planned
 +
Date
 
! scope="col"| Completion
 
! scope="col"| Completion
 
Date
 
Date
 
|-
 
|-
 
! scope="row"| 1
 
! scope="row"| 1
| 10/8
 
 
| Identify R/C Car usage and ensure operation
 
| Identify R/C Car usage and ensure operation
 
Identify & Order parts needed
 
Identify & Order parts needed
 
Complete Project Proposal document
 
Complete Project Proposal document
 +
| 10/8
 
| 10/8
 
| 10/8
 
|-
 
|-
 
! scope="row"| 2
 
! scope="row"| 2
| 10/15
 
 
| Setup & build R/C Car
 
| Setup & build R/C Car
 
Test R/C operation with nominal controller
 
Test R/C operation with nominal controller
 
Develop pin list for I/O use & types
 
Develop pin list for I/O use & types
 +
| 10/15
 
| 10/15
 
| 10/15
 
|-
 
|-
 
! scope="row"| 3
 
! scope="row"| 3
 +
| Develop Accelerometer software driver
 +
Develop Servo control software driver
 
| 10/22
 
| 10/22
| Develop Accelerometer software driver
 
Develop Server control software driver
 
 
| 10/15
 
| 10/15
 
|-
 
|-
 
! scope="row"| 4
 
! scope="row"| 4
| 10/29
 
 
| Develop Transmitter data protocol
 
| Develop Transmitter data protocol
 
Develop Transmitter software driver
 
Develop Transmitter software driver
Develop LED control software driver
+
Develop Proximity sensor software driver
 +
| 10/29
 
| 10/15
 
| 10/15
 
|-
 
|-
 
! scope="row"| 5
 
! scope="row"| 5
 +
| Integrate accelerometer and transmitter drivers program
 +
Integrate servo and proximity drivers into program
 
| 11/5
 
| 11/5
| Integrate accelerometer and transmitter drivers program
 
Integrate servo and LED control drivers into program
 
 
| 10/29
 
| 10/29
 
|-
 
|-
 
! scope="row"| 6
 
! scope="row"| 6
| 11/12
 
 
| Integrate TX and RX development boards communications
 
| Integrate TX and RX development boards communications
 
Integrate & Test system with simulated R/C Car
 
Integrate & Test system with simulated R/C Car
| 10/29
+
| 11/12
 +
| 11/05
 
|-
 
|-
 
! scope="row"| 7
 
! scope="row"| 7
 +
| Integrate & Test system with actual R/C Car
 
| 11/19
 
| 11/19
| Integrate & Test system with actual R/C Car
 
 
| 11/18
 
| 11/18
 
|-
 
|-
 
! scope="row"| 8
 
! scope="row"| 8
| 12/3
 
 
| Demo Project
 
| Demo Project
 
Finish report
 
Finish report
| On-Schedule
+
| 12/3
 +
| 12/3
 
|}
 
|}
 
IN-WORK: Show a simple table or figures that show your scheduled as planned before you started working on the project.  Then in another table column, write down the actual schedule so that readers can see the planned vs. actual goals.  The point of the schedule is for readers to assess how to pace themselves if they are doing a similar project.
 
  
 
== Parts List & Cost ==
 
== Parts List & Cost ==
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! scope="col"| Number
+
! scope="col"| Part Number
 
! scope="col"| Description
 
! scope="col"| Description
! scope="col"| Quantity
 
 
! scope="col"| Price ($)
 
! scope="col"| Price ($)
 +
! scope="col"| Qty
 
|-
 
|-
! scope="row"| 1
+
! scope="row"| SJSUONE
| XX
+
| SJSU-One Development Board
 +
| 75.00
 +
| 2
 +
|-
 +
! scope="row"| -
 +
| AA Battery Pack
 +
| 6.00
 +
| 1
 +
|-
 +
! scope="row"| RC10
 +
| Associated RC10 Car
 +
| 305.00
 
| 1
 
| 1
| 59.95
 
 
|-
 
|-
! scope="row"| 2
+
! scope="row"| 410-MXc
| XX
+
| Novak Electronic Speed Control
| 10
+
| 90.00
| 10.00
+
| 1
 
|-
 
|-
! scope="row"| 3
+
! scope="row"| Stock
| XX
+
| Pocket Rocket Motor
| 4
+
| 25.00
| 3.95
+
| 1
 
|-
 
|-
! scope="row"| 4
+
! scope="row"| -
| XX
+
| Sanyo 1400mA 7.2V Battery
 +
| 20.00
 
| 1
 
| 1
| 2.45
 
 
|-
 
|-
! scope="row"| 5
+
! scope="row"| S9302
| XX
+
| Futaba HS Steering Servo
 +
| 40.00
 
| 1
 
| 1
| 5.00
 
 
|-
 
|-
! scope="row"| 6
+
! scope="row"| MB1010
| XX
+
| LV-MaxSonar EZ1
 +
| 30.00
 
| 1
 
| 1
| 25.90
 
 
|-
 
|-
! scope="row"| 7
+
! scope="row"| -
| SJ One Board
+
| Misc Hardware
 +
| 8.00
 
| 1
 
| 1
| 75.00
 
 
|-
 
|-
! scope="row"| 8
+
! scope="row"|  
 
| Total
 
| Total
 +
| 674.00
 
|   
 
|   
| XX
 
 
|-
 
|-
 
|}
 
|}
  
 +
== Design & Implementation ==
  
IN-WORK: Give a simple list of the cost of your project broken down by components.  Do not write long stories here.
 
 
== 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 ===
 
=== Hardware Design ===
Discuss your hardware design here. Show detailed schematics, and the interface here.
+
The hardware development mostly consisted of integrated the R/C car and SJSU-one development board. The custom made cables and power distribution header required planning and custom soldering. The SJSJ-one board was mounted on the R/C car using screws with plastic spacers.
  
 
[[File:CmpE240_F13_RCCAR_CarDetail.jpg]]
 
[[File:CmpE240_F13_RCCAR_CarDetail.jpg]]
  
 
=== Hardware Interface ===
 
=== 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.
 
  
 
The TX board used the following interfaces:
 
The TX board used the following interfaces:
*   
+
* I2C Bus
 +
*Accelerometer sensor for steering and throttle control
 +
**  LED number display for throttle position
 +
* SPI Bus
 +
**  Nordic wireless interface for transmitting control packets
 +
* GPIO
 +
**  Switches for Enable/Disable of Control and Sensor (GPIO)
 +
 
  
 
The RX board used the following interfaces:
 
The RX board used the following interfaces:
*  PWM interface to steering servo (50Hz)
+
* I2C Bus
*  PWM interface to electronic speed control (50Hz)
+
**  Accelerometer sensor to detect upside or flipping of car
*  Analog to Digital Converter from proximity sensor
+
**  LED Display (numbers) for error codes
* Accelerometer sensor to detect upside or flipping of car
+
* SPI Bus
GPIO to read switch values and output LED status
+
**  Nordic wireless interface for receiving control packets
LED number display for error codes
+
* Pulse Width Modulation (PWM)
 +
**  PWM interface to steering servo (50Hz)
 +
**  PWM interface to electronic speed control (50Hz)
 +
* A/D Converter
 +
**  Analog to Digital Converter from proximity sensor (LPC1758, 12-bit)
 +
* GPIO
 +
*Switches for Car Enable/Disable
 +
*Discrete LEDs for status such Car and Proximity Sensor Enable/Disable
  
 
=== Software Design ===
 
=== Software Design ===
Show your software design.  For example, if you are designing an MP3 Player, show the tasks that you are using, and what they are doing at a high level.  Do not show the details of the code.  For example, do not show exact code, but you may show psuedocode and fragments of code.  Keep in mind that you are showing DESIGN of your software, not the inner workings of it.
 
  
RX Board Software Diagram
+
'''RX Board Software Diagram'''
  
 
[[File:CmpE240_F13_RCCAR_RxBoardSw.jpg]]
 
[[File:CmpE240_F13_RCCAR_RxBoardSw.jpg]]
 +
 +
'''TX Board Software Diagram'''
 +
 +
[[File:CmpE240_F13_RCCAR_rxsoftware.jpg]]
  
 
=== Implementation ===
 
=== 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.
 
  
== Testing & Technical Challenges ==
+
Switch De-bounce Timer
Describe the challenges of your projectWhat advise would you give yourself or someone else if your project can be started from scratch again?
+
*  A 200ms software timer is used to set the sensor configuration variable.  At the beginning of the control loop, if the timer has expired then the switch status is read and the configuration is updated. This is to "de-bounce" the switch.
Make a smooth transition to testing section and described what it took to test your project.
+
 
 +
Steering and Throttle Resolution
 +
* The 16-bit value read from the accelerometer is translated to an 8-bit value.  The 8-bit value (capped at +/- 100) is then transmitted to the RX Board, to control steering and throttle.  100 steps in each direction provided smoother control and acceleration of the car. 
 +
 
 +
'''Wireless Command Format'''
 +
*  A header field and checksum was included with the control data to form the command packet. The format is shown below
 +
[[File:CmpE240_F13_RCCAR_cmdformat.jpg]]
 +
 
 +
== Technical Challenges ==
  
 +
=== Steering and Throttle Resolution ===
 +
The initial design used 10 steps in each direction for direction and throttle.  As a result, the steering was incredibly jittery and acceleration of the car was difficult to control.  After testing several settings, we settled on 100 steps.  This allowed for smoother control with full range of steering motion.
  
 
=== Proximity Sensor Detection ===
 
=== Proximity Sensor Detection ===
Cone shape xxx
+
The proximity sensor was first mounted to the front bumper of the car.  When it was disabled, control of the car was normal.  When enabled the car became very erratic.  We later learned that the field-of-view of the sensor was cone shaped and the ground was most likely in view of the sensor. The sensor also has a minimum range detection of 6".  We mounted the sensor higher and farther back on the car which gave us the control expected.
 +
 
 +
== Testing ==
 +
 
 +
The TX board software and RX board software were tested independently prior to integration.
 +
Then the integration of the TX and RX board was performed in steps up to the final integrated configuration.
 +
 
 +
'''TX Board'''
 +
 
 +
The TX board software testing consisted of printing wireless commands to the serial window to verify the accelerometer function. Although this did not mimic the timing of the actual system, since the serial port print slows the processor, it provided a baseline of the command data to be transmitted and gave the ability to develop the accelerometer value conversions.
 +
 
 +
'''RX Board'''
 +
 
 +
The RX board software testing consisted of using switches rather than receiving wireless commands, controlled by #define, to control the car. Some timers were used to de-bounce the switches. Also, an oscilloscope was used to verify the PWM frequency and pulse widths required by the servo and speed controller. The serial port was also used to test the features of the upside detection and tilt over detection logic.
 +
 
 +
'''Integrated Testing'''
 +
 
 +
Once both the TX and RX board were tested independently, the first integration test was to have the TX board transmit the wireless commands and have the RX board print the value to the serial port. Next, with the car sitting on a stand we determined the stability of the TX and RX boards to control the car. When it was proven that the car was reliable and stable, we drove the car in a controlled environment.
 +
 
 +
We operated the the car in different environments, outside and inside, to ensure its reliability. We also tested the distance that the car could travel from the TX board and it found it to be around 40 feet.
  
 
== Conclusion ==
 
== 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?
+
The RC Control car was a fun project that also demonstrated that the simplest software solution to control hardware is usually the best. Integrating software and hardware with the knowledge of the hardware devices being controlled made integrated levels of degrees easier. The testing philosophy of verifying drivers as they are developed, rather than at final integration, proved successful. Since TX and RX boards software was tested by modules, individually, and finally integrated, the project came together smoothly. The UART interface was vital in the development as challenges encountered were quickly overcome.
 +
 
 +
We did have some thoughts for future expansion on this project such as:
 +
* Add GPS features to command the car to a location
 +
* Add small video camera to utilize the SD card memory as a recorder
 +
* Replace the electronic speed control to include reverse (current one only had forward and brake)
 +
 
 +
 
 +
 
 +
All in all, the experience gave us good practical applications of standard interfaces such as I2C, UART, ADC and SPI to control multiple devices in a practical manner.
  
 
=== Project Video ===
 
=== Project Video ===
Upload a video of your project and post the link here.
+
[http://youtu.be/JgZC1rasnzs Youtube Video Link]
  
 
=== Project Source Code ===
 
=== Project Source Code ===
Send me your zipped source code and I will upload this to SourceForge and link it for you.
+
[https://sourceforge.net/projects/sjsu/files/CmpE240_LM_F2013/ Sourceforge Source Code]
  
 
== References ==
 
== References ==
 
=== Acknowledgement ===
 
=== Acknowledgement ===
Any acknowledgement that you may wish to provide can be included here.
+
Thank you Professor Kang for expanding our project with the supplied proximity sensor and provided guidance.
  
 
=== References Used ===
 
=== References Used ===
List any references used in project.
+
None
  
 
=== Appendix ===
 
=== Appendix ===
You can list the references you used.
 

Latest revision as of 03:56, 8 December 2013

Remote Control Car

Abstract

The goal of this project is to use 2 SJSU Development boards to control a remote control car. The first board will act as the controller using motion for control (throttle and steering). The second board will be mounted on the car and control the servo and motor controller with a front proximity sensor.

Objectives & Introduction

CmpE240 F13 RCCAR TopLevel.jpg


RX Board Overview

CmpE240 F13 RCCAR CarHardware.jpg

The RX board provides:

  • Receives wireless commands from transmitter board
  • Control for steering servo and speed throttle control
  • Car On/Off button
  • Proximity Sensor for front obstacle avoidance
  • Stability control to self-correct if starting to flip over

TX Board Overview

CmpE240 F13 RCCAR CtlHardware.JPG

The TX board provides:

  • Wireless control of R/C using tilt detection (2-channel)
  • Car On/Off button
  • Front Proximity Sensor On/Off button

Team Members & Responsibilities

  • Alan Wang
    • TX Board software development including:
      • Develop driver for Acceleration Sensor (throttle and steering)
      • Develop Wireless message protocol between boards
      • Develop TX board software to transmit commands
  • Curtis Woodworth
    • RX Board software/hardware development including:
      • Integrate hardware onto R/C Car (board, power, cable)
      • Develop RX board software to control RC car
      • Develop front proximity sensor detection software

Schedule

Week# Task Planned

Date

Completion

Date

1 Identify R/C Car usage and ensure operation

Identify & Order parts needed Complete Project Proposal document

10/8 10/8
2 Setup & build R/C Car

Test R/C operation with nominal controller Develop pin list for I/O use & types

10/15 10/15
3 Develop Accelerometer software driver

Develop Servo control software driver

10/22 10/15
4 Develop Transmitter data protocol

Develop Transmitter software driver Develop Proximity sensor software driver

10/29 10/15
5 Integrate accelerometer and transmitter drivers program

Integrate servo and proximity drivers into program

11/5 10/29
6 Integrate TX and RX development boards communications

Integrate & Test system with simulated R/C Car

11/12 11/05
7 Integrate & Test system with actual R/C Car 11/19 11/18
8 Demo Project

Finish report

12/3 12/3

Parts List & Cost

Part Number Description Price ($) Qty
SJSUONE SJSU-One Development Board 75.00 2
- AA Battery Pack 6.00 1
RC10 Associated RC10 Car 305.00 1
410-MXc Novak Electronic Speed Control 90.00 1
Stock Pocket Rocket Motor 25.00 1
- Sanyo 1400mA 7.2V Battery 20.00 1
S9302 Futaba HS Steering Servo 40.00 1
MB1010 LV-MaxSonar EZ1 30.00 1
- Misc Hardware 8.00 1
Total 674.00

Design & Implementation

Hardware Design

The hardware development mostly consisted of integrated the R/C car and SJSU-one development board. The custom made cables and power distribution header required planning and custom soldering. The SJSJ-one board was mounted on the R/C car using screws with plastic spacers.

CmpE240 F13 RCCAR CarDetail.jpg

Hardware Interface

The TX board used the following interfaces:

  • I2C Bus
    • Accelerometer sensor for steering and throttle control
    • LED number display for throttle position
  • SPI Bus
    • Nordic wireless interface for transmitting control packets
  • GPIO
    • Switches for Enable/Disable of Control and Sensor (GPIO)


The RX board used the following interfaces:

  • I2C Bus
    • Accelerometer sensor to detect upside or flipping of car
    • LED Display (numbers) for error codes
  • SPI Bus
    • Nordic wireless interface for receiving control packets
  • Pulse Width Modulation (PWM)
    • PWM interface to steering servo (50Hz)
    • PWM interface to electronic speed control (50Hz)
  • A/D Converter
    • Analog to Digital Converter from proximity sensor (LPC1758, 12-bit)
  • GPIO
    • Switches for Car Enable/Disable
    • Discrete LEDs for status such Car and Proximity Sensor Enable/Disable

Software Design

RX Board Software Diagram

CmpE240 F13 RCCAR RxBoardSw.jpg

TX Board Software Diagram

CmpE240 F13 RCCAR rxsoftware.jpg

Implementation

Switch De-bounce Timer

  • A 200ms software timer is used to set the sensor configuration variable. At the beginning of the control loop, if the timer has expired then the switch status is read and the configuration is updated. This is to "de-bounce" the switch.

Steering and Throttle Resolution

  • The 16-bit value read from the accelerometer is translated to an 8-bit value. The 8-bit value (capped at +/- 100) is then transmitted to the RX Board, to control steering and throttle. 100 steps in each direction provided smoother control and acceleration of the car.

Wireless Command Format

  • A header field and checksum was included with the control data to form the command packet. The format is shown below

CmpE240 F13 RCCAR cmdformat.jpg

Technical Challenges

Steering and Throttle Resolution

The initial design used 10 steps in each direction for direction and throttle. As a result, the steering was incredibly jittery and acceleration of the car was difficult to control. After testing several settings, we settled on 100 steps. This allowed for smoother control with full range of steering motion.

Proximity Sensor Detection

The proximity sensor was first mounted to the front bumper of the car. When it was disabled, control of the car was normal. When enabled the car became very erratic. We later learned that the field-of-view of the sensor was cone shaped and the ground was most likely in view of the sensor. The sensor also has a minimum range detection of 6". We mounted the sensor higher and farther back on the car which gave us the control expected.

Testing

The TX board software and RX board software were tested independently prior to integration. Then the integration of the TX and RX board was performed in steps up to the final integrated configuration.

TX Board

The TX board software testing consisted of printing wireless commands to the serial window to verify the accelerometer function. Although this did not mimic the timing of the actual system, since the serial port print slows the processor, it provided a baseline of the command data to be transmitted and gave the ability to develop the accelerometer value conversions.

RX Board

The RX board software testing consisted of using switches rather than receiving wireless commands, controlled by #define, to control the car. Some timers were used to de-bounce the switches. Also, an oscilloscope was used to verify the PWM frequency and pulse widths required by the servo and speed controller. The serial port was also used to test the features of the upside detection and tilt over detection logic.

Integrated Testing

Once both the TX and RX board were tested independently, the first integration test was to have the TX board transmit the wireless commands and have the RX board print the value to the serial port. Next, with the car sitting on a stand we determined the stability of the TX and RX boards to control the car. When it was proven that the car was reliable and stable, we drove the car in a controlled environment.

We operated the the car in different environments, outside and inside, to ensure its reliability. We also tested the distance that the car could travel from the TX board and it found it to be around 40 feet.

Conclusion

The RC Control car was a fun project that also demonstrated that the simplest software solution to control hardware is usually the best. Integrating software and hardware with the knowledge of the hardware devices being controlled made integrated levels of degrees easier. The testing philosophy of verifying drivers as they are developed, rather than at final integration, proved successful. Since TX and RX boards software was tested by modules, individually, and finally integrated, the project came together smoothly. The UART interface was vital in the development as challenges encountered were quickly overcome.

We did have some thoughts for future expansion on this project such as:

  • Add GPS features to command the car to a location
  • Add small video camera to utilize the SD card memory as a recorder
  • Replace the electronic speed control to include reverse (current one only had forward and brake)


All in all, the experience gave us good practical applications of standard interfaces such as I2C, UART, ADC and SPI to control multiple devices in a practical manner.

Project Video

Youtube Video Link

Project Source Code

Sourceforge Source Code

References

Acknowledgement

Thank you Professor Kang for expanding our project with the supplied proximity sensor and provided guidance.

References Used

None

Appendix