[P-Comp] Mid-Term: Witch’s Cauldron

Final Idea: A cauldron. When you pass your hand over it, a ladle magically lifts witchy ingredients into the brew. When you touch it with a wand, another ladle magically lifts other witchy ingredients into the brew. It then bubbles ominously.

[drawing]

We went through several permutations of several ideas before landing on this one but once we did, we had a pretty clear idea of how we thought it should work:

Components

  • light sensor
  • ultrasonic sensor
  • two servos
  • bubble maker
  • 10k resistor

[schematic]

Code

[final code]

Challenges

We had to make sure to time the execution of the servos so that there would be enough time for them to complete their rotation before firing the next event. We found that we had to keep our hands over the ultrasonic sensor for the full rotation or else the servo would go back to its starting position because the value it was reading would not reach the threshold we set. We tried wrapping the whole if statement in an if (millis() % 100) {}  but then the sensor would only read every other second or so. We then put the millis() within the if() statement with the logic that it would make it so that once the threshold was reached, it would only fire the rotation every other second or so. But it didn’t work out. We ended up using delay() in order to try to give the servos enough time to complete their rotations before firing the next event. We realized that in order to get in shape to present today, we’d have to just find the way that seemed to execute the actions we were going for and adjust our interaction to however seemed to make it go as smoothly as possible. The goal is to make this something that could just be put out in the world that people could interact with but we need to figure out the timing issues first.


Comments

Leave a Reply