Infinity LED Table
An Infinity LED table is a table that has an optical illusion making it look infinitely deep and like it has an infinite number of LEDs in the center. This is made by cutting out the center of a table and putting in a solid mirror, LEDs and a transparent mirror on top so that the transparent mirror partially reflects the LEDs down to the mirror which reflects it back infinitely.
Engineer
Brian
Area of Interest
Computer Science, Mechanical and Electrical Engineering
School
Menlo School
Grade
Incoming Junior
Six weeks ago I came into blue stamp not knowing anything about Arduino, LED strips, Objective C, and Bluetooth. Six weeks later I have a good understanding of all those things and the confidence that I will be able to understand anything else that is placed in front of me. This camp has been an incredible experience for me as not only did I have tons of fun building and coding I also learned so much that I will be able to use on future projects. This is because at this camp I was forced to figure out complex things on my own at points. While this was very difficult and was the cause of much of my frustration I ended up learning so much because of it. When I started this project I would have been happy if someone told me do this and do that and your project will be done. Now looking back I am so glad that I had to figure out everything for myself cause not only did that force me to completely understand everything I was doing but it also gave me a massive sense of accomplishment when I finished as I felt what I did was truly my own work. Overall this has been an amazing experience with engineering that has only made me fall more in love with it. Through this program, I have been motivated to go back to school and not only take more engineering and computer science courses but also improve our robotics teams performance in this year’s upcoming challenge.
Links:
Github Repository for Code
Mechanical Drawing for Table
Initial Build Plan (it changed as my project developed):
Final Milestone
For my third milestone, I designed an IOS app to communicate with my Arduino via Bluetooth to change the pattern displayed on my LED strip. To do this I used an hm-10 Bluetooth module connected to my Arduino to receive signals from my phone. I started by using a pre-made app for the hm-10 module, called HM10 Bluetooth Serial, to send signals to my Arduino. I then designed my Arduino code around receiving these signals and displaying certain patterns on the LEDs based on the signal sent.
I faced a couple of challenges while coding my Arduino to handle Bluetooth. Firstly in order to be able to change the pattern as soon as the button was pressed, I had to be constantly checking if there was an input. To do this I made a global variable that stored what pattern that was supposed to be displayed so when I got a new input I would immediately put that into the variable. If I was currently in a pattern first I would check if the pattern equaled the current pattern then I would do nothing otherwise I would break all current loops. Then in the void loop method, I would run whatever the global pattern variable was. The other thing that gave me problems was if a button was rapidly pressed the inputs would stack up and be read over and over making it unresponsive to new commands for some time. To fix this I made it so that if there was something being inputted it was always read immediately and if it was useless information it was discarded. After I got my Arduino code handling Bluetooth signals being sent it was time to design my own app to send those signals.
In order to make an IOS app, I used Xcode and in order to access my phones Bluetooth capabilities, I used Apple’s core Bluetooth framework library. I used this website to figure out how to use it: https://ladvien.com/robots/connect-an-arduino-to-iphone. How the code works is when it discovers a peripheral device it gets that device’s UUID(its identifier) and stores it in a mutable dictionary (a data storage tool that stores keys mapped to values) with the UUID as the key and the device as the value. After the device is added to the mutable dictionary it is then connected to the phone. After connecting the device to the phone in order to be able to send data to it I needed to discover the services and then the characteristic of those services. Then I was able to write to those characteristics. To send values based on buttons being pressed I then created a layout with buttons for each of the patterns I wanted to display. I initialized the buttons and then created actions for when each of them was pressed. So when a button was pressed I looped over my devices their services and their characteristics and wrote to the characteristics an integer based on which buttons were pressed. However, cause apple is special you can’t simply send integers you need to send NSData which has 3 unnecessary zeros so that is why there are random for loops in my Arduino code that seem to have no use.
Designing this app was probably the hardest part of my project. First things first, Xcode is not like anything I have used before and figuring how to simply create an app took some time. The story board (what you use to create your layout) was also new to me and the concept of dragging and dropping elements onto the screen then linking them in your code took some time to get down. As for the Apple core Bluetooth framework, it is not simple and can be very overwhelming at first if you have never worked with Bluetooth before. I had to watch a couple videos on apple developer website as well go over example code for a while before I understood what was going on. Also, Xcode allows you to code in their language Swift or in Objective C. This made finding example code a little more difficult and confusing because you have to make sure the example you are looking at is in the right language. For my project, I used Objective C because there is more documentation and it is more of an industry standard than Swift currently is. Overall this was a great learning experience for me and now I have a great understanding of how Bluetooth works and how devices connect at a very low level. Although it was frustrating at many times it was a great challenge and in the end, I had a lot of fun with it.
Second Milestone
For my second Milestone, I modified a coffee table to hold my circuit and mirrors to create the illusion of the center of the table being infinitely deep and containing infinite LEDs. When I started on this milestone I did not have my coffee table yet but this ended up being a good thing as it gave me lots of time to plan how I was going to build it before I dove in headfirst. I used CAD (computer aided design) to model how the table would look after I cut out the center and how it would look once I put in my mirrors and LED strip in. I had planned on the table being either hollow or solid cheap wood. However, when the table arrived I discovered that it was a wooden shell filled with cardboard for support. This forced me to change up my plan and so what I ended up doing was making a 12″ x 12″ cut out of the top piece of wood then tearing out the cardboard but leaving the wooden shell on the bottom. I made this cut by first measuring out the 12″ x 12″ center of the table then drilling 4 holes within those dimensions. I then used a handsaw cutting outwards from those 4 to remove the entire center piece of wood. I also used the saw to cut the cardboard so it was easy to pull out. I also drilled holes in the bottom piece of wood. After making the hole in the center of the table I 3d printed 4 pillars to mount the first mirror so that when I put in the LED strip and second mirror, the second mirror would be flush with the table. I glued the pillars to the bottom of the wooden shell of the table. Then I glued the acrylic mirror to the pillars. Afte I threaded the LED strip through on of the holes in the bottom of the table and pushed in one of the cardboard walls so that I could pull the LED strip up past the mirror. I then strung them all the way around and super glued the LED strip at each of the corners in the inner cut to the cardboard walls. I then used a friction fit flush with the top of the table to mount the see through mirror. This made it so the LEDs would be reflected by the lower mirror and then reflected by the see-through mirror back down creating the illusion that the table had infinite LEDs and was infinitely deep.
First Milestone
My first milestone was completing the circuit for the LED strip that will be inside my table. This involved connecting it to a power supply while also going through two 470 microfarad capacitors to make none of the LEDs burst from a sudden rush of current. I controlled the LEDs using an Arduino, which is just an ATmega microcontroller that his soldered to a boards to make it easier to use and easily programmable as it has a chip that enables the use of USB. To control the LEDs I used a library created by Adafruit designed to control the LEDs. This library allowed me to do things such as setting the color of the LEDs, turn the LEDs on and off and change the brightness of the LEDs. I used these commands as well as simple computer science concepts to make 4 different patterns flash on the LED display such as a blinking pattern, a rainbow pattern, a circular pattern of red lights and a pattern in which each LED is assigned a random color that changes periodically. In terms of challenges I faced, it took me some time to get acquainted with the Adafruit library for controlling also it is important to find the correct power supply for the LED strip. The strip works on 5 volts but it can not be powered by the Arduino because it draws 2 amps per 30 LEDs. I am using a 60 LED strip so I needed a power supply that could deliver 4 amps at 5 volts.
For my next Milestone, I will be cutting out the center of the table and replacing it with my circuit and mirrors then assembling the entire table.
Link to code:
Circuit Diagram
Starter Project
For my starter project, I built a Simon Says game. The components making it up include batteries, resistors, capacitors, a microcontroller, a speaker, switches and 4 LEDs surrounded by touch sensors. There is a four-button pad over the LEDs, 1 button over each LED. The way it works is the microcontroller sends out a pattern that is displayed by lighting up the LEDs in a certain order. This pattern is stored in the memory of the chip. Then the user enters the pattern on the buttons and after each button is pressed a signal is sent to the microcontroller. The microcontroller then compares the user-entered pattern to the given pattern and either gives the next pattern to the user by adding one more LED lighting up. However, if the user entered the incorrect pattern the microcontroller wipes the pattern from its memory and the game resets. The microcontroller communicates with the touch sensors via a USART within the microcontroller. There are also timers within the microcontroller that control the amount of time the user is given to input the pattern as well as the time between each LED flash.The microcontroller also controls a speaker that outputs sound based on the user’s input. It plays a different sound for each of the four buttons as well as a sound when the game is turned on and a sound when the game ends. All these sounds are produced by the internal circuit of the speaker and the sound being produced is determined by the signal the microcontroller sends to the speaker.
I learned a lot about how the ATmega328 microcontroller worked. I learned about the two different types of memory it had (RAM and ROM) and what both types of memory were for. I also learned how the chip communicates with the touch sensors via the USART (universal synchronous/asynchronous receiver transmitter). Finally, I learned why some speakers are polar where others are not. This is because if a speaker only needs to produce one sound this can be accomplished with a spinning disk which means it does not matter if which way current flows through it cause the disk can spin either way however if the speaker needs to produce multiple sounds a circuit inside the speaker is necessary and the current must flow the correct way through the circuit to produce the sound.