Concept
As part of the 9th Assignment of Intro to IM, we were tasked with the objective of reading input from at least one analog sensor, and at least one digital sensor (switch). This data would then be used to control at least two LEDs, one in a digital fashion and the other in an analog fashion, in some creative way.
The core idea of my project is to create an interactive light experience using a combination of analog and digital inputs to control an RGB LED in a creative and visually appealing manner. Initially, the RGB LED displays a steady red color, which gradually transitions through a spectrum of colors, creating a calming and dynamic visual effect. This smooth color transition continues indefinitely, creating a mesmerizing ambient display.
The interaction becomes more engaging with the introduction of a user-controlled digital button and a light sensor. The button, when pressed, shifts the mode of the LED from its continuous color transition to a responsive blinking state. In this state, the color of the LED’s blinking is determined by the ambient light level measured by the sensor. Specifically:
- Below 300 units: The LED blinks in red, indicating low light conditions.
- Between 300 and 900 units: The LED blinks in blue, corresponding to moderate light levels.
- Above 900 units: The LED blinks in green, signifying high light intensity.
Implementation
Pictures of Circuit
With this, I produced the following circuit:
Demo Video
A demo video, in detail, can be seen here:
Difficulties & Improvements
While the concept of the color transition was straightforward, implementing it in Arduino presented significant challenges. Determining the correct method for transitioning from one color to another smoothly, without abrupt changes, was particularly tricky. This aspect of the project required careful tweaking of the code to ensure that the color shifts were visually pleasing.
void smoothColorTransition() { // Fade colors smoothly if (redValue > 0 && blueValue == 0) { redValue -= step; greenValue += step; } if (greenValue > 0 && redValue == 0) { greenValue -= step; blueValue += step; } if (blueValue > 0 && greenValue == 0) { blueValue -= step; redValue += step; }
Despite these challenges, I thoroughly enjoyed this part of the project. It was rewarding to see the seamless color transitions come to life. Looking ahead, I plan to expand this project by adding an additional LED and another button to enhance interactivity and complexity, making the experience even more engaging.