Last update: 11/27/2024
Authors:
- Clevant Yang
- Danny Wu
- Aria Mottaghi
TODO
- Background Information
- Tools Needed
- Get Started
- References
We are developing a device to assist drivers with parking, specifically in compact spots. This will be done with a LiDAR sensor that will map a 2D birds eye view of obstacles in front and to the side of the car. This map will then be displayed on a screen for the driver to see and make judgements accordingly while parking. The device will also detect empty parking spots to then measure the width and judge whether or not it is too compact to park in.
- PC with Windows 10 or later to upload code to ESP32, other platforms are not tested
Arduino IDE 2.x, download it here- Visual Studio Code, download it here
- Circuit Python, you can follow this instruction here, which is the same instruction for your VU Meter
- youyeetoo FHL-LD20 8 Meters 360 deg Lidar Sensor, you can find it here
- ESP32-S3 for wireless transfer data, we are using ESP-WROOM-32, you can find it here
- ESP Dev Board you built from ECE 196 earlier
A ESP32 screen, we are using this screen- An OLED screen, we are using this screen
- A suction cup to stable lidar on car, we are using this one
- A breadboard
- Cables and Wires, be aware the screen is using USB-C, ESP32 is using Micro-USB
Due to people are changing the ways to use their library or even change the syntax, USE THE EXACT VERSION OF LIBRARY IN ARDUINO IDE AS WE DO, library differences cause error such as too many arguments of a function or missing function prototype or blablabla and it's very hard to debug and extremely annoying.
Since the writer was annoyed by different tutorials using different version of library, different configuration, different IDE, different...This tutorial doesn't plan to throw a bunch of documentations and libraries on you without explaining what's the meaning of each line of code. I will explain what the code means to my greatest effort, giving you an overview to how the ESP32 wireless, display, and lidar work. I then will reference documentations and libraries I use for your interest if you want to look for more.
I assume you haved built the VU Meter using Circuit Python as this instruction, so you should have it installed and set up for the ESP32 you built earlier in class. You know how to let "CIRCUITPY" drive appear on your computer. Go to the drive, you can see there is a "lib" folder, this is the folder storing all the libraries we will use for Circuit Python.
To let the screen work, we need some libraries. Download Circuit Python libraries here, under "Bundle for Version 9.x", there should be a download link looks something like "adafruit-circuitpython-bundle-9.x-mpy-20241127.zip". Download it to somewhere you know on your computer. Find "adafruit_ssd1306.mpy", "adafruit_displayio_ssd1306.mpy", "adafruit_framebuf.mpy",
Unzip "adafruit-circuitpython-bundle-9.x-mpy-xxxxxxxx.zip", open the folder , there should be some folders and files, one of them is "lib" folder. This folder as its name suggests contains all the Circuit Python libraries, but we are not using all of them. Open the folder
First thing first. There are some changes and library needed. Open Arduino IDE, go to File->prefrences->Additional boards manager URLs, add this link, like this
There are some libraries are needed. Inside Arduino IDE->Library Manager
TODO
The lidar doesn't have a wifi, and we need to display sensor data coming from outside of the car. We need wireless transfer. So we will be using ESP-NOW. ESP-NOW is a wireless communication protocol defined by Espressif, which enables the direct, quick and low-power control of smart devices, without the need of a router.
The lidar will be sending 47-bytes hexadecimal data string, they are distance and angle of objects that your lidar detected. They can be represented in Polar coordinate, however, the screen use Cartesian coordinate, so we need to transform distances and angles to x and y axis.
menuconfig: Check Support for external, SPI-connected RAM, select Octal Mode PSRAM, this is because the screen has large PSRAM, writing to PSRAM will prevent it from rebooting. Flash size 8MB
Library needed: adafruit_ssd1306.mpy, adafruit_framebuf.mpy.
List any required downloads and installations here. Make sure to include tutorials on how to install them. You can either make your own tutorials or include a link to them.
List any tools and equipment you need here. (Ex, computer, soldering station, etc.)
Briefly introduce what you are teaching in this section.
- List the learning objectives of this section
Give a brief explanation of the technical skills learned/needed in this challenge. There is no need to go into detail as a separation document should be prepared to explain more in depth about the technical skills
- List the components needed in this challenge
Teach the contents of this section
Introduce the example that you are showing here.
Present the example here. Include visuals to help better understanding
Explain how the example used your tutorial topic. Give in-depth analysis of each part and show your understanding of the tutorial topic
List any sources you used, documentation, helpful examples, similar projects etc.