As a student, I often struggle with dividing portions of my time to focus on certain assignments. While I found use in online timers, nearly all became distracting over time as I disliked that they had to display on the same screen that I was using to work.
This project is an effort to solve this issue by converting the timer into a portable physical object. The timer is enclosed in a custom 3D-printed case 3.3 inches in length, 2.4 inches in width, and 2.7 inches in height. To create a bright display, a 0.96” OLED screen is used to show the countdown, powered by an Arduino Nano. In addition, a rotary encoder is included to allow a user to easily set the duration of their work or study session.
Through this device, myself and students alike can improve their academic productivity and time management.
How It Works:Upon plugging in the project to a 5V USB power source, it will show a short title screen.It will then display and start a countdown with a time of 25 minutes.
The project's main functions can be accessed by pressing the encoder knob multiple times.
1 press: pause the timer
2 presses: allow a user to adjust the "minute" value by turning the encoder clockwise or counterclockwise
3 presses: allow a user to adjust the "second" value by turning the encoder clockwise or counterclockwise
4 presses: prompt user if they wish to return to the countdown
5 presses: resume the timer
Once the countdown completes, it will display "study time complete!" and automatically pause the timer.
Reason for Name:The project's name was inspired from the Pomodoro Technique, a time management strategy which involves 25-minute intervals of work separated by 5-minute breaks.
Step 1: Coding the Timer1.1: Time Setting Mechanism
I began the project by building the programming needed to display objects on the OLED screen. I decided on using an OLED screen over an LCD because of the screen resolution.
I then constructed code to respond to a user turning and pressing the encoder knob.
Since I use the encoder knob as a button, I decided to develop a system that eliminates button bouncing. It was done with the use of the millis() function to separate the responses for button pushes into intervals of 50 milliseconds. More details on millis() are listed later in the project.
Following this, I restructured my programming to fit the encoder logic into multiple interrupts. Two such interrupts, minuteTurnSensing() and secondTurnSensing(), operate on a series of simple if statements.
The first statement compares the states of variables "currentStateClick" and "lastStateClick". As "currentStateClick" is always updated with a new value from "CLK" before "lastStateClick", the button is always in a responsive state.
The second statement compares the value of "DT" to "currentStateClick". This line of code allows the program to register the direction in which the encoder knob is turning.
1.2: Formatting the Timer
I designed the layout of the countdown screen to resemble a standard digital stopwatch. While programming, I discovered that the 0.96" OLED screen could only display 10 characters per line. As a result, all of the text in the project is very simple.
1.3 Countdown Mechanism
At this point, I began to research methods to create the countdown function. Since multiple portions of my program needed to be polled at different rates, I decided on utilizing millis() to establish a "tempo" that functions would consistently excecute themselves by.
millis() is a function in Arduino that counts the number of milliseconds that have passed since the program was initialized.
Since the countdown mechanism must run once each second, the function decrementing the timer must be polled once every 1000 milliseconds. It does this by comparing millis() to a custom variable called "previousCountdownMillis".
"previousCountdownMillis" is initially set to 0 when the program begins. Importantly, it is not updated to match millis() until the difference between millis() and "previousCountdownMillis" reaches 1000 milliseconds.
Through this method, the code decrementing the timer can accurately run once per second without the need to delay the entire while loop. Better yet, the system can be applied and tailored to any part of the code that must run at a certain interval, such as detecting button pushes.
Step 2: Building the 3D model2.1: Measuring and Modeling
To make the project portable, I sought to make its enclosure very compact.
It was initially planned to be the size of an ordinary computer mouse but was downsized further when the small breadboard was removed. In its current design, the project uses only 1 mini breadboard.
The design also includes several structures to keep the microelectronics in place.
Near the front of the 3D model, I included a divot to secure the OLED screen in place. The timer's "ceiling" is also only 0.18 inches thick to allow for the encoder to be bolted to it.
For printing, the model was oriented with the OLED screen side and the back side of the model laying on the print bed.
The print can be any color or filament, I used black PLA.
Step 3: Assembling the TimerBefore assembling:
- Gather the Arduino Nano, OLED screen, encoder, and a tiny breadboard.
- Also gather 9 4-inch male-female jumper wires.
- Remove the encoder knob from the encoder.
Step 1: Align the encoder on the breadboard. Ensure 2 contact points are left open to the left and 3 to the right of the encoder.
Step 2: Attach one jumper wire to the GND pin on the encoder. Place the male end of the wire into the contact point directly adjacent to the microcontroller's GND pin. Repeat this process for the wire connecting the 5V and + pins.
Step 3: Affix a jumper wire from the SW pin to the hole adjacent to the D4 pin. Next, connect a wire from the DT pin to the D3 pin. Following this, connect a wire from the CLK pin to the D2 pin.
Step 4: Attach a jumper wire to the GND pin on the OLED. Then, attach it to the contact point directly next to the encoder's GND pin. Repeat for a second wire; connecting the VCC pin on the OLED to the contact point directly next to the encoder's 5V pin.
Step 5: Connect a jumper wire between the SCL pin on the OLED and the contact point adjacent to the A5 pin on the microcontroller. Similarly, attach a jumper wire between the SDA pin on the OLED and the contact point adjacent to A4.
Step 6: Prepare the 3D print by deburring the edges of the enclosure and the lid. Supports may generate in the OLED divot hole and the inside of the encoder knob cover, those must be removed.
Step 7: Insert the encoder into the hole in the ceiling of the model. Orient the encoder so that the wires point to the left wall of the enclosure. Then, use the M7 hex nut to tighten it into place.
Step 8: Place the OLED screen into the divot.
Step 9: Slide the microcontroller into the enclosure, ensuring that the USB port faces the hole in the side of the enclosure. Then, connect the USB wire to the port and slide the lid onto the notches on the side of the enclosure.
Step 10: Place the encoder knob onto the shaft, and then place the cover on top of the knob.








_Bf5hPj8nWo.png)

_t9PF3orMPd.png?auto=compress%2Cformat&w=40&h=40&fit=fillmax&bg=fff&dpr=2)


Comments