Difference between revisions of "S17: ElectricBoard"

From Embedded Systems Learning Academy
Jump to: navigation, search
(Software Design)
(Software Design)
Line 313: Line 313:
  
 
[[File:CMPE244_S17_ControlFlowDiagram.png | 500px | thumb | center | Skateboard Control Flow Diagram]]
 
[[File:CMPE244_S17_ControlFlowDiagram.png | 500px | thumb | center | Skateboard Control Flow Diagram]]
 +
  
 
The LCD Screen is displayed using RemoteUI. RemoteUI includes "LCD/draw.hpp" and "source/LCD/pixel.h". It gets the data from screenQueue. Data will consist of power level, acceleration, connection status, and eBrake. The connection status indicates if the wireless communication of the skateboard SJ One Board is still active by sending constant pings and seeing if it replies. This is so that, with the implementation of the button to ''only'' respond when the button is pressed, the remote control can see if the system is still connected when it is not pressed.
 
The LCD Screen is displayed using RemoteUI. RemoteUI includes "LCD/draw.hpp" and "source/LCD/pixel.h". It gets the data from screenQueue. Data will consist of power level, acceleration, connection status, and eBrake. The connection status indicates if the wireless communication of the skateboard SJ One Board is still active by sending constant pings and seeing if it replies. This is so that, with the implementation of the button to ''only'' respond when the button is pressed, the remote control can see if the system is still connected when it is not pressed.

Revision as of 23:57, 18 May 2017

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.

ElectricBoard

Abstract

Transportation is a necessary part of everyday life, and it can be a stressful, time-consuming task. People are often looking for faster, cleaner, inexpensive, and more convenient modes for transportation. Considering the amount of traffic in urban areas such as San Jose, regular vehicles are not as convenient or quicker than other methods such as bikes or skateboards. However, cities like SJ are quite large college cities, so human-powered modes make it potentially tiring. Therefore, this project hopes to enhance these modes by creating electronic versions.

The goal of this project is to design an electric skateboard which can be controlled via a wireless remote. Two SJOne Boards with FreeRTOS will be used as microcontrollers to control both the remote control and motors.

Objectives & Introduction

The main objective of this project is to develop a user-controlled electric skateboard. In order to do so, the following will need to be done:

  • Design of motor control system
    • Appropriate motor controls and interfacing with Electronic Speed Controllers (ESC)
  • Design of remote control system
    • Button and analog linear slider inputs to determine motor powers
    • Thin Film Transistor Liquid-Crystal Display (TFT LCD) screen to display electric skateboard data
  • Establish wireless communication between motor control and remote control systems

Team Members & Responsibilities

  • Andrew Vo
  • Elton Leung
  • Eric Panganiban
    • Money Bag
  • James Grantham
  • Saketh Sai Narayana

Schedule

Week# Date Task Status Details Actual Date Complete
0 03/14 Finalize Project Proposals Completed Project Proposal Finalized. 03/14/2017
1 03/21 Finalize Bill of Materials/Design Schematic Completed BoM finalized. Design schematic completed. 03/25/2017
2 03/28 Order Parts/Components Completed Kit ordered 3/22. LiPo and Charger ordered 3/30. Personal longboard to be used. 03/30/2017
3 04/04 PCB Design/Order Completed PCB designed 04/07. PCB received 5/11. 05/11/2017
4 04/11 Assembly of Components Completed Will not be using housing. All parts mounted by velcro tape. 05/10/2017
5 04/18 Motor Control Implementation Completed Use PWM pin 2.0 on board. 04/20/2017
6 04/25 Remote Control Implementation Completed Using pin 2.6 for button and pin 0.26 for analog slider. Screen to be implemented later. 04/25/2017
7 05/02 Testing/Debug/Troubleshoot Completed Need to improve wireless communication range. Max motor velocity causes instability. 05/08/2017
8 05/09 Fine Tune
9 05/16 Prepare for Demo/Complete Report In Progress Report began 05/13
10 05/23 Project Demo

Parts List & Cost

Part Name Cost Qty Comments
SJOne Board $80.00 2 Microcontrollers used for communicating between remote control and skateboard
Nucbot Motor Kit $369.00 1 Includes Motors, wheels, and ESC
LiPo Batteries $43.00 1 Rechargeable battery to power ESC/motors
LiPo Balancer/Charger $62.99 1 Charge LiPo batteries
PCB order $30.00 1 Battery charing for Remote Control
Skateboard $100.00 1 Longboard used.
Velcro mounting $8.99 1 Mounting components onto bottom of longboard
Button $1.99 1 Press to send motor driving percentage.
Analog Slider $1.99 1 Slide to adjust power to drive motors.
TFT LCD Screen $15.00 1 UI display for remote control

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.

There are two subsystems to consider for hardware design: the motor controller and the remote control.

Motor Controller

The main hardware components for the electric skateboard consist of:

  • SJ One Board
  • Electronic Speed Controllers (ESCs) x2
  • Brushless Wheel Hub Motors x2
  • 6S 3300 mAh 22.2V Lithium Polymer (LiPo) Battery
  • 2-AA Battery Pack
  • Force/Pressure Sensor

The main micro controller used for the skateboard portion was the SJ One Board. It is connected directly to the ESC's, which are then directly connected to the motors. The board also connects to pressure sensor as an additional feature to aide in controlling the skateboard. However, the ESC's and SJ One Board are powered separately. The SJ One board is powered via the 2 pack AA batteries, while the ESC's use the 6S 3300 mAh 22.2V Lithium Polymer (LiPo) Battery. The wire configuration can be seen in the figure below:


Skateboard Top Level Connection
Remote Control

The main hardware components for the electric skateboard consist of:

  • SJ One Board
  • Slider Switch
  • Button
  • NiMH Battery
  • Power Printed Circuit Board
  • TFT LCD Screen


Remote Top Level Connection

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.

Electric Skateboard
PIN number Function Component
P2.0 PWM ESC's
P0.1 GPIO Force Sensor


Skateboard Circuit
Remote Control
PIN number Function Component
P0.26 ADC0.3 Slider Switch
P0.0 GPIO Button
P2.0-2.7 GPIO TFT LCD Screen Display
P1.28-P.31, P1.33 GPIO TFT LCD Screen Controls

The main components used for the remote control were a slider switch, a button, and a TFT LCD Screen for UI. The slider switch is an analog signal, which requires an ADC pin to be used for the input. The button can be a GPIO, which will read when the switch is activated. The TFT LCD Screen uses pins 0-7 on port 2 for the display, and pins 28-31 and pin 33 on port 1 for the control signals.

The slider switch would control the speed of the skateboard by varying resistance, while the button would be used to initiate that change. The speed can only be changed once the button is being held. If the button is not held, the speed will default back to zero. This use was to limit communication between the boards, and thus, lower power consumption as well. For this instance, an ADC pin and a GPIO pin were needed for both the slider switch and the button, respectively. A diagram of the connections can be seen in the Figure below:


Remote Circuit


Once the button is pressed, it would activate an interrupt, which would immediately send the signal of the slider into a queue to communicate with the SJ One Board on the skateboard to control the motors. To send the information via wireless communication, the nordic wireless API ("wireless.h") was used. This is a wrap-around for "mesh.h".

TALKS ABOUT SCREEN

TALKS ABOUT PCB BOARD

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.

There are X main files that runs this project: RemoteControl, ElectricBoardControl, and ElectricBoardReceiver, and RemoteUI (and ElectricBoardSend?). RemoteControl continuously checks to see if the button is pressed. If so, there is an interrupt that activates and starts to calculate the appropriate power level given from the slider switch, and sends it out to ElectricBoardReceive. This signal is sent out in two ways: one goes through the screenQueue data where the TFT LCD screen is reading the information from, and one is through the wireless network API so that the SJ One Board on the skateboard can obtain the data. ElectricBoardReceiver simply handles the packet coming from RemoteControl via wireless communication, and reads the data to send to the driveQueue. The queue is then seen via commandQueue by ElectricBoardControl, which reads the power level, calculates duty cycles from the power level, and controls the motors to run accordingly.


Remote Flow Diagram


The diagram below shows the flow of the ElectricBoardReceiver and the ElectricBoardControls (And RemoteUI?). The ElectricBoardReceiver continuously checks to see if there is a packet available via the Nordic wireless communication. Once the packet is received successfully, the packet is then parsed to get the appropriate data (such as powerLevel, acceleration, and eBrake). eBrake is simply a bit that indicates if the Force Sensor if stepped on. If so, the skateboard should begin to decelerate(?). After parsing the data, it will be sent to the ElectricBoardControl and RemoteUI separately. This is so that the ElectricBoardControl can change the speed of the skateboard given power level (needs to be converted into duty cycle), and the RemoteUI can display the statistics into the TFT LCD screen.


Skateboard Control Flow Diagram


The LCD Screen is displayed using RemoteUI. RemoteUI includes "LCD/draw.hpp" and "source/LCD/pixel.h". It gets the data from screenQueue. Data will consist of power level, acceleration, connection status, and eBrake. The connection status indicates if the wireless communication of the skateboard SJ One Board is still active by sending constant pings and seeing if it replies. This is so that, with the implementation of the button to only respond when the button is pressed, the remote control can see if the system is still connected when it is not pressed.

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.

  • Connect sensors and switches connect to the SJ One Boards
    • Ensure that the Slider Switch and Button are configured correctly to SJ One Board for Remote Control
    • Ensure that the Force Sensor are configured correctly to the SJ One Board for Skateboard
    • Ensure that the connections for TFT LCD Screen is correct for Remote control
  • Calibrate and verify signals of the ESC's using oscilloscope to turn on motors correctly
    • Should be able to get frequency to turn on/off motors via ESCs
    • Should be able to get duty cycles to change the speed of the motors
  • Establish wireless communication
    • Know how to send data
    • Know how to parse the packet

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:

Hardware Mounting

Most electric skateboards have a housing which encases the LiPo battery, ESCs, and receiver that are necessary to be mounted onto the board. However, all commercially available housings for skateboards were too small for the components ordered. This is mainly due to the size of the LiPo battery. The LiPo battery being used for this project is not one typically used for electric skateboards. It is very thick compared to the ones that are used for electric skateboards. Velcro mounting tape will be used instead of the housing enclosure for this project because it has a strong enough hold and can easily be removed without damaging the equipment. This is only being used as a temporary solution until a thinner LiPo battery can replace the existing one and an appropriate housing enclosure can be ordered.

Electronic Speed Controllers

The electronic speed controllers (ESC) were ordered as part of a kit. However, no specification sheet or documentation came with the ESC's. ESC's usually receive and interpret an input PWM signal to drive motors at a specified speed. The duty cycle of the PWM signal required by the ESC's to drive the motor was unknown. We requested a data sheet for the ESC's from the company that we ordered from but there was no response.

An existing wireless receiver and remote came with the kit as well, but, for this project, we wanted to design and implement our own remote control. The output of the wireless receiver was observed with an oscilloscope after connecting these two components to the board. From the oscilloscope readings, proper PWM signals were determined for an idle state, maximum velocity state, and maximum reverse velocity state for the ESC's.

Wireless Communication Range

The electric skateboard and wireless communication were initially working. However, with further testing, it was found that the wireless communication was unstable for the nordic wireless chip on the SJ One board for distances over approximately 3 feet. The data transfer rate was lowered to 250 kB/s from 2000 kB/s which increased the wireless communication distance to about 4 feet. However, we wanted a much more stable connection so antennas were added.

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.