Difference between revisions of "F16: Spartan and Furious"

From Embedded Systems Learning Academy
Jump to: navigation, search
(Hardware Design)
(Sensor and I/O)
Line 411: Line 411:
 
*'''''[http://www.linkedin.com/in/bhushanmuthiyan Bhushan Muthiyan]<br> '''''
 
*'''''[http://www.linkedin.com/in/bhushanmuthiyan Bhushan Muthiyan]<br> '''''
 
*'''''[http://www.linkedin.com/in/kparameswaran Karthik Parameswaran]<br>'''''
 
*'''''[http://www.linkedin.com/in/kparameswaran Karthik Parameswaran]<br>'''''
 +
===SENSOR===
  
=== Design & Implementation ===
+
----
 +
 
 +
==== Design & Implementation ====
 
We are using Maxbotix LV-EZ Ultrasonic sensors (MB1000). The configuration of the sensor is 3:1 that is three sensors in the front separated by 60 degrees apart and one in the rear. The ultrasonic sensors mounted on the car are used to detect the obstacle on its route. These sensors are connected to the SJOne board and work with a 5.0V power supply. The SJ One board then sends the sensors message with the help of CAN bus.   
 
We are using Maxbotix LV-EZ Ultrasonic sensors (MB1000). The configuration of the sensor is 3:1 that is three sensors in the front separated by 60 degrees apart and one in the rear. The ultrasonic sensors mounted on the car are used to detect the obstacle on its route. These sensors are connected to the SJOne board and work with a 5.0V power supply. The SJ One board then sends the sensors message with the help of CAN bus.   
  
Line 432: Line 435:
 
Pin 7-GND- Return for the DC power supply. GND (& Vcc) must be ripple and noise free for best operation.
 
Pin 7-GND- Return for the DC power supply. GND (& Vcc) must be ripple and noise free for best operation.
  
=== Hardware Design ===
+
==== Hardware Design ====
 
The ultrasonic sensor is interfaced through GPIO, each sensor requires 2 pins, PW and RX, in addition to the two pins required for powering up the sensor. The PW pins for each sensor is configured as an interrupt.
 
The ultrasonic sensor is interfaced through GPIO, each sensor requires 2 pins, PW and RX, in addition to the two pins required for powering up the sensor. The PW pins for each sensor is configured as an interrupt.
 
The following table and figure shows the pin connections for all the sensors to the SJOne board.
 
The following table and figure shows the pin connections for all the sensors to the SJOne board.
Line 484: Line 487:
 
[[File:SNF_Ultrasonic_Mount.png]]  
 
[[File:SNF_Ultrasonic_Mount.png]]  
  
====Ultrasonic Sensor====
+
=====Ultrasonic Sensor=====
 
There are three ultrasonic sensors for the front of the car positioned at different angles to provide a wide ultrasonic "vision" for the car. The mount for the sensors was 3D printed such that we have the flexibility to change the angle of the sensor at a later stage when debugging the sensor.
 
There are three ultrasonic sensors for the front of the car positioned at different angles to provide a wide ultrasonic "vision" for the car. The mount for the sensors was 3D printed such that we have the flexibility to change the angle of the sensor at a later stage when debugging the sensor.
  
Line 516: Line 519:
 
Describe the challenges of your project.  What advise would you give yourself or someone else if your project can be started from scratch again?
 
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.
 
Make a smooth transition to testing section and described what it took to test your project.
 +
===I/O===
 +
 +
----
  
 
== Master Controller ==
 
== Master Controller ==

Revision as of 01:12, 4 December 2016

Project Title

Android Application controlled Self-Driving Car using CAN bus.

Abstract

This section should be a couple lines to describe what your project does.

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.

Team Members & Responsibilities

Schedule

Legend:

Motor Controller , Master Controller , Android Controller, Geo Controller, Sensor and I/O Controller , Team Goal

Week# Date Task Actual Status
1 9/17/2016
  • Purchasing RC car.
  • Purchased RC car.
Complete.
2 9/24/2016
  • Individual module distribution.
  • Project report setup.
  • Git setup.
  • Order components for individual modules.
  • Members identified for modules.
  • Wikipage project report template and Git were setup.
  • Ordered GPS module and CAN transceivers.
Complete
3 10/01/2016
  • Define scope of each module.
  • Determine Git flow.
  • Follow up on component procurement.
  • Determining and analyzing the duty cycle for servomotor and DC motor of the car.
  • Implement basic CAN communication CAN between two SJ-One Boards.
  • Initial flow of each module defined.
  • Identified the branches and decided on merge process.
  • Ordered additional ultrasonic sensors and LCD.
  • Tested the car servo and DC motor using Digital Oscilloscope.
  • Observed and noted the duty cycle wave forms .
  • Successfully tested CAN communication between two SJ-One boards.
Complete
4 10/08/2016
  • Create branches in Git
  • Follow up on component procurement
  • Basic testing of Servo and DC motor.
  • Testing speed of car with variable PWM.
  • Research on the CAN bus, tasks and scheduling.
  • Decision regarding flow of the master controller.
  • Download software for LCD
  • Created Master branch on Git
  • All ordered parts received by 10/07.
  • Implemented test code to interface SJOne board with a servo motor to control the direction and verified the same on the car.
  • Speed testing in progress.
  • Learnt about the working of CAN bus and decided on flow for the master controller.
  • Installed 4D System Workshop4 IDE (for LCD).
Complete
5 10/15/2016
  • Developing drivers for both motors.
  • Android app prototype.
  • Parse GPS data and format the data to be transmitted.
  • Decision making regarding various messages to be sent on CAN bus.
  • Design basic sensor algorithm for range finding.
  • Algorithm developed for both the motors.
  • Basic App Screen layout designed.
  • GPS latitude & longitude coordinates extracted from NMEA format.
  • Identified various messages for different nodes.
  • Designed basic algorithm for range finding.
Complete
6 10/22/2016
  • Define CAN signals for each module.
  • Testing the car with developed drivers.
  • Interface Bluetooth module with SJ-One board.
  • Implement source code and fetch Magnetometer reading.
  • Design of CAN bus hardware.
  • Test basic working for IR.
  • CAN signals along with their priorities identified (DBC file format generated).
  • Testing for developed motor drivers in progress.
  • Testing of Bluetooth interface in progress.
  • Implemented the Magnetometer source code, Testing in progress.
  • Tested for hardware integrity.
  • Developed algorithm for obstacle detection.
Complete.
7 10/29/2016
  • Fine tuning motor control code.
  • Transmitting and receiving messages between Android App and SJ-One board.
  • Test the extracted GPS data for consistency and check the update rate.
  • Basic interfacing of master controller with motor module.
  • Integrate IR sensor for gauging speed.
  • Testing in Progress for the motor control code.
  • Successfully established communication interface between app and SJ-one board
  • Latitude and Longitude parsed data tested, observed few NMEA strings with wrong checksum values.
  • Testing in Progress of the interface over CAN bus.
  • Developed algorithm for obstacle detection.
  • Speed sensing was delegated to motor team as suggested by Preet.
Complete.
8 11/05/2016
  • Integration of modules for first demo.
Integration and Testing completed for the first demo. Complete.
9 11/12/2016
  • Design of Feedback Control mechanism for car.
  • Initial algorithm development of GPS module for heading calculation.
  • Integration of master module with bluetooth module .
  • Develop LCD code for displaying all sensor information and car vitals.
  • Decide upon additional I/O such as lights.
  • Developed algorithm for motor feedback mechanism.
  • Initial algorithm developed for GPS heading calculation and tested.
  • Communication between bluetooth and master module established successfully .
  • Created project in Workshop4 IDE for all elements to be displayed by LCD.
  • Found UART commands to control each element in the LCD display.
  • I/O hardware was decided upon.
Complete.
10 11/19/2016
  • Speed synchronization of car using speed sensor and testing.
  • Interfacing Android controller with the GPS module
  • Algorithm for distance and heading calculation.
  • Coding and Calibration of GPS module.
  • Interface of master module with I/O module and testing to ensure predicted output.
  • Integrate sensor and I/O code.
  • Integrated speed sensor for calculating the speed and controlling motor speed.
  • Communication between I/O module and master module established successfully .
  • Algorithm implemented for distance and heading calculation.
  • Calibration of Magnetometer ongoing.
  • LCD code completed and sensors adjusted to work in tandem with obstacle avoidance logic.
Complete
11 11/26/2016
  • Testing and debugging for second demo.

  • Integration and testing complete for second demo.
Complete
12 12/03/2016
  • Fine tuning, debugging and integration.
  • Enhancing the UI of the android application
  • Integrate master controller with android module.
  • Develop kill switch mechanism.
  • Interface of master controller with GPS module.

In Progress
13 12/10/2016
  • Final testing and fine tuning
  • Report preparation

Parts List & Cost

Item# Part Description Vendor Qty Cost
1 SJ One Board (LPC 1758) From Preet 6 $480
2 RC Car Sheldon Hobbyist 1 $309.99
3 Accelerometer/Magnetometer LSM303 Adafruit 2 $40.00
4 Bluetooth Module From Preet 2 $0
5 CAN Transceivers From Microchip. 10 $0 (Free Samples)
6 Battery Pack From Sheldon Hobbist 1 $49.99
7 Ultra Sonic Sensor From Maxbotix 5 $91.15 (at 40% student discount)
8 LCD Display From Digikey 1 $94.21
9 GPS Module From Adafruit 1 $43.34
10 General Components From HSC electronics - $83.17
11 DC Current Sensor From Adafruit 1 $14.39
12 PCB From Amazon 1 $10.66
13 Corrugated Sheet for chasis From Home Depot 1 $6.74

DBC File

ECUs

Motor Controller

Group Members

Design & Implementation

The motor controller is responsible for generating the driving and steering action of the car. For this purpose, we have two types motors viz DC motor for driving and Servo motor which is used for changing directions of the car. The motor controller is also interfaced with a speed encoder for generating a feedback mechanism to automatically control and monitor the speed of the car. Our car came equipped with a Servo motor and brushed DC motor which is connected Electronic Speed Control (ESC).

Hardware Design

Motor Hardware Schematics
  • Hardware Specifications
    • 1. DC Motor
DC Motor

Our car came with Titan 12T 550 brushed motor and waterproof ESC. The ESC drives the DC motor based on the Pulse Width modulation (PWM) applied to it. The power supply required for this motor is 8.4 V. Maximum speed of upto 30mph can be achieved. The rotational speed is proportional to the EMF generated in its coil and the torque is proportional to the current.The main connection pins driving the motor are VCC,GND and the Control pin (PWM). The pin P2.1 of SJ-one board is connected to supply the required PWM to the motor. The basic working principle of DC motor is illustrated in the following figure : Since the preprogrammed controller has to be replaced by using our design ,the DC motor is then tested with Digital Oscilloscope for getting the frequency of operation and equivalent PWM values for full throttle condition in the forward as well as backward condition. It was observed from the waveform that the frequency of operation is 100Hz. The range of operational duty cycle is 10% to 20% with 15% being the neutral value or the stop condition. In order to accelerate the car a PWM value in the range of 15.6%-20.0% is applied. The 15.6 is the minimum pickup PWM that should be supplied in order to get the car moving at full load.

    • 2. Servo Motor
Servo Motor

The servomotor used in the car is #2056 a waterproof all weather-action and double the steering power as compared to standard servos. The servo motor is responsible for controlling the steering action of right or left by applying a suitable PWM pulse. The servo motor can be driven with 3.3 V power supply. The pin P2.0 of SJ-one board is connected to supply the required PWM to the motor. After testing the servo motor, we found that the frequency of operation is 100Hz and the operational duty cycle range is 10.0%-20.0% with 15% being the neutral value. For a full right deflection, we provide input PWM pulse ranging from 15.0-20.0% and for full deflection to the left we apply 10.0-15.0% of PWM.

Digital Oscilloscope readings for the motors.
  • 3. Speed Sensor

The speed feedback is monitored through the speed encoder which works on the Hall-effect principle. The Hall-effect speed sensor works as a transducer whose output voltage varies in response to the magnetic field. The sensor is mounted on the Spur gear instead of the wheel. The sensor would detect the rotation of axle. The motor controller would detect whenever the magnet is aligned with the sensor. This would generate a pulse. The pulse is detected in the form of rising-edge interrupt. This gives the wheel rotation count. The wheel rotates for every 1/4th rotation of the spur gear. The rotation count can then be converted to rpm to calculate the speed of the car.

Traxxas RPM Telemetry Speed Sensor.

Hardware Interface

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.

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

  • Wheel Alignment Error

Though the neutral value of PWM is 15% at which the servo is supposed to be aligned straight. In practice, however when we tested the car for straight run slight deflection towards right was observed when the PWM pulse width was set to 15.0 %. Thus, to correct this, we provided correction value of -0.98 giving a resultant PWM pulse width of 14.02%. Thus, we fixed the wheel alignment and obtained the desired straight path traversal.

Android and Communication Bridge

Group Members

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

Discuss your hardware design here. Show detailed schematics, and the interface here.

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

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.

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

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.

Geographical Controller

Group Members

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

Discuss your hardware design here. Show detailed schematics, and the interface here.

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

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.

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

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.

Sensor and I/O

Group Members

SENSOR


Design & Implementation

We are using Maxbotix LV-EZ Ultrasonic sensors (MB1000). The configuration of the sensor is 3:1 that is three sensors in the front separated by 60 degrees apart and one in the rear. The ultrasonic sensors mounted on the car are used to detect the obstacle on its route. These sensors are connected to the SJOne board and work with a 5.0V power supply. The SJ One board then sends the sensors message with the help of CAN bus.

The pin description of Maxbotix LV-EZ Ultrasonic sensors is as follows:

Pin 1-BW- Unused, leave disconnected or connect to circuit common ground.

Pin 2-PW- Digital Proximity Logic, outputs a High/Low logic voltage level depending on proximity detection. High means an object has been detected in the detection zone. Low means no object is present. There is a ~2.5 second delay on acquiring targets and a ~1.5 second delay for releasing a target once detected. This hysteresis improves sensor reliability.

Pin 3-AN- Unused, leave disconnected or connect to circuit common ground.

Pin 4-RX- This pin is internally pulled high. The LV-ProxSonar-EZ will continually measure proximity information and output send to data. Leave the pin disconnected or hold the pin high for proximity information. Hold low to stop all sensor activity and reset acquire timers. Upon returning to a high state, the sensor will initiate a calibration sequence.

Pin 5-TX- The TX output delivers asynchronous serial with an RS232 format, except voltages are 0-Vcc

Pin 6-+5V- Vcc – Operates on 2.5V - 5.5V. Recommended current capability of 3mA for 5V, and 2mA for 3V.

Pin 7-GND- Return for the DC power supply. GND (& Vcc) must be ripple and noise free for best operation.

Hardware Design

The ultrasonic sensor is interfaced through GPIO, each sensor requires 2 pins, PW and RX, in addition to the two pins required for powering up the sensor. The PW pins for each sensor is configured as an interrupt. The following table and figure shows the pin connections for all the sensors to the SJOne board. SNF Sensor schematic.png

Sr.No SJOne Pin Number Sensor Pin Function
1 P1.23 Middle Sensor PW
2 P 2.3 Middle Sensor Rx
3 P 1.28 Left Sensor PW
4 P 2.5 Left Sensor Rx
5 P1.22 Right Sensor PW
6 P 1.29 Rear Sensor Pw
7 P 2.7 Rear Sensor Rx


The figure below shows the design for the 3D mount for the front sensors.

SNF Ultrasonic Mount.png

Ultrasonic Sensor

There are three ultrasonic sensors for the front of the car positioned at different angles to provide a wide ultrasonic "vision" for the car. The mount for the sensors was 3D printed such that we have the flexibility to change the angle of the sensor at a later stage when debugging the sensor.

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

The readings from the sensor is taken in the form of PWM signals with the help of interrupts. The following steps should be performed to take readings and calculating distance from the sensor

1) Configure the PW pin of sensor as input.

2) Configure RX pin of the sensor as output and set it high.

3) Enable the Rising and the Falling edge interrupt on the PW pin of the sensor.

4) Start timer at the rising edge of the interrupt (time T1).

5) At falling Edge of the interrupt stop the timer (time T2).

6) The distance of the obstacle is = (T2-T1)/147 inches.

7) Apply average filter. That is take 3 readings of each sensor and perform average of it.

8) Send this average value in a 10Hz task on CAN bus to Master and IO controller.

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

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.

I/O


Master Controller

Group Members

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

Discuss your hardware design here. Show detailed schematics, and the interface here.

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

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.

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

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.

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

References

Acknowledgement

Any acknowledgement that you may wish to provide can be included here.

References Used

List any references used in project.

Appendix

You can list the references you used.