9-17-2014 - This is version 1 of my project to automate a gyro wheel toy. I really wanted to use reed switches but didn't have any available so created my own magnetic switch in the meantime.
This photo shows a simple off/on switch I made using a ball point pen spring which gets pulled over by the gyro wheel magnetic axle to then make contact with the gyro frame which completes a 3.3 v ciruit to the Arduino. The servo then positions the frame vertically for a second or so then positions the frame back down so the wheel will roll by the switch again. Pretty simple.
Next photo shows gyro frame attached to fiberglass fishing pole axle with aluminum angle bracket and also a heavy metal corner bracket used to counterweight the gyro to make life easier for the servo.
p
Used standard size servo and some servo arms to create linkage
Had to put couple of larger sized pieces of fishing pole over the axle and a retaining bolt to keep the axle from moving in and out.
Used 3.3 circuit with resistor for the spring switch and 5v circuit to drive the servo.
Not much of program yet:
#include <Servo.h>
Servo servo1;
int servangle = 0; // servo angle variable
int potPin = 2; // select the input pin for the potentiometer
int ledPin = 13; // select the pin for the LED
//Analog read pins
const int buttonPin = 2;
void setup() {
Serial.begin(9600);
pinMode(ledPin, OUTPUT); // declare the ledPin as an OUTPUT
pinMode(buttonPin,INPUT);
servo1.attach(9);
delay(1000);
servo1.write(90);
delay(5000);
servo1.write(172);
}
void loop() {
if (digitalRead(buttonPin) == HIGH) {
digitalWrite(ledPin,HIGH);
servo1.write(90);
delay(1200);
servo1.write(172);
digitalWrite(ledPin,LOW);
}
}
Future Versions:
Version 2 will use a pot control to vary the delay time to see if I can get a more efficient cycle.
Version 3 will use multiple reed switches mounted on the gyro frame itself so that I will be able to perform the following:
- stop gyro
- start gyro
- reverse gyro direction
- speed up and slow gyro down
- use different throw rates for servo
- maybe even determine most efficient throw rates and dwell times
Rock on!
https://www.youtube.com/watch?v=YqnH0fz2k70