Concept
For my final project, I am yet again choosing to go with a butterfly theme. This time, however, I plan to give it a little life – in the real physical sense. With the ability of bringing hardware components together, and controlling them programmatically, we can simulate many things. I will attempt to do just that and bring a little life to a small butterfly.
My final project will essentially be a physical, mini-interface with a butterfly that reacts to human touch. The interface will display a butterfly atop a flower, undisturbed and resting peacefully. Once touched, its wings will flutter, awakening a swarm of butterflies that begins to flap away from beneath. The interface itself will be a physical surface on a table, with the animation, designed and implemented in p5.js, projected onto it. The interface will have a physical butterfly prototype (made from paper and laminated, perhaps) protruding in the middle. Once a sensor (a capacitive touch sensor) that is connected to it senses a signal, its wings will be activated and so will the butterflies’ animation in the backdrop. Its wings will be attached to two servo motors that will move once a signal is received from p5.
Materials and Hardware
- Arduino Uno and breadboard
- Capacitive touch sensor
- Two servo motors
- A general-purpose tripod
- A projector
p5.js
The p5.js sketch is responsible for creating and controlling the animation. For the creation of butterfly objects, I tried experimenting with generative art, but it proved to be quite challenging as I needed to simulate the smooth motion of flapping wings. I, hence, will be using standard images (spritesheets) to display the graphics. The p5.js sketch will consistently read the messages transmitted from the Arduino program, waiting for a touch signal to activate the motion of the butterfly wings and the subsequent animation. Once the animation begins, it will send messages to the Arduino program, communicating that the animation is still underway. These messages are going to be used to keep the servo motors, controlling the wings, in motion. Once the animation stops, as indicated by all the smaller butterflies that escaped from beneath the central butterfly leaving the screen display, the sketch will send a terminating message to the Arduino, which will be used to bring the motion of the servos to a halt.
In order to ensure a seamless mapping experience between the sketch and the physical surface, I will be using p5.mapper. This library allows you to calibrate your sketches dynamically in order to match the dimensions of your sketch with that of a surface, once projected.
Arduino
The Arduino program will have a touch sensor as an input and servo motors as output. The touch sensor sends a signal to p5 indicating a touch is detected and will receive messages used to control the duration of the motor-controlled wing flaps.
Progress
p5
So far, I have the major parts of my sketch (the animation, serial communication, and projection mapping) completed for the most part. I want to work on the aesthetics of it a little more next and will have to modify the serial communication implementation to synchronize the movement of the motors.
https://editor.p5js.org/sarah-altowaity1/sketches/5eZkJXShI
Arduino
The main circuitry is wired up to connect the touch sensor and the motors. The program sends the sensor signal over to p5 for detection of touch. I, additionally, implemented the wing flap motion with the motors. However, I still need to work on the synchronization between the animation and the servo movements. I also need to figure out a way to conveniently and securely place the wings on the motor flaps and stabilize the components.
Next Steps
The main next step is putting it all together and completing the technical aspects of synchronizing the animation with the physical components. I also need to work on designing a neat interface with stable components as I would like to reduce the overhead of setting up (and the possibility of things falling apart or out-of-sync) as much as possible.