About the project
Autonomous car which can fast race alone on white track and can omit obstacles. Also it can react to some special patterns noticed on the ground.
Estimated time: 7 months+
Items used in this project
Software apps and online services
Hand tools and fabrication machines
- All repository we have is here:
It contains firmware, software and hardware directories.
All hardware contains 3D printed models and two PCB.
We used the chassis from Alamak
but we changed motors and all steering system.
b) battery holder
c) back with extra hole for second camera stick (second camera is not used now)
d) back panel
e) PIXY CAM holder with lens holder
f) encoder disc (for feedback how hast the car is moving)
g) main board with:
- double H bridge driver
- double wireless connectivity via Bluetooth (we can plug BT adapters directly to connectors and debug both processors)
- seven-segment display
- connectors for ultrasonic and laser sensors, encoders, servo, two line cameras (not used now) and PIXY CAM
h) laser sensors extension board with:
- connectors for six laser sensors
- PIXY CAM 2 connector (compatible with J2 connector on PIXY PCB board)
- connector for external LEDs
And all electric circuit is shown here:
2. Firmware, what we did so far
All source code is on github
CMake is used to control the software compilation process for three targets:
- MKV58 - main microcontroller
- MKL25Z - microcontroller responsible for obstacle detection
- x86 - GoogleTest library for testing algorithms
So we do not need IDE for compiling this project, in the simplest case, all is needed is a command terminal console. But we used MCUXpresso for creating basic peripheral source code e.g. timers, ADC, PWM.
Structure of project in lcp branch:
Just for fan and learn something new.
PID – let’s get what we really want to
Commonly known problem is that some mechanical parts often don’t act exactly like they should and so the motors do. We put some voltage on them counting on achieving some result, but motors final value differs from our expectation due to friction and strengths distribution during the motion. That’s why we have implemented PID regulator algorithm to reduce occurring error and always get the proper value of motors. Such algorithm uses output signal from optical encoders to get real value of motors, compares it with demanded one and performs some changes of controlling signal to bring real value as close as it possible to the assumed one.
PIXY CAM 2
In µVision IDE we redesigned some source code. Camera can detect black and white lines and communicate with main board. We got rid of given code for line detecting. We wrote our new, because it caused us less problems with calibration.
a) LPC PDF PARSER (lpc branch)
For PIXY, LPCOpen was not enough, we needed some CMSIS-like registers description. It took long time to write it on our way, so we created pdf-table parser using C# and .NET with Visual Studio.
Table like this:
just copy and click "PARSE" in LPC_PDF_PARSER and we have code like this:
b) MATLAB app for simple car control
4. Make Pixy great again
We also decided to rewrite PixyCam source code. In this project we only need to stream video via USB and detect edges to decide where the track is. Also we do not like using µVision IDE. For us better is CMake with C++20. We bought a LPC4330-Xplorer Board with the same microcontroller that is in Pixy.
Source code is on github in lpc branch and LCP directory (target):
We use LPCOpen library and old Pixy code. By now all pins are set, both cores (M4 and M0) are working and USB is properly working with PC.
5. First loops with new firmware
- fully implement obstacle detection
- design and print models for six VL53L0X
- rewrite the rest of Pixy source code
- finish and trim all algorithms
- design new main board with better H Bridges, build in VL53L0X connectors and Pixy connector