ESP32 Pocket Multi-tool

by Adrian Pol in Circuits > Microcontrollers

2304 Views, 24 Favorites, 0 Comments

ESP32 Pocket Multi-tool

20260626_075558.jpg
20260626_082829.jpg

I often find myself in a situation, where I need to measure temperature, distance or just compare how strong are the light in a room. That is why I decided to build this multitool. It features a photoresistor, thermistor, time of flight sensor (for measuring distance), passive buzzer for sounds, 1.8 inch tft lcd with 4 buttons, and an esp32-c3 supermini microcontroller. It also has some small fun games when you are bored.

Supplies

ESP32-C3supermini.jpg
1.8inchTFT.jpg
Photoresistor.jpeg
Thermistor.jpg
VL53L0X.jpg
buzzer.jpg
wires.jpg
resistor.jpg
PCB.jpg

Components:

  1. ESP32-C3 supermini
  2. 1.8 inch tft lcd ST7735S with 4 buttons
  3. Photoresistor
  4. Thermistor
  5. VL53L0X ToF sensor
  6. Passive buzzer
  7. Thin wires (I used 25AWG)
  8. 1 1kΩ resistor
  9. 2 10kΩ resistors
  10. Universal PCB

Tools:

  1. USB type C cable
  2. Soldering iron
  3. PC

Optional:

  1. USB power bank

Wiring

circuit.png

ESP32 pinout:

  1. GPIO 0: Photoresistor Analog Input
  2. GPIO 1: Thermistor Analog Input
  3. GPIO 2: Passive Buzzer Output
  4. GPIO 3: Buttons K2 & K3 (Resistor Ladder Input)
  5. GPIO 4: ST7735S TFT Screen SCK (SPI Clock)
  6. GPIO 5: Button K1
  7. GPIO 6: ST7735 TFT Screen SDA
  8. GPIO 7: ST7735 TFT Screen CS
  9. GPIO 8: VL53L0X sensor SDA
  10. GPIO 9: VL53L0X sensor SCL
  11. GPIO 10: ST7735 TFT Screen RST
  12. GPIO 20: ST7735 TFT Screen DC
  13. GPIO 21: Button K4

The ESP32-C3 supermini has a tiny footprint with only 13 exposed gpio pins. I didn't manage to fit photoresistor, thermistor, SPI screen, ToF sensor, buzzer, and 4 buttons to only 13 gpio pins. That is why buttons K2 and K3 share one gpio pin using a resistor ladder. When button K2 is pressed it pulls gpio 3 directly to ground and when button K3 is pressed it connects gpio 3 to ground through a 1kΩ resistor so the ESP32 can detect witch button was pressed. The 10kΩ resistors are there, so the photoresistor or the thermistor work as a voltage divider based on the sensors resistance the voltage on the gpio pin changes, so the ESP32 can detect the value.Other I2C sensors can be added since they can share the same lines just be sure to include a 4.7kΩ pullup resistor if the sensor doesn't have one included.

Code for the ESP32-C3 Supermini

code.png

When you launch the code it shows a menu with these categories and functions for each:

  1. Sensors:
  2. Display all sensor data (in graph or digital readout in real time)
  3. Photoresistor, displays light level as percentage from the sensor
  4. Temperature, displays temperature form thermistor in degrees celsius
  5. Distance, displays distance from Time of Flight sensor in centimeters
  6. Utilities:
  7. Periodic table of elements, shows all 118 elements with some information about them
  8. Constans, list of popular constants like pi, speed of light in vacuum, Planck's constant, and so on
  9. Unit converter, convert common units of distance, volume, velocity and so on
  10. Calculator, simple calculator with plus, minus, multiplication, division, and decimal numbers
  11. Wi-Fi scanner, scans nearby Wi-Fi networks and displays their signal strength
  12. BLE scanner, displays Bluetooth devices in range
  13. Stopwatch, can track time and store laps
  14. Counter Timer, set a timer and after set time a buzzer will alert you
  15. Games:
  16. Simon, simple memory game
  17. Dino, a copy of famous chrome dino game
  18. Snake, a copy of snake game on old Nokia phones
  19. Flappy bird, copy of flappy bird game
  20. Settings:
  21. Language, toggles between English and Czech
  22. Simon Speed, changes the speed of Simon memory game so it is easier or harder
  23. Sound, change to turn on or off sound that plays every time a button is pressed
  24. Brightness, does not work with this wiring BLK pin on lcd would have to be wired to gpio 2
  25. Temperature offset, adjusts the temp offset for thermistor readout value
  26. Colors/Themes, changes the color theme of the menu's (4options)


UI is controlled with 4 buttons:

  1. K1 for up
  2. K2 for down
  3. K3 for back (#)
  4. K4 for select (*)

Some settings and high scores in games are saved in rom so even when power is disconnected or MCU was restarted they will be saved. To erase all the data reflash the code in Arduino IDE but under tools set "Erase All Flash Before Sketch Upload" to enabled.

I am not this good at coding most of the code was generated using AI, don't give me credit for it.

Soldering

Picture1.jpg
Picture2.jpg
Picture3.jpg
Picture4.jpg
Picture5.jpg
  1. Lay all your components on the universal PCB to see how they would fit and mark the dimensions (picture 1)
  2. Cut the universal PCB to its size so all the components would fit (Picture 2)
  3. Put the components legs thought the holes on the PCB and bend then so they wont fall out when soldering (Picture 3)
  4. Start soldering all the components one by one and the jumper wires (Picture 4)
  5. Finish soldering all the components and wires (Picture 5)
  6. Check that you wired all the connection correctly according to the wiring diagram specially ground and VCC so you don't accidently destroy some components
  7. Flash your ESP32-C3 supermini with the code from step 2

Test and Future Upgrades

Now you can plug it into power and see if it all works!

For upgrades you could hot glue a power bank to the back of the PCB so it can work without any external battery. It is also possible to add other I2C sensors such as gyroscope or accelerometer. In the future I could add a micro SD card reader for storing long data logs or even images. This card can be powered with any USB type C source, you can even plug it into your phone for power so it is portable and can be used everywhere (if you carry your phone and cable). Thank you for reading my instructable.