Difference between revisions of "S19: Run D.B.C"

From Embedded Systems Learning Academy
Jump to: navigation, search
(GEOGRAPHIC CONTROLLER)
(GPS Module)
Line 658: Line 658:
  
 
[[File:S19_RUNDBC.jpg| 200px]]
 
[[File:S19_RUNDBC.jpg| 200px]]
 
  
 
=== Geographic Controller Schematic ===
 
=== Geographic Controller Schematic ===

Revision as of 02:24, 18 May 2019

caption

ABSTRACT

The RUN-D.B.C project, involves the design and construction of an autonomously navigating RC car. Development of the R.C car's subsystem modules will be divided amongst and performed by seven team members. Each team member will lead or significantly contribute to the development of at least one subsystem.

INTRODUCTION & OBJECTIVES

RC CAR OBJECTIVES

  • Successfully detect and avoid obstacles
  • Autonomously navigate to a fixed destination, from a fixed starting location; based on feedback from a GPS
  • Integrate communication between the RC car's master controller and an Android device, using Bluetooth
  • Integrate system hardware communication using a PCB


TEAM OBJECTIVES

  • Strive to learn as much as possible, in order to develop a professional product
  • Establish and enforce professional software design standards
  • Establish and enforce professional hardware design standards
  • Achieve 100% code coverage, during unit testing
  • Carefully document and track all bugs encountered and patched, during development
  • Clearly communicate the development of all modules of the RC car


CORE MODULES OF RC CAR

  • Android Mobile Application
  • Bridge Controller
  • Geographic Controller
  • Master Controller
  • Motor Controller
  • Sensor Controller
  • Hardware Integration PCB
  • Wiring Harness


PROJECT MANAGEMENT ADMINISTRATION ROLES

  • Team Lead
  • Finance Manager
  • Git Repository Manager
  • Wiki Report Manager
  • Gantt Chart Manager
  • Bill of Materials Manager
  • Project Presentation Manager


TEAM MEMBERS & RESPONSIBILITIES

Team Members

Administrative Roles

Technical Roles

  • Tristan French
  • Team Lead
  • Git Repository Manager
  • Finance Manager
  • Master Controller (Lead)
  • Hardware Integration PCB
  • Wiring Harness
  • Ryan Zelek
  • Testing and Integration (Lead)
  • Master Controller
  • Motor Controller
  • Samir Mohammed
  • Wiki Report Manager
  • Gantt Chart Manager
  • Bill of Materials Manager
  • Android Mobile Application & Bridge Controller (Lead)
  • Hardware Integration PCB
  • Wiring Harness
  • Vignesh Kumar Venkateshwar
  • Project Presentation Manager
  • Motor Controller (Lead)
  • Android Mobile Application & Bridge Controller
  • Bharath Vyas Balasubramanyam
  • Geographic Controller (Lead)
  • Motor Controller
  • Nuoya Xie
  • Sensor Controller (Lead)
  • Geographic Controller
  • Kelvin Cheong
  • Sensor Controller
  • Geographic Controller


SCHEDULE

TEAM MEETING DATES & DELIVERABLES

Week#

Date Assigned

Deliverables

Status

1 2/16/19
  • Share team contact information
  • Create Git Repository (Tristan)
  • Set up Slack
  • Invite Preet to Slack
  • Establish Code Guidelines and Standards
  • Complete
  • Complete
  • Complete
  • Complete
  • Complete
2 2/24/19
  • (1/2 team) Share research of past projects
  • Establish ownership of Administrative and Technical Project Modules
  • Establish weekly team meeting time
  • Establish Team Slack usage Guidelines and Standards
  • Received CAN Transceivers
  • Create a Gantt chart to track project progress (Samir)
  • Create Git directory structure (Tristan)
  • Create a Bill of Materials (Samir)
  • Select and order an RC car (Bharath)
  • Push a file to Git Repository
  • Conduct research of project modules (based on ownership/sub-team)
  • Invite Preet to Gitlab
  • Complete
  • Complete
  • Complete
  • Complete
  • Complete
  • Complete
  • Complete
  • Complete
  • Complete
  • Complete
  • Complete
  • Complete
3 3/3/19
  • (2/2 team) Share research of past projects
  • Explore using Splitwise for managing project finances
  • Explore using Taiga.io for project management (Samir/Tristan)
  • Sub-teams share research and findings with each other and the team
  • Start planning what parts need to be ordered and update BoM
  • Email Preet regarding LCD screen for Bridge Controller
  • Interface with the HC05 Bluetooth module
  • Research frameworks for Android App development
  • Research GPS modules
  • Create a high-level system block diagram and control scheme
  • Develop a high-level plan interfacing with speed controller and servo controller
  • Select a PCB design tool (develop a sample board in KiCAD)
  • Test performance/specs of current Ultrasonic sensors and research others
  • Complete
  • Complete
  • Complete
  • Complete
  • Complete
  • Complete
  • Complete
  • Complete
  • Complete
  • Complete
  • Complete
  • Complete
  • Complete
4 3/10/19
  • Each team create a schedule for sub-system development and send to Samir
  • Set up Cygwin on Windows (and configure) Mac machines for auto-formatting
  • Finalize and purchase LCD screen for Bridge Controller
  • Learn to develop in Android Studio (watch tutorials and begin developing Android App)
  • Purchase Adafruit Ultimate GPS module
  • Selected KiCad as PCB design tool (develop sample PCB to help learn how to use software)
  • Purchase long-range distance sensors and select bump sensors
  • Complete
  • Complete
  • Complete
  • Complete
  • Complete
  • Complete
  • Complete
5 3/17/19
  • Established Git Repository Structure
  • Completed PCB design requirements
  • Selected PCB manufacturer
  • Completed high-level system block diagram
  • Complete
  • Complete
6 3/24/19
  • Ordered PCB
  • Successfully unit tested a JAVA module with JUnit (JAVA unit test framework)
  • Choose Android mobile phone/OS to load app onto
  • Interface with GPS and compass modules
  • Finalize high-level system block diagram and control scheme
  • Record how servo and DC motors react to RC Transmitter and Receiver feedback
  • Interface with with speed controller and servo controller
  • Complete
  • Complete
  • Complete
  • Complete
  • Complete
  • Complete
  • Complete
7 3/31/19
  • All parts have been ordered
  • Create button to launch mobile application
  • Integrate Google Maps into mobile application
  • Use feedback from GPS and compass to calculate bearing angle
  • LPC 1758 responds to feedback from motor speed sensor (reports RPM of wheels, when a PWM signal is applied)
  • Complete DBC CAN message format
  • Complete DBC CAN message format
  • LPC 1758 responds to feedback from bump sensor
  • LPC 1758 responds to feedback from Ultrasonic sensors (reports distance of objects in their detection radius)
  • Complete
  • Complete
  • Complete
  • Complete
  • Complete
  • Complete
  • Complete
  • Complete
  • Complete
8 4/7/19
  • Successfully get starting and destination coordinates
  • Transmit latitude and longitude coordinates as CAN messages to master controller
  • Master controller can send/receive CAN messages to/from all other controllers on CANbus
  • Complete sensor module code and push final revision to GitLab
  • Angle wheels left/right/straight based on CAN feedback from master controller
  • Complete
  • In Progress
  • In Progress
9 4/14/19
  • All modules have been fully assembled
  • Successfully integrate checkpoints into mobile app
  • Transmit heading and bearing angle as CAN messages to master controller
  • Completed implementation of speed control algorithm
  • Implement obstacle avoidance algorithm
  • In Progress
10 4/21/19
  • Complete first vehicle test drive
  • Send starting/destination coordinates to bridge controller
  • Send starting/destination coordinates as CAN messages from bridge controller to master controller
  • Design a feed back mechanism to adjust speed of DC motor using RPM sensor values for vehicular movement on the slope
11 4/28/19
  • Achieve full communication between all subsystems on the CANbus
  • Use GPS feedback to govern (motor behavior) car movement
12 5/5/19
  • RC car has been fully assembled and modules have been integrated
  • Complete integration of PCB and wiring harness


13 5/12/19
  • Resolve any remaining bugs or concerns
14 5/22/19
  • DEMO


BILL OF MATERIALS (GENERAL PARTS)

MICRO-CONTROLLERS

PART NAME

PART MODEL & SOURCE

QUANTITY

COST PER UNIT (USD)

  • Micro-controller
  • LPC 1758 (Purchased from Preet Kang)
  • 5
  • $80.00


RC CAR

PART NAME

PART MODEL & SOURCE

QUANTITY

COST PER UNIT (USD)

  • RC Car
  • 1
  • $205.99
  • Lithium-Ion Battery
  • 1
  • $74.95
  • Battery Charger
  • 1
  • $47.95


HARDWARE INTEGRATION PCB

Hardware Design

RUN DBC PCB layout.jpeg


The hardware integration PCB was designed with two goals:


1. Minimize the footprint of the onboard electronics
2. Minimize the chances of wires disconnecting, during drives


To accomplish these goals, all controllers were directly connected to the board's 34 pin header arrays, while all sensors were connected to the board, using ribbon cables and locking connectors. The master controller's header pins were inverted and then connected to a header array on top of the PCB, while the other controllers were mounted to the bottom. This guaranteed secure power and signal transmission paths, throughout the system.


The board consisted of 4 layers:


Signal
3.3V
5.0V
GND

Technical Challenges

Design

  • Balancing priorities between HW design and getting a working prototype
  • Finalizing a PCB design, when some components and module designs are not nailed down

Assembly

  • DB-9 connector for CAN dongle was wired backwards in the PCB design. Because there are several unused pins, we were able to just.
  • Spacing for headers with clips were not accounted for properly in the design. two of them are very close. It's a tight fit, but it should work.
  • Wireless antenna connector on master board not accounted for in footprint, it may have to be removed to avoid interference with one connector.


Bill Of Materials

HARDWARE INTEGRATION PCB

PART NAME

PART MODEL

QUANTITY

COST PER UNIT (USD)



CAN NETWORK

<Talk about your message IDs or communication strategy, such as periodic transmission, MIA management etc.>

Hardware Design

<Show your CAN bus hardware design>

DBC File

<Gitlab link to your DBC file> <You can optionally use an inline image>



ANDROID MOBILE APPLICATION

<Picture and link to Gitlab>

Hardware Design

Software Design

<List the code modules that are being called periodically.>

Technical Challenges

<Bullet or Headings of a module>

Bug Tracking

<Problem Summary> <Problem Resolution>

Bill Of Materials

ANDROID MOBILE APPLICATION

PART NAME

PART MODEL

QUANTITY

COST PER UNIT (USD)



BRIDGE CONTROLLER

Hardware Design

RUN DBC Bridge Sch.jpeg

Software Design

<List the code modules that are being called periodically.>

Technical Challenges

<Problem Summary> <Problem Resolution>



Bill Of Materials

BRIDGE CONTROLLER

PART NAME

PART MODEL

QUANTITY

COST PER UNIT (USD)

  • Bluetooth Serial Communication Module
  • 1
  • N/A


GEOGRAPHIC CONTROLLER

Hardware Design

The geographical controller, was responsible for providing the required directions, in order for the car to navigate from a fixed starting point, to a destination. the four primary feedback parameters, used by this module, were the latitude and longitude coordinates of the starting and ending locations, the heading (direction which the car is pointing) and the bearing angle (the angle between the heading of the car and the destination).

We employed an Adafruit MTK3339 Ultimate GPS module and the CMPS12 9DOF compass module, in order to obtain the heading and bearing angle.

The car's starting latitude and longitude coordinates, were calculated by the GPS and then transmitted over CAN to the bridge controller, which transmitted them to the Android phone, using bluetooth. Upon executing the RUN-D.B.C Android mobile application, the user was able to select a destination location, by placing a marker on the Google Map fragment. The app parsed the destination's latitude and longitude coordinates and then sent them to the bridge controller. This method allowed the geographic controller to use its pathfinding algorithm (Dikstra's algorithm) to calculate a path to goal, based on the starting location, destination and a series of pre-programmed checkpoints, along the path.


GPS Module

As stated before, we used an Adafruit MTK3339 Ultimate GPS module. An external antenna was integrated, in order to help parse the GPS data more efficiently. The GPS module used UART, to communicate with the SJOne board. The baud rate for the UART interface had to be initialized twice in the code: 9600bps at first and then 57600bps. This was because the GPS set its baud rate to 9600bps by default, but we required a higher baud rate.

The GPS module came with a GPS lock, which allowed it to use satellite feedback to parse its location. This lock was indicated by an LED, which illuminated once every 15 seconds. If no lock was found then the LED illuminated once every 1-2 seconds. The parsing of data from the GPS was in terms of NMEA sentences, each of which had a specific functionality. Out of the several NMEA sentences, $GPRMC was used. It provided essential information, such as latitude and longitude coordinates. The $GPRMC sentence is separated by commas, which the user had to parse in order to get useful data out of the module. The strtok() function is used to parse data from the GPS module, with comma(,) as the delimiter.

S19 RUNDBC.jpg

Geographic Controller Schematic

RUN DBC geo sch.jpeg


Software Design

<List the code modules that are being called periodically.>


Technical Challenges

<Bullet or Headings of a module>


Bug Tracking

<Problem Summary> <Problem Resolution>


Bill Of Materials

GEOGRAPHIC CONTROLLER

PART NAME

PART MODEL

QUANTITY

COST PER UNIT (USD)

  • GPS
  • 1
  • $69.13
  • Compass
  • 1
  • $32.89


MASTER CONTROLLER

<Picture and link to Gitlab>

Hardware Design

The master controller is primarily interfaced with the other controllers over CAN bus. The other main interface is control of the LCD display for debug data, which communicates over UART.

Software Design

<List the code modules that are being called periodically.>

  • LCD display
  • CAN read and send
  • Navigation
    • obstacle avoidance
    • steer to checkpoint

Technical Challenges

<Bullet or Headings of a module>

Bug Tracking

<Problem Summary> <Problem Resolution>

Bill Of Materials

MASTER CONTROLLER

PART NAME

PART MODEL

QUANTITY

COST PER UNIT (USD)



MOTOR CONTROLLER

<Picture and link to Gitlab>

Hardware Design

Software Design

<List the code modules that are being called periodically.>

Technical Challenges

<Bullet or Headings of a module>

  • We had to change the PWM driver to hard code the sys_clock frequency. We found solution.
  • Original encoder sourced is was designed to be a knob, not a motor encoder. The additional rotational resistance caused vibrations and resulted in it becoming disconnected from the motor shaft several times. The solution was to us a slightly more expensive encoder, designed for higher speed continuous operation on a motor.

Bug Tracking

<Problem Summary> <Problem Resolution>

Bill Of Materials

MOTOR CONTROLLER

PART NAME

PART MODEL

QUANTITY

COST PER UNIT (USD)



SENSOR CONTROLLER

Hardware Design

Part Number Quantity Location on Car Range Voltage Requirement Link
MB1000 LV-MaxSonar-EZ0 1 Front - Middle 6 in - 254 in (0.15 m - 6.45m) 3.3V https://www.maxbotix.com/Ultrasonic_Sensors/MB1000.htm
MB1010 LV-MaxSonar-EZ1 2 Front - Left
Front - Right
6 in - 254 in (0.15 m - 6.45m) 3.3V https://www.maxbotix.com/Ultrasonic_Sensors/MB1010.htm
Infrared Proximity Sensor - Sharp GP2Y0A21YK 1 Back - Middle 10 cm - 80cm 5V https://www.sparkfun.com/products/242

Image002.jpg

We put in a lot of thoughts on how sensors should be placed on the car. In order to facilitate easy adjustment of sensor direction, we incorporated circular grooves in the sensor bases so the mount left/right direction can be adjusted on the fly. The hinge of the sensor mount also allows sensors to be tiled up and down, together with the sensor mount, offering two degrees of freedom.

CAD Design

Picture on the left shows the hinge of the sensor guard can be adjusted to minimize the amount of interference between sensors.
Picture on the right shows the hinge of the sensor mount allows sensors to be tiled up and down.

SW001.gif SW002.gif

Placement for the Ultrasonic Sensors

We realized that when the sensors are turned on, the left and right sensors output ultrasonic waves that can interfere that of the middle sensor, even though we purposefully place them in different iterations of the periodic tasks. However, by placing the middle sensor on a higher ground, interference decreases. Moreover, by attaching two guard pieces on the left/right sensors we can further minimize the amount of interference between sensors. The integrity of sensor readings was rigorously tested with the guards to make sure they don’t lead to inaccurate readings for left and right sensors.

Software Design

Flowchart

Software003.png

Timing Diagram

Software002.jpg

Technical Challenges

Sensor Interference

We saw a lot of interference between the front 3 sensors. We were able to overcome the issue with both hardware and software tweaks:

  • Higher placement of middle ultrasonic sensor and interference guard for the left and right sensors
  • Instead of leaving the RX pin of the sensors unconnected, which causes the sensors to output ultrasonic waves continuously, we toggle the RX pin to turn off sensor ranging and only allow wave output when we need it. The periodic callback function is also written in a way that staggers sensor trigger and sensor reading in a way to ensure sufficient time before ADC read.

Power Deficiency

At first, when the sensors are tested as an individual module, everything is fine. However, when the modules are integrated towards the end of the semester, suddenly they all start to output erroneous data. After many hours of troubleshooting we realized that our power supply was not enough to power everything on the car. We fixed it by having battery with higher power output.

HR-04 unstable reading

At first, our left and right sensors are two HC-SR04 modules from Ebay. However when we tested them during obstacle avoidance we realized that they have very narrow range and can sometimes not see what is in front of them. As a result we switched to more expensive, but reliable Maxbotix EZ line of sensors.

The ADC module can only read 3.3V

Our middle sensor was having fluctuating readings that were very difficult to filter. After hours of testing we realized that we are connecting it to 5V supply but uses the ADC of SJone board to read distance value. As the ADCs of SJone cannot read above 3.3V, this is the reason for the erroneous data and after we switched the sensor to 3.3V supply, the problem disappeared.

Bug Tracking

Slow car response to obstacle due to large queue size (running average)

During our first try at obstacle avoidance we found that the car reacts very slowly to obstacles, even though the sensor update rate is 10Hz. Later we found out that the reason is because of our queue implementation. We used to have a very large queue to calculate running average. This filters out spikes but also means when an obstacle is detected it takes very long time for the running average to be updated.

  • Solution: Decrease the queue size and find median value instead of average to output to the master module.

Bill Of Materials

SENSOR CONTROLLER

PART NAME

PART MODEL

QUANTITY

COST PER UNIT (USD)

  • Bumper Sensors
  • 2
  • $18.98
  • Distance Sensors
  • 1
  • $40.17
  • Set Screw Shaft Coupler
  • 1
  • $11.98
  • Encoder
  • 1
  • $26.46


CONCLUSION

<Organized summary of the project>

<What did you learn?>

Project Video

Project Source Code

Advice for Future Students

<Bullet points and discussion>


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.