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.

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.

042117_1148_TinkeringTu2.jpg

Tinkering Tuesday – HUEify – JN5168 to Arduino Mega PWM extension

The JN5168 chip itself has only 5 PWM outputs and thus is not able to control more than one RGB LED strip. To overcome this I want to connect an Arduino Mega to the JN5168. The Mega has 15 PWM outputs so up to 5 RGB strips can be connected. To connect the two devices I chose to use the standard UART serial interface that is activated by default in the NXP demos. In this post I will describe how to connect the two devices and what to do to make the Arduino understand commands from the JN5168.

Hardware serial connection from JN5168 to the Arduino

As the Arduino is using 5V level on the serial connection and the JN5168 is using 3.3V a logic level converter (LLC) has to be used. This little device connects the two serial interfaces shifting from 5V to 3.3V. The connection can be seen in the following image (to drive the JN5168 from the Arduino connect an additional wire from the 3V3 pin of the Arduino to PIN 17 of the JN5168):

Connecting the JN5168 to the Arduino Mega via logic level converter
Connecting the JN5168 to the Arduino Mega via logic level converter

Software serial connection from JN5168 to the Arduino (JN5168 program)

I used the default UART port of the JN5168 because of two reasons:

  1. It is activated by default and the demos are already making use of the output
  2. I didn’t connect any additional wires than the ones that need to be connected to flash the chip and use the PWM output and the default UART is also used to flash the firmware

To have a more stable connection to the Arduino I reduced the baud rate from 115600, which is the default rate, to 9600 which the Arduino can handle better. To do this in the file app_start_light.c go to the function vAppMain() and search for the line :

DBG_vUartInit(DBG_E_UART_0, DBG_E_UART_BAUD_RATE_115200);

and change it to:

DBG_vUartInit(DBG_E_UART_0, DBG_E_UART_BAUD_RATE_9600);

Do the same in the function vInitialiseApp() in the same file.

I tried two different approaches to send output to the arduino:

  1. Use the debug output of the TRACE_LIGHT_TASK / DEBUG_LIGHT_TASK
  2. Define a custom debug flag to directly output the PWM signal.

As I didn’t have success yet creating multiple RGB endpoints and am waiting for PeeVeeOne to publish his work on multiple endpoints, I first went with option 2 which is currently not able to hand over an identifier for the endpoint which the option 1 is able to. The second option has the advantage that it handles smooth transitions, which the other one doesn’t. Once I am able to create more endpoints I may create another output. I will describe both solutions anyway:

Option 1: TRACE_LIGHT_TASK

First, activate the debug flag in the Makefile:

CFLAGS += -DDEBUG_LIGHT_TASK

Then go to the file app_zcl_light_task.c and search for

DBG_vPrintf(TRACE_LIGHT_TASK

I modified the first appearance (in APP_ZCL_cbEndpointCallback) of the function, where it outputs a new line and the RGBL (Red, Green, Blue, Level) values to include an identifiying symbol (§) and the endpoint:

DBG_vPrintf(TRACE_LIGHT_TASK, "\n§ EP %d R %d G %d B %d L %d ",
psEvent->u8EndPoint, u8Red, u8Green, u8Blue, sLight.sLevelControlServerCluster.u8CurrentLevel);

There is a second appearance in the same file and the same function (APP_ZCL_cbEndpointCallback ) where I did the same thing again.

In the file App_Light_ColorLight.c there are two other usages of the function which handle the identification effect. In the function APP_vHandleIdentify() there is currently no handle for the endpoint available so I didn’t modify this one. In the vIdEffectTick() there is an endpoint reference available so I added this similar to the function call above.

DBG_vPrintf(TRACE_LIGHT_TASK, "§ EP %d R %d G %d B %d L %d Hue %d Sat %d\n",
u8Endpoint,
u8Red,
u8Green,
u8Blue,
sLight.sLevelControlServerCluster.u8CurrentLevel,
sLight.sColourControlServerCluster.u8CurrentHue,
sLight.sColourControlServerCluster.u8CurrentSaturation);

In the end the Arduino will receive a message will look like this:

§ EP 10 R 255 G 227 B 139 L 147 Hue 0 Sat 0 X 24939 Y 24701 M 1 On 1 OnTime 0 OffTime 0

This one call will result in 10 PWM changes in the JN5168 to have a nice transition. This is why I currently go with the second option:

Option 2: TRACE_PWM

First, I defined and enabled a new debug flag in the Makefile:

CFLAGS += -DDEBUG_PWM

Then in the file DriverBulb_JN516X_RGB.c I added the following to the definition section at the beginning:

#ifdef DEBUG_PWM
#define TRACE_PWM TRUE
#else
#define TRACE_PWM FALSE
#endif

Then, in the function DriverBulb_vOutput() I added the following after the calls to vAHI_TimerStartRepeat at the end:

#if TRACE_PWM
DBG_vPrintf(TRACE_PWM, "\n# EP %d On %d R %d G %d B %d L %d",
(uint8)10,
bIsOn,
u8Red,
u8Green,
u8Blue,
u8CurrLevel
);
#endif

Together with the first option this will result in the following output (as I said it produces a smooth transition):

§ EP 10 R 255 G 227 B 139 L 147 Hue 0 Sat 0 X 24939 Y 24701 M 1 On 1 OnTime 0 OffTime 0
# EP 10 On 1 R 170 G 151 B 92 L 170
# EP 10 On 1 R 167 G 148 B 91 L 167
# EP 10 On 1 R 165 G 146 B 89 L 165
# EP 10 On 1 R 162 G 144 B 88 L 162
# EP 10 On 1 R 160 G 142 B 87 L 160
# EP 10 On 1 R 157 G 139 B 85 L 157
# EP 10 On 1 R 154 G 137 B 83 L 154
# EP 10 On 1 R 152 G 135 B 82 L 152
# EP 10 On 1 R 149 G 132 B 81 L 149
# EP 10 On 1 R 147 G 130 B 80 L 147

You can also see that the RGB values changed. This is according to the level value. The calculation is:

/* Scale colour for brightness level */
u8Red = (uint8)(((uint32)u8CurrRed * (uint32)u8CurrLevel) / (uint32)255);
u8Green = (uint8)(((uint32)u8CurrGreen * (uint32)u8CurrLevel) / (uint32)255);
u8Blue = (uint8)(((uint32)u8CurrBlue * (uint32)u8CurrLevel) / (uint32)255);

The level is not really necessary in the output because the RGB values are already adjusted. I kept them anyway.

Software serial connection from JN5168 to the Arduino (Arduino program)

For the Arduino part I first setup the serial connection (I connected it to Serial2) and read the input. Based on the first character (§ or # are the relevant ones for the two options) the program decides whether the whole line is relevant.

Then it parses the input line using the function strtok(). Then I set the PWM using analogWrite(pin, value).

The serial input is lagging sometimes (though I think this is only the case when using the serial output to the other serial port) so garbage is getting read as a line. In case of not set values I checked whether the value is correctly set. Otherwise the old value is used. This may lead to wrong values but better than nothing.

My currently used Arduino sketch (using only one PWM output) can be downloaded here:

SerialReadPWMFromJN5168

Conclusion

This may not be the best way of communication (SPI may be better) but it is the easiest to setup. To command 4 separate endpoints I may have to use option 1 and go without transitions or implement them myself on the arduino. The bottle neck seems to be the serial connection as the arduino seems to be too slow to process the serial input fast enough. This is another argument for option 1 as it sends fewer lines. Although it is sending more than one line for a simple light change, too. Maybe the app itself also sends several commands to have a nice transition. I may check this later on. In any case I recommend disabling all other debug outputs to make better use of the serial communication and loose fewer lines.

Currently I am also building a board to connect everything together. It will not be very professional (as I will be using many jumper wires instead of connecting everything directly but I want to be flexible) but should work for me. It will be hidden away anyway. The board connected to the Arduino and the serial connection to the JN5168 can be seen in the upper left with one temporarily connected RGB strip. In the final version they will be connected with screw terminals. The LLC will also go from the breadboard to the custom board.

The completed serial connection from JN5168 to Arduino Mega and custom PWM to RGB LED adapter board
The completed serial connection from JN5168 to Arduino Mega and custom PWM to RGB LED adapter board

This is the current progress with connections ready for two RGB strips.

Custom PWM to RGB LED strip adapter board (work in progress)
Custom PWM to RGB LED strip adapter board (work in progress)

There will be 4 RGB connections in the final version to be connected with screw terminals, the LLC and a connection for an external power source. This is all still work in progress so I will publih the final schematics when I am ready and know that everything is working as expected. And of course I hope that the weather will be getting better here so I can disassemble our night desks and get them to my workbench (actually my balcony which is why I am hoping for good weather 😉

021717_1339_FotoFridayX5.png

Foto Friday – Xiaomi Yi HD RAW komfortabel in DNG konvertieren

In meinem letzten Foto Friday habe ich ja schon über die Möglichkeit geschrieben mit der Xiaomi YI Fotos im RAW Format aufzunehmen. Im dort referenzierten Beitrag im Dashcam Forum gibt es auch gesammelte Tools zum Postprocessing:

https://dashcamtalk.com/forum/threads/the-definitive-xiaomi-yi-raw-guide.13079/

Das Vorgehen, das dort beschrieben wird ist jedoch mit einigem manuellen Aufwand verbunden. Wer Photoshop und/oder Lightroom nutzt, der bekommt dort auch ein Lens Profile. Da ich das nicht nutze ist das für mich nicht interessant, könnte aber ganz praktisch sein.

Auf der Seite http://www.tawbaware.com/xiaomiyi.htm gibt es ebenfalls noch ein paar gute Tipps über das Hacking der Yi und auch ein Skript um die RAWs umzuwandeln (leider nur die unkomprimierten, die per Skript, Einzelfoto oder Timer, nicht aber Burstmodus oder der Standard Timelapse-Modus, erstellt werden). Das finde ich das beste und einfachste Tool. Die Einrichtung ist aber nicht ganz intuitiv weil man sich die Programme noch zusammensammeln muss und entsprechend einrichten, sodass es einfach zu bedienen ist (ist dort im Grunde fast alles beschrieben, allerdings nicht als zusammenhängende Anleitung und an verschiedenen Stellen):

  1. Unten auf der Seite http://www.tawbaware.com/xiaomiyi.htm gibt es ein ZIP-File herunterzuladen:
  2. Den Inhalt entpackt man sich bestenfalls in einen Ordner auf C:\. Im Skript ist der Ordner C:\utilities vorgesehen, ich habe meinen Tools genannt. In den gleichen Ordner habe ich die beiden Programme raw2dng und exiftool gepackt. Die muss man sich nochmal separat besorgen.
  3. Raw2dng bekommt man auf der Seite http://e2500.narod.ru/raw2dng_e.htm (Download als .7z-File, man benötigt also 7-zip oder ein kompatibles Entpackprogramm). Hierin sind mehrere Dateien enthalten:
    Gebraucht wird aber nur die Datei raw2dng.exe, welches die Kommandozeilenversion ist. Der Download aus dem Dashcam-Forum nutzt z.B. die raw2dng_en.exe, welches die Version mit einer grafischen Oberfläche ist.
  4. Exiftool bekommt man auf der Seite http://www.sno.phy.queensu.ca/~phil/exiftool/. Hier lädt man sich die Windows-Executable herunter:
    Die Datei dann in den gleichen Ordner wie die anderen Dateien entpacken und wie auf der Seite beschrieben in exiftool.exe umbenennen.
  5. Im Skript selbst muss man nun die Pfade zu den Programmen eintragen. Dazu die xiaomi_dng.bat mit dem Texteditor der Wahl öffnen und in den Zeilen 33 und 34 den Pfad anpassen. Bei mir wäre das:
    Und wo wir dort gerade sind: Standardmäßig ist die Ausgabe des Skripts sehr umfangreich. Deswegen am besten in der ersten Zeile das „rem“ entfernen, also die Zeile
    @rem echo off
    ändern in
    @ echo off
  6. Nun wäre das Tool schon einsatzbereit indem man die RAW-Dateien einfach auf die BAT-Datei zieht. Aber man kann sich das Leben noch etwas komfortabler machen indem man einen neuen „Senden an…“ Eintrag im Windows Explorer Kontextmenü hinzufügt. Dazu öffnet man einen Windows Explorer und fügt in die Adresszeile
    shell:sendto
    ein. Das ist ein Shortcut für den Ordner C:\Users\<username>\AppData\Roaming\Microsoft\Windows\SendTo
    Dort fügt man jetzt einfach eine Verknüpfung zur xiaomi_dng.bat ein (z.B. „Rechtsklick – Verknüpfung erstellen“ oder Drag & Drop unter festhalten der Alt-Taste). Den Namen der Verknüpfung kann man frei wählen, ich habe mich z.B. für „Xiaomi RAW 2 DNG Converter“ entschieden.
  7. Jetzt kann man ganz einfach seine RAWs im Windwos Explorer markieren und im Kontextmenü an den Converter senden:
  8. Es öffnet sich ein Command Fenster und die Dateien werden verarbeitet. Am Ende wird dann die Meldung „Conversion Complete“ ausgegeben und mit einer beliebigen Taste kann das Fenster geschlossen werden:

Komprimierte RAWs

Das Prozedere funktioniert wie schon gesagt leider nur für die unkomprimierten RAWs (um die 31 MB), nicht für die 13 MB großen komprimierten.

Dashcam User AndreaPaco hat ein wenig Zeit investiert um auch die komprimierten, 13 MB großen Files nutzbar zu machen. Mit den folgenden Einstellungen für raw2dng kann man zumindest das Bild erahnen, es ist aber weit entfernt von nutzbar:

13492224, 0, 4608, 3456, 7, 3904, 16, 4, XIAOMI-YI-COMP

Siehe: https://dashcamtalk.com/forum/threads/the-definitive-xiaomi-yi-raw-guide.13079/page-4#post-250926

Das Ergebnis sieht wie folgt aus:

Auf der linken Seite ist das Bild grob zu erkennen. Mehr aber auch nicht. Leider ist dort seit Mai 2016 nichts mehr passiert, sodass ich hier keine Hoffnung mehr habe (vor allem auch, da ja der Nachfolger mit der Yi 4K schon lange raus ist und dessen Nachfolger auch in den Startlöchern steht).

Rotstich

Sollte das RAW sehr rotstichig sein, so hat die Umwandlung mit dem Exiftool nicht funktioniert:

Sollte eher so aussehen (nach erfolgreicher Umwandlung):