Make Sports Push Buttons With ESP32-C3 to Get You Moving

by Jaychouu in Circuits > Electronics

2943 Views, 39 Favorites, 0 Comments

Make Sports Push Buttons With ESP32-C3 to Get You Moving

封面图.png
QQ图片20221118100326.png
How to Create A Sports Button - Beetle ESP32 - C3
C3yy2.gif

Story

Push buttons, also known as tactile switches, can be found everywhere from simple lamps, doorbells to large industrial machines. There are so many kinds of push buttons, but I like the arcade push buttons most because they usually have a great tactile, "clicky” feel. I have several arcade buttons in my toolbox, and I always want to make something with them. Lately, I've been working out. One day an idea comes to my mind, can I turn my arcade buttons into a device that helps me do sports? Sounds not bad. I decided to give it a try.

Thoughts

I am going to make 4 sports push buttons, one as a master node with a screen that supports a menu display and the other three as salve nodes. They are all based on ESP32-C3, a micro Beetle controller from DFRobot. It integrates a battery charging management function, which allows us to connect a lithium battery to it as a mobile power supply for the project, or charge the battery from the controller's USB-C port when the battery is low. Also, to make them more interactive, I will add some sound and lighting to the push buttons. 

It looks like the figure above in the end. 

Supplies

ESP32-C3 × 4

OLED Display × 1

Digital Buzzer × 4

WS2812 RGB LED Strip × 1

3.7V battery × 4

Arcade Push Button × 4

Power Switch × 4

Case × 4

Hardware Connection

电路图2(1).png

The master node comes with a screen while the slave nodes do not. All parts should be connected as the diagram below.

Buzzer -> Controller’s P6

Button -> Controller’s P5

WS2812 -> Controller’s P0

Screen->I2C

Solder and Connect

QQ图片20221116142239.png
QQ图片20221116142235.png
QQ图片20221118152350.jpg

1. Cut four LEDs from the ws2812 RGB LED strip, and solder one LED to Beetle ESP32-C3. GND goes to GND, VCC to VCC and signal to pin 0.

2. Solder 3.7V lithium battery to C3 controller.

3. Connect the screen and buzzer to the ESP-C3 controller through its Gravity connectors. 

Laser Cut the Case and Assembly

QQ图片20221116140350.png
QQ图片20221116140354.png
QQ图片20221117090608.png
QQ图片20221117090612.png
QQ图片20221118152820.jpg
QQ图片20221117101125.png
QQ图片20221117101129.png
QQ图片20221121100315.png
QQ图片20221117101042.png
QQ图片20221117101045.png
QQ图片20221117090627.png

4. Use a laser cutter machine to cut out the holes in a plastic case for installing a type-C port, display, switch, and button.

5. Install the arcade button. 

6. Attach the power switch, and screen to the case. 

7. Fix the battery, buzzer, and Beetle ESP32-C3 inside the case with a hot glue gun. 

8. And put the cover on and tighten the screws.

Now a sport button of the master node has been done. Repeat the steps above to complete the other three salve nodes. (The salve nodes do not include screens).  

Upload Program

QQ图片20221118143430.png
QQ图片20221117101747.png

Download the codes at https://github.com/DFRobot/SportsButtonESP32C3

Since the master node communicates with the slave nodes by ESP-NOW in this project, the only MAC address of each ESP32-C3 should be obtained so that the master knows which device the message is intended for. 

Revise the MAC address to yours and upload the program.

Start to Play

QQ图片20221118111351.png
C3yy1.gif
C3yy3.gif
C3yy6.gif
C3yy5.gif
C3yy4.gif
QQ图片20221117162306.png
C3yy7.gif

In the program, I set three modes for the buttons. Short press to select mode, press and hold for 2 seconds to confirm or enter the selection menu.

Mode 1- Whac-A-Mole

In this mode, all 4 buttons show green light at first, then one of them changes to red randomly, and we need to hit the red one within a certain time to score. They can be played in various ways.

Mode 2- Relay Race Mode

In this mode, hit the first button, then the second will light up green. Just like a relay race, the green light acts like a baton, which will be transferred one by one among four members repeatedly.

Mode 3- Random Picker Mode

When entering this mode, 4 buttons repeatedly show blue light in order, hit the main button(button with screen), and this time the button whose light turns on in blue will be the picked one. 

Or you can only use one button to test how high you can jump. 

ESP-NOW Delay Test:

QQ图片20221117103609.png

In the project, the master communicates with the salves by ESP-NOW. To ensure that the NOW protocol meets the communication requirement, here I completed a simple ESP-NOW delay test to record the time one node transmits a message to another and receives a replay. It can be seen that the total delay for transmitting and receiving is about 4ms, which means only a 2ms delay for one-direction transmission, equaling to 1/100s.

Well, that's all for this project. There are so many possibilities for these sports push buttons. Come and try your sports buttons! 

Thanks for reading, feel free to leave your opinion about this project.

Codes are here: https://github.com/DFRobot/SportsButtonESP32C3