Fast And Furious

About the project

We are two Master-Students at the University for Applied Sciences in Landshut, Germany and we want to participate at the NXP Cup with our car named Gustl. This Electromaker-project contains the development and building process of our autonomous driving model car. We're trying to get a place on the podium at the next NXP Cup.

Project info

Difficulty: Difficult

Platforms: DFRobotNXPhttps://www.mouser.com/Arm

Estimated time: 5 months

License: GNU General Public License, version 3 or later (GPL3+)

Items used in this project

Hardware components

DFRobot ROB0165 DFRobot ROB0165 Chassis with brushless motors and servo x 1
NXP OM13098: LPCXpresso54628 NXP OM13098: LPCXpresso54628 Development board x 1
Vishay O128O064JLPP3N000 Vishay O128O064JLPP3N000 OLED display x 1
Several Custom 3D Printed extension components Several Custom 3D Printed extension components Bumper, side skirts, several fastenings etc. x 1

Software apps and online services

NXP MCUXpresso IDE, SDK NXP MCUXpresso IDE, SDK Software development toolchain
FreeRTOS FreeRTOS Realtime operating system running on MCUs
BLHeliSuite BLHeliSuite Software for configuring motor controllers (ESCs)

Hand tools and fabrication machines

3D Printer 3D Printer x 1
Drill Drill x 1
Several Screwdrivers Several Screwdrivers Hexagon, Phillips, Pozidrive... x 1

Story

NXP Cup

The NXP Cup let students get creative and design autonomous race cars to compete with each other.

The cup has 5 different challenges whereby only the timed race is mandatory:

For more information about the cup visit https://community.nxp.com/groups/tfc-emea.

About us

Matthias and me, Christian are master students of electronics engineering at the University of Applied Sciences Landshut, Germany. We both graduated as bachelor of engineering this year. The participation at the NXP Cup is also our compulsory project for the first master's semester. We are using some parts for our project from our predecessor to save time and to be able to focus on our own goals.

Goals

-  Take part in the NXP Cup and make it onto the podium

- Develop an easy understandable code

- Be as fast as possible

- Gain more experience with real time operating systems

- Gain more experience with programming MCUs

Concept

At the beginning, the vehicle will be assembled using the  DFRobot ROB0165 kit. The code will be put together from existing previous projects and will be optimized. The major focus is on a clearer structure of the code and a better traceability through commenting on the code. The coding will be done piece by piece, starting with the control of the BLDC-Motors. When the motors are finally running and the speed can be varied via the pulse-width modulation the next part which will be programmed is the steering. When the car is able to  set different steering angles the display will be programmed. After implementing the Car Control Menu the next step will be the camera for detecting the road. The last step will be the ultrasonic board for detecting obstacles on the road.

BLDC-Motors

The two BLDC motors for the car are both controlled by an ESC (electronic speed control). The ESC needs the batteryvoltage as power supply and a PWM signal (pulse width modulation) with a pulse width of 1ms to 2ms and a period time of 20ms (50Hz). At fist we thought it would be easy and we only had to set a timer for pulse width modulation. But we were wrong.

Startup sequence:

The ESC needs a PWM start sequence to detect the pulse width for full speed and zero speed. The following figure shows the startup sequence which the ESCs need. When the power supply of the ESCs is switched on the BLDC Motor beeps three times (low tone, middle tone, high tone). Then the ESC needs to detect the PWM signal. When detected the motor beeps once (low tone). After that the PWM signal must briefly have a larger pulse width before it is again reduced to the value for zero speed. After detecting the zero throttle value the motor beeps the fifth time (high tone) and any throttle value can be set.

However, the theory could not be implemented in practice because we didn't know the settings for the high and low PWM-signals in the ESC. We tried the sequence "PowerOn (3 beeps following) --> 1ms pulse width for 2s (1 beep following) --> 1.5ms pulse width for 2s --> 1ms for 3.5s" but there was no fourth beep. Nothing we did was helpful.

At the end we had to configure the ESCs because we didn't knew the standard settings. The documentation of the ESCs is unlikely very bad. We carried out the configuration of the ESCs via the BLHeliSuite. The following figure shows the parameters and their values ​​that we have set.

We set the low value of the PWM pulse width to 1100µs and the high value to 1900 µs. The start sequence we are using is  "PowerOn --> 1ms PWM for 2s  --> 1.5ms PWM for 2s --> 1ms PWM for 3.5s". The start sequence is working, all five beeps can be heard. The PWM pulse width times for full throttle and zero throttle are 1.9ms and 1.1ms. The problem with 1.1ms is that the generated PWM signal is not as precisely as wanted. So the PWM pulse width for zero throttle has to be a little below 1.1ms.

Coding:

The coding of the vehicles drive system is contained in two files, the "drive.c" and "drive.h" (see attachement). The file "drive.c" contains the Timer initialization for the PWM signal and the startup sequence. "drive.h" contains the parameters for the initialization, the parameters for full and zero throttle and the function prototypes.

Steering

For the steering of the vehicle we are using the servo motor of the  DFRobot ROB0165 kit. A servo is controlled with a PWM signal just as the BLDC motors. The pulse width is also between 1ms and 2ms. While testing the servo we found out that you can also set less than 1ms or more than 2ms for the PWM pulse width. This helps to achieve the maximum possible steering angle. The middle value (about 1.5ms) corresponds to zero degree steering angle. Because the kit is not manufactured very precisely, we determined the value for the middle position by trying out. The result was 1.486ms. The maximum amounts to 2.08ms and the minimum to 0.91ms (under minimum or over maximum --> Hardware Crash).

Coding:

The coding of the vehicles steering system is contained in two files, the "servo.c" and "servo.h" (see attachement). The file "servo.c" contains the Timer initialization for the PWM signal and a demo task. "servo.h" contains the parameters for the initialization, the parameters for minimum, maximum and zero steering angle and the function prototypes.

HMI

Camera

Ultrasonic Board

Speed Measurement

Lane Keeping Control

CAD, enclosures and custom parts

Controller mount

This is the mount for the development board

ESC mount

This is the mount for a motor controller (ESC)

HMI mount

This is the mount for the HMI board

Front bumper top

This is the top part of the Front bumper

Side skirts

These are the side skirts which are also used as battery pack mount

Display cover

This is the cover of the display

Single PCB mount

This is the mount for the power PCB

Ultrasonic board mount

This is the mount for the ultrasonic board

HMI button

This is the button for HMI control

Camera mount camera

This is the part of the camera mount which is attached to the camera

Camera mount pole

This is the part of the camera mount which is attached to the pole

Front bumper bottom

This is the bottom part of the front bumper

Battery pack mount

This is the mount for the battery pack

Code

Github project link

This is the link to the github project hosting the code fopr this NXP-Cup project: https://github.com/CEcker94/NXP_Gustl_SumEck

servo.h

This file contains the parameters for minimum, maximum and zero steering angles and the function prototypes

drive.h

This file contains all parameters for the initialization, the parameters for full and zero throttle and the function prototypes

servo.c

This file contains the timer initialization for the servo's PWM signal and a demo task

drive.c

This file contains the initialization of the vehicles drive. In addition to the timer initialization for the PWM signal, the startup sequence is also included.

Credits

Leave your feedback...