090317_0848_TinkeringTu5.jpg

Tinkering Tuesday – Playmobil Stage – Disco Ball with stepper motor

Past posts of this series:

Tinkering Tuesday – Playmobil Stage – Einführung
Tinkering Tuesday – Playmobil Stage – Introduction
Tinkering Tuesday – Playmobil Stage – Playmobil parts
Tinkering Tuesday – Playmobil Stage – LED Stage Lights


 

As already written on my last post I bought a disco mirror ball (5cm diameter) from Conrad:

I had some cheap stepper motors lying around so I decided to use one of those to drive the ball. Those are 28BYJ-48 motors with a ULN2003APG based driver board:

The motor was mounted using two simple screws:

View from above the stage
View from inside the stage

With a small drill bit I was able to make a small hole into the shaft and with some „Tüdeldraht“ and hot glue the ball was mounted onto it.

Final assembly

For the software part the following website http://www.eprojectszone.com/2016/11/19/arduino-and-uln2003apg/ was very helpful in understanding the ULN2003APG and using it together with an Arduino.

//http://www.eprojectszone.com/2016/11/19/arduino-and-uln2003apg/

int motorpin1 = 10;

int motorpin2 = 9;

int motorpin3 = 8;

int motorpin4 = 5;

int t =2;

void setup() {

pinMode(motorpin1, OUTPUT);

pinMode(motorpin2, OUTPUT);

pinMode(motorpin3, OUTPUT);

pinMode(motorpin4, OUTPUT);

}

void loop() {

digitalWrite(motorpin1, HIGH);

digitalWrite(motorpin2, LOW);

digitalWrite(motorpin3, LOW);

digitalWrite(motorpin4, LOW);

delay(t);

digitalWrite(motorpin1, LOW);

digitalWrite(motorpin2, HIGH);

digitalWrite(motorpin3, LOW);

digitalWrite(motorpin4, LOW);

delay(t);

digitalWrite(motorpin1, LOW);

digitalWrite(motorpin2, LOW);

digitalWrite(motorpin3, HIGH);

digitalWrite(motorpin4, LOW);

delay(t);

digitalWrite(motorpin1, LOW);

digitalWrite(motorpin2, LOW);

digitalWrite(motorpin3, LOW);

digitalWrite(motorpin4, HIGH);

delay(t);

}

This is not the most beautiful way to use a stepper motor in your code, so I just switched over to the stepper library (https://www.arduino.cc/en/Reference/Stepper). This reduces the code mostly to the following:

#include <Stepper.h>

#define motorpin1 7

#define motorpin2 8

#define motorpin3 12

#define motorpin4 13

#define STEPS 4096

Stepper stepper(STEPS, motorpin1, motorpin2, motorpin3, motorpin4);

void setup() {

stepper.setSpeed(2);

}

void loop() {

stepper.step(1);

}

This on its own worked great. But I had to learn that this is working just as the first code and is blocking the Arduino / slowing it down so much that everything else is not working as I was expecting it to be (especially the Audio analysis). Also together with the LED rings it was not really working out. It also produces interferences in the power lines. I used one single power source (5V 3A). But this led to so much interferences in using the stepper motor in the Audio output that I had to come up with another solution. More on that in a later part 😉

In the video there is the disco ball in action (starting at 0:48):