1st-time newby: I want to do an art project wherein various light wooden sticks (~4-6) attached to servos on the back of a circular plate, say, are moved independently at seemingly random times and angles by a computer program until a human nears, and then it begins to flirt.
Ideally, the servos could be programmed a random full 360 degrees, various durations, various rates of movement. Any suggestions of specific devices most welcome.Not used servos before - is there an alternative?
I know how conceptually to program the project’s behavior in a language like C, but have no idea how to get down to the servo level - HELP!
Many thanks!
Hello lancish!
Servos would be the easiest things to use for a project like yours. Servos come in three basic flavors.
- **Standard** (0-180 degree)
- **Sail winch** (0 to 1 full turn or several turns)
- **Continuous rotation** (more like a speed/direction controllable gearbox than a servo)
You’re probably going to want to go with continuous rotation servos since they can rotate a full 360 degrees in either direction and can rotate continuously as long as you want them too. Continuous rotation servos are a lot more common than sail winch servos and that make them more affordable too.
For controlling those, I’d use something like an Arduino Uno (or [SparkFun RedBoard). Either board can control up to 12 servos (if I recall correctly) but you will need to power the servos with an external power source since the board by itself can’t provide enough current to run more than 2 or 3 servos at a time.
You could use an external computer to control these, but the RedBoard is a small computer on it’s own. You could program that to run through a random animation until a sensor detect someone nearby and then have it run a different animation.
What you use to detect a person nearby could be a lot of different things. A distance sensor would detect someone directly in front of the sensor and could signal the RedBoard to change animations. A PIR sensor could detect anyone nearby and trigger when it senses movement.
I’ve put a few parts suggestions below that you might consider. You don’t need all of them, but could mix and match for what works for you.
- [[SparkFun RedBoard](https://www.sparkfun.com/products/15123) (The controller)
- [[Continuous Rotation Servo](https://www.sparkfun.com/products/9347)
- [[PIR Motion Sensor](https://www.sparkfun.com/products/13285) (Motion sensor)
- [[SparkFun OpenPIR](https://www.sparkfun.com/products/13968) (Motion sensor)
- [[Ultrasonic Distance Sensor - HC-SR04](https://www.sparkfun.com/products/15569) (Distance sensor)
- [[SparkFun Distance Sensor Breakout - RFD77402 (Qwiic)](https://www.sparkfun.com/products/14539) (Distance sensor)
- [[SparkFun Distance Sensor Breakout - 4 Meter, VL53L1X (Qwiic)](https://www.sparkfun.com/products/14722) (Distance sensor)
[/list]
SparkFun can’t help you write the code to control all of this but it’s programmed in Arduino and that’s based on C. If you’re comfortable with C, learning Arduin should be fairly straightforward and most of the parts above should have a hookup guide that has code examples. For code example for a servo, the Arduino website has a nice tutorial [here.
Hope this helps get you started, and good luck with your project!](Servo - Arduino Reference)](SparkFun Distance Sensor Breakout - 4 Meter, VL53L1X (Qwiic) - SEN-14722 - SparkFun Electronics)](SparkFun Distance Sensor Breakout - RFD77402 (Qwiic) - SEN-14539 - SparkFun Electronics)](Ultrasonic Distance Sensor - 5V (HC-SR04) - SEN-15569 - SparkFun Electronics)](SparkFun OpenPIR - SEN-13968 - SparkFun Electronics)](https://www.sparkfun.com/products/13285)](Servo - Generic High Torque Continuous Rotation (Standard Size) - ROB-09347 - SparkFun Electronics)](SparkFun RedBoard Qwiic - DEV-15123 - SparkFun Electronics)](SparkFun RedBoard Qwiic - DEV-15123 - SparkFun Electronics)