”Tis the season!’, or rather, ”Twas the season!’
I recently started tinkering around with a servo motor (my Christmas present) and decided to put it to use on our tree.
As you might have figured out, it’s a smartphone-tilt-sensitive star, sitting atop the tree on a servo motor.
When the phone is tilted to the right, the star turns left and vice-versa.
The signals from the phone’s internal accelerometer (only x-axis is used here) are sent via bluetooth to the HC05 bluetooth module, which in turn, sends it to the Arduino UNO. The Arduino then converts the raw data into PWM (pulse width modulation) signals and transmits it through digital pin 9 to the servo motor.
The project makes use of the following hardware:
- Arduino UNO
- HC05 (bluetooth module)
- Plastic geared servo motor
- Android app made using MIT App Inventor 2
- Components used:
- Arduino code:
val = map(state,-22,0,0,180);
The pin connections are fairly straightforward:
Have a great year ahead!