100917_1349_TinkeringTu13.png

Tinkering Tuesday – Playmobil Stage – Woodwork

Planning and assembling the wood and components.


Past parts of this series:

Tinkering Tuesday – Playmobil Stage – Introduction
Tinkering Tuesday – Playmobil Stage – Playmobil parts
Tinkering Tuesday – Playmobil Stage – LED Stage Lights
Tinkering Tuesday – Playmobil Stage – Disco Ball with stepper motor
Tinkering Tuesday – Playmobil Stage – LED Rings
Tinkering Tuesday – Playmobil Stage – Audio Output from microSD with Arduino
Tinkering Tuesday – Playmobil Stage – Audio Spectrum Analysis from WAV input with simple logic, FHT and MSGEQ7
Tinkering Tuesday – Playmobil Stage – Audio Spectrum Analysis using Sound Sensor Module


When I planned the stage I did not really think about the dimensions it needs. So I just layed out some DIN A4 sized sheets of paper and had a look:

That is DIN A3 and looks quite good already. But I need some space on sides as well (for all of the electronics) so I planned to make a typical stage as can be seen on festivals, e.g. Rock am Ring:

So I initially planned with DIN A3 size for the stage and half a DIN A4 sheet for the sides. I thought about using precut wood like the following that is available in the DIN Ax sizes:

But then I also decided that it is not very cool to cut and merge different sheets to get to the DIN A3 plus DIN A4 size. So I decided I need to get that custom cut at the home improvement store and went with 5mm MDF. That’s when I came up with the following sketch, planning with the 4mm A4 precut sheets and the custom 5mm sheets:

I had a look in the different stores and some only offered 3mm and I also wanted to go with premade laths for the top and bottom of the stage (30 and 50mm in the sketch, at the top I need minimum 22mm to fit the stepper motor which will drive the disco mirror ball). Those are also supplied in different sizes in different stores. I planned to make the top sheet overlap the back and the side sheets, so it has to be wider by the width of the wood I buy.

I decided to make an excel sheet to dynamically calculate the required sizes which include the different material widths.

It calculates the required sizes based on the given dimensions of the stage and the width of the wood. I also added the height of the top and bottom as a variable to adjust to the different sizes of the laths, in this case it was Bauhaus with 24x48mm. I adjusted the inner size of the stage in the excel to 250mm widht because I plan to have a sheet of acrylic glass in the back and Bauhaus offered a precut sheet with a height of 250mm. Additionally the stage size was reduced to 600mm as the laths are 2m long and this way I can cut it into 3 parts and still have 200mm which I can use for the sides.

Unfortunately the wood I initially wanted (MDF, 3mm, black coated) was not available in the Bauhaus. It could have been ordered but 2-3 weeks were too much for me. So I went with 5mm raw MDF and decided to paint it myself.

After I got all the wood cut I layed it out and wondered why it didn’t fit. After several measurements I gave the guy at the wood cutting station the wrong numbers. I read columns D and E instead of E and F… So another trip to the store… But luckily it wasn’t that many sheets that were wrong. So: always check/measure twice before cutting and joining.

In the following picture you can see how I want to layout the acrylic glas and the sides:

In the following pictures you can see the final layout of the stage put together loosely.

Then I went to my little workbench in the cellar and build up the base using mostly my newly acquired Dremel 4000. First drilling and counter sinking all the holes

After that I put it the base together:

The next step was to paint everything:

Then adding all the components. First the servo from the top and the bottom:

Next the rods for the stage lights (I just drilled through everything and the outer panel is holding it in place):

I sanded the acrylic glass, which can be seen in the background here:

All of the other components are going into the left side of the stage, hot-glued in place:

Putting all the LED stage lights and LED rings in place (see the posts for those). I initially planned on using a USB connector for PC cases to power both of the Arduinos. This caused some weird sounds when the servo or especially the LED rings were turned on. I tried several things, also having some capacitors in several places (I wasn’t aware of the principle of decoupling capacitors at that time… now I am at least a little bit…) but nothing worked out. My first tests were done using two separate power sources (240V to USB adaptors from smart phones) and at that time there were no problems, so I had to go with two sepearate power cables. One for the Audio Arduino alone and the other one for all the light components and the other Arduino.

The sound sensor is facing to the front:

All of the outer sheets were fixed with black nails but to be able to reopen the stage to get to the electronics parts (which I already did once to check the speaker cabling because it was not loud enough) I used screws at the left side and glued on black plastic caps to have a better look (you can also see that it is not 100% perfect… I am not the most precise woodworker…):

At the back of the stage there is the push button, a switch, the potentiometer and the two cables (secured with hot glue and a rubber from a beer bottle):

This was the woodworking part. Next up is the final Software. After that I will share some problems, learnings and additional possibilities (that I planned but lacked time).

091117_2114_TinkeringTu1.png

Tinkering Tuesday – Playmobil Stage – Audio Spectrum Analysis using Sound Sensor Module

In this post I will describe my results using a sound sensor board to analyze music to make a sound reactive light show. Based on my last post I will exchange the audio input from the Auduino with the analog readings of a cheap sound sensor board.


Past parts of this series:

Tinkering Tuesday – Playmobil Stage – Introduction (englische Einführung, restliche Parts sind nur auf Englisch verfügbar)

Tinkering Tuesday – Playmobil Stage – Playmobil parts

Tinkering Tuesday – Playmobil Stage – LED Stage Lights
Tinkering Tuesday – Playmobil Stage – Disco Ball with stepper motor
Tinkering Tuesday – Playmobil Stage – LED Rings

Tinkering Tuesday – Playmobil Stage – Audio Output from microSD with Arduino

Tinkering Tuesday – Playmobil Stage – Audio Spectrum Analysis from WAV input with simple logic, FHT and MSGEQ7


Sound Sensor Board Keyes KY-037

I ordered a sound sensor board from ebay, which seems to be the Keyes KY-037 (2,09 EUR for 3 pcs). More details can be found at https://tkkrlab.nl/wiki/Arduino_KY-037_Sensitive_microphone_sensor_module (there is also another version, the KY-038 which seems to be only differing in sensitivity, see https://tkkrlab.nl/wiki/Arduino_KY-038_Microphone_sound_sensor_module) and the power point presentation found at http://brd4.braude.ac.il/~ksamuel/ElIn.31361/Lectures/022-Basic%20Definitions%20and%20Concepts%20Sensors%20and%20Actiators%202013-10-10.pdf (slide 40 ff.).

The wiring is very simple. Just connect ground and 5V and depending whether you want to use digital or analog input the pin D0 and/or A0. In the following schematic you can see both:

Analog input

Using the example sketch from tkkrlab for the analog reading I got some reading in silence from the analog pin. That base reading can be adjusted by using the screw on the board. I adjusted it to around 100 for the first tests:

First I modified the sketch to not delay the reading based on the value so I had all the data.

int sensorPin = A1; // select the input pin for the potentiometer
int sensorValue = 0; // variable to store the value coming from the sensor
void setup ()
{
Serial.begin (9600);
}
void loop ()
{
sensorValue = analogRead (sensorPin);
Serial.println (sensorValue, DEC);
}

I then played a song on my PC („Wecker“ from my band Monkey Fly: https://www.youtube.com/watch?v=3l2iKzLA9VY) and exported the readings to excel to draw a graph resulting in a wonderful waveform:

Here are the numbers:

You can see that the readings at 500 have a little wider span than those at 100, so I will go with this being in the middle of the value range for analog readings (0-1023). The adjustment around 750 is not bringing any more accuracy.

I also did a test with different volume levels (using the same song and the same speaker level I adjusted the volume via Windows to 50%, 75% and 100%:

The peaks are much lower but I think this will work for some sound reacting lights. I just have to dynamically adopt the thresholds to the minimum and maximum over some readings or implement a potentiometer to adjust the sensivity dynamically.

Digital input

Just for completeness I also tested the digital readings. Still having the screw to an analog level of around 750, I installed the following sketch reading the analogValue when a HIGH is recognized at the digital Input (yes, there is some delay but it has to be precise enough here). Playing my song back I got no feedback, even on the bass notes. Clapping gave analog readings around 500.

Bringing the analog readings back down to around 100 resulted in the digital input always being HIGH. I turned the screw until the reading got LOW at around 560 again.

Using the Basic input sketch from the audio input I also get similar readings so I could easily switch between both inputs:

-- base reading without sound
Time: 230 Min: 502 Max: 505 Avg: 503 Span: 3, 2, 1
Time: 229 Min: 502 Max: 505 Avg: 503 Span: 3, 2, 1
Time: 229 Min: 501 Max: 506 Avg: 503 Span: 5, 3, 2
Time: 230 Min: 501 Max: 506 Avg: 503 Span: 5, 3, 2

-- Intro of the song (silent part)
Time: 229 Min: 499 Max: 508 Avg: 503 Span: 9, 5, 4
Time: 229 Min: 501 Max: 506 Avg: 503 Span: 5, 3, 2
Time: 230 Min: 500 Max: 506 Avg: 503 Span: 6, 3, 3
Time: 229 Min: 499 Max: 506 Avg: 503 Span: 7, 3, 4
Time: 230 Min: 500 Max: 508 Avg: 503 Span: 8, 5, 3

-- Intro of the song (loud part)
Time: 229 Min: 461 Max: 531 Avg: 503 Span: 70, 28, 42
Time: 229 Min: 477 Max: 525 Avg: 503 Span: 48, 22, 26
Time: 230 Min: 476 Max: 524 Avg: 503 Span: 48, 21, 27
Time: 229 Min: 478 Max: 527 Avg: 503 Span: 49, 24, 25
Time: 230 Min: 486 Max: 521 Avg: 503 Span: 35, 18, 17

Summary

I think the analog input will work together with the results from my previous post on the audio analysis. The plan is to combine the sound sensor and the wav playback. So if there is no sound playing on the other Arduino I will read the sound sensor but for this I have to notify on playback. Let’s see how I will do this.

More to read

Sound Sensor Modul: http://linksprite.com/wiki/index.php5?title=Advanced_Sensors_Kit_for_Arduino (auch Laser)

Sound Sensor Modul: https://tkkrlab.nl/wiki/Arduino_KY-038_Microphone_sound_sensor_module (auch Laser https://tkkrlab.nl/wiki/Arduino_KY-008_Laser_sensor_module)

Sound Sensor Modul: http://brd4.braude.ac.il/~ksamuel/ElIn.31361/Lectures/022-Basic%20Definitions%20and%20Concepts%20Sensors%20and%20Actiators%202013-10-10.pdf

Spectrum analysis using electret microphone and LM386 amp: http://shin-ajaran.blogspot.de/2014/11/arduino-spectrum-analyzer-for-music-to.html

091117_2114_TinkeringTu6.png

Tinkering Tuesday – Playmobil Stage – Audio Spectrum Analysis from WAV input with simple logic, FHT and MSGEQ7

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

Tinkering Tuesday – Playmobil Stage – Disco Ball with stepper motor

Tinkering Tuesday – Playmobil Stage – LED Rings
Tinkering Tuesday – Playmobil Stage – Audio Output from microSD with Arduino


This post will be about different possibilities to do sound input analysis (or spectrum analysis) with the Arduino. The source of sound will be my Arduino audio output from the last post for now. But I plan on using a sound sensor board additionally for the final build. The audio output from my last post is a little bit special because it uses PWM. „Normal“ audio is more of a sine wave. To not have any side effects I will do my testing with a second Arduino (nano in my case)

But lets start using the PWM output directly:

Sound input analysis on PWM signals

I made a direct connection from the PWM output of my audio output Arduino to A0 of the input Arduino:

New is only the Arduino nano, connecting A0 and GND.

With this we can use a simple input analysis, based on the code at http://blog.yavilevich.com/2016/08/arduino-sound-level-meter-and-spectrum-analyzer/ (which is by the way a great post for the theory also).

//based on: http://blog.yavilevich.com/2016/08/arduino-sound-level-meter-and-spectrum-analyzer/
#define MicSamples (1024*2)
#define MicPin A0

// measure basic properties of the input signal
// determine if analog or digital, determine range and average.
void MeasureAnalog()
{
long signalAvg = 0, signalMax = 0, signalMin = 1024, t0 = millis();
for (int i = 0; i < MicSamples; i++)
{
int k = analogRead(MicPin);
signalMin = min(signalMin, k);
signalMax = max(signalMax, k);
signalAvg += k;
}
signalAvg /= MicSamples;

// print
Serial.print("Time: " + String(millis() - t0));
Serial.print(" Min: " + String(signalMin));
Serial.print(" Max: " + String(signalMax));
Serial.print(" Avg: " + String(signalAvg));
Serial.print(" Span: " + String(signalMax - signalMin));
Serial.print(", " + String(signalMax - signalAvg));
Serial.print(", " + String(signalAvg - signalMin));
Serial.println("");

}
void setup() {
Serial.begin(115200);
}

void loop() {
MeasureAnalog();
}

As a result I got some readings. First you see the basic noise (without the output Arduino connected), then the plugin noise of the output Arduino and finally the sound playing.

--Basic noise
Time: 229 Min: 0 Max: 8 Avg: 2 Span: 8, 6, 2
Time: 229 Min: 0 Max: 7 Avg: 2 Span: 7, 5, 2
Time: 230 Min: 0 Max: 8 Avg: 2 Span: 8, 6, 2
Time: 229 Min: 0 Max: 8 Avg: 2 Span: 8, 6, 2
--PlugIn
Time: 229 Min: 0 Max: 221 Avg: 89 Span: 221, 132, 89
Time: 229 Min: 0 Max: 180 Avg: 108 Span: 180, 72, 108
Time: 229 Min: 28 Max: 88 Avg: 52 Span: 60, 36, 24
--Playing Sound
Time: 230 Min: 0 Max: 1023 Avg: 24 Span: 1023, 999, 24
Time: 229 Min: 0 Max: 1023 Avg: 327 Span: 1023, 696, 327
Time: 230 Min: 0 Max: 1023 Avg: 332 Span: 1023, 691, 332
Time: 229 Min: 0 Max: 1023 Avg: 327 Span: 1023, 696, 327
Time: 229 Min: 0 Max: 1023 Avg: 331 Span: 1023, 692, 331
Time: 230 Min: 0 Max: 1023 Avg: 323 Span: 1023, 700, 323
Time: 229 Min: 0 Max: 1023 Avg: 327 Span: 1023, 696, 327
Time: 230 Min: 0 Max: 1023 Avg: 326 Span: 1023, 697, 326
Time: 229 Min: 0 Max: 1023 Avg: 325 Span: 1023, 698, 325
Time: 229 Min: 0 Max: 1023 Avg: 325 Span: 1023, 698, 325

Having a closer look at the readings shows what could already be expected. Values ranging from 0 to 1023, the averages varying a bit. It is PWM, so fully on (1023) or fully off (0). That can be verified by a pure analog read:

#define MicPin A0

void setup() {
Serial.begin(115200);

}

void loop() {
Serial.println(analogRead(MicPin));
}
1023
0
0
1023
0
0
195
1
0
524
0
7
1023
0
988
0
7
1023
0
62
0
574
0
1023
0
0
0
902
0
1023

I don’t know quite the theory why the „in-between-values“ are there but they are. But mostly you can see 0 and 1023.

There is an advanced function to analyse audio on the arduino and it is called the Arduino FHT library. For more information about that please have a look at http://wiki.openmusiclabs.com/wiki/ArduinoFHT. There is also the full theory.

The following sketch is a modified example code and is producing serial output:

/*
fht_adc.pde
guest openmusiclabs.com 9.5.12
example sketch for testing the fht library.
it takes in data on ADC0 (Analog0) and processes them
with the fht. the data is sent out over the serial
port at 115.2kb.  there is a pure data patch for
visualizing the data.
*/

#define LOG_OUT 1 // use the log output function
#define FHT_N 256 // set to 256 point fht

#include <FHT.h> // include the library

void setup() {
Serial.begin(115200); // use the serial port
TIMSK0 = 0; // turn off timer0 for lower jitter
ADCSRA = 0xe5; // set the adc to free running mode
ADMUX = 0x40; // use adc0
DIDR0 = 0x01; // turn off the digital input for adc0
}

void loop() {
while(1) { // reduces jitter
cli();  // UDRE interrupt slows this way down on arduino1.0
long t0 = micros();
for (int i = 0 ; i < FHT_N ; i++) { // save 256 samples
while(!(ADCSRA & 0x10)); // wait for adc to be ready
ADCSRA = 0xf5; // restart adc
byte m = ADCL; // fetch adc data
byte j = ADCH;
int k = (j << 8) | m; // form into an int
k -= 0x0200; // form into a signed int
k <<= 6; // form into a 16b signed int
fht_input[i] = k; // put real data into bins
}
long dt = micros() - t0;
fht_window(); // window the data for better frequency response
fht_reorder(); // reorder the data before doing the fht
fht_run(); // process the data in the fht
fht_mag_log(); // take the output of the fht
//    sei();
//    Serial.write(255); // send a start byte
//    Serial.write(fht_log_out, FHT_N/2); // send out the data
// print as text
for (int i = 0; i < FHT_N / 2; i++)
{
Serial.print(fht_input[i]);
Serial.print(',');
}
long sample_rate = FHT_N * 1000000l / dt;
Serial.print(dt);
Serial.print(',');
Serial.println(sample_rate);
}
}

The result can be seen in the following screenshot:

Puh, that’s a lot of numbers. As a plot in excel this is the result:

Using digital to analog conversion (DAC) to convert PWM back to analog signal

Searching for some solutions I stumbled upon the DAC from http://www.instructables.com/id/Analog-Output-Convert-PWM-to-Voltage/

This is using a capacitor and a resistor to smoothen the PWM signal back into a voltage level. It is also known as a low pass filter (if you exchange the resistor and the capacitor you get a high pass filter as I read in the comments…).

The following schematic shows the enhanced connection:

R1=3,9k, C=100nF (0,1uF)

The output from the basic input readings look much better now:

Time: 230 Min: 155 Max: 547 Avg: 347 Span: 392, 200, 192
Time: 229 Min: 174 Max: 562 Avg: 347 Span: 388, 215, 173
Time: 230 Min: 150 Max: 545 Avg: 347 Span: 395, 198, 197
Time: 229 Min: 175 Max: 528 Avg: 347 Span: 353, 181, 172
Time: 229 Min: 163 Max: 513 Avg: 347 Span: 350, 166, 184
Time: 229 Min: 149 Max: 511 Avg: 347 Span: 362, 164, 198
Time: 230 Min: 180 Max: 539 Avg: 347 Span: 359, 192, 167
Time: 230 Min: 202 Max: 504 Avg: 347 Span: 302, 157, 145
Time: 229 Min: 161 Max: 540 Avg: 347 Span: 379, 193, 186
Time: 230 Min: 147 Max: 582 Avg: 347 Span: 435, 235, 200
Time: 229 Min: 118 Max: 546 Avg: 349 Span: 428, 197, 231
Time: 229 Min: 59 Max: 610 Avg: 347 Span: 551, 263, 288
Time: 230 Min: 187 Max: 553 Avg: 347 Span: 366, 206, 160
Time: 229 Min: 179 Max: 603 Avg: 348 Span: 424, 255, 169
Time: 230 Min: 186 Max: 569 Avg: 347 Span: 383, 222, 161
Time: 229 Min: 175 Max: 502 Avg: 347 Span: 327, 155, 172
Time: 229 Min: 191 Max: 497 Avg: 347 Span: 306, 150, 156
Time: 231 Min: 170 Max: 494 Avg: 347 Span: 324, 147, 177
Time: 229 Min: 203 Max: 517 Avg: 347 Span: 314, 170, 144
Time: 230 Min: 218 Max: 532 Avg: 347 Span: 314, 185, 129
Time: 229 Min: 189 Max: 514 Avg: 347 Span: 325, 167, 158
Time: 230 Min: 201 Max: 484 Avg: 347 Span: 283, 137, 146
Time: 229 Min: 117 Max: 532 Avg: 347 Span: 415, 185, 230

This can also be observed in the pure readings:

245
253
310
368
424
398
382
370
390
405
402
386
400
399
387
345
308
292
320
338
337
313
317
335
353
371
348
290
280
279
263
232
221
247
319

I have to admit in the FHT output I don’t see much difference:

Connecting some LEDs I modified the sketch to light the LEDs up based on some thresholds.

//based on: http://blog.yavilevich.com/2016/08/arduino-sound-level-meter-and-spectrum-analyzer/
#define MicSamples (1024*2)
#define MicPin A0
#define LEDRedPin 11
#define LEDGreenPin 9
#define LEDBluePin 10

// measure basic properties of the input signal
// determine if analog or digital, determine range and average.
void MeasureAnalog()
{
long signalAvg = 0, signalMax = 0, signalMin = 1024, t0 = millis();
for (int i = 0; i < MicSamples; i++) { int k = analogRead(MicPin); signalMin = min(signalMin, k); signalMax = max(signalMax, k); signalAvg += k; } signalAvg /= MicSamples; // print Serial.print("Time: " + String(millis() - t0)); Serial.print(" Min: " + String(signalMin)); Serial.print(" Max: " + String(signalMax)); Serial.print(" Avg: " + String(signalAvg)); Serial.print(" Span: " + String(signalMax - signalMin)); Serial.print(", " + String(signalMax - signalAvg)); Serial.print(", " + String(signalAvg - signalMin)); Serial.println(""); if(signalMax - signalMin > 450){
analogWrite(LEDRedPin, 255);
} else {
analogWrite(LEDRedPin, 0);
}
if(signalMax - signalMin > 400){
analogWrite(LEDGreenPin, 255);
} else {
analogWrite(LEDGreenPin, 0);
}
if(signalMax - signalMin > 500){
analogWrite(LEDBluePin, 255);
} else {
analogWrite(LEDBluePin, 0);
}
}
void setup() {
Serial.begin(115200);
pinMode(LED_BUILTIN, OUTPUT);
pinMode(LEDRedPin, OUTPUT);
pinMode(LEDBluePin, OUTPUT);
pinMode(LEDGreenPin, OUTPUT);
}

void loop() {
MeasureAnalog();
}

It is currently based on the intro, so it is not really an optimal solution for the whole song and for other songs. I will have to see how to configure the threshholds best. Maybe they have to adopt to the levels of the prior readings.

MSGEQ7

Then I connected the MSGEQ7 according to the schematic shown at http://nuewire.com/info-archive/msgeq7-by-j-skoba/. Using the very same Arduino sketch from there I got a lot of zeros for my input with some readings in different frequencies in between. What I also recognized was that the direct PWM output from the other Arduino was giving at least some results (not for the intro of the test song but from the chorus onwards. I have no clue why this is…). When I used the DAC / low pass filter shown above, I got no readings at all. I had no 200ohm resistor and used a 220ohm but should this result in such a difference? I don’t think so. I also tried connecting an MP3 player directly to the MSGEQ7 but also got no results.

Abb: Wiring with DAC – R2=200k, C2=33pF, C3=100nF, C4=10nF, C5=100nF

Abb: Wiring without DAC – R2=200k, C2=33pF, C3=100nF, C4=10nF, C5=100nF

I found a MSGEQ7 Demo app at https://forum.arduino.cc/index.php?topic=425799.0. Adopted to my setup:

/*
MSGEQ7 Demo app
Look for the breakout board on www.whizoo.com

This code runs on an Arduino Duemilanove, but will run on other Arduino models.

Connections:
- GND to GND on MSGEQ7 breakout board, and LED's
- 5V to VDD on MSGEQ7 breakout board
- A0 to OUT on MSGEQ7 breakout board
- D2 to STROBE on MSGEQ7 breakout board
- D3 to RESET on MSGEQ7 breakout board
- D9 to LED 0 (indicator for frequency band 0)
- D10 to LED 1 (indicator for frequency band 1)
- D11 to LED 2 (indicator for frequency band 2)
- no pin to LED 3 (indicator for frequency band 3)
- no pin to LED 4 (indicator for frequency band 4)
- no pin to LED 5 (indicator for frequency band 5)

*/

// Hardware-specific defines
#define MSGEQ7_STROBE_PIN      2
#define MSGEQ7_RESET_PIN       3
#define MSGEQ7_ANALOG_PIN      A0

#define NUM_FREQUENCY_BANDS    3

// Duemilanove only has 6 PWM outputs, so the last LED won't respond properly.  Your
// board may have more PWM outputs.  Typically you only want to monitor the lowest
// frequency bands because that is where the beat is.
int led[NUM_FREQUENCY_BANDS] = {9, 10, 11};

// There is a concept of "persistence of vision" with LED's.  The LED has to be on long enough
// for the eye to recognise that it is on.  When a high volume is received on a frequency band,
// The LED is turned on (at a high PWM value) and then gradually faded until the next beat in
// that frequency.
int ledPWMValue[NUM_FREQUENCY_BANDS] = {0, 0, 0};

void setup() {
// Set the LED pins as outputs
for (int i=0; i<NUM_FREQUENCY_BANDS; i++)
pinMode(led[i], OUTPUT);

// Set up the MSGEQ7 IC
pinMode(MSGEQ7_ANALOG_PIN, INPUT);
pinMode(MSGEQ7_STROBE_PIN, OUTPUT);
pinMode(MSGEQ7_RESET_PIN, OUTPUT);
digitalWrite(MSGEQ7_RESET_PIN, LOW);
digitalWrite(MSGEQ7_STROBE_PIN, HIGH);
Serial.begin(9600);
}

// This loop executes around 100 times per second
void loop() {
int frequencyBandVolume;

// Toggle the RESET pin of the MSGEQ7 to start reading from the lowest frequency band
digitalWrite(MSGEQ7_RESET_PIN, HIGH);
digitalWrite(MSGEQ7_RESET_PIN, LOW);

// Read the volume in every frequency band from the MSGEQ7
for (int i=0; i<NUM_FREQUENCY_BANDS; i++) { digitalWrite(MSGEQ7_STROBE_PIN, LOW); // delayMicroseconds(20); // Allow the output to settle frequencyBandVolume = analogRead(MSGEQ7_ANALOG_PIN); digitalWrite(MSGEQ7_STROBE_PIN, HIGH); Serial.print(frequencyBandVolume); Serial.print(" "); if (i == NUM_FREQUENCY_BANDS-1) { Serial.println(""); } // The read value is 10-bit (0 to 1024). PWM needs a value from 0 to 255, so divide by 4 frequencyBandVolume = frequencyBandVolume >> 2;

// Fade the current LED value for this band
ledPWMValue[i] = ledPWMValue[i] > 7? ledPWMValue[i] - 7 : 0;

// Don't show the lower values
if ((frequencyBandVolume > 70) && (frequencyBandVolume < 100)){ // If the new volume is greater than that currently being showed then show the higher volume if (frequencyBandVolume > ledPWMValue[i])
ledPWMValue[i] = frequencyBandVolume;
}

if (frequencyBandVolume > 220) {
// If the new volume is greater than that currently being showed then show the higher volume
if (frequencyBandVolume > ledPWMValue[i])
ledPWMValue[i] = frequencyBandVolume;
}

// Set the LED PWM value to the frequency band's volume
analogWrite(led[i],  ledPWMValue[i]);
}

// Wait before executing this loop again
//delay(2);
}

With some LEDs connected (there will be another post regarding the LEDs) you can see the result for the chorus in the video below:

I don’t have so much time to tinker more with the MSGEQ7 right now, so I will just go with a simple input solution I guess. At least I will take the fading of the LEDs from the MSGEQ7 Demo app. But one more note: http://www.eetimes.com/author.asp?doc_id=1323030 recommends to also use 100nF instead of the 10nF capacitor. Perhaps that might be something worth to try. The site has also the wiring for stereo input.

Doing it all on one Arduino

For my tests I used two separate Arduinos. But of course I would really like to reduce this down to one Arduino. So I connected the output of the DAC directly to the A0 pin of the Arduino UNO and combined the two sketches:

// ---------------------------------------------------------------------------------
// DO NOT USE CLASS-10 CARDS on this project - they're too fast to operate using SPI
// ---------------------------------------------------------------------------------

#include <SD.h>
#include <TMRpcm.h>
TMRpcm tmrpcm;

File root;
File entry;
#define MicSamples (1024^2)
#define MicPin A0
#define LEDRedPin 11
#define LEDGreenPin 9
#define LEDBluePin 10

// ---------------------------------------------------------------------------------
// set chipSelect to '10' if using the $2 SD card module or '4' if using the
// Ethernet shield's microSD card instead.
const int chipSelect = 10;
// ---------------------------------------------------------------------------------

const int oldCard = SPI_HALF_SPEED;
const int newCard = SPI_QUARTER_SPEED;

// ---------------------------------------------------------------------------------
// set cardType to 'oldCard' if using an old SD card (more than a few years old) or
// to 'newCard' if using a newly-purchase Class-4 card.
int cardType = newCard;
// ---------------------------------------------------------------------------------

int wasPlaying = 0;
int inSwitch = 7;
int finished = 0;
int start = 0;
int pauseOn = 0;
unsigned long timeDiff = 0;
unsigned long timePress = 0;
int analogMeasureCounter = 0;
int analogMeasureValue = 0;
long signalAvg = 0, signalMax = 0, signalMin = 1024, t0 = millis();

void setup() {
Serial.begin(9600);
Serial.print("\nInitializing SD card...");
pinMode(chipSelect, OUTPUT);
if (!SD.begin(chipSelect,cardType)) {
Serial.println("failed!");
return;
}
Serial.println("done.");

tmrpcm.speakerPin = 9;

pinMode(inSwitch,INPUT_PULLUP);
digitalWrite(inSwitch,HIGH);

root = SD.open("/");
}

void loop(void) {
if(!tmrpcm.isPlaying() && wasPlaying == 1) {
tmrpcm.stopPlayback();
playNext();
}
MeasureAnalog();
if (millis() - timeDiff > 50) { // check switch every 100ms
timeDiff = millis(); // get current millisecond count

if(digitalRead(inSwitch) == LOW) {

if(start==0) {
start=1;
playNext();
delay(200);

} else {

timePress = millis();
while(digitalRead(inSwitch)==LOW) {
delay(50);
}
if (millis() - timePress < 1000 && start == 1) { tmrpcm.pause(); if (pauseOn == 0) { pauseOn = 1; } else { pauseOn = 0; } } if (millis() - timePress > 1000 && start == 1) {
if (pauseOn == 1) {pauseOn = 0; tmrpcm.pause();}
tmrpcm.stopPlayback();
timePress = millis();
if (finished == 0) {
playNext();
} else {
finished = 0;
Serial.println("Restarting.");
root.rewindDirectory();
playNext();
}
}
}
}
}
}

void playNext() {
entry = root.openNextFile();
if (entry) {
entry.close();
tmrpcm.play(entry.name());
Serial.print("Playing ");
Serial.print(entry.name());
wasPlaying = 1;
} else {
if (wasPlaying == 1) {
Serial.println("Completed playback.");
wasPlaying = 0;
finished = 1;
start = 0;
root.rewindDirectory();
}
}
}
void MeasureAnalog()
{
if (analogMeasureCounter == MicSamples) {
signalAvg /= MicSamples;

// print
Serial.print("Time: " + String(millis() - t0));
Serial.print(" Min: " + String(signalMin));
Serial.print(" Max: " + String(signalMax));
Serial.print(" Avg: " + String(signalAvg));
Serial.print(" Span: " + String(signalMax - signalMin));
Serial.print(", " + String(signalMax - signalAvg));
Serial.print(", " + String(signalAvg - signalMin));
Serial.println("");

//    if(signalMax - signalMin > 450){
//      analogWrite(LEDRedPin, 255);
//    } else {
//      analogWrite(LEDRedPin, 0);
//    }
//    if(signalMax - signalMin > 400){
//      analogWrite(LEDGreenPin, 255);
//    } else {
//      analogWrite(LEDGreenPin, 0);
//    }
//    if(signalMax - signalMin > 500){
//      analogWrite(LEDBluePin, 255);
//    } else {
//      analogWrite(LEDBluePin, 0);
//    }
t0 = millis();
analogMeasureCounter = 0;
} else {
//Serial.println( analogRead(MicPin));
analogMeasureValue = analogRead(MicPin);
//signalMin = min(signalMin, analogMeasureValue);
//signalMax = max(signalMax, analogMeasureValue);
signalAvg += analogMeasureValue;
analogMeasureCounter++;
}

}

That resulted in very slow readings. Instead of every 230 milliseconds I got a reading every 2-4 seconds. Also reducing the number of MicSamples down to 512 resulted in the following output:

Time: 1197 Min: 1024 Max: 0 Avg: 234 Span: -1024, -234, -790
Time: 1274 Min: 1024 Max: 0 Avg: 236 Span: -1024, -236, -788
Time: 1235 Min: 1024 Max: 0 Avg: 233 Span: -1024, -233, -791
Time: 1275 Min: 1024 Max: 0 Avg: 236 Span: -1024, -236, -788
Time: 1196 Min: 1024 Max: 0 Avg: 231 Span: -1024, -231, -793
Time: 1258 Min: 1024 Max: 0 Avg: 231 Span: -1024, -231, -793
Time: 1274 Min: 1024 Max: 0 Avg: 238 Span: -1024, -238, -786

So still over a second. That is not usable for sound reactive lights. It would lag very much behind.

I also got to remove the calculation of min and max values because the dynamic memory was giving a warning and the playback did not start anymore.

TMRpcm versions

I used the version of TMRpcm that came with the Auduino. It doesn’t include volume adjustment yet and so I wanted to upgrade to the most recent version of the library from https://github.com/TMRh20/TMRpcm/wiki. Unfortunately I was not able to get that one running. I tried the basic examples and also my above used codes but it was refusing to playback anything. I have no clue why.

In the end I will just continue with the current setup of two Arduinos (perhaps I might exchange the one that is doing the audio playback with an Arduino nano and try the recent version again. But for now I don’t want to reconnect all the cables. I will go for some PCB design soon and solder everything together. That will make rewiring everything easier.

More to read

Fading RGB FHT: http://shin-ajaran.blogspot.de/2014/11/arduino-spectrum-analyzer-for-music-to.html

PWM to Voltage: http://www.instructables.com/id/Arduino-RC-Circuit-PWM-to-analog-DC/

Wiring of the MSGEQ7 http://nuewire.com/info-archive/msgeq7-by-j-skoba/

Matching Instructable: http://www.instructables.com/id/Extreme-Nightlight-Color-Organ/

MSGEQ7 forum post with TestCode https://forum.arduino.cc/index.php?topic=425799.0

MSGEQ7 Datasheet: https://www.sparkfun.com/datasheets/Components/General/MSGEQ7.pdf

MSGEQ7 Tutorial http://tronixstuff.com/2013/01/31/tutorial-arduino-and-the-msgeq7-spectrum-analyzer/

MSGEQ7 Tutorial https://www.baldengineer.com/msgeq7-simple-spectrum-analyzer.html

Mic Amp: http://www.redcircuits.com/Page38.htm

AnalogIn Basic analysis, theory: http://blog.yavilevich.com/2016/08/arduino-sound-level-meter-and-spectrum-analyzer/

FFT for Arduino: http://wiki.openmusiclabs.com/wiki/ArduinoFFT

FHT for Arduino: http://wiki.openmusiclabs.com/wiki/ArduinoFHT

Arduino, FHT, RGB Led, sound to lighting: https://gist.github.com/teos0009/6e54aff7e3d236d17ac4

091117_2101_TinkeringTu3.jpg

Tinkering Tuesday – Playmobil Stage – LED Rings

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

Tinkering Tuesday – Playmobil Stage – Disco Ball with stepper motor


This one will be a rather short post to describe the LED rings that I used for the background effect.

They are very cheap WS2812B based LED rings from ebay. I bought 3 different ones, 7 LEDs (1,10 EUR), 16 LEDs (2,29 EUR) and 24 LEDs (3,69 EUR). The wiring is very easy, the WS2812B is addressable and requires only 5V, GND and one control pin from the Arduino. They are even chainable so I connected the control pins of all three rings to only require one singel Arduino pin.

In the following picture you can see the wiring. Yellow is the control pin chained from the biggest to the smallest ring. The black ground wire is also chained. I decided to provide the 5V to every ring on its own to avoid a loss of brightness (but I guess with only 47 LEDs that was not really necessary). I even made a professional looking schematic, see the small orange paper in the pic?!

Soldered and chained rings

In the next picture you see the solder pads in a closeup.. Here is the smallest ring only connecting the input side (black=GND, red=5V, yellow=control pin). As you saw above I secured everything with hot glue.

Solder pad closeup

Here it is already glued to the back of the stage:

Glued to the background

As a beginning I searched for an easy to use library and found FastLED. They are also compatible with Adafruits NeoPixel. So go have a look there. They have great guides.

The most simple program using it is:

#include "FastLED.h"
CRGB leds[1];
void setup() { FastLED.addLeds&lt;NEOPIXEL, 6&gt;(leds, 1); }
void loop() {
leds[0] = CRGB::White; FastLED.show(); delay(30);
leds[0] = CRGB::Black; FastLED.show(); delay(30);
}

This only blinks the first LED. There are some more great examples in the download from Github and the basics are very easy.

Here is a small test video switching all LEDs one after another from red to yellow to blue:

I wanted to use something with a little more effects than just blinking like with the LED spots so I chose one of the bigger examples, the NoisePlusPallette which can be found at: https://github.com/FastLED/FastLED/blob/master/examples/NoisePlusPalette/NoisePlusPalette.ino

This is using readymade color palettes and combines that with a random noise generator. You can influence the parameters (e.g. with the sound input) and so make this you own. I didn’t have so much time so I just fed in some parameters from my sound input and adapted it to the number of LEDs. The result will later be described in my Software wrapup.

I used acrylic glass that I sanded so it is not clear but milky to make the effect more outstanding. That will be seen later in the woodworking part. In my demonstration video you can see the rings in action (here directly starting at 0:11):

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):

082617_0857_TinkeringTu23.jpg

Tinkering Tuesday – Playmobil Stage – LED Stage Lights

Past posts of this series:

Tinkering Tuesday – Playmobil Stage – Einführung

Tinkering Tuesday – Playmobil Stage – Introduction
Tinkering Tuesday – Playmobil Stage – Playmobil parts


 

I bought some stage lights from Playmobil (see also my post on the Playmobil parts):

They have a diameter of 1cm inside. So I thought „why not buy big LEDs that fit in there?“. I measured and looked through the online shop of http://www.conrad.de. I figured out that the 10mm LEDs will not fit because they have a slightly wider ring on the bottom. The 8mm LEDs also have this ring but this one is about 10mm so fit perfectly.

I bought 9 of these in the colors red, yellow and green (after the guy at the parts counter wanted to also sell me white ones. Right before going to the checkout I saw that they cost 4.95 EUR each. He nearly got me. Now I know I always have to ask for the price of all parts, even if they seem nearly the same…).

Back home I calculated the resistors needed and came up with the following results using http://ledcalc.com/:

Green LED

https://www.conrad.de/de/led-bedrahtet-gruen-rund-8-mm-3-mcd-60-20-ma-22-v-l-793-gd-180343.html

Red LED

https://www.conrad.de/de/led-bedrahtet-rot-rund-8-mm-3-mcd-60-20-ma-2-v-l-793-id-180327.html

Yellow LED

https://www.conrad.de/de/led-bedrahtet-gelb-rund-8-mm-3-mcd-60-20-ma-21-v-kingbright-l-793yd-180475.html?sc.ref=Product%20Details

What I didn’t think of was how bright they would be. When I connected everything I was a bit disappointed but having a look at the data sheets I understood why and blamed myself. They only have 3 mcd of light. That’s really next to nothing. A candle has about 1000 mcd. So I will go back to using 5mm LEDs that are cheaper and easier to find in various colors and with a much higher mcd value. Lesson learned!

I then just ordered a cheap LED set from ebay with higher mcd values and 5 colors each in sizes 5mm and 3mm. Those are quite acceptable in brightness. Only the green LED is very dark (although it has the highest mcd ratings… can anyone explain that? I experimented with resistors from 82 ohm to 100 ohm but it is not very bright). I won’t do the full resistor math here, just use an online LED calculator

The light distribution is very wide but I also had some LEDs from a cheap starter set which are more like a spot light. I will combine both and will place the spots. I also have red, blue and green LEDs from those but the green ones have the same brightness problem so I will just use red and blue. I combine the red and blue spots together with the yellow ones from the set in the Playmobil spots and have two white spots at fixed points at the side of the stage for the disco mirror ball (5cm diameter) I bought from Conrad:

The spotlights are mounted on a 4mm aluminum rod:

That is a tight fit but is just the right tension to not move easily and be able to move the spots.

Schematics LED controller board

From my HUEify project I had good experiences with using a MOSFET to drive LEDs so I bought some BUZ11 again (I know, not the best ones to use but at least here a very cheap way to go). So the plan is to drive the LEDs in color groups, each driven by a BUZ11. In the groups the LEDs will be connected in parallel with a resistor each.

This is the basic cabling for one LED. There are two pin headers for power (top=GND, botton=5V) and one pin header for the control pin of the Arduino. Three of the LEDs are connected to one MOSFET with common 5V. The build process is documented in the following pictures:

Resistors first, then the cables to LED’s anode (red cabling).

Then solder the MOSFETs, the pin headers for the control pins and the pin headers for GND in place (I took 2 here which was a good decision in the end. I will explain that later). If you have a closer look at the picture above: do you see what’s wrong? Post it in the comments… Always double-check before soldering!

On the right side is another pin header (also 2 pins here) for the 5V power. Above are the black cablings from the LED’s cathodes. The lower part is for the white LEDs for the mirror ball. I messed up with one resistor so I had to solder a third one… Here the cabling is a bit different because I wired them directly to pins 9 and 10 of the Arduino. I also messed up with the black cable: it goes to the LED’s anode, not cathode so I used yellow cabling to the anode to be reminded of the mistake. It helped! And finally some hot glue to hold everything in place (that is a whole lot of cables…)

Here is a picture to give you an idea of the mess of cables (LED rings are also included there):

I used tape to hold the cable pairs together and marked them to see which is connected to which MOSFET. Also a good idea!

To put them into the spots I had to drill a hole in the spot itself. I think it was a 4mm drill that was perfectly fitting. After that I put some heat shrink tubing in place:

Putting the cables through and adding another small heat shrink tubing to the black wire:

Then I soldered the LED in place:

Always test after sodlering and before shrinking the heat shrink tubes:

Then put the LED into the spot and use hot glue to hold in place:

Last but not least put them on the rod (more on that in a future post):

In the following picture you can see one of the spot LEDs for the disco ball. They are just hot glued into the side walls:

And it’s always a good idea to prepare for mass production:

The control of the lights will be described in the software wrapup. Next week will be about the disco ball, including the control of the stepper motor.

082017_1242_TinkeringTu8.jpg

Tinkering Tuesday – Playmobil Stage – Playmobil parts

In this post I will provide details about all the parts that I used and all the other music stuff I found and could be used.


Past parts of this series:

Tinkering Tuesday – Playmobil Stage – Einführung (German introduction)
Tinkering Tuesday – Playmobil Stage – Introduction


Playmobil sets

I found several music related sets and also wedding related ones that I will just list here. The picture is linked to Amazon using my partner ID. If you choose to buy something I would be glad if you’d use the link.

Music sets

Link and Picture Set number Set name (german)

4787 Musik-Clowns

4231 Zirkuskapelle

4329 Schulband

4784 Rockstar

5377 DJ Z
5602 Pop Stars Stage Bühne


5603 Pop Stars Tour Bus

5604 Pop Stars Keyboarder

5605 Pop Stars Band

5610 Musik Band

6983 Disco mit Liveshow

9095 Sängerin am Keyboard

Wedding sets

Link and Picture Set number Set name (german)

4298 Brautpaar mit Hochzeitstorte

4308 Hochzeitsgäste im Partyzelt

5163 Brautpaar

6871 StarterSet Hochzeit

9226 Brautmodengeschäft mit Salon

9227 Hochzeitslimousine

9228 Hochzeitsparty

9229 Hochzeitspavillon mit Brautpaar

9230 Fotograf mit Blumenkindern

From those sets I researched all the parts that I could use and got the prices and availabilty from the Playmobil spare parts service. Unfortunately I found the really helpful site http://playmodb.org/
after I researched everything via the manuals from Playmobil. But as a hint: use it if you search for something:

Playmobil Parts

To research the part numbers from sets just enter the set number:

And you will get all the details: http://playmodb.org/cgi-bin/showinv.pl?setnum=5602

And you can even get an inventory list (link on the top: Show text-only list with quantities:

This would have saved me some work. If you are not sure about the part, just match the part number from the inventory with the picture. For prices just go to the Playmobil service site and enter the part number:

Most of the parts I searched for had no picture and sometimes the names are also not the best ones. PlaymoDB is much better!

Another hint: Don’t forget to order the stickers for the parts that require some, e.g.:

Sometimes there are even several options:

At the service you have two options. The first one is to directly order in the shop. But there were nearly no parts available that I wanted to order. There is a hint that you have to make an individual order:

There is a separate form for that: https://www.playmobil.de/ersatzteilbestellung But there you can only enter 10 parts. I read some forum posts on http://www.klickywelt.de/ and they just call (also not cool if you want many parts) or send an email (in Germany it’s service@playmobil.de). Please save them some work and prepare your list with part numbers and names and how many you want. I even included the prices. You will get an offer with the total costs which you have to confirm and then receive a package a few days later J

I didn’t know about the service before I purchased my first set, the rockstar (4784) via https://www.ebay-kleinanzeigen.de/. That was cheap and included a guitar, a microhpne and stand and the amp, so it was okay. I also (still) don’t know whether you are able to order the figures from the spare part service or how much they cost because you don’t find them in the spare part search, so I searched and ordered them separately. The wedding couple (5163) was matching the real couple okay (the couple from 9229 would have matched better but that was only announced when I researched and the whole set would anyway been to expensive) and I got that with a coupon also really cheap. I had to search for a boy (they have a kid and a band needs a drummer) a little longer but found a very cheap offer of the set 9230 with a boy as a flower kid also on https://www.ebay-kleinanzeigen.de/. I haven’t yet sold the leftover parts, so if someone is in need of a photographer set without a boy or of a rockstar without equipment…

Here is a list of parts that I researched. For most of the things you need several parts, e.g. for the guitar you need 3 parts (the neck, the body and the strap), for the drum even more. I listed them seperately as complete sets though they include equal parts. For the final order I consolidated that of course:

Part List

Subject / required quantity (if more than 1) Part number Part description Price (EUR)
Drumset blue
30637792 Bass Drum Front 1,15
30064300 Drum-Stand 0,45
30642180 Bass Drum Back 0,95
30642740 Tom Top-Part 0,75
30461280 Tom Bottom-Part n/a
Drum Cymbals
30281540 Cymbal 0,25
30064290 Cymbal Stand Rod 0,25
30064270 Cymbal Stand 0,3
Drumset black
30610292 Bass Drum 0,55
30064300 Drum-Stand 0,45
2x 30610302 Tom 0,3
30808233 Sticker (for the whole stage set) 1,15
Drum Seat
30252313 Drum Seat (blau) 0,4
30064270 Drum Seat Stand 0,3
Guitar Stand
30252213 Guitar Stand Rod 0,15
30064270 Guitar Stand Bottom 0,3
Guitar Strat blue
30252303 Strat Body blue 0,4
30079480 Guitar Neck 0,3
30800400 Guitar Strap 0,35
Guitar Strat white
30212423 Strat Body white 0,4
30252293 Strat Body white (alternative) 0,4
30079480 Guitar Neck 0,3
30800400 Guitar Strap 0,35
Guitar Strat red
30079490 Strat Body red 0,4
30079480 Guitar Neck 0,3
30800400 Guitar Strap 0,35
Guitar Strat yellow
30233022 Strat Body yellow n/a
30079480 Guitar Neck 0,3
30800400 Guitar Strap 0,35
30037202 Guitar Neck (brown) n/a
Micro Stand (short)
30217172 Microphone clip 0,15
30248472 Micro Stand rod 0,15
30064270 Micro Stand Bottom 0,3
Micro Stand (boom)
2x 30217172 Microphone clip 0,15
2x 30248472 Micro Stand rod 0,15
30064270 Micro Stand Bottom 0,3
DJ Counter
30644994 Counter base, solid 3,2
2x 30645004 Compact disc 0,95
30246863 Turntables 0,4
2x 30246873 Turntable-arms 0,2
30246893 Earphones 0,35
Other
30604752 Guitar Amp 3T 0,9
30809443 Guitar Amp 3T (Aufkleber) 0,2
30648603 Rock Guitar 0,55
30209600 Drumstick (2x) 0,15
30609010 Drumsticks and -jazz broomsticks 0,45
30218270 Trumpet 0,3
30657190 Accordion 0,5
30218320 Horn 0,35
30218280 Saxophone 0,3
30080280 Tambourine Batter 0,3
30080290 Tambourine bells 0,3
30252173 Micophone grey 0,15
30035032 Micophone black 0,15
30066220 Micophone black round 0,21
30660103 Strobe-Light n/a
Light 1
30252343 PAR-Stand 0,25
30224582 PAR-Spot 0,25
30032040 PAR yellow glass 0,2
30253133 PAR red glass 0,2
30255083 PAR orange glass 0,2
Light 2 (Set 6983)
30035042 PAR light-yellow glass 0,2
30035052 PAR light pink glass 0,2
30035072 PAR spot 0,2
30245722 PAR Stand 0,2
PA
4x 30252333 PA-Box 0,6
30821603 PA-Box Sticker 4x PA-Box 0,3
30808233 PA-Box Sticker alternative: whole stage set 1,15
Keyboard
30252143 Top 0,35
30252153 Keys (white) 0,3
30252163 Keys black) 0,45
2x 30201212 Stand 0,2

Final order

My final order was the following (german, not including parts that I didn’t use in the final product and which I already had from the sets):

Anzahl Ersatzteilnummer Bezeichnung Einzelpreis Gesamtpreis
1

30610292

Basstrommel-Schlagzeug 0,55 € 0,55 €
1

30064300

Gestell-Schlagzeug II 0,45 € 0,45 €
2

30610302

Trommel-Schlagzeug 0,30 € 0,60 €
2

30281540

Becken-Schlagzeug 0,25 € 0,50 €
2

30064290

Stativstange Gebogen 0,25 € 0,50 €
7

30064270

Dreibein 0,30 € 2,10 €
1

30252313

Sitz-Dreibein 0,40 € 0,40 €
2

30252213

E-Gitarre-Ständer 0,15 € 0,30 €
1

30252303

E-Gitarre-Körper (blau) 0,40 € 0,40 €
2

30079480

E-Gitarre-Hals 0,30 € 0,60 €
2

30800400

E-Gitarre-Riemen 0,35 € 0,70 €
1

30212423

E-Gitarre-Körper (weiß) 0,40 € 0,40 €
2

30217172

Adapter-Clip 3 6 0,15 € 0,30 €
2

30248472

Stange 46×3 6mm 0,15 € 0,30 €
9

30224582

Suchscheinwerfer 0,25 € 2,25 €
4

30252333

Lautsprecher stapelbar 0,60 € 2,40 €
1

30821603

Etikett 5610 „Carrying Case Band“ 0,30 € 0,30 €
1

30209600

Trommelstöcke 0,15 € 0,15 €
1

30035032

Mikrofon 2012 0,15 € 0,15 €
1

30066220

Mikrofon 0,21 € 0,21 €
1

30604752

Verstärker-Gitarre 3T 0,90 € 0,90 €
1

30809443

Etikett 4784 „Rockstar“ 0,20 € 0,20 €

Here again a picture of the first (with the rockstar as drummer and some additional parts I ordered) and the final setup:

Next week I will most probably continue with the assembly of the LED spots.

082017_1114_TinkeringTu1.jpg

Tinkering Tuesday – Playmobil Stage – Introduction

All posts of the series (will be continued):

Tinkering Tuesday – Playmobil Stage – Einführung (German introduction)
Tinkering Tuesday – Playmobil Stage – Playmobil parts
Tinkering Tuesday – Playmobil Stage – LED Stage Lights
Tinkering Tuesday – Playmobil Stage – Disco Ball with stepper motor
Tinkering Tuesday – Playmobil Stage – LED Rings
Tinkering Tuesday – Playmobil Stage – Audio Output from microSD with Arduino
Tinkering Tuesday – Playmobil Stage – Audio Spectrum Analysis from WAV input with simple logic, FHT and MSGEQ7


 

As a wedding gift for a befriended couple, both are musicians, I build a stage for Playmobil figures. The result can be seen in the following pictures (a video is at the end of the article):

In a series of blog posts within the nest weeks I will describe in detail how I build it, what the difficulties were and everything I had in mind that would be also possible (but as a matter of time I wasn’t able to implement in the final product). Today will be about the basic idea and the implemented functions.

The idea

The inspiration came from a gift we got to our own wedding. In a small wooden frame there was a horse (my wife is a horse rider), bride and groom with a guitar on it. Unfortunately I don’t have a picture of the gift as a whole but I still have the figures:

2017-08-14 20.54.37

 

I thought that I could reuse the guitar and build a small stage with a couple on it. But then there questions came up: I would need new figures, a second guitar (or a bass guitar). And a stage with no light or music at all?

My first thoughts were about figures. I came up with Playmobil. I saw guitars there and after some internet research I found a big community about customizing Playmobil. And even stumbled upon several pictures on Pinterest about rebuilding Rock Bands (I Love Clicks, e.g. Bon Jovi in the following image):

Source: https://www.pinterest.de/pin/300756081338206340/

Some people also build small stages. But that was not what I had in mind. I wanted a festival stage, like Rock am Ring.

Source: https://www.pinterest.de/pin/300756081338196939/

Source: https://www.pinterest.de/pin/300756081338204651/

Playmobil also offers a pop stars stage, even with a builtin speaker and some lights:

Source: http://amzn.to/2wGOC1o

But that’s also not what I wanted and was too expensive.

But there were some cool things: The whole music equipment like the drums, guitars and microphones. The light spots. After another short research I came up with the spare part service from Playmobil (this is the german link but they also provide that in different countries): https://www.playmobil.de/content/spareparts_info/SPAREPARTS_INFO.html

Great! But you need the part numbers. I googled all the sets with music equipment and searched for the part numbers. You can use the manuals available with the set numbers on the Playmobil site and/or http://playmodb.org/. I will provide the details in the next blog post.

The plan

The basic functions I came up with were:

  • Play music
  • Light reacting to sound

And then it went all out of control… J But more on all the ideas in a future post.

As I already said the stage should be like a festival stage. That includes a certain size. The first draft was to use DIN A4 and/or DIN A3 sized sheet wood. But two of those were not quite the size. And I had to plan for some space for all of the electronics:

So it had to be bigger! The detailed measures and the plans for the wood will follow in a separate post.

I did some more research and because of my electronic knowledge is mainly based on the Arduino as a controller and I had some cheap ones lying around, I wanted to do everything on this basis. I found a library to play music from an (micro) SD card and I already played around with lighting in my HUEify project. Build some LEDs into the spot is not the most difficult thing.

The other features have evolved by internet surfing and eBay. The following is included into the final stage:

  • Play music from a microSD card
  • Buttons for Play/Next/Stop
  • Sound Sensor to analyze the ambient sound
  • Sensitivity-potentiometer for the Sound Sensor
  • Switch for swithing between internal and external audio
  • LED-spots (3 blue, 3 red and 3 yellow spots, each color can be controlled seperately, more or less, more on that later …)
  • LED-rings behind a milky acrylic glass as the background, LEDs controllable seperately
  • Turning disco ball (by a stepper motor) with seperate white spots

That’s it. Here is the backpanel:

From top to bottom:
Button: Audio Playback (short push=Play/Next, long pugh=Stop)
Switch: Input Switch (left=internal audio playback, right=external sound)
Potentiometer: Sensitivity for external sound (controls the threshold volume for activating the light)
Cable: Using a rubber from a beer bottle to hide the cable hole. Two cables, small black=audio player, grey=light control.

And now I will finish this post with a video (Music: Monkey Fly – Whatever  – www.monkeyfly.de):

In the next weeks I will continue with the detailed posts. I have already written some of the really technical posts, but I will try to have the general posts before the nitty gritty details.

081417_1823_TinkeringTu1.jpg

Tinkering Tuesday – Playmobil Stage – Einführung

Alle Teile dieser Serie:

Tinkering Tuesday – Playmobil Stage – Introduction (englische Einführung, restliche Parts sind nur auf Englisch verfügbar)
Tinkering Tuesday – Playmobil Stage – Playmobil parts
Tinkering Tuesday – Playmobil Stage – LED Stage Lights
Tinkering Tuesday – Playmobil Stage – Disco Ball with stepper motor
Tinkering Tuesday – Playmobil Stage – LED Rings
Tinkering Tuesday – Playmobil Stage – Audio Output from microSD with Arduino
Tinkering Tuesday – Playmobil Stage – Audio Spectrum Analysis from WAV input with simple logic, FHT and MSGEQ7


 

Als Hochzeitsgeschenk für ein befreundetes Paar, beide Musiker, habe ich eine Bühne für Playmobilfiguren gebaut. Das Ergebnis ist in den folgenden Bildern zu sehen (ein Video gibt es unten):

In einer Serie von Beiträgen werde ich detaillierter beschreiben, wie das Ding aufgebaut ist, was sich mir für Schwierigkeiten in den Weg gestellt haben und was mir noch alles im Kopf herumgeschwirrt ist, aus Mangel an Zeit dann aber nicht mehr umgesetzt werden konnte. Heute geht es erst mal um die grundlegende Idee und die Funktionen.

Die Idee

Inspiriert hat mich ein Geschenk, das wir zu unserer eigenen Hochzeit bekommen haben. Es war ein Rahmen, darauf ein Pferd, ein Hochzeitspaar, er mit einer kleinen Gitarre in der Hand. Ich habe leider kein vollständiges Bild mehr, aber die Figuren:

2017-08-14 20.54.37

Da dachte ich mir, das lässt sich doch auch für die beiden anpassen. Aber als kleine Bühne. Die Gitarre kann ich nutzen, ggf. Die beiden Figuren auch. Aber dann kamen erst die Probleme: woher einen kleinen Bass oder eine zweite Gitarre bekommen? Vielleicht andere Figuren? Und dann muss es ja auch nach einer Bühne aussehen.

Also mal überlegt. Und auf Playmobil gekommen. Da hab ich doch auch schon mal Gitarren gesehen. Eine kurze Recherche im Internet bringt eine Community zu Tage, die sich mit Playmobil beschäftigt und verschiedenste Szenarien nachbaut. Auf Pinterest gibt es da auch so einiges, wie etwa die „I Love Clicks“ Bilder, hier z.B. Bon Jovi:

Quelle: https://www.pinterest.de/pin/300756081338206340/

Auch einige Bühnen sind dort zu finden, aber nicht so wie ich mir das vorgestellt habe:

Quelle: https://www.pinterest.de/pin/300756081338196939/
Quelle: https://www.pinterest.de/pin/300756081338204651/

Direkt von Playmobil gibt es auch eine Popstars Bühne:

Quelle: http://amzn.to/2wGOC1o

Aber das ist ja auch garnicht so wie ich mir das vorgestellt hatte und auch zu teuer.

Da sind aber schon einige coole Sachen dabei. Das gesamte Musikequipment (Schlagzeug, Gitarren, Mikros und –stative), die Boxen, die Spots. Eine weitere kurze Internet-Recherche bringt einen Top-Ersatzteilservice von Playmobil hervor: https://www.playmobil.de/content/spareparts_info/SPAREPARTS_INFO.html

Großartig! Dafür braucht man aber die Teilenummern. Also erstmal nach Sets gegoogelt, die Musikteile beinhalten. Dann die Einzelteile herausgesucht (dabei helfen http://playmodb.org/ und die Anleitungssuche auf der Playmobil Homepage sehr weiter). Alles weitere dazu kommt in einem seperaten Teil.

Der Plan

Als Grundfunktionen habe ich mir dann folgendes überlegt:

  • Musik abspielen
  • Licht passend zur Musik

Und dann ist es irgendwann aus dem Ruder gelaufen J

Zu allen weiteren Ideen später nochmal mehr.

Insgesamt sollte die Bühne wie eine Festival-Bühne daherkommen. Zuerst habe ich mit A4-großen Spanplatten geplant. Dann aber schnell gemerkt, dass das nichts werden kann. A3 war auch noch sehr gedrängt (hier schon mit dem Bühnensetup und den Hochzeitsfiguren):

Zwei A4 Blätter lassen auch nicht viel Platz für die Technik.

Also musste es noch größer werden. Die genaue Holzplanung und die Abmessungen gibt es ebenfalls in einem späteren Teil.

Dann etwas weiter recherchiert und da sich meine Elektronikkenntnisse hauptsächlich auf den Arduino konzentrieren und ich davon noch einige billige rumliegen habe, wurde auf der Basis versucht die Hauptfunktionen umzusetzen. Audio kann man mit dem Arduino mittels einer Library von einer (micro) SD Karte abspielen. Check.

Licht ist sowieso kein Problem. Die Spots, die auch bei der oben abgebildeten Bühne zum Einsatz kommen kann man einfach mit LEDs bestücken und die Steuerung kenne ich ja schon von meiner HUEify-Serie.

Alle weiteren Funktionen haben sich dann durch Stöbern bei eBay ergeben. Hier der volle Funktionsumfang, der letztlich in der fertigen Bühne steckt:

  • Musik von microSD-Karte abspielen
  • Button für Play/Next/Stop
  • Sound Sensor, der die Umgebungsgeräusche erkennt
  • Sensitivity-Regler für den Sound Sensor
  • Umschalter zwischen internem/externem Audio
  • LED-Spots (jeweils 3 blaue, 3 rote und 3 gelbe, pro Farbe steuerbar, naja, fast…)
  • LED-Ringe als Bühnenhintergrund (hinter milchig geschliffenem Acrylglas), LEDs einzeln ansteuerbar
  • Drehbare Diskokugel mit seperaten weißen Spots

Das ist es grob. Hier einmal das Backpanel:

Backpanel

Von oben nach unten:
Taster: Audio Playback (kurzes Drücken=Play/Next, langes Drücken=Stop)
Kippschalter: Input Switch (links=interne Audio-Wiedergabe, rechts=externer Sound)
Potentiometer: Sensitivity für externen Sound (regelt, ab welcher Lautstärke auf Sound reagiert wird)
Kabeldurchführung: ein Flaschengummi von einer Flensflasche (bzw. einem Alster, da es ein blaues Gummi hatte)

Als Abschluss für heute gibt es noch ein Video (Music: Monkey Fly – Whatever  – www.monkeyfly.de):

In der nächsten Woche geht es dann mit Detailberichten weiter. Ich habe einige Teile bereits vorgeschrieben, allerdings geht es da eher um den eher trockenen Software-Part. Ich versuche möglichst erst die spannenden Dinge zu dokumentieren und eine einigermaßen sinnvolle Reihenfolge hinzubekommen. Außerdem wird es diese Einführung spätestens am Wochenende noch auf Englisch geben, da alle anderen Teile ebenfalls in englischer Sprache erscheinen werden.