Ideation
For this project, I wanted to use a circular motion to trigger a photoreceptor as a proximity sensor to a surface. Originally, I intended to make a rolling circle that would jump when the photoreceptor got close to the surface. However, when connecting all the wires from the servo and photoreceptor to the Arduino, the motion was partially obstructed. After this minor setback, I changed my design to an oscillator that refuses to oscillate.
The Oscillator
In my design, the circle houses a photoreceptor which moves the servo arm when it gets close to a surface. Because of the ball bearings in each side, the circle tries to move back, but the servo now holds it in place. While not exactly what I first planned, I think this movement is quite intriguing as it taunts viewers by unexpectedly stopping.
Software
The software for this project is very simple. It has two while loops waiting for changes in the photoreceptor state, which are followed by the respective angle to which the servo should be set.
#include <Servo.h> const int PhotoReceptorPIN = 7; Servo wheel; const int servoPIN = 9; void setup() { pinMode(PhotoReceptorPIN, INPUT); wheel.attach(servoPIN); Serial.begin(9600); } void loop() { while(digitalRead(PhotoReceptorPIN) == 1); wheel.write(120); while(digitalRead(PhotoReceptorPIN) == 0); wheel.write(30); }
Leave a Reply
You must be logged in to post a comment.