Category Archives: Building things

WS2812 CrossFader

Based on Clay Shirky’s work for the Arduino, I extended it a little bit to use it with the WS2812 LED’s. Enjoy 🙂


That’s what happens when you code without trying, it doesn’t work at all, haha. Below is the revised code including some randomness, setup for 3 LED’s. Next step will be to remember the given values for each LED, it’s still a bit jumpy now.


Nextion 3.5″ touch display

After somewhat disappointing results with the 3D printer (XYZPrinting makes crap printers, fyi), I’ve had a display gathering dust. Namely the 3.5″ touch display from Nextion. This display has a builtin touch functionality and comes with a piece of software to upload images, buttons, gauges and whatnot to the screen. The screen than handles all the clicking and dragging and you get some clean out put to your Arduino or other serial device, neat!!

Too bad the software is, how to put it nicely, the biggest piece of crap you have ever seen. To proces things in the builtin controller of the screen there is something of a “programming” language available without much documentation. You’d suspect there would be something like a for-loop huh? Well, no … they can handle not too complex IF-statements but that’s about it.

But after messing around a bit, it started to make sense. Global variables are not global, and post/pre-actions don’t make sense, spaces between filling variables are of course leading to compilation errors and much more misery.

So, lots of work left there … the hardware seems really nice though. In the end I managed to setup a little LCARS interface with buttons who actually remember their settings and it even has a fade-in/fade-out sequence with a timeout! Don’t ask how I made the timers do the fading though. Normally you would load a little library in the Arduino and control the screen from there, but I want to put as much functions in the screen itself as possible so I can have the most juice in my Arduino or ESP to handle important things, like running my coffeemaker.

Anyway, here is a little piece of footage to let you see what I made. It’s not too fancy, but it shows a little of what this neat screen can do (if you stop thinking about everything you learned when programming …). In the end it makes it worth.

The next step is getting things to work with the Arduino and my favorite Arduino App, Blynk. I’ll probably be using this library to read/write to the screen. Very light and simple, I like that 🙂

Slic3r and da Vinci 1.0 Pro

Sup folks,

Here is a little snippet I wrote in Perl to use as post-processing script in Slic3r. It will pick up the Slic3r .gcode output file and transform it in to a .3w file to use with XYZware. This is for those who, like, don’t really like the XYZware software and are too cheap to buy Simplify3D 😉

This script is quite possibly not written in the best way, but it’s the least I could do in about two hours. It works fine on my Mac,  but I’m guessing Windows users could be a bit troubled because of Perl not working OK. Basically this script was based on this article, but since I can’t run Notepad++ without Wine, I thought I’d eliminate this step.

One more word of caution, I did not test the script yet, but it looks fine in XYZware. The description of the file is NOT accurate though because I manually insert a heading which is just rubbish, so I suggest trying this with a simple print first. I’m too lazy to get all parameters from Slic3r, though it should be possible to insert those into the modified header, maybe later …

-edit- Machine name ID should be daVinciAW10 apparently for the 1.0 Pro …

Brain fart

Brain farts? We all have them, don’t worry. Usually though it doesn’t go that fast from idea to exectution. In this case, it did. Worse, the brain fart was much longer than the time I needed to build it. Check this out!

I made a very simple Etch-A-Sketch (without the shaking, but with the knobs) using an Arduino, two variable resistors and the Adafruit GFX library. The wiring took about two minutes because I misplaced some wires, so I had to search and the code was about 46s.

Surprise, digital Etch-A-Sketch was born! Somebody probably allready did it, but I thought it was cool to demonstrate the ease with which you can prototype on this smart lil’ platform.

Lego Trains again

Hello folks.

I’ve made a little project and video of my next step in Lego-train control land. You can check it out over here on YouTube

It’s basically simple detection with reed-contacts. I’ve placed a little magnet on the front of the train and the display let’s you look at where it is. Also this is my first go at the display, it works neat!

There are many, many, things to do. The next step will be detecting which way the train is going and using two magnets. On the front and on the back of the train. After that I’m thinking of running more trains on one track. The idea is to have one train automated and the other at manual control. So if the manual train blocks anything like a station or a section, the automated train reacts by stopping or whatnot.

Anyway, short text, but nifty progress. The reed magnets work perfect! I’ve just soldered them onto a little print which is made to fit between the Lego rails, like so:

IMG_3460-300x225 IMG_3461-300x225

Not the most compicated thing, but it runs really well. Much better than using physical buttons or photoresistors.

Arduino LED Light

You know those Philips very expensive LED lights? Yeah, we can do that too! But a lot cheaper. Order some Arduino’s, get some RGB leds from a famous Chinese source and get coding! I’ve made a little example here:

Twitter link

It fades in when it becomes too dark. This takes about 10 secondes and it fades out when the light returns to normal. This is ideal for a night light or just regular lights in the living room. The concept is sound. I orginally tried to make each R, G and B led to fade in/out depending on the resistance of the LDR, but gives a really annoying flickering in most cases, so I decided to just fade in and fade out.

The code, nothing fancy, but it works nice. I’m using three LDR’s to get a good average reading, but I guess you can go with one if you want.


Lego Tracksections

And we are back for the next level! It’s time to divide up the track in sections so we can have a couple trains driving around. I found the blog at really interesting because it makes use of photosensors. I used microswitches, but they tend not to work really well with a carpet and everything, so I started using LDR’s instead. The result looks a bit likes this:

IMG_3028 IMG_3027 IMG_3026

I used a couple little prints to put the LDR’s on with a 10k Ohm resistor as voltage divider. This works pretty much ok. In the last picture you can see the first attempt of the setup. In the meantime I changed it a little bit, but not too much. The “railplan” looks like this at this point:


In short, this is what happens so far:

1. Get the sensor reading

2. Determine the previous sensor (so you know which way your train is going)

3. Set the correct flags so we can call a function to get the trains up and running (e.g. what section will the train in be next?)

4. The function to get the trains running checks for some things. Of course we need to know if the next section to where the train is going will be busy or not. This can later be used to set switches and signposts!

As of this evening the sensors started acting up, but my detection mechanism worked flawlessly. It gives the current position, train number and next section via the Arduino Serial Monitor.

Ah well, more to fiddle around with! Catch you later!