Final problem-based Project

Problem

My problem involves me needing a way to keep track of the different tasks that I must complete on a daily basis. This is because I'm a fairly busy person that sometimes struggles with remembering what I need to do on a particular day. Thus, I would like to have some sort of interactive system to indicate what tasks I have or have not finished in a given day, and, ideally, I would enjoy being able to easily change which tasks are being shown as needing to be done since the the chores I have change each day. Furthermore, I would like to include some sort of visual stimulus to alarm me of which tasks are not done or which ones are of the highest priority. Lastly, it would be nice to incorporate some positive reinforcement in the form of a happy sound to motivate me to continue to complete my tasks.

Solution

Initially, I wasn't sure how I wanted to go about creating my design solution so I conducted research online to see if there were similar projects that were previously done. I found that someone had made a task tracker using LED arcade buttons. Their design had seven buttons that they could press to turn on a light after they finished their given tasks for a day of the week, and the buttons were embedded in an electrical junction box. Using inspiration from this design, I decided I also wanted to create a box that would have embedded LED-infused bush buttons in it for toggling light states. However, unlike the other design, I wanted each button to correlate to a different daily task with labels next to each of them. Since I wanted to be able to change what the task label was for each day, I thought it would be good to incorporate a white board top that I could draw on and erase as I please. Finally, I recognized that I would need to be able to take off the top of the box so that I could adjust the electrical components as necessary. Thus, I decided to use magnets or velcro to make the top stick to the box.

Initial sketch of my design solution

Design Process

After figuring out how I wanted my design solution to work and function, I began researching what hardware and software was needed to make it all work. To do this, I partially referenced the previous project I mentioned obtaining inspiration from as well as a variety of other web pages I found. Researching was probably the most daunting aspect of this project as I seriously struggled with figuring out how to create my electrical circuit with different components and also using Arduino code to make the buttons function as I wanted them to. 

Hardware

Before focusing on producing any code for my project, I quickly realized that I would need the necessary electrical components for making my circuit. I already had my SparkFun Qwiic RedBoard and a USB power cable, and I knew that I wanted to used LED-infused push buttons like the project I viewed before. However, I wasn't sure what other components I might need. I went back to see what pieces were used in the project I viewed before. From that, I discovered that they had used LED arcade buttons along with Adafruit's arcade button JST XH quick-connect wire pairs to limit soldering data connections. From this, I grasped that since I didn't have the experience or necessary tools for soldering, I wanted to eliminate any need for doing so, which is why I decided to look into the quick-connect wires that the other project used. I explored Adafruit's website while looking at their various products and found a very useful page that gave instructions for  setting up and lighting their LED arcade buttons. The page listed necessary components for making the buttons work and provided some Arduino code that I could use later when beginning to program. From Adafruit's website, I ended up buying four 30mm LED arcade buttons of various colors, a pack of arcade button quick-connect wires, and a LED arcade button 1x4 Qwiic I2C breakout that has eight JST XH sockets that will connect to the quick-connect cables and make the buttons function. Besides those pieces, I needed to buy Qwiic cables with 1mm JST SH 4-pin female connectors and male headers to connect my Qwiic RedBoard to my LED arcade button I2C breakout. The wires of the cable are red, black, yellow, and blue which connect to 5V power, GND, SCL, and SDA board peripherals respectively. Finally, I recognized the need for a power supply that could connect to my RedBoard and run all of the Arduino code and LED arcade buttons, which prompted me to buy a 12V power adapter

Putting all of the necessary components together was moderately easy since the previously mentioned Adafruit page included pictures and instructions on how to connect everything. On the other hand, it took some considerable effort to physically attach the quick-connect wires to the arcade buttons. I also had to research which of the LED arcade button terminals corresponded to the LEDs versus the push button switches in order to correctly attach the quick-connect wire pairs to their corresponding JST XH sockets on the Qwiic I2C breakout. Afterwards, I was fairly quick in connecting the rest of the electrical pieces to the RedBoard.

In terms of my initial design solution objectives, there were some changes that needed to be made. Although I originally wanted to be able to list five tasks per day on my tracker, I had to change it to four because of the limited number of sockets on the Qwiic I2C breakout. Furthermore, I later added a piezo buzzer by attaching it to GND and digital pins on the RedBoard via male-to-female jumper wires, which I figured out how to do from watching a YouTube video I came across. I did this because I wanted to add a sound feature that would play a happy melody after I successfully finished a task as a form of positive reinforcement.

LED arcade button

Arcade button quick-connect wires

Qwiic JST SH 4-pin to male headers cable

LED arcade button 1x4  Qwiic I2C breakout 

Power adapter

Qwiic microcontroller board

Piezo buzzer

Male-to-female jumper wires

Software

Once I had all of my electronic components set up, it was time to begin programming with Arduino code to make my buttons light up as I wanted to. Throughout the process of programming, I experienced various challenges while iterating upon my code.

For my first iteration of code, I used the code that was provided on the previously mentioned Adafruit website that contained instructions on lighting up LED arcade buttons. In order to use this code in the first place, I had to install the Adafruit Seesaw library in my Arduino IDE since the LED arcade button 1x4 Qwiic I2C breakout I have uses a seesaw chip. The code basically functioned to turn the LED on in each of the arcade buttons when they were being pushed. Although this code was a useful starting point, it was my goal to get the LEDs to toggle between states of being on and off, and I wanted these states to be maintained between each push of the button. If a button's LED was on, it meant a task was not finished.

The second iteration of my code was probably the most challenging one to complete because I wasn't sure how to program my buttons to maintain LED states between each push. Therefore, I had to conduct a substanial amount of research to learn about how to do so. The main problem with this was that I initially wasn't sure what to search for in Google since many of my searches did not produce helpful results. I eventually was able to narrow down the terms I used to those such as "toggle LED button on and off" when searching, though, which helped me with finding pages containing useful information. 

One web page provided helpful code and rationale for each line. This page helped me in understanding how I could initially go about achieving my goal, but I found it somewhat difficult to understand so I didn't use the code in my own. Upon continuous searching, I found an Arduino forum page in which an individual asked for help on the same task as mine. One of the responses was to use what is called "state edge detection" to count how many times a push button has been pressed and factor that into consideration when toggling the LED states. This was a breakthrough piece of information for me because I hadn't previously considered it. Furthermore, when I searched up "state edge detection," I found an Arduino docs page that provided further information on it as well as code I could understand and use. The example code basically functioned to turn on an LED with every four button pushes. I added this code to my own and implemented some slight changes, including checking if the button switch state is "LOW" instead of "HIGH" (since my button switches were set to digital input pull-up mode) and changing the LED state based on whether the button had been pushed an even or odd amount of times.

Arduino Code Iteration 2 - added button push counter and switch state variables

Arduino Code Iteration 2- added lines that would check a button's switch state, alter the button's push counter, and change the LED state based on the push counter (even vs. odd)

Arduino_Code_Iteration_#2.mp4

Arduino Code Iteration 2 Result

After getting my LED arcade buttons to maintain "on" and "off" light states between pushes, I embarked on the task of adding an additional blinking state that would indicate whether a task was of high priority at the moment or not. This iteration didn't require research like the previous one, but it did include some troubleshooting with different code. 

First, I made a function that would make a light blink on and off. For this function, I referenced Arduino code that I used for the third lab assignment regarding light circuits. Next, using this function, I added code that would alter the LED states to be on, off, blinking, off, on, blinking, and so forth with each push. Although I was happy that the LED could blink with this code, I was actually trying to get the LED to toggle between being on, blinking, off, on, blinking, off, and so forth. 

By spending time focusing on how the the number of button pushes would work in changing these LED states, I realized that instead of checking if the number of pushes was even or odd when altering the state, I could make the code specifically turn the LED into a maintained "on" state with every three pushes. Additionally, I could make the LED blink if the number of pushes was one above or two below a multiple of three, and every other occurrence would result in the LED being turned off.

Arduino Code Iteration 3 - added a function to make the LED button blink

Arduino Code Iteration 3.1 - changed lines to make the LED change from on, off, blink, off, on, blink, etc. based on the push counter

Arduino_Code_Iteration_3.1.mp4

Arduino Code Iteration 3.1 Result

Arduino Code Iteration 3.2 - changed lines to make the LED change from on, blink, off, on, blink, off, etc. based on the push counter

Arduino_Code_Iteration_3.2.mp4

Arduino Code Iteration 3.2 Result

For my final code iteration, I decided that I wanted to add sound feedback after I finished a given task for positive reinforcement. To accomplish this, I first had to add additional hardware as mentioned previously. Then, in my Arduino program, I added a function that would play a happy melody of different tones. To do this, I used code from the fourth lab assignment regarding sound circuits. I added this function in my existing code so that after I press a button and the LED changes from blinking to "off," the melody plays. 

Final Arduino Code - added a function to make a sequence of sounds play

Final Arduino Code - changed lines so that a sequence of sounds play after a task has been finished and the LED turns off  

Final Design

While creating my electrical circuit function the way I wanted to with the required hardware and Arduino code, I formed the box that I would use to place my components in. First, I found an old white board that I had laying around my house to use as the top that I would embed the buttons in and write on with my daily tasks. Since I didn't have a lot of experience with drilling and woodworking, I received assistance from dad in making my box. He showed me to how to drill holes in the white board for screwing in each of my buttons. I also had to create the box base using leftover wood planks my dad had. He aided me in measuring the white board, cutting out wood sides and a bottom, and gluing the pieces together. Furthermore, two additional holes needed to be drilled out of one the sides for my power adapter and USB cords to be able to connect to my RedBoard. Inside the box, I had to glue in some standing wood planks in each of the corners. I did this so that I could add magnets, which would be used in keeping the white board top on. By attaching magnets to the bottom of the white board, I could then connect the top to the rest of my box. Lastly, after I finished making my box with the help of my dad, I screwed my RedBoard into the bottom and attached all of the necessary hardware together. With my box together, electronic components connected, and Arduino program working, I had finished my design.

Final_Arduino_Code.mp4

Making Skills

The making skills I learned throughout this course were instrumental in helping me create my final design project. These skills included knowledge of and experience with creating electrical circuits that use light and sound components since my final design incorporated elements of both. I also had to use my newly acquired understanding of Arduino programming to create the code that would ultimately run my design's functions.