<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Jan Enning on Medium]]></title>
        <description><![CDATA[Stories by Jan Enning on Medium]]></description>
        <link>https://medium.com/@kleinejan?source=rss-58121a0540d8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Amjd_vhv5kYLW7yn3RJlqw.jpeg</url>
            <title>Stories by Jan Enning on Medium</title>
            <link>https://medium.com/@kleinejan?source=rss-58121a0540d8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 07:07:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kleinejan/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[DIY dual illuminated LED tail/brake light]]></title>
            <link>https://kleinejan.medium.com/diy-dual-illuminated-led-tail-brake-light-8f37a483a055?source=rss-58121a0540d8------2</link>
            <guid isPermaLink="false">https://medium.com/p/8f37a483a055</guid>
            <category><![CDATA[electronics]]></category>
            <category><![CDATA[motorcycle]]></category>
            <category><![CDATA[diy]]></category>
            <category><![CDATA[led-lighting]]></category>
            <category><![CDATA[lighting]]></category>
            <dc:creator><![CDATA[Jan Enning]]></dc:creator>
            <pubDate>Fri, 23 Apr 2021 13:13:56 GMT</pubDate>
            <atom:updated>2021-04-23T15:00:40.055Z</atom:updated>
            <content:encoded><![CDATA[<h3>DIY LM317 dual illuminated LED tail/brake light</h3><p>With two LM317 you can create a custom LED tail light that brightens when you hit the breaks and stay lit at the same time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/887/1*NdCR09gFdI-IdLpJL9Ooew.png" /><figcaption>Custom tail light for a badass custom motorbike. (the antichrist — <a href="https://www.facebook.com/Deathwish-Company-1508483236034134/">Deathwish Company</a>)</figcaption></figure><p>You will find multiple schema’s for making your own brake light. So this one is not specific or involving any rocket science. Just a LM317.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t0gm8zRVtexzoEnXdtAf1A.png" /><figcaption>Custom tail light for a badass custom motorbike. (the antichrist —<a href="https://www.facebook.com/Deathwish-Company-1508483236034134/"> Deathwish Company</a>)</figcaption></figure><h3>How does a brake light work?</h3><p>You vehicle will have three cables: one for a tail light, one for ground (or just use the frame as a ground) and one for the brake.<br>When the lights are on, the tail light cable receives 12 Volt, illuminating the tail light. When you brake the brake light cable receives 12 Volt and illuminates the brake part of the light.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eaM4pqNs4t_jkLoCLI2PJQ.png" /></figure><h3>Combining the tail light and brake</h3><p>In our design we wanted to use the same light for both functions. With only the illumination as a difference. Resulting in a slightly dimmed tail light, but when you brake, the light will do full blast.</p><p>Most of the examples online show two different “lights” combined in the tail lights. Basically you have two separate circuits working together.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MZ4JLbXjADPwTHlbJXXOTQ.png" /><figcaption>Combining 2 functions in one light</figcaption></figure><h3>Using a LED</h3><p>Fist thing is to do some calculations. What Voltage and amperage does it require? Look for a datasheet and distill some values:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*GdeS1nZlwzIDCR1OKPE6SQ.png" /><figcaption>Actual datasheets for our tail light LEDS.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/546/1*_aXHnMOKxp9jy3qM_8LFmw.png" /><figcaption>Our Led uses 2.2V and 20mA</figcaption></figure><h3>LED and it’s resistor?</h3><p>You can drive LEDS with a simple resistor to limit the current. ( a LED is just a simple SHORT that will consume all current, if it’s not limited.</p><p>For example: an <strong>incandescent light </strong>will only consume the <strong>RESISTIVE</strong> value of the filament in the light and turning that into heat and visible light. A LED will consume all and burnout. That is why we need to limit the current. When doing to it looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*4lMN-yztRfiebI_EwHmWHw.png" /></figure><p>But when we apply more voltage: <em>if you throttle your vehicle and the alternator generates more voltage</em>. The LED will illuminate brighter:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*DWamKyHbQGOAWnas-f9qZQ.png" /><figcaption>Led will brighten when it receives more voltage</figcaption></figure><p>Therefore we need to look at other options to drive the LEDS.</p><h3>Current limiting with LM317</h3><p>This IC can do the heavy lifting when you simply want to drive a LED. It can be configured to either <strong>limit the voltage</strong> or <strong>limit the current</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/1*KpaZu1voQr9GpOpD3TjixQ.png" /><figcaption>LM317</figcaption></figure><p>The IC also needs some juice to be able to work. That will be deducted from our 12 V.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q3yqHIqair5at53enMlBtQ.png" /></figure><p>This means we have 10V left to drive the rest of the circuit.</p><h3>The plan</h3><p>The design required 40 LEDS. The maximum LEDS in series for these LEDS is 4. Meaning you can chain 4 leds in one group. We will get 10 groups of 4 leds.<br>Get your calculator and follow along.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/594/1*6Xf4t1Wr9ycerVR9P1EgOw.png" /><figcaption>Led group</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hahhyAbgYVvMuxjrcfIdog.png" /><figcaption>40 LEDS (4 series and 10 groups)</figcaption></figure><h3>Calculations</h3><p>Now we know what the LEDS consume and need to operate. We also know the LM317 details. The voltage difference between ADJUST and OUTPUT pin is 1.25v. With this number we can calculate what <strong>resistor</strong> value we need.<br>Our leds combined need <strong>200mA</strong> in total to be at full brightness. To dimm them we feed them with half of that <strong>100mA</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ABOkigsufuKKKp2kcAUd4w.png" /><figcaption>Max illumination</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zuvre_I1Ok23pKXstIO5AQ.png" /><figcaption>Half illuminated</figcaption></figure><h3>The LM317 setup</h3><p>When I first made the circuit I mistakenly connected to the wrong PINS of the LM317. Just like here:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/593/1*RwHBKpTWT9oL5283vwo9OQ.png" /></figure><p>The correct layout where I used the OUTPUT pin (duh…)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/788/1*78tR0wVuChIVwrlZRUosSg.png" /></figure><p>When you apply more voltage to the LM317: the LEDS will just keep their brightness, the LM317 transfers that excess voltage into heat.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/607/1*va66x4L3ysHRPbld-dyBdQ.png" /></figure><h3>Combining 2 x LM317</h3><p>We have two LM317’s. One LM317 feeds to the other. In order to have our effect: <strong>dimmed brightness</strong> when you run the tail light, <strong>full lights</strong> when you brake.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/994/1*CKcTqG3XNckaRprw3--1Kg.png" /></figure><h3>PCB time</h3><p>I really like <a href="https://easyeda.com/">https://easyeda.com/</a> where you can create and produce you PCB’s in (low) volume. The first version did not work because I used the wrong pins to feed the LEDS. That resulted in shorting /ruining the LEDS</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HxLekVicPqhY0_5wyqNauA.png" /><figcaption>bushfix for version 1.0 to make it work</figcaption></figure><p>After making some hacks on the PCB with floating components I managed to get it working. Redesigned the PCB, reordered and it worked.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_xRGfeSD5kZrRJrOY9HuXA.png" /><figcaption>Tada!</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q6xrWflGazYA6HtxA1nyqQ.png" /><figcaption>Fresh baked PCB’s</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HBAXVdU3L1cu1aPlrU1BMg.png" /><figcaption>Working PCB</figcaption></figure><h3>Protection diodes</h3><p>A lastminute change was adding some DIODES to protect the circuit. What I forgot is that they also take away some <strong>CURRENT.</strong> Resulting in a slightly dimmer tail light. Without the DIODES it works as the theory above :-)</p><p>But it’s good enough for now and I can bridge the diode pads and leave them out. You can skip the DIODE anyway.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cUNrUzdYzMp9FL5u3NbBsg.png" /><figcaption>Custom tail light circuit</figcaption></figure><h3>Embedded heatsink</h3><p>The LM317 can get hot, when used inside high amperage applications. In this case it will not get that hot and does not have a dedicated heatsink. In my design I used the bottom copper layer to act as a heatsink. The screw terminal will also drive the heat info the bike frame. Both LM317&#39;s have their own <em>embedded heat sink. </em>I measured the temperature after 60 minutes and registered 45<strong>°</strong>C / 113°F. That fits perfectly into the LM317 specs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nsKHo9_ZCzl80kTll2iYYw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8f37a483a055" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Boltanski Prendre la parole V2: Tokyo drift]]></title>
            <link>https://kleinejan.medium.com/boltanski-prendre-la-parole-v2-tokyo-drift-4de41202ccb6?source=rss-58121a0540d8------2</link>
            <guid isPermaLink="false">https://medium.com/p/4de41202ccb6</guid>
            <category><![CDATA[arduino]]></category>
            <category><![CDATA[diy]]></category>
            <category><![CDATA[art]]></category>
            <category><![CDATA[hardware]]></category>
            <category><![CDATA[installation]]></category>
            <dc:creator><![CDATA[Jan Enning]]></dc:creator>
            <pubDate>Fri, 19 Jul 2019 09:11:26 GMT</pubDate>
            <atom:updated>2021-04-23T13:29:17.580Z</atom:updated>
            <content:encoded><![CDATA[<h3>Arduino radar sensor triggers DFplayer: Boltanski Prendre la parole V2</h3><p>A few months later and we are working on an improved version of Prendre la parole. This time for a show in <a href="http://www.nact.jp/english/exhibitions/2019/boltanski2019/">Tokyo</a>. We learned from the <a href="https://medium.com/@kleinejan/boltanski-prendre-la-parole-v1-bb17cb72dfc8">previous version </a>and are ready. This time armed with my Prusa MKi3 and new sensors.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X4mPPDDdFcTnCZVoaJwtYw.jpeg" /><figcaption>Sound units: Arduino, DFplayer, HFS-DC06</figcaption></figure><h4>How contemporary art works</h4><p>The artist has and idea/vision. A production company will take care on how to build and produce it. After approval this ‘product’ is the art piece. Results can be different if you visit other exhibitions of the same artist. The Prendre la parole is build in many ways. Only our version is bulletproof and works, because it is custom made and tested. Shows in Paris and Osaka were using something different, I have no details about it. Other then they power regular 220V desk lights and use <a href="https://www.youtube.com/watch?v=sOd5_RBU7bw">these kind of devices</a>. Where the PIR sensor is marked with black paint to “direct” the beam. This never works and batteries die quickly without being noticed. Ending up with a inferieur experience.</p><h3>But first</h3><p>After the 3d printing hype was over I decided I want one to use for my projects. Binge watching tons of youtube channels: <a href="https://www.youtube.com/channel/UC_7aK9PpYTqt08ERh1MewlQ">3d printing nerd</a>, <a href="https://www.youtube.com/channel/UCxQbYGpbdrh-b2ND-AfIybg">Makers muse</a>, <a href="https://www.youtube.com/user/ThomasSanladerer">Thomas Sanladerer</a>, <a href="https://www.youtube.com/channel/UCiczXOhGpvoQGhOL16EZiTg">CNC Kitchen</a>, <a href="https://www.youtube.com/channel/UCIi0sokRP7JKU-f0HHIhicw">C.R.T</a>, <a href="https://www.youtube.com/channel/UC6mIxFTvXkWQVEHPsEdflzQ">GreatScott!</a>, <a href="https://www.youtube.com/user/cadcamstuff">Lars Christensen</a>. I was ready.</p><h3>Oeps, what the Radar!</h3><p>I do not windows shop @ zalando, instead I zapp through Banggood, just to see what I potentially could be missing and maybe (not) need. ;) These $1 radars keep popping up, what are they, how do they work? After ordering them I discovered they are a nice piece of kit that I probably could use. They are X seconds HIGH/ON when triggered, just like when you press a button, perfect! If only I could limit the range…</p><h4>Not possible</h4><p>The RCWL-0516 seemed to be popular. On <a href="https://github.com/jdesbonnet/RCWL-0516/issues/22">github</a> you will find a page about it, and even more radar units. Also a <a href="https://www.youtube.com/watch?v=YLMlRhxgTWQ&amp;feature=youtu.be">video</a> than nobody understands, but is analyzed to the max. According to the <a href="https://www.epitran.it/ebayDrive/datasheet/19.pdf">datasheet</a> you should be able to limit the range by replacing a resistor. Well that doesn’t work. I used some extension wired to a breadboard and placing resistors in series. So I could maximize / minimize the value. Nothing happened, abord idea.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CQEH5PyY2dHGil6gGCn82A.jpeg" /><figcaption>RCWL-0516 module</figcaption></figure><h4>Possible!</h4><p><a href="https://www.youtube.com/channel/UCu7_D0o48KbfhpEohoP7YSQ">Andreas Spiess</a> to the rescue! He made a video about a handful of radar sensors. Amongst them the super duper <a href="https://www.google.com/search?q=HFS-DC06&amp;source=lnms&amp;tbm=isch&amp;sa=X&amp;ved=0ahUKEwi-x5KlnKbjAhVGKFAKHWMNAswQ_AUIECgB&amp;biw=2069&amp;bih=1679">HFS-DC06</a>. It has 2 pots to limit sensitivity and delay. Just what I needed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*RgwjDZ_SmT40yLQrG_TafA.jpeg" /><figcaption>HFS-DC06 module</figcaption></figure><h4>Or not</h4><p>after ordering 2 units (When in prototyping alway buy +2. You always will destroy one) it kinda worked. The LED would trigger when I wave my hands closely, the led looked dim, triggering was not consistent. Then you start searching for other people who use the unit, in order to see how they used it. Soon I discovered people where not happy:</p><blockquote>Banggood random review of the HFS-DC06: i planned to start working with the HFS-DC06 Module. Unfortunately it does not work at all after applying the Vcc of 5 VDC. How can it happen to ship untested electronics? Please send me an replacement module as soon as possible.</blockquote><p>So what’s the deal? More digging lead me to a conclusion: it might work on 5V, others use 12V…But the “specs” say 5V other “specs” 12V. Only one way to test. Upping the power supply a bit;</p><ul><li>6 volts = kinda works</li><li>7 Volts = better</li><li>8 Volts = hmm, okay</li><li>9 Volts = Wow! that LED is working</li><li>10 Volts = did not test</li></ul><p>At 9 Volt everything worked stable and I got a good minimum range of 2~3 meters. At this point I can adjust the “sensitivity” potmeter just enough to be precise and not overshooting the range. The onboard potmeter can now be adjusted between 2 ~ 9 meters.</p><h4>HFS-DC06H and the magic smoke.</h4><p>So now we know it works. But this unit may have different specs. My second batch, released the <a href="https://en.wikipedia.org/wiki/Magic_smoke">magic smoke</a> at 9V. What the hell is going on. Time to sacrifice some units.</p><p>What they all have in common:</p><ul><li><a href="http://ww1.microchip.com/downloads/en/devicedoc/8126s.pdf">ATMEL-1723/Tiny13a</a> or <a href="https://datasheet.lcsc.com/szlcsc/Holtek-Semicon-HT66F003_C91852.pdf">HT66F002</a></li><li><a href="http://www.ti.com/lit/ds/symlink/lm358b.pdf">LM2904</a></li></ul><p>But the 12V version has also a <a href="http://users.ece.utexas.edu/~valvano/Datasheets/LM78L05.pdf">78L05</a> = Voltage regulator that can take 7/20V. Plus some extra diodes. So that explains a lot about those mixed results from other users. At lower voltage these units are not reliable. LED looks dimm, triggering feels random.</p><p>In the picture you also see we have 2 types of boards. The upper 2 are the same, except the 78L05, layout is the same. The bottom one is really different. Something for <a href="https://www.youtube.com/channel/UCtM5z2gkrGRuWd0JQMx76qA">BigClive</a> to reverse engineer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xr_Y9K9RY_zL0kK4PHBbdA.jpeg" /><figcaption>The 3 different types of the HFS-DC06H</figcaption></figure><h3>Hardware</h3><p>Our first version of “Prendre la parole” had good hardware, except for the sensor. That is going to be replaced with a ‘static’ sensor. This time we also wanted to add some UI elements: Display with status, potmeter for adjustments.</p><h4>BOM</h4><ul><li>arduino pro mini (because: cheap)</li><li>DFplayer (because: sound)</li><li>3 Watt 4 Ohm speaker (because: DFplayer)</li><li>2 x flat potmeter (because: looks nice)</li><li>Oled display: 0.91 Inch 128x32 IIC (because: Oled is cool)</li><li>HFS-DC06 radar sensor (because: radar!)</li><li>DC booster (because: for some units I need it)</li><li>Dupond cable 2x + 4x (because: …)</li><li>resistor (because: they do it)</li><li>USB-A female (because: why not)</li><li>USB-B female (because: it’s different)</li></ul><h3>Lights on! @ 5 volts 350mAh</h3><p>To enable reproduction and not be reliable on third party stock. Even simple armature can be discontinued over time. We made a custom modulair light design. It consists out of 4 printed parts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GBeiLJqpn6e_-VchmzWXsg.png" /><figcaption>Light model</figcaption></figure><ul><li>Back nut with thread: takes the male part of the gooseneck (Galaxy black)</li><li>cylinder M22 screw thread (Snow white): holds the 1W LED and the 350mAh LED driver</li><li>inner shell for reflection (Snow white): m22 counter thread</li><li>outer shell: esthetic shell (Galaxy black)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M6hmLNU1UQ3ztVHIGor2Dw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XqBF3saRcesX1BY7gV4-fw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cDLhTYQIW8HNzPRidkKwRQ.jpeg" /><figcaption>Cylinder holding the 350mAh led driver and the LED can be glued with Gel-tape.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LEJ-odyGQMcB5cNSVFbPCg.jpeg" /><figcaption>LED 350mAh drive that fits inside the cylinder</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NblAfZJZ9yCiCJ5Py6NBXA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hasbb3sb-ciYVYZDwFLFbQ.jpeg" /><figcaption>LED with Gel-tape to limit heat transfer to PLA. Assembled light attached to a gooseneck</figcaption></figure><h4>Lights keep running</h4><p>Sure nice idea to print the lights, one unit takes about 22 hours to complete, resulting in 2 effective days for 1 unit. you need to replace the filament, checking up with the status, did it fail?, is my studio burned to the ground? The result is pretty nice and everything fits like a glove, so in the end the result is what matters. But man, it sure was a printing frenzy!</p><h4>Heat and stuff</h4><p>I wanted the light to be a “separation of concerns”. It had a USB plug that can be plugged in any usb socket. It takes 5V and drives the 1W LED. The driver did not produce any significantly heat. The LED stabilized around 60° celcius. To hot for the PLA. There was not force on the plastic, but it could deform over time. Adding a piece of gell-tape, protected the plastic from the heat transfer. With the tape I now measured 30° celsius on the PLA. Now we are safe.</p><h3>PCB and the footprint</h3><p>The layout was again easy, this time I used <a href="https://easyeda.com/">Easyeda</a>, just to check it out. But also the convenience of not having to source components. You can order the parts directly from the website. You pick your part and dump the footprint that matches the actual part you order, easy.</p><h4>Connecting the connectors</h4><p>In the previous version we used DC connectors and a cut USB cable that came out the case. This time I wanted to use solid connectors that are readily available and suitable for the application. But also idiot proof. The main power from the powerbank 5V was provided with an old fashioned USB printer cable (USB-B female), power to the lamp was using a USB-A connector. To withstand the force everything is through hole. It’s also nice to solder a big blob in those connector. Welding for whoosies ;-)</p><h4>Component party</h4><p>The rest of the components are just solder on the board. I did not bother adding extra female headers so I later could remove/replace individual elements. Space in the case was tight. Also soldering them takes time that would not compensate the total price. If a unit would fail, we just replace it with new one.</p><h4>Not really a design</h4><p>Looking at the board you see it is composition of readymades. Connecting the dots and you get this unit. It does not have many other options, only one optional sensor and one button can be added. The rest is just as is. But it works just fine.</p><h4>Failure, mister Jan</h4><p>In my previous projects I used KICAD, this time <a href="https://easyeda.com/">Easyeda</a>. On my first order I got an email:</p><blockquote>Many thanks for your order, but sorry to bother you to confirm a issue.<br>In your file,The top and bottom layer all cover with tin, If all are tin then we can not make top and bottom silk screen (since the silk screen must print up solder mask oil)…</blockquote><p>Whuut? I totally did not understand the question. But this is what that sharp employer was trying to tell me:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ClqBjWo4B421thilAmbXSA.jpeg" /><figcaption>Where is my soldermask!</figcaption></figure><p>My initial thought was, of course; <em>Dude, just print the PCB. </em>After receiving it, yeah failure, mister Jan.</p><h4>Community failure</h4><p>What I did not check is the fact people also make footprints and share them. Nice and horrible at the same time. I sourced the part from <a href="http://lcsc.com/">lcsc.com</a>, used a footprint matching the part number. Not checking the creator. Thus when I first tested my unit, the potmeters were wired incorrectly. Just because the pins did not match the right connection. GND was VCC etc. The same happened to the USB connection. VCC and GND were reversed. To always check, double check the creator. Better is even to order the parts first, check them with your Fluke 87, then proceed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HMCUC3BBzUVqOVBJNjj9jw.jpeg" /><figcaption>Failure is alway an option</figcaption></figure><h4>Wrong polarity</h4><p>Adding a solder mask, uploading, waiting then I got the good version. Soldering everything on the board, uploading the code…Nothing. Where is my Fluke?! SThe potmeter was using a wrong footprint. Oeps and the USB connector had a reversed polarity. That I could fix by rewiring the light, potmeter was a no go. Back to the drawing board.</p><h4>Third time</h4><p>Then everything worked the “first” time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-qITOWExiraS50tapgO1UQ.jpeg" /><figcaption>Whoop Whoop ready!</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HX7q3m3gh5h8fv64_VkRvw.jpeg" /><figcaption>How can other people have a clean desk? I never manage to do it, ever.</figcaption></figure><h3>Case</h3><p>Last time we used a stock ABS case, this time we have the power of 3d printing. Designing a case is just a parametric job; Width / Height / Depth / Holes / Cover / Backplate / Mount holes.</p><p><a href="https://www.youtube.com/channel/UCIi0sokRP7JKU-f0HHIhicw">C.R.T</a>. gave me the idea to flip the design. Use the “cover” to mount everything and the backplate to close the case.</p><h4>Print Prusa, Print!</h4><p>So the idea to print 8 cases looked nice. Remember one case takes 9 hours to complete. We needed 8 units + 2 spare just in case (no pun intended). In total 10 effective days of printing. None of the cases failed while printing. I use a stock Prusa i3 MK3S because I just want to print and not tinker around with settings, temperatures, nozzles all that stuff. I want a want my idea to be created, I’m not interested in the ‘hobby’ of 3D printing. That is why I bought the assembled Prusa i3 MK3S.</p><h4>Print tolerances</h4><p>As a rule of thumb I used 0.2mm of extra tolerance for non printed parts that needed to fit. The backplate had no extra margins, because the shrink would also crimp the cover; n=1</p><p>The PCB had USB ports, potmeters that would stick out the case. In order to be sure for a perfect fit. I created the pcb and speaker driver in Fusion 360. So I had something to design around.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mo4oX06gMf_GoVcxStxhsw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6tTdKCs_ItLluFmm40vbUw.png" /><figcaption>PCB, speaker mockups</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4F1UtvgkOPS9_O3ylX7ULg.png" /><figcaption>Final case design</figcaption></figure><h4>Not a single print failed</h4><p>No, just one part failed; the white cylinder where the LED booster and the LED is mounted. That part costed me 1 Kg. of filament. First I printed a bridge with a gap, oepsie. Then I added a .2mm sacrificial layer on that hole. Those prints came lose: air trapped inside popped the prints of the build plate. etc… I ended up printing them upside down in pairs of 2. Just to let only 2 fail instead of more at once.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KCnmhSLf69R8R-eQJZRFog.jpeg" /><figcaption>White cylinder that failed over and over.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pwsmuaVXpVa-LsQCMrSk0w.jpeg" /><figcaption>A fresh case ready to pickup</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YJ-HTlO2xonpF9gdrjyb_Q.jpeg" /><figcaption>Mounting bracket for different corners 35/45 degree</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*efUzTmT0AQspFZhiSBaLsw.jpeg" /><figcaption>Prints did not fail, but designs did.</figcaption></figure><h4>M3 inserts — banggood</h4><p>On my window shopping adventures, 3 years ago, I ordered some m3 brass inserts. Yes, with the thought; Hmm that might come handy… At that time I made a <a href="https://github.com/kleinejan/Apple-pencil-case">Apple Pencil holder</a> and did not use these inserts. Now with the power of my TS-100 I could heat-force them into my case. To have some sturdy screw mounts. It seems that <a href="https://learn.adafruit.com/heat-set-rig">Adafruit is now reselling Mc masters</a> inserts with a special soldering tip. You do not need this. Just use a pair of tweezers. Make sure you have ~3mm wall thickness where the insert is going to set. Else all the plastic will melt and does not have enough flesh to hold on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*whuDKAfTKB4g-eBZUCyJqw.jpeg" /></figure><h4>Shielding the radar</h4><p>Radar can penetrate wood, this means with this version we can just mount it outside the view of the visitors. Previous, when we had the Ultrasonic sensors where we needed a line-of-sight. But this radar works somewhat 180<strong>°, </strong>that was to wide. Simple metal tape in the inside of the case would give us a more directed beam.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2FWxqFR1MrO7MnnHiAwSgg.jpeg" /></figure><h4>Mounting the box</h4><p>The installation is using a wooden frame that is angled. Straight mounting would mean the sensor is pointing to the ground. It also needed to be serviceable; quick mount and unmounting. We made 3 different brackets: 0/30/45 angle mounts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NeCWXPpIwfDMdL0er5CYsw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EbBCwdkaX8U_wNPZuz2SSA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B01Ynt5fQpw5JMueEQlfAA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-7QnEvQNvf3cv_1ynKJXcQ.jpeg" /><figcaption>The bracket slides in and is self tightening</figcaption></figure><h3>Show me the result!</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EyYPnVEeWdeerrA5ozes4w.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VIedKf02DhnrbAvXuOnVog.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZXQP4l6qm8pE3ElAIL3PDQ.jpeg" /><figcaption>OLED display on the side</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dE1F9ARXpesKxSsf59lATA.jpeg" /><figcaption>Behind the lid you can replace the SDcard and adjust the sensor.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P3FQ5erIjUVVS57lBI8I6w.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3xTwppdJ9Q1Jb4-ZkXCoQQ.jpeg" /><figcaption>The OLED cover is glued in place</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X4mPPDDdFcTnCZVoaJwtYw.jpeg" /><figcaption>Units ready!</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N6fPhD495YSgXqjUqISMLQ.jpeg" /><figcaption>Flightcase #1 with spare parts</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/899/1*m1IREuKzJ_H6zl2XpOOIBg.jpeg" /><figcaption>Because gold is shiny ;)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o-hHfZ3DPDpr5Na_T1LCHg.jpeg" /><figcaption>Christian Boltanski @ tokyo opening in <a href="https://www.haconiwa-mag.com/exhibition/2019/06/boltanski2019/">NACT</a></figcaption></figure><h3>What about the source?</h3><p>The 256 BIT shiftregister was open source. This time I’m not sure if I can. I would say yes, I created everything and don’t care. What this makes art is also the added sound files, which I don’t have. All 3d files can be <a href="https://github.com/kleinejan/prendre-la-parole">downloaded</a>.</p><h3>Any improvements?</h3><p>Yes, this version is bigger and better. No parts that are exposed to the elements. Easy mounting inside the jacket. But the next version is going to use a single rotary input then we ditch the potmeters. SDCard mount that would be accessible from outside, instead of first removing the lid. And the LED driver, not inside the light but somewhere inside/on the cable. Find a way to adjust the sensitivity from the UI instead of on the sensor itself. Mounting the OLED on the PCB, finding the right polarity with dupont cable is crap. I add always a mark that needs to align, not fail safe.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4de41202ccb6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Boltanski Prendre la parole V1]]></title>
            <link>https://kleinejan.medium.com/boltanski-prendre-la-parole-v1-bb17cb72dfc8?source=rss-58121a0540d8------2</link>
            <guid isPermaLink="false">https://medium.com/p/bb17cb72dfc8</guid>
            <category><![CDATA[art]]></category>
            <category><![CDATA[diy]]></category>
            <category><![CDATA[arduino]]></category>
            <dc:creator><![CDATA[Jan Enning]]></dc:creator>
            <pubDate>Mon, 08 Jul 2019 20:24:02 GMT</pubDate>
            <atom:updated>2019-07-08T20:24:02.784Z</atom:updated>
            <content:encoded><![CDATA[<p>A year ago we were asked to build this installation for the <a href="https://oudekerk.nl/programma/christian-boltanski/">Oude Kerk</a> in Amsterdam. This installation from Christian Boltanski had a sensor which, when triggered, will play an audio file. The light will always be on. The sensor was battery powered, the light was using mains voltage (220v).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tj2mjDr-VOpHPZ74X-OEJg.jpeg" /></figure><p>We had to tackle 3 problems;</p><ul><li>Maintenance personnel needed to check if the sensor was still working and if the batteries were still charged.</li><li>And get rid of mains voltage. This due to fact that the Oude Kerk was build out of wood, just like Notre-Dame — Paris.</li><li>Easy way of adding sound files.</li></ul><h3>Idea</h3><p>A normal usb-power bank to power both units. Build a custom led light. Arduino/ESP and a ultrasonic rangefinder to detect people walking by. DFplayer to play the sound.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X7pxiGWSLCoAP0X99oy1Hw.jpeg" /><figcaption>Layout of the components we need: Speaker, Arduino Pro mini, led driver, Sonic rangefinder, DFplayer and an optional potentiometer</figcaption></figure><h3>Prototyping</h3><p>My favorite weapon of choice are the overpriced Grove sensors. Within 2 minutes you have the hardware ready and you can start testing with code. Connectors are stable and you do not need to hassle with b-grade breadboards, cutting wires, wiggle resistors. It enables you to focus on the core functions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qqbYEYBtKDUeKTwU-3A-VQ.jpeg" /></figure><h3>Function layout</h3><ul><li>Light needed to be on all the time and was not interactive.</li><li>When a user walked between 80 Cm ~ 130 Cm the sensored needed to trigger</li><li>Then an audio file needed to play</li><li>Meanwhile the sensor would not pick up a trigger</li><li>When the file was finished playing the sensor was disabled for 30 Seconds</li><li>After that the system was primed again for a new trigger.</li></ul><h3>PCB hacking</h3><p>Everything seems to work, next step is to make a custom PCB. The 2018 version was build within KICAD. It’s awesome. I only had through-hole components and a not so complicated layout. Matching the arduino pins with the right footprint was easy. There are enough footprints in the community to choose from. Up until this point it was not sure how we where going to power the led. So I added a double custom footprint with jumpers. That way we could choose what DC booster or Led driver we would need, depending on the choice. Uploading the gerber files to EasyPCB and wait.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3y1D_CHvWnFQG0KSxTSaiQ.jpeg" /></figure><h3>Testing</h3><p>A power bank is nice, but the unit needed to run for +8 hours. And a led consumes power, so we needed to know roughly how big the powerbank needed to be. A random power bank brand with a capacity of 8000mAh would run for 6 hours. Getting 15.000mAh power banks would do the job. By this time we replace the stock light with a 1W Warm-white led. Driven by a very common 350mAh LED driver, that also would support PWM.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L5p52NlXKiIls3i-eQ61-w.jpeg" /></figure><h3>Production</h3><p>I sourced a lot of part from Banggood, ebay, Aliexpress, Conrad. Some parts took 4 months, so I ended up ordering with extra parts because I needed it faster. Now I have a stack of 80 Ultrasonic units that I probably never going to use ;) After a good long night the board was complete.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9OrBQvadUqD-ictJ6UfzJQ.jpeg" /><figcaption>Units getting ready</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ym9out71tWeWrwa1fzl-VQ.jpeg" /><figcaption>20 units ready</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W7Us_OeRTCdVlFLlM1sngg.jpeg" /><figcaption>Stock case with laser cut holes</figcaption></figure><h3>What we needed to do differently</h3><p>Sure, most of the times you can improve. Sometimes you think you made the right choice and in hindsight you didn&#39;t.</p><h4>Do not use an Ultrasonic sensor</h4><p>The ultrasonic sensor use sound to detect a difference in sound reflection. Meaning: it vibrates. Not a real problem, but the top cones of the sensors are glued in place. If the environment (Oude Kerk) is cold and a bit moisture they can come loose and render the unit broken. We have replaced 5 sensors in a total of 20 units, that is a big number.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fjWXVSYptM3hTMVP4_ulfw.jpeg" /><figcaption>A faulty ultrasonic sensor; upper cone came loose due to temperature differences.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KjMPacheDZ1tKfblH2jOJA.jpeg" /><figcaption>On the back of the cone you see a tiny bit of glue. It would not soften when I heated it. But the glue did not hold its rigidity when exposed to cold and moisture.</figcaption></figure><h4>Internals</h4><p>We used a lot af screw terminals, handy but are too fiddly to handle. The jumpers were a nice idea, it made the board modular, thus also bigger.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AC3JWGSg-NFid8KXdtmBpg.jpeg" /></figure><h4>Troubling case</h4><p>The case was a stock one which we modified. Laser Cut speaker holes, custom acrylic inlay, custom spacers, custom pcb mount. Resulting in a longer build time. The speaker was hot Glued and holded nice. DC connectors where not so reliable, they are manually soldered and can not take daily handling. The wall thickness and the screw are not working nicely.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PdckZObNS2gUtLxIEpmgHw.jpeg" /></figure><h4>Software</h4><p>We used a static version, all values were hardcoded; Volume, detecting distance, delay. For this project it was okay and we never adjusted the timing of the software. But it would be nice for the users to adjust something. This unit had only one task and needed to work always. Leaving out options is also minimizing trouble.</p><h4>PCB design</h4><p>From all the IO ports of the arduino we only used 4. But the fear of a design error made me tracing all inputs to unused IO options in the board. Just in case when we need an extra IO port, rewire something etc. Also leading to a larger board. I never used one of them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xOTtqA8_IZNJMVr00rW_2A.jpeg" /></figure><h4>Time</h4><p>Overall I spend 4 to 6 days actually working on it. PCB design took, for me, the most time. The waiting is of course free ;) With oversea shipping you never know how long it might take. Can be 2 weeks up to 12 weeks in the most extreme case. Sourcing the parts that fit; screw terminals, DC connectors/male/female, the right DC booster/LED driver. can be a tedious task. You need to be prepared to have a backup plan ready.</p><h3>What went good</h3><p>Overall the installation worked for 6 months 7 days a week +8 hours a day. We had only 5 sensors to replace and 2 DC connectors that needed resoldering.</p><h3>What went even better</h3><p>For the <a href="http://www.nact.jp/english/exhibitions/2019/boltanski2019/">Tokyo exhibition</a> we also produced the units. This time with all the learning from the previous build.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bb17cb72dfc8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[256 bit shiftregister (74hc595) powered by ESP8266]]></title>
            <link>https://kleinejan.medium.com/256-bit-shiftregister-74hc595-powered-by-esp8266-c629bb3363ce?source=rss-58121a0540d8------2</link>
            <guid isPermaLink="false">https://medium.com/p/c629bb3363ce</guid>
            <category><![CDATA[hardware]]></category>
            <category><![CDATA[arduino]]></category>
            <category><![CDATA[esp8266]]></category>
            <category><![CDATA[electronics]]></category>
            <dc:creator><![CDATA[Jan Enning]]></dc:creator>
            <pubDate>Wed, 07 Mar 2018 12:10:24 GMT</pubDate>
            <atom:updated>2018-03-07T12:10:24.866Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N2ko1rjkAJIN-4s4m4VGbA.jpeg" /><figcaption>157 Lightbulbs controlled by ESP8266</figcaption></figure><p>For an art installation (<a href="https://en.wikipedia.org/wiki/Christian_Boltanski">Christaan Boltanski </a>@ <a href="https://oudekerk.nl/en/programma/christian-boltanski-na/">Oudekerk</a> — Amsterdam) we had 157 light bulbs randomly laying on the ground. Every day at 12:00h one bulb needed to be switched off.</p><h3>Problem</h3><p>You could just unscrew a lightbulb everyday, but how would you test if everything is still working? Rescrew all light bulbs :-| Perhaps mounting 157 wall sockets and plugs to 1m2, nahh doesn’t fit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HK_a2G2tx5FRA1HlDUH_RA.jpeg" /><figcaption>This shows the space we had to work with. Mounting wall sockets was no option.</figcaption></figure><h3>Solution</h3><p>To save space and keep everything safe, we need relays and some logic. ESP8266 to do http requests, Shiftregisters to control a lot of relay’s, circuit breakers to make it more safe. Cherry on top would be a dimmer for the 2 mains group we have, 2 x 16A (220v).</p><h3>Shiftregisters</h3><p>Off the shelf Shift Registers did not fit the specs. They only exist in 8 bit per board. Every relayboard has 16 relays, so 2 shifregister boards per relayboard (8bit x 2 boards = 1 relay board with 16 relays). Mounting and chaining these boards are fine if you just need a few. Talking about 32 boards makes it to impractical.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/662/1*AS-FXITzpE8Muvny9IxehA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*8eZRRYR1tDVvaL-izmiLXw.jpeg" /></figure><h3>Custom PCB</h3><p>Knowing the technical solution it was time to build a custom PCB with 16 (74hc595) then stack just two of these boards and bob’s your uncle. I had designed custom PCB’s in Illustrator but never with real PCB design tools. Starting with the free version of Eagle was a disappointment, buying a license even more. You pay the license to get a bigger design canvas. But I had no clue how big it was going to be. Autodesk did refund my license, kudos! Open Source all the way and really Kicad is your friend, just like Joe ;)</p><h3>Kicad</h3><p>It is never easy to wrap your head around new software. The youtube channel of <a href="https://www.youtube.com/channel/UCkJRycUz2CylxpiP-zMePow">Contextual Electronics</a> did help me a lot. Just open <a href="http://kicad-pcb.org/">Kicad</a> and follow everything step by step. Sure after a few day’s you have your PCB design. Do not forget to add the <a href="http://kicad-pcb.org/">Kicad</a> and <a href="https://en.wikipedia.org/wiki/Open-source_hardware">openhardware</a> logo to your PCB, it is nice for the community and looks cool :)</p><p>Getting your PCB printed is easy and cheap. I choose to make one in The Netherlands (mijnprintplaat.nl) and the other in China (PCBway). The only two differences where the production time and price. China: 7 days, €35, Netherlands: 14 days, €152,- I only did a visual inspection of the boards and soldered one of each supplier. Well no difference. Future projects will be send to <a href="http://pcbway.com/">PCBway.com</a></p><p><a href="https://github.com/kleinejan/128bit-shiftregister">Download 128bit shiftregister board (Kicad files)</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gRbOK8wPnWdsVe44dNHsGA.jpeg" /><figcaption>Fresh and naked 128bit shiftregsiter PCB</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mxyvySRObIQxF9aw2jrowA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xtv60Q8i5KaJW05AdOOmaw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UnjtKB1HaaCb-W2HSQN62Q.jpeg" /><figcaption>Kicad schematic, routed schematic and the working 128bit board.</figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fy97195RR8gE%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dy97195RR8gE&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fy97195RR8gE%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/8a0f38ac0ea210c458b01c84fb0a5fc8/href">https://medium.com/media/8a0f38ac0ea210c458b01c84fb0a5fc8/href</a></iframe><h3>The Build</h3><p>Having all restrains and specs it was time for some elbow grease. Building a massive relay box is no rocket science but you need your brain to think ahead and recheck your wiring.</p><h3>Shopping list</h3><ul><li>NodeMCU ESP8266 + 0.96 Inch OLED</li><li>2 x 10.000 Watt dimmer (80 x 30Watt = 2400Watt per group)</li><li>30W 5v Power supply</li><li>DC booter for case fan</li><li>2 x PC case fans</li><li>2 x 100 mtr wire; Red, Black</li><li>3 x 16A circuit breakers</li><li>Big metal case</li><li>Din rails 6 x 40Cm</li><li>Din rail connectors (dual and single)</li><li>Din rail bridges</li><li>Mobile wifi</li><li>Wire stripper</li><li>Makerbeam stuff to fiddle with mounting issues</li><li>Cable binders</li><li>10 x relayboard (16) or as many as you need</li></ul><p>Total costs for the build is around €1700,- for the hardware and PCB’s only. Mistakes, wrong decisions, faulty hardware, hours of work, rework not included. To get an idea I started working in august 2017 and the project was live in November 2017. About 3 months of work, that’s only the evening hours.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*cUgea3n3adDWPQPVLSCUeA.jpeg" /><figcaption>NodeMCU ESP8266 + 0.96 Inch OLED Board. Having a display is practical for debugging. You know what’s going on and when there’s a fault other people can call me and tell me the error displayed on the ESP.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EMo13I_3plnnuwvXrxAfhQ.jpeg" /><figcaption>The empty box</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RVlmUn4Ipi66tA5pTHAwug.jpeg" /><figcaption>Mouting dinrails in to see how everything is going to fit.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AvW4UADZKMTe9xyGIqfE5w.jpeg" /><figcaption>Starting with a basic layout where we divide the 2 x (220v) mains groups into sections that can be dimmed.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aRD7lGeMDRUDnBLSc7bSdA.jpeg" /><figcaption>Cable guy is working.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ovMCtHFIQNg4hdBv73rKkQ.jpeg" /><figcaption>Left: ESP connected to the dinrail. Right: DC booster to power the case fans (12V).</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o-NyFrVChaxc1rzgJXGvBA.jpeg" /><figcaption>Tidy up cables</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B7Ft0hhcaD1aAbcCFKZXGA.jpeg" /><figcaption>Ready for the first boot.</figcaption></figure><h3>Installation</h3><p>The small electronics are all done and the relays are clicking away. The machine is brought to the Oudekerk for final installation. After a few tests we discovered some faulty power lines and light fixtures. Which caused the breakers to fire. Double checking every powerline before installation is a necessity. The failure number of 157 light bulbs was about 15%. Either the bulb did not work at all or failed short after. That is why the ESP program has a test cycle.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3LCO1eyrR-9rLH0YoFRvcA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j6JT7Vu-rDJNeyUIYmoOQw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UD6R4nV1wcoJ_10tvOURrw.jpeg" /><figcaption>Installation of the 157 wires.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9F4Aph5izeQiKjhb16Qcxg.jpeg" /><figcaption>Time to do some bulbing.</figcaption></figure><h3>Time to test</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fcdb8IDN_4Sw%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dcdb8IDN_4Sw&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fcdb8IDN_4Sw%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/d2672a65b75329c16fadaf807f10407c/href">https://medium.com/media/d2672a65b75329c16fadaf807f10407c/href</a></iframe><p>A small test program will fire all lights in sequence and has nothing to do with the art, it’s only for debugging.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F8IkVKLlU54A%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D8IkVKLlU54A&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F8IkVKLlU54A%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/41b0700e16c194bd8ba21cf30dcf8113/href">https://medium.com/media/41b0700e16c194bd8ba21cf30dcf8113/href</a></iframe><h3>Code</h3><p>The ESP will get JSON data from a webserver. In our case a google appengine instance. The ESP will only read, every 10 seconds, the file an do as it is told.</p><h4>JSON data served from a google appengine</h4><p>The app will return the current lights that need to be switched on. Every day @ 12:00h it will change this value.</p><pre><strong>{</strong>&quot;switch&quot;: &quot;12:00&quot;,&quot;appinit&quot;: &quot;2&quot;,&quot;title&quot;: &quot;oudekerk&quot;,&quot;description&quot;: &quot;Boltanski - Oudekerk&quot;,&quot;enddate&quot;: &quot;2018-04-30&quot;,&quot;totallights&quot;: &quot;160&quot;,&quot;id&quot;: &quot;xxxxxxxxxxxxxx&quot;,&quot;lights&quot;: <strong>54}</strong></pre><h4>ESP Source code</h4><p>The code was written on the go, and surly can be compactor, nicer. To do the bitshifting I used the Arduino <a href="https://github.com/johnnyb/Shifty">Shifty library</a>. That worked like a charm for about 16 x 8bit (74HC595) = 128 bits. But I needed more. <a href="https://github.com/Simsso/Shift-Register-74HC595-Arduino-Library">ShiftRegister74HC595</a> to the rescue. Out of the box it just worked with 32 x 8 (74HC595) = 256 bit shift register. <a href="https://gist.github.com/kleinejan/e9ae3b8e7ec258397085323e89a40ade">Download source</a></p><h3>Troubles</h3><p>Everything on a hardware level was fixed quickly. New cables, light bulbs etc. The only thing the ESP did was sudden reboots. After debugging the ESP with some stacktraces, I found some code bugs. I simplified the program, and made the logic that it did nothing when; for example the wifi was shutdown or the program was unable to get a new update from the server. This new program I tested for 2 days without any sudden reboot. Stacktrace your code and let it run for a few day in a controlled environment is…handy :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c629bb3363ce" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>