Kanvi’s prototype

Video of wire moving petal from “close” to open position
Wire stand made from paper clips

In making this, I learned a few things: the servo sweep must be for a very limited angle range in order to make sure the petal does not fall off and our mechanism for “closing” the flower is not visually drastic enough.

For improvements, I might try a different open/close mechanism and will be working on a full fabric colored flower to animate. I’ll also be putting together the prototype with the sensor reactive code.

Elise’s Prototype – Suspension

Opened State
Closed State

With Kanvi’s prototype needing some tweaking, Elise has made a suspended flower petal to try to counteract the use of a stand that might get in the way of the tendon’s movement. The petal doesn’t go into the closed state as originally intended, which we could fix with a reversal of the sine movement so that it stops at the closed state. The thick wire used to suspend has a circle at the bottom to attach the other petals. We also had changed to tone to be a little more daunting and jarring but not excessively so.

This prototype does show movement and the gentle back and forth that we intended. The closing is drastic enough to see with just one petal, so if we just fix the code to close, we think a full flower will definitely work. The circuit playground is not in view but for the final product, we can attach it to the inside of the cardboard so that the lights are in view.

import time
import math
import board
import pwmio
from adafruit_circuitplayground import cp
from adafruit_motor import servo

pwm = pwmio.PWMOut(board.A5, duty_cycle=0, frequency=50)
actuator = servo.Servo(pwm, min_pulse=1000, max_pulse=2000)

phase_angle = 0.0
phase_rate  = 2*math.pi / 6.0 
next_servo_update = time.monotonic_ns()
next_status_update = time.monotonic_ns()

while True:
    now = time.monotonic_ns()
    if cp.sound_level >= 300:
        actuator.angle = 0
        cp.pixels.fill((255, 0, 0))
        cp.play_tone(2000,.5)
        cp.play_tone(1950, .1)
        cp.play_tone(1875, .07)
        cp.play_tone(1900, .3)
        time.sleep(10)

    elif now >= next_servo_update:
        cp.pixels.fill((0, 255, 0))
        next_servo_update += 20000000
        actuator.angle = 90 + 90 * math.sin(phase_angle)
        phase_angle += phase_rate * 0.020

    if now >= next_status_update:
        next_status_update += 500000000