Automated Gyro Wheel Toy (version 2)

About: I am an American teaching English at Shangluo University, Shaanxi. I like making machines that do interesting but fairly useless things - I call them Quixotic Machines.

Here is my second version of an automated toy using a reed switch from my bicycle to control the servo which tilts the toy up and down. Also I use a smoothing routine in the Arduino code to keep the toy from bouncing.

It works quite well and goes quite fast (video does not show the top speed) but still fast.

Next version will use an adjustable reed switch so that I can adjust the toy angle.

Stay tuned!

Step 1: Arduino Code...

#include <Servo.h>

Servo servo1;

int servangle = 0; // servo angle variable

int potPin = 4; // select the input pin for the potentiometer

int ledPin = 13; // select the pin for the LED

int val = 0; // variable to store the value coming from the sensor

int valInc = 4; int currAngle = 0; int newAngle = 0; int delayTime = 0; //////////////////////////////////////

/Analog read pins const

int buttonPin = 2;

void myServo1(int curAngle,int newAngle,int angleInc,int incDelay) {

if (curAngle < newAngle) { for(int angle=curAngle;angle < newAngle;angle += angleInc) { servo1.write(angle); delay(incDelay); } }

else if (curAngle > newAngle) { for(int angle=curAngle;angle > newAngle;angle -= angleInc) { servo1.write(angle); delay(incDelay); } }


void setup()

{ Serial.begin(9600);

pinMode(ledPin, OUTPUT); // declare the ledPin as an OUTPUT




servo1.write(90); //go vertical

delay(5000); //wait 5 seconds

servo1.write(172); } //start rolling by lowering toy frame

void loop() {

if (digitalRead(buttonPin) == HIGH) {

val = analogRead(potPin) * 2; // read the value from the pot sensor (1 to 1024)

Serial.print(" poy val= ");Serial.println(val);


servo1.write(90); //put frame vertical

// myServo1(172,90,1,15);



myServo1(90,172,1,5); //put frame down slower so not to bounce it

digitalWrite(ledPin,LOW); }




    • Build a Tool Contest

      Build a Tool Contest
    • Faux-Real Contest

      Faux-Real Contest
    • Organization Contest

      Organization Contest

    10 Discussions


    4 years ago

    Smart idea! Thanks for shearig :)


    4 years ago on Introduction

    I have to say I was curious but didn't think much of it from the pictures.

    Then I saw the video and changed my mind! It's curiously hypnotic and has a great feel to it when it's moving! The magic is in the motion.

    3 replies

    Reply 4 years ago on Introduction

    I like cyclical projects for some reason, maybe they are easier. I made an electronic pendulum that is often running on my table. Maybe it appeals to my obsessive/compulsive brain.


    Reply 4 years ago on Introduction

    I've had a look at your other Instructables. I immediately thought anyone who rides a unicycle can't be all mad but then I saw your bike reins so I changed my mind. However, they seem to be filling a gap in my life so I'll definitely be making some. I'll let you know how I got on with them once I get out of my anticipated stay in casualty.


    4 years ago on Introduction

    It's great to see the development of this from the earliest version (on LMR). That is running so much better now.

    2 replies

    Reply 4 years ago on Introduction

    Yes, thanks. LMR gives a lot of good technical ideas and motivation to make a project better. Thought about smoothing but probably wouldnt have done it except for some suggestions about it. And someones ragging about the spring switch I built got me to thinking that, yes, I do have a reed switch, on my bike.


    4 years ago on Introduction

    This is really cool!! I'd love to see some pictures of your build process and what your code looks like!! I'm excited to see your future updates!

    1 reply

    Reply 4 years ago on Introduction

    Thank you so much! Here is a link to more details about version 1. I will post the code though here in this instructable.