This week we managed to have our code working with the HC-SR04 Ultrasonic Range Sensor as the input.
The way it works: The sensor converts the time it takes to send and receive signals into distance – if it detects an object at a distance within 10cm of itself, it activates the stepper motors. The motors move the petals down, then up, completing one full cycle. If this object is still within 10cm of the sensor once the movement is finished, the motors repeat. If the object is no longer there, the motors stop. See flowchart below:
Here is a video of the working mechanism, not yet attached to a model:
We will use this next week to build the model and mechanism for the final piece, fitting the electronics into a wooden base with the pulleys running through the Plexiglas stem (see below for diagram).
We attempted to incorporate a speaker to the mechanism, which would cause a tune to play whenever it was activated. However, tests ran with this speaker were not very successful due to the sound quality being very poor (and having to input each note manually). We looked into purchasing an SD card reading speaker that would play a full song imported onto a card, however delivery times meant it would not have arrived until after the project deadline.