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.
This final effect is shown in the video at 4: 19.
1. Hardware ConnectionFirst 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.
The connection of this project is as below:
- Laser cut a rectangular hole in the four sides of the plastic shell respectively for installing the displays.
- 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.
- Install the displays.
- The sizes of the cutouts are determined by those of the displays, so they match perfectly.
- 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.
- Cut DuPont wires to a suitable length.
- Connect the 4 displays to ports 0-3 of the I2C Multiplexer respectively.
- Then connect the I2C port of the I2C Multiplexer to that of the ESP32-E main controller.
- Connect the battery to the corresponding port of the ESP32-E main controller.
- And connect the I2C port of the RTC module to that of the ESP32-E main controller.
- The overall view is as shown in the figure below
- 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.
2. Fix the tilt sensor inside the top cover of the shell at a certain angle with hot melt adhesive.
- And hook up the wires.
- Finally, assemble the top cover and the box, and fix them with the screws. Then all done.
Here a cube timer is ready for use. Touch the capacitive pin to start countdown. The preset countdown times of 5, 10, 15, and 20 minutes will be respectively shown on its four sides.
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, all ideas are welcome. Thanks for reading!
Comments