If you watch my videos, that means I know something about you. You are just like me. You are a Jedi Master of procrastination. This year, I set a goal for myself to build an epic Star Wars inspired project by May the Fourth, but true to form, it’s April 30th, the Death Star is coming into range, and I have not even scrambled the X-wings. I have four days to lock in, or this holiday is toast. I want to build a tactical targeting computer that will help me stay on target, ignore the TIE fighters of distraction, and fire my torpedoes into the exhaust port of my to-do list before the clock strikes May the Fourth. Red Five standing by. Let’s build.
Here is what I am thinking. What if I engineer something that will help me focus? I recently learned about something called a Pomodoro timer. The idea is simple. You have a chunk of intensely focused time followed by short breaks. Most often, you will see a 25-minute period of focus followed by a 5-minute break. After you have done this cycle four times, you get a longer 30-minute break. By doing these periods of focus followed by breaks, you are supposed to get a lot more done. I do not know if it will work, but it will be fun to try.
I started looking through my boxes of components, and I found the M5 Core2. It is an ESP32 device with a TFT display, buttons, and a sound module. This is going to be perfect for a short-deadline project because I will not have to design and 3D-print an enclosure, as it already comes in one.
Since this has to be a Star Wars inspired project, I cannot just have a regular, boring timer on the screen. Instead, I am going to reference the scene from Star Wars: “A New Hope” where they enter the trench of the Death Star. As they get closer to the exhaust port, they need to fire the torpedoes. The X-wing pilot switches on his targeting computer, and that is the graphic I want to recreate. We need a rectangle with fixed grid lines, successive rectangles extending toward us to create a three-dimensional illusion of moving down the trench, vertical red lines moving toward the center, and red numbers at the bottom counting down.
I know I have at least a day or two of programming ahead of me. I am not going to make you read through my code with me, but I will explain my approach. First, I want to create the two borders around the screen and where the numbers will go. Right now, I'm just using the built-in color yellow, but I don't think it matches the real Star Wars color yellow. I'll adjust that at some point, but for now, I'm just going to leave it.
I'm not sure exactly how I'll be able to create wireframes that move across the display, because when you create a new wireframe, you need to erase the old one. If you have static elements on the display, they will be erased.
I wasted several hours trying to draw those static elements pixel by pixel, but I think the easiest way is to erase the old moving elements and then draw the static elements last, so they don't get erased. I think if I keep my frame rate low enough, I'll get away with this technique. I've tried it before, and if the frame rate is too high, it just results in a bunch of flickering, and it won't look right. I have been at this for a couple of days now, and I am making a ton of progress. The only thing I was not happy with was the wireframes around the edge of the screen disappearing.
I was seeing artifacts because I used a radius on the border, and as those lines vanished, they were overriding that radius.
I thought I might need high school trigonometry, but it turned out to be simpler geometry. I used the Pythagorean theorem to adjust the lengths of those lines at their intersections with the radius so they would not overwrite any existing pixels.
I also fixed the awful yellow color and swapped it out for something I am calling burnt yellow, which looks much better. Hopefully the rest isn't too bad.
All I have to do now is add the red bars moving across, which shouldn't be too difficult. Fingers crossed. Then I have to create the red countdown numbers showing the time left in my focus session. It's getting late, I'm tired, but I'm really close to finishing this.
I finally got this thing to work. I built a Star Wars targeting computer that acts as a real Pomodoro timer. I easily get distracted by my day-to-day stuff, and I really think this thing is going to help me focus in short bursts and get little breaks in between.
As with all my projects, this will be open source. If you want to build one, go pick up an M5 Core2 from DigiKey and load this code on it. I barely scratched the surface of what this module can do; it has a built-in speaker and SD card reader for WAV files, and you could even turn the buttons into a video game, though that sounds like an even better way to get distracted. Hopefully, this project inspires you to unleash your inner maker. My name is Zach, and May the Fourth be with you.
Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.
By using the Co-Browse feature, you are agreeing to allow a support representative from DigiKey to view your browser remotely. When the Co-Browse window opens, give the session ID that is located in the toolbar to the representative.
DigiKey respects your right to privacy. For more information please see our Privacy Notice and Cookie Notice.