What it does

Slumbering past your ringing alarm and don't want to get up? Feeling disheartened at more strict stay at home orders? Not sure what your life's meaning is anymore?

No problem! This is the one-stop solution to all your motivational problems while you're stuck at home. With one click, this little machine will generate and display a random encouraging, inspiring, and motivating message. It will leave you refreshed and ready to tackle a busy day of school or work!

Inspiration

To me, home improvements was less about altering a physical or electrical aspect of our home, but about making my time at home more fruitful. One thing I always lacked was motivation. Especially at home, it was easy to slump into a state of atrophy. I wanted this project to support me in my attempt to better myself in this time stuck at home.

Initial setback

When the hacking began, I excitedly cut open the box full of goodies. I was greeted with a ESP 32 microcontroller, a OLED display, a PDM microphone, and a whole load of wires. However, when I put the ESP 32 onto the breadboard and connected it to a 9V battery, I noticed something wrong.

Though the red light turned on, the voltage regulator on the microcontroller started to heat up within seconds. It soon became too hot to touch, and I disconnected the circuit.

I thought it was just because the battery voltage was too high, so I tried using a 5V regulator. Same thing occurred. Then I tried connecting the microcontroller using a micro-USB cable to my laptop. Same thing. My laptop couldn't even detect the microcontroller. At this point, I've also started to be able to smell something burning. Oh dear!

Live with what we've got

At this point, I was slowly starting to realize that my ESP 32 microcontroller may be busted. The voltage regulator seemed to have shorted, which explains the heat near the regulator. After talking to the volunteers, my backup option was my Arduino.

So I got to work with the (comparatively) bulky Arduino, playing around with the OLED display and the PDM microphone. I was thrilled at the way that the OLED display looked, and I was determined to use it somehow in my design.

Brainstorm

At first, I wanted to do some sort of animation using the OLED and use the PDM microphone as some sort of auditory support. The animation would feature a motivating and inspiring storyline involving a guy losing something he really cared about but finding the meaning of life in his strive to achieve his life goal. It would be a story that inspires the viewers, especially in this time when we are stuck at home and physically separated from each other. However, given the time restraint and my extremely limited knowledge of how electronics worked, I opted for a more conservatory project.

Instead of animation, I would focus on a less vivid and emotional delivery: motivational quotes. The Arduino would randomly choose between a library of quotes and display it on the OLED screen so that anyone who saw it would be greatly inspired.

Construction

First, I found that the OLED display can only support up to 84 characters. That's the physical length limit of the quotes we can use. With that in mind, I looked up "short inspirational quotes" on Google, copied a few website's worth into Microsoft Excel, and started organizing them.

First, I eliminated all the formatting, including random capitalizations and extra quotation marks. Next, I took out the names as they only make the quotes longer. Then, I used the "remove duplicates" function to eliminate all the repeated quotes. Lastly, I sorted them all alphabetically. I ended up with 200 quotes to use. Hoorah!

Problem arises

The code itself is relatively simple. The idea is that it would contain a library of quotes, select one at random, and display it on the screen.

The first problem I ran into was that the actual random() function in Arduino is not random. After receiving the same motivational message 10 times, I was not very motivated and realized that something was wrong.

After some research, I found out that I needed to manually use the randomSeed() function to keep the random() function random. But the randomSeed() function required an input too. To give it an input, I plugged a wire in to the A0 analog pin and connected it to a random part of the breadboard unrelated to the OLED display. Then, using randomSeed(analogRead(A0)), I finally achieved randomization. Or at least, as random as I could reasonably get.

Sacrifices

The next problem I encountered was one more difficult to resolve. I realized that the Arduino, with its limited memory, can only support about 15 quotes with stable performance. That is less than 15% of the initial 200 quotes I planned to have.

A potential solution I could have implemented to alleviate this issue was to turn the quotes into numbers, associating each letter with a 2 digit number. "A" would be "01", "B" would be "02", etc. Space bar would be "00", and other special characters would be "27" and beyond.

The benefit of this method is that the int type in Arduino takes up a lot less memory than the char type, meaning that I would be able to store more quotes with the same amount of memory. However, this also means that I have to convert the numbers back into the quotes by iterating through them. At this point, I decided to stick to what I'm familiar with as the time was tickling down.

Accomplishments

This was my first hackathon, and I was quite happy about how it turned out! I was quite happy that I was actually able to make a functional system given that I had never done a hackathon before. This experience not only put my adaptive skills to the test due to the time pressure of the challenge, but also helped me see areas that I am good at and areas I could improve on.

Self-Improvement this year

It was a huge bummer that I envisioned a motivating animation but ended up making a quote generator for only 15 quotes. There were definitely room for improvement.

For one, I was not very familiar with a lot of the electronics terms and jargons, so I spent a lot of time trying to read through documentations that I ended up not really understand. I also realized that I have not coded in C++ or with the Arduino for a long time, so I was really rusty and had to look up a lot of references to get comfortable again.

Reflecting on my experiences, my goal this year is to try to engage in more communication with electronics, both through talking about them with other people and through trying to experiment with them myself. A lot of the components inside my box didn't make it into my design, but I plan to use them throughout the year as I work on my hacking skills.

And I'll be sure to demonstrate how much I learn in next year's hackathon.

Built With

Share this project:

Updates