After coming up with the sketches and putting them in Processing, we were then tasked with connecting it to Arduino. We settled with 4 main functions with different triggers.
- On/Off – Proximity Sensor
- Brightness – Volume (Microphone level)
- Colour Change – Compass + Gravity
- Preset Colour Patterns – Touch 2D + Wekinator
We wanted the on/off function to be the most straightforward way, which was for the LED lights to turn on when the phone is faced up (i.e. proximity sensor not covered, giving a value of “false”/”0”), and then for it to off when you place the phone faced down on a surface (i.e. proximity sensor covered, giving a value of “true”/”1”).
One interesting feature we found on the iOS version of ZIGSIM was “Mic Level”, so we wanted to experiment with it. We figured volume could work well with brightness because it was quite intuitive for the LED to be more intense as the environment gets louder. Additionally, we tested this feature with music, and the results turned out surprisingly well!
Essentially, we wanted to use the compass to draw a circle, using the gestures to change the colours while “colouring” the circle. We made use of the Gravity, Quaternion and Compass sensors from ZigSim, linking it through Processing to Arduino. From Processing, the data received from ZigSim is communicated to Arduino and translated to colour codes and number patterning for the Adafruit LED Strip.
Preset Colour Patterns
We learnt how to use Wekinator in the previous lesson, so we thought that it would be a good chance for us to apply it in our project. We coded various LED light strip patterns in Arduino, and the trigger for each of the different patterns would be the different touch gestures that we trained in Wekinator. We had 3 gestures to trigger 3 different patterns.
Other variations that we tried and tested
- Saturation – Gravity
- Colour Wheel – Touch 2D
- Pattern Change – Accelerometer (Shake)
Saturation defines the brilliance and intensity of a color. White and black (grey) are added to a colour to reduce its saturation. Hence, we worked in greyscale (black to white), with the highest point being white and the lowest point being black.
Using the full dimensions of the screen to map to the colours of the RGB colour palette.
Using accelerometer, if the value reads more than 8, or less than -8, then the device will register the motion as one shake (i.e. “shaketrue”) and the next pattern will play. The shake cycles through the preset patterns.
Click here for our codes.