Have you ever counted how much time you spend on your phone a day? I counted and the result shocked me. I cannot even remember the last time I truly focused on sth without looking at my phone for 2 hours. I realized that my phone impairs my ability to concentrate, so I really need a tool that can keep me reliably distraction-free. I searched online and found that timing is a good idea. It is said that when people understand that there's a tangible end to whatever they're doing, they will be able to focus on that one activity better. This inspires me why not make a timer? And I happened to have four OLED displays so I decided to make a cube timer with different time durations displayed on each of its four sides.
But here comes a problem. The display communicates with the MCU via the I2C port, and the devices can't be connected to the same I2C port and thus share the same address due to address conflict, otherwise, they can't communicate with each other normally. Now the ESP32-E controller has only one I2C port, and even with an expansion board, there are only three, which cannot suffice for four displays.
This time an I2C Multiplexer will just come in handy.
This final effect is shown in the video below(at 4: 00)
Hardware Connection
Assembly
1. Laser cut a rectangular hole in the four sides of the plastic shell respectively for installing the displays.
2. Generally, we need to cut at least 2 times to cut a thick plastic successfully. Multiple cuttings may lead to the edge-curl phenomenon, so here I used a utility knife to trim the kerf edge.
3. Install the displays.
4. The sizes of the cutouts are determined by those of the displays, so they match perfectly.
5. Attach and fix a 3M single-sided adhesive foam tape on the back of the displays respectively to avoid a short circuit caused by hardware touching.
6. Cut DuPont wires to a suitable length.
7. Connect the 4 displays to the ports 0-3 of the I2C Multiplexer respectively.
The I2C Multiplexer solves the address conflict on I2C port and enables normal communication with multiple same-address I2C devices.
8. Then connect the I2C port of the I2C Multiplexer to that of the ESP32-E main controller.
9. Connect the battery to the corresponding port of the ESP32-E main controller.
10. And connect the I2C port of the RTC module to that of the ESP32-E main controller
11. The overall view is as shown in the figure below.
12. Solder the capacitive touch pin (D12) of the main controller with one of the screws on the shell, so that the screw can be used as a touch sensing button.
13. Fix the tilt sensor inside the top cover of the shell at a certain angle with hot melt adhesive.
14. And hook up the wires
Finally, assemble the top cover and the box, and fix them with the screws. Then all done.
You may find that the title sensor is not used in this project, that because I made two versions for this project. One is the cube timer stated above, and the other is a clock box with four types of information shown on the displays: countdown, time, date, and motto. The tilt sensor is used to set countdown time and the capacitive touch pin is used to switch on/off screens. And these functions are still included in the codes.
Problem during the making:
When all finished, I just found that the timer has no response to the touch button, but it works fine in the test before assembly.
I thought maybe there was a short circuit between parts, so I attached the 3M foam tape to them. But the problem remains.
Then I guessed maybe the circuit connections went wrong, so I re-connected and got all connections right.
Sadly, the problem still exists.
After many tests, the problem disappears when I replace the capacitive touch button with a general one. It turns out there is something wrong with the capacitive touch button.
For the touch pin, the touchRead() function returns the value of about 10 when mains-powered and returns about 30 when battery-powered.
Still, there are things to be improved in this project, feel free to leave your comments. Thanks for reading!