091117_2112_TinkeringTu6.png

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

The most important thing a stage needs is sound! As I want to keep costs down I want to use one of the several cheap Arduino copies I have lying around. That will be not the best quality sound but it will work. In the following post I will describe my way to Arduino sound.

microSD card to Arduino

I bought some cheap microSD card modules from eBay (1 EUR for 2 pcs) to save the audio files on.

MicroSD cards work with 3.3V serial communication, the Arduino with 5V. As I had a spare LLC (Logic Level Converter) from my HUEify project lying around I decided to use that one. I couldn’t find much about using one with a microSD adapter on the web (here is a german site: http://physudo.blogspot.de/2013/09/sd-karten-mit-dem-arduino-beschreiben.html) but in the end it is straight forward. The only I issue I had (which made me nearly giving up) was that connecting everything through the LLC always resulted in the Arduino not being able to initialize the card. Directly connecting the MISO (Master In Slave Out) pin from the SD to the Arduino finally solved it. There is no issue in voltage level as this pin only sends data from the SD card to the Arduino (Master=Arduino in, Slave=SD card Out) so it communicates with 3.3V which is enough for the Arduino.

This is the schematic I came up with (the fancy colors are a result of my jumper wires on the breadboard, see picture below):

If you even want to save the microSD adapter, you can build your own adapter for normal SD cards. In this picture shown by Nathan Chantrell on flickr, you can also see the connections that have to be made.

Using the sample code from https://www.arduino.cc/en/Tutorial/listfiles you can test whether your connections are working. My first attempts always showed „initialization failed“ until I connected MISO directly to the Arduino and not via the LLC. You also need to format the card in FAT16 or FAT32. I had a 2GB card lying around and my bigger cards did not work. So just try different ones if it is not working.

Making the audio connection

I had no Amplifier or something (but I ordered it) at first, so I searched for a way to hook up the Arduino directly to a speaker. I had a small battery powered Bluetooth speaker which also had a 3.5 input jack. So I used that one. It is pretty much crap but for testing it is sufficient. Mainly I followed the instructions at apcmag, building the Auduino. Only with some adjustments to match what I have on hand.

The connection to audio is also shown very simply in the following screenshot:

Source: Arduino Music and Audio Projects – Mike Cook (on Google books)

The setup can be seen in the following image:

For coding I used the Auduino code from apcmag. Try setting the cardType variable to newCard if working with newer cards (they provide a modified SD card library). You also need to convert your audio to compatible WAV files. Just follow the instructions on apcmag.

What should I say: There is sound!

But as you can hear in the video the output has much noise. The speaker has no volume control so this might be the problem.

Using LM386 amplifier module with passive speaker

To attach a normal speaker, I ordered some cheap LM386 modules from ebay (5pcs 3.79 EUR). Specifications can be found on www.petervis.com. It is rated for 5V-12V power so can be powered directly from the Arduino.

I had an old Logitech speaker set lying around which I don’t need anymore so I cut the passive speaker off the other part to serve as a speaker.

The connection is also very easy:

LM386 Arduino
VCC/VDD 5V
IN Pin 9
GND GND

The second ground pin is for use with external power. You need then to connect the IN and GND from the sound source and the VCC and second GND pin from your power source.

The result can be seen in the following picture and the sound quality is already much better than the crappy bluetooth speaker:

The only thing that is not working is the volume control. On the left of the small potentiometer there is a small space where it gets a little more quiet and finally silent but everywhere else it is nearly the same volume.

Using PAM8403 amplifier module with passive speaker

Just out of curiosity I ordered another cheap amplifying module based on the PAM8403. This one is stereo and has a bigger potentiometer. It is 1 EUR on ebay for one piece. It is also rated for 5V power (2.5V-5V) and has a maximum output of 2x3W (5V, 4 Ohm)

The pinout is as easy as from the LM386 but for stereo. I soldered the pin headers. You need 3 for input, 2 for power and 4 for the output to the speakers. I used only mono output for the test:

From left to right:

  • rout-
  • rout+
  • lout+
  • lout-
  • power-
  • power+
  • input L
  • input GND
  • input R

Input GND and power- are connected so you only need one if powering directly from the Arduino.

The setup of the module looked like this:

The sound is slightly better and also louder. By using the volume control the sound goes to mute smoothly but is also clipping at about half the way.

Summary

The PAM I felt was slightly better at sound quality but only at the right volume. The advantage would be an adjustable volume but as half of the potentiometer causes distortion I can’t expose it to the user. So in the end I think I will stick with the LM386 for the build because the sound quality was good and the volume was also acceptable so it doesn’t have to be adjusted.

Further reading

Here are some more links on the topics:

Auduino build: http://apcmag.com/arduino-project-5-digital-audio-player.htm/

Audio on an Arduino nano: http://apcmag.com/play-wav-filesn-arduino-nano.htm/

Extensive post using SimpleSDaudio library, building SD card adapter, connecting speakers http://www.hackerspace-ffm.de/wiki/index.php?title=SimpleSDAudio

Builiding an adapter for microSD cards (and some other useful breadboarding tips): https://protostack.com.au/2011/09/8-breadboard-hacks/

SD card connection to arduino: https://www.flickr.com/photos/nathanchantrell/6323290363/in/photostream/

Connecting SD card to Arduino with LLC: http://physudo.blogspot.de/2013/09/sd-karten-mit-dem-arduino-beschreiben.html

SD/MMC From the ground up: http://forum.arduino.cc/index.php?topic=8314.0

Another great instruction from sparkfun – MicroSD Shield and SD Breakout Hookup Guide: https://learn.sparkfun.com/tutorials/microsd-shield-and-sd-breakout-hookup-guide

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<NEOPIXEL, 6>(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


 

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


 

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.

052817_1619_MusicMonday4.jpg

Music Monday – eDrum Trigger Pad to MIDI mit Arduino und Roland PD-8

Heute geht es darum ein eDrum Trigger Pad (das Roland PD-8) MIDI-fähig zu machen. Ich will für ein Projekt, von dem es bald mehr geben wird, einen einfachen und intuitiven Weg um on-the-fly Drumsounds in Cubase einzuspielen. Was kommt da besser als ein Drumpad mit einem Drumstick zu bearbeiten? Das Pad selbst hab ich mir vom Drummer meiner Band http://www.monkeyfly.de/ ausgeliehen. Im Netz ein wenig gesucht und diverse Anleitungen zum kompletten Eigenbau gefunden (wie auch im Artikel der aktuellen make gesehen, mehr dazu aber bei Andy direkt unter http://doktor-andy.de/wordpress//?s=drum).

Die Funktionsweise des Roland PD-8 ist prinzipiell genauso, also ein Piezo, der angeschlagen eine Spannung abgibt. Das lässt sich genauso mit dem Arduino auslesen und dann per MIDI weitergeben.

Da das auch mein erster MIDI Gehversuch mit dem Arduino ist, hab ich mir erstmal die grundlegende Funktionsweise von seriellem MIDI (ich hatte keine Lust und keine Teile mir ein richtiges MIDI-Gerät zu bauen, ist ja erstmal nur zum Testen). Dazu braucht es eigentlich nur einen Arduino, der per USB angeschlossen wird, hairless MIDI (Seriell zu MIDI Konverter) und ein virtuelles MIDI Device, für Windows ist hier wohl loopMIDI die beste Wahl.

Nach der Installation von loopMIDI einfach mit dem + einen Port hinzufügen.

hairless MIDI muss nichtmal installiert werden, sondern nur gestartet. Als seriellen Port wählt man dann einfach seinen Arduino aus (COM-Port bekommt man aus der Arduino IDE) und wählt im MIDI In/Out den loopMIDI Port aus. Unter Help -> Preferences wählt man noch die Baud-Rate aus, die man im Arduino Programm hinterlegt hat. Ich habe erstmal 9600 genommen.

Einstellungen in hairless MIDI

Wie man dann den Arduino dazu bringt MIDI-fähigen Output auszugeben steht sehr schön auf http://www.instructables.com/id/Send-and-Receive-MIDI-with-Arduino/ beschrieben. Dort in Schritt 5 ist auch der Weg über hairless beschrieben. Das Programm aus Schritt ist sehr schön um das Setup zu testen. Es gibt einfach nacheinander in einer Schleife einige MIDI-Noten aus. Beachtet aber die Baud-Rate dort auf die MIDI-Rate (31250) eingestelt ist. Die muss mit der Rate in den Preferences von hairless übereinstimmen.

Die Noten sollte man dann im Debug Output von hairless sehen (vorher natürlich den Debug aktivieren).

Wenn das funktioniert kann man sich daran machen das Drum-Pad anzuschließen und auszulesen. Das ist eigentlich ganz einfach und wie immer hat auch sparkfun da ein Tutorial für die Grundlagen bereit: https://www.sparkfun.com/tutorials/330

Im Grunde schließt man das Pad einfach an GND und A0 des Arduino an. Dazwischen kommt noch ein 1 MOhm Widerstand und gut ist:

TriggerToMIDI
Anschlussdiagramm (R1 = 1 MOhm)

Das Roland PD-8 hat die Besodnerheit, dass es ein Dual Trigger ist. Das heißt, das Pad und das Rim haben einen eigenen Trigger. Deswegen sollte man ein Klinkenkabel mit TRS Anschluss (Tip-Ring-Sleeve oder einfach Stereo-Klinke) benutzen. Ich schließe aber nur das Hauptpad (Tip) an. Ich habe auch mit beidem experimentiert, aber der Rim-Trigger liefert bei mir nur sehr kleine Ausschläge und das Übersprechen des Hauptpads ist recht groß. Lässt sich sicher auch noch Software-seitig irgendwie lösen.

Wenn die Software von Sparkfun zum seriellen Auslesen funktioniert, kann man sich daran machen alles zu verbinden. Ich habe als Ausgangsbasis den Code von https://beammyselfintothefuture.wordpress.com/2015/01/28/sensing-hit-velocity-and-quick-subsequent-hits-of-a-piezo-with-an-arduino-teensy/ genutzt. Dort habe ich statt der Ausgabe für den Teensy einfach die Ausgabe aus dem MIDI Beispiel genutzt.

Hier gibt es den Source Code:

/*
 * Source www.boriswerner.eu 2017
 * Merged from https://beammyselfintothefuture.wordpress.com/2015/01/28/sensing-hit-velocity-and-quick-subsequent-hits-of-a-piezo-with-an-arduino-teensy/
 * and 
 * MIDI On/Off Messages
 * By Amanda Ghassaei
 * July 2012
 * https://www.instructables.com/id/Send-and-Receive-MIDI-with-Arduino/
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 * 
 */
#define triggerThreshold 10 // If this is set too low, hits on other pads will trigger a "hit" on this pad
#define initialHitReadDuration 500 // In microseconds. Shorter times will mean less latency, but less accuracy. 500 microseconds is nothing, anyway
#define midiVelocityScaleDownAmount 2 // Number of halvings that will be applied to MIDI velocity
#define inputPin A0
 
// Getting the ideal balance of these two constants will ensure that fast subsequent hits are perceived accurately, but false hits are not generated
#define subsequentHitThreshold 1.7
#define subsequentHitThresholdDecaySpeed 14
 
uint16_t highestYet;
uint32_t startReadingTime;
uint32_t highestValueTime;
boolean hitOccurredRecently = false;
 
int noteON = 144;//144 = 10010000 in binary, note on command
int noteOFF = 128;//128 = 10000000 in binary, note off command
int midiNote = 69;//MIDI Note A3

void setup() {
  Serial.begin(9600); //Set Baud Rate to 31250 for MIDI or other rate to use with serial-MIDI-converter
}
 
void loop() {
 
  // Assume the normal hit-threshold
  uint16_t thresholdNow = triggerThreshold;
 
  // But, if a hit occurred very recently, we need to set a higher threshold for triggering another hit, otherwise the dissipating vibrations
  // of the previous hit would trigger another one now
  if (hitOccurredRecently) {
 
      // Work out how high a reading we'd need to see right now in order to conclude that another hit has occurred
      uint16_t currentDynamicThreshold = (highestYet >> ((micros() - highestValueTime) >> subsequentHitThresholdDecaySpeed)) * subsequentHitThreshold;
 
      // If that calculated threshold is now as low as the regular threshold, we can go back to just waiting for a regular, isolated hit
      if (currentDynamicThreshold <= triggerThreshold) hitOccurredRecently = false; // Otherwise, do use this higher threshold else thresholdNow = currentDynamicThreshold; } // Read the piezo uint16_t value = analogRead(inputPin); // If we've breached the threshold, it means we've got a hit! if (value >= thresholdNow) {
    startReadingTime = micros();
    highestYet = 0;
 
    // For the next few milliseconds, look out for the highest "spike" in the reading from the piezo. Its height is representative of the hit's velocity
    do {
      if (value > highestYet) {
        highestYet = value;
        highestValueTime = micros();
      }
      value = analogRead(inputPin);
    } while (timeGreaterOrEqual(startReadingTime + initialHitReadDuration, micros()));
 
    // Send the MIDI note
    //usbMIDI.sendNoteOn(0, (highestYet >> midiVelocityScaleDownAmount) + 1, 1); // We add 1 onto the velocity so that the result is never 0, which would mean the same as a note-off
    MIDImessage(noteON, midiNote, (highestYet >> midiVelocityScaleDownAmount) + 1);//turn note on
    //Serial.println(highestYet); // Send the unscaled velocity value to the serial monitor too, for debugging / fine-tuning
    hitOccurredRecently = true;
  }
}
 
// Compares times without being prone to problems when the micros() counter overflows, every ~70 mins
boolean timeGreaterOrEqual(uint32_t lhs, uint32_t rhs) {
  return (((lhs - rhs) & 2147483648) == 0);
}

void MIDImessage(int command, int MIDInote, int MIDIvelocity) {
  Serial.write(command);//send note on or note off command 
  Serial.write(MIDInote);//send pitch data
  Serial.write(MIDIvelocity);//send velocity data
}

Nach dem Experiment auf dem Breadboard habe ich das Ganze direkt an der Klinkenbuchse zusammengelötet und gut ist.

Anschluss noch über das Breadboard
Und direkt an der Klinkenbuchse zusammengelötet

Hier noch ein kurzes Beispielvideo, dass die Steuerung von DrumMic’a in Cubase mit dem Triggerpad zeigt:

052117_1850_TinkeringTu1.jpg

Tinkering Tuesday – HUEify – JN5169 Xiaomi Smart Button – Part 1 – Making a connection

This is a side project to the original HUEify series on connecting a custom light to the HUE ecosystem. On the site http://faire-ca-soi-meme.fr/ there are some articles about what’s inside the Smart Home Gadgets of Xiaomi (at the end of this I provide all the links currently available). Every single piece is taken apart and detailed pictures were taken describing all the identifiable parts. With my little bit french from school even I can read through it. But maybe Google Translator may help others.

I decided to order two pieces because they were very cheap at Gearbest at that time and they would make a perfect match to the nightpanel lights I am currently building and replace the currently used Amazon Dash button. And because they just arrived and I am waiting for PeeVeeOne to publish his solution for the Multiple Endpoint RGB lights on the JN5168, I will now try my luck with the Xiaomi button to see whether I can get it to communicate with Hue.

On faire-ca-soi-meme there are several detailed images of the button and also the pinout from the test pins. Unfortunately these are pogo pins and my tries to solder a wire to them were not very successful. I was successful though with using jumper wires to connect 3.3V and GND to the battery connector, hot-glueing two jumper wires together in the right spacing and forcing it to the pogo pin connectors for RX and TX with a soldering hand. The fifth pin that is required is only temporary and is the SPIMISO pin next to RX/TX. Just shortly connect a ground wire to it when connecting the power (even with my shaky hand that works).

If that is done right you can open the Device Info in NXP Beyond Studio (use 1000000 Baud and the correct COM Port):

I then compiled the Controller_OnOffSensor Demo app from NXP although in the documentation it is only described to work with the JN5168 demo hardware. I used the compile flag for the JN5169 and it compiled successfully. There is an error when flashing the firmware with the flash utility from BeyondStudio but this is only the validation after flashing. The reason is that the chip was read-protected from Xiaomi in order to make reengineering their firmware impossible (or not-so-easy). So the flashing was successful which can be seen from the serial monitor after rebooting:

APP: Switch Power Up...........................(several dots more)
Heap size at step 1 is 11412 bytes (start=04003fe4 end=04006c78)
APP: Watchdog timer has reset device!
Heap size at step 2a is 11412 bytes (start=04003fe4 end=04006c78)
Heap size at step 3 is 11412 bytes (start=04003fe4 end=04006c78)
Heap size at step 4 is 11412 bytes (start=04003fe4 end=04006c78)
Heap size at step 5 is 8216 bytes (start=04004c60 end=04006c78)
Heap size at step 6 is 8216 bytes (start=04004c60 end=04006c78)
Starting Touch Interface...

This ouput is repeated from the timer resetting the device. There seems to be something wrong. The last output message can be found and after that the drivers eTouchInit method is called. I added some debug output and commented out the first for loop (is this a delay or what is that for?):

This results in the following output (the BWE was added because I wanted to be sure I have the correct call):

APP: Switch Power Up...........................(several dots more)
Heap size at step 1 is 11428 bytes (start=04003fd4 end=04006c78)
APP: Watchdog timer has reset device!
Heap size at step 2a is 11428 bytes (start=04003fd4 end=04006c78)
Heap size at step 3 is 11428 bytes (start=04003fd4 end=04006c78)
Heap size at step 4 is 11428 bytes (start=04003fd4 end=04006c78)
Heap size at step 5 is 8232 bytes (start=04004c50 end=04006c78)
Heap size at step 6 is 8232 bytes (start=04004c50 end=04006c78)
Starting Touch Interface...BWE
Starting vTouchInitHardware
Stoping vTouchInitHardware

So there seems to be something wrong with the for-loop. Maybe it tries to read from a wrong pin (because it was made for the JN5168). I will have to take a closer look at the driver and see what I can do. I think I have to understand how it is working first (it is build for a remote control with several buttons so I guess a more simple solution has to be found). I also have to see which DIO pin the buttons are connected to…

In parallel there are also some comments from lucac81 on peeveeone.com about using the JN5169 and Peter also wrote that he ordered some, so maybe the master is faster than me 😀 lucac81 had trouble even installing the light firmware compiled for the JN5169 so maybe I will even try flashing that on the chip to see what happens with the button (just to see if it works, of course I will not use a button to make a light…). I also remember a comment asking about using the chip as a switch for HUE. So maybe someone else is also making progress on this end. I am open for any discussion/help/input.

To be continued sooner or later.

UPDATE

I flashed the JN5169 binary provided by Peter on the Xiaomi SmartHome button but it didn’t join. Unfortunately the debug output on that build doesn’t provide much information.
I build a new one from the demo application with all debugs enabled and the keys in place as I did with the JN5168 but I am getting the same output I had when not correctly putting the keys in place the first time with the JN5168 (see my post http://www.boriswerner.eu/tinkering-tuesday-hueify-making-the-custom-binary-and-the-demo-app-work-on-the-jn5168/):

Try To join 6a075d40c86781e on Ch 11
Try join status 00
Join failed ad

I already researched the error code „ad“ before:

ZPS_APL_APS_E_SECURITY_FAIL: An APSDE-DATA.request requesting security has resulted in an error during the corresponding security processing.

Which definitely hints to a key problem. So the general function is there and it even tries to connect to the bridge but get’s a bad response. That can’t be everything here 😉

 

Links

http://faire-ca-soi-meme.fr/domotique/2017/05/09/test-xiaomi-power-socket/

http://faire-ca-soi-meme.fr/hack/2017/04/24/hack-xiaomi-mi-smarthome-decouverte-de-clef/

http://faire-ca-soi-meme.fr/domotique/2017/04/15/test-xiaomi-mijia-6-in-1-smart-home/

http://faire-ca-soi-meme.fr/domotique/2017/04/04/detournement-capteur-de-mouvement-xiaomi/

http://faire-ca-soi-meme.fr/domotique/2017/03/13/hack-xiaomi-mi-smarthome-zigbee-sniffer/

http://faire-ca-soi-meme.fr/domotique/2017/02/27/hack-xiaomi-mi-smart-temperature-and-humidity-sensor/

JN5169 discussion on https://peeveeone.com/?p=187&

050317_1802_TinkeringTu1.jpg

Tinkering Tuesday – HUEify – PWM to RGB LED strip driver Board

Today I want to show you the board that I created in order to drive 4 RGB LED strips from 16 PWM outputs of the Arduino Mega. It is not the best design as this is my first board and I began without really knowing how to connect the strips in the end 😉 This board connected to the Arduino Mega controlled by the output of the JN5168 will then be the final solution to integrate light in to our nightstands.

I built the design in fritzing so let’s have a look at it:

  • J3, J5, J7, J9 are the connectors (male pin headers) for the PWM pins from the Arduino Mega
  • J2, J4, J6, J8 are also male pin headers to connect the RGB strips
  • J1 ist the input for the external power source (5V in my case) also as male pin headers
  • J22 are additional ground pins to connect the ground from the Arduino (I connected three because you never know…)
  • Q1 – Q12 are MOSFETs, in my case BUZ11

On the board I put all ground connections to the second PCB side (orange) so the connections are clear.

When I had already started soldering the board I thought about how I wanted to connect the RGB strips in the final setup and I decided to go with commonly available 4 wire RGB strip cable (can be found on ebay) and connect it via screw terminals. I was not able to change the design I already started so I just added another board (in the end I had enough space on the same board) which had four 4-pin headers again directly connected to four 4-output (okay, it’s eight 2-output) screw terminals:

I did not put much effort in making the fritzing pretty so the schematic view is a real mess and in the breadboard view I just used perfboard without any wire connections. So essentially just use the PCB view. It should be obvious. Anyway I would modify the board to make direct connections to the screw terminals if you want to use it. But it is working now and it is my first completely self designed and soldered board J

You can download the fritzing file here: 16PWMIn_4RGBOut

This is the progress with the first working module (I already showed a work in progress version in the previous post):

This is the final board including all terminals and pin headers. I even have space to include the logic level converter (LLC) that I need for the JN5168. This way I can directly connect the grounds all on this board. This is not yet soldered because I ran out of solder wire.

This is the board connected to the Arduino and currently directly from the pin headers to the RGB strips.

I put together a small sketch that activates the colors one after the other on all 4 strips. You can download it here: Arduino_Mega_4_RGB_Strip_Color_Test

This is a video of the Arduino Mega controlling all 4 strips via PWM signals from 16 pins:

Next task is to solder the LLC and reconnect the JN5168. Then I have to prepare the wires to connect from the screw terminals to the RGB strip (needs a little soldering and heat shrink tubing). This will then suffice to control all 4 strips with the same setting (one endpoint) but the final piece will then be to create 4 endpoints on the JN5168 to control the 4 strips independently.