Lemontree

Road traffic system based on esp32

 
Overview

Table of contents
mentioned earlier

  1. topic
  2. Function
  3. Material
  4. ESP32 hardware connection method
  5. Construction of mixly+Arduino+ESP32 development environment
  6. Use of mixly pins
  7. Use of mixly
  8. Use of mixly OLED modules
  9. Use of mixly paj7620u2 module
  10. The use of serial function in arduino
  11. Scene building
  12. Test Results

Said it in front

  • This project is actually done to complete the school competition. The program and writing may be a little bit unclear. Please correct me and criticize me.
  • The explanation is inevitably not detailed. If you don’t understand the parts, you can look at the code to understand.

1. Question

image.png

2. Function

  • The simulated scene is: a traffic road with pedestrian crosswalks, motor vehicle lanes, and corresponding traffic lights.
  • Traffic lights on lanes and sidewalks alternately flash on and off to indicate the passage of vehicles and pedestrians.
  • The OLED will display the passing or waiting time and icons of people and vehicles, allowing vehicles and pedestrians to judge whether they should pass by observing whether the icons flash (flashing means that they can pass).
  • Relevant personnel can make gestures to control the time changes of the traffic lights, including increasing or decreasing the time of 5 seconds and making the traffic lights full red or returning to normal to simulate pre-processing in an emergency.
  • At the same time, you can also communicate with the computer through the serial port.

3.Materials

  • Escinco's ESP32-C3-13U development board
    image.png
    image.png
    only costs 20 yuan and can be purchased on Taobao. It is cost-effective. Due to the school competition requirements, I had to choose ESP32 to use. But if you do not use Bluetooth and wifi, it is recommended to use the esp32 development board produced by Espressif Systems. There are some problems with this board of Essence.
  • OLED module
  • paj7620u2 module
  • dupont line
  • LED small light (red 2 green 2 yellow*1)

  • We picked the foam board directly from outside...

4.ESP32 hardware connection method

Because it was my first time using it and I wasn’t very good at it, so I used drawing software to do it...
Untitled-1.jpg

5. Construction of mixly+arduino+ESP32 development environment

There are several mainstream ESP32 compilation environments in the world, namely

  • ESP32-idf (Espressif's own IDE)
  • microPython
  • arduino
  • vscode-platformIO (actually arduino)

There are basically some tutorials on the Internet. I chose the Arduino compilation environment. Let’s talk about the other ones. I have never used the first two, but it seems that configuring the environment is too troublesome, so I abandoned them; vscode, needless to say, You can look for tutorials on the Internet; if you want to configure Arduino, you can watch the esp32 tutorial on station B. It mainly requires the files in the video and just follow the configuration in the video. If you have used vscode-platformIO and arduino, you will find that the ino file code of arduino is quite concise, and the header files are all placed in the running file.
As for why you should use mixly? Mixly is actually a graphical programming software that can display code internally. We chose it because we were a little confused at first using esp32 and didn't know where to start writing code, but mixly makes writing code much more intuitive. But mixly is just an auxiliary tool to help you write some simple codes. Some things that need to be configured by yourself (such as timers) still need to be written by yourself.
In the save as option, you can save the mixly file as an arduino file and use its code directly, because the code displayed on the mixly interface can only be viewed and cannot be copied.
The specific usage of mixly can be found online.
Another tip, because arduino was originally built for arduino development boards, domestic boards such as esp32 need to download some library files. Generally, when the program cannot run, an error will be reported during compilation. You can check the error message to see if there is anything missing. For header files, if there are any, just search and download them in the library options of Arduino.
If you want to burn a program in Mixly, I recommend a method. Go to the Mixly source file and you will find an arduino folder. In fact, an arduino is installed in it. If you don’t want to reconfigure it, just put your previous arduino. Just replace all the files.
It is highly not recommended to use mixly to burn programs directly. The first is that it is very slow. After all, it is a modular thing. The second is that it actually uses the built-in arduino to burn the program. It is better to export the ino file and burn it directly with arduino. Recording will be much faster.

6.Use of mixly pins

7.Use of mixly

8.Use of mixly OLED module

9.Use of mixly paj7620u2 module

As for these modules, you can learn them by groping around in Mixly. You can also check how to use them online.
It is worth mentioning that the paj7620u2 module is in the maker-arduino of the mixly library and needs to be imported into the library before it can be used.

10.Use of serial function in arduino

The reason why I discuss this separately is because the serial port function of this Essence board is really great.
When we tried to make two microcontrollers communicate through the serial port, we found that this board had a magical function. Whenever its RX was connected to TX (TX was fine, but RX was useless), the board would not move. We discovered this problem at that time and tried to use pin mapping (perhaps you have seen hardwareSerial, which is related to pin mapping), but of course it was useless, but this is actually our problem, pin mapping can only be used on ESP32 Above, the ESP32-C3 board still has too few functions. You can learn this from the development board documentation.

11. Scene construction

At the teacher's request, we built a very crude road model, which was made of discarded foam and foam board... The ESP32 board is hidden under the board. As shown in the picture below,
Picture 1.png
we also connected with the teacher's brother to create a gesture-controlled soft robot movement. , the video is below.
2.png
I also sought help from the graduate student in the laboratory and built a gesture-controlled simulated drone.
3.png
In fact, except for the first one, which was completely written by ourselves, the soft robots and drones actually send data to the computer through the serial port, and the subsequent execution programs were not written by us. If you need a simulation drone program, you can contact me via email.

12.Test results

Such as video

Thanks to Expert Wang for his contribution to this competition

参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-06-19 05:27:06

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号