Flux irl, building a Hue clone

How I ported the Flux app to hardware and made a Hue clone for $20

Christophe Smet
7 min readFeb 14, 2016

I always wanted to make a product, and I mean a physical product, one that is useful for people in their daily lives. Instead of another SAAS or app etc,
The goal isn’t getting rich, just gaining experience and having some fun trying to build something I would use.

What to build ?

Everyone has tons of ideas, but recently I discovered a great OSX app called FLUX.

The idea is that blue light inhibits the production of melatonin. So the app turns everything red so you prepare to fall asleep.
I had great results with this, but lack the same function in my living room and bedroom lights.
I always wanted to buy a wake-up light for the same reason, I’m a terrible morning person.

The wakeup light from Philipps.

Sounds like I could solve both problems by making this one thing. Sounds like a fun idea.

The lights should automatically adjust the color depending on sunset and should smoothly wake me up before my alarm goes off.
I’ll make an android app to control it and listen to my alarm and check when to make the lights red in the evening. This part should be simple.

Validation ?

Are people interested in this ? Is this the right approach ? Does anyone else make this ?

The concept of validation sounds good, check if people would want to use/buy it and if it would solve the problem before spending time and energy into building it.

If you are the first and there is not a single person out of the 7.3 Billion people building the same thing, then that could be a red flag.

Kickstarter LIFX makes bulbs that can be controlled through WiFi.

Not bad at all, the app doesn’t look that great but the hardware is impressive.

And I’m not a fan of the UI.

While I was soldering my hardware prototype I stumbled upon this gem.

The hardware is pretty good and even uses the same chip as mine, the ESP8266.

The UI and flow is horrible and complicated. It seems he values hardware over software.

Most important, people actually buy it !
You can find it here on AliExpress
It’s not huge, but it works.

Sounds like enough validation, even though I’m only going to use it.

Finally, the building

We know what we want, now we can start building.
I plan on open sourcing everything, see the links at the bottom.

There are 2 parts to this, the hardware & the software.
Since I’ll be buying most of the parts from China (AliExpress), I’ll be spending a long time waiting for parts to arrive.

So the plan is to start with the hardware, order the parts and while waiting for shipments, develop the software.

Put it together. See what brakes. Order new parts and do this loop until it works.

The hardware

I only know my basics from high school, but let’s hack it together with some googling.

Whip out that breadboard and start building your circuit. Since this is a fairly simple circuit it won’t take long.

The first breadboard prototype.

Pretty ugly with a wasteful 3.3v regulator and too many caps.

Be wary of the ESP crashing and acting crazy due to a dirty power supply from China. The caps made it a lot more stable.

But it works !

Next up: the prototype PCB

Download EAGLE, start building, get stuck, look up videos and try until it works. After around 4 hours you will end up with something like this:

Board example V3

That looks ok, a basic 2 layer board with the components on it.

If you look close you can see half the board is split with a red outline.
Everything in the red box is for driving the LEDs.

This modular design means we can easily adapt it to make a wireless switch or anything else without starting from scratch. The same will go for the software.

Great, so now we know what and how many components we need.
Now order everything from aliexpress.com times +- 7.
You will need a lot more components since many prototypes will die and it’s dirty cheap.

Speaking of dirty, the times of messy PCB etching in your basement are long gone.
http://dirtypcbs.com ! These guys are amazing.
Submit your eagle files and they do the rest. For each round I order the prototype pack +- 10 boards for only 14 dollars (incl shipping).
It’s an absurdly cheap.

So now the first round of the hardware is done, the boards and the components are underway. Expect many odd looks from your coworkers as many brown envelopes arrive at your work from China …

The first round costs me around 120 dollars. Many components are bought in bulk so the next rounds will be even cheaper. And there is a lot of room to cut costs by using cheaper components etc. But I chose convenience over costs. Since this will probably never see the light of day, I don’t have to worry about costs.

Assembly of PCB prototype

Assembling the parts looks something like this.

Note: never place via’s under components …

But after a few tries, some working prototypes were finished.

Going great so far.

Software time !

I’m not a product designer, but I do love the magical experience a product can bring with good designed software.

The chromecast is a wonderful product, from the box to the setup. I’ll try to steal as much as I can.

I won’t go to deep into the software details, but we’ll steal the flow from the chromecast with a seperate design. And build it as an SDK so anyone can use it.

Since I want to use this platform for other stuff such as switches etc. This will be modular like the hardware and will be open source should anyone want to use it.

For the sake of easy I’ll just make a rest server on the ESP8266 so anyone can use it. Be it a browser, an android app or an iphone app.

ESP8266 code

You can program the ESP in C with the Espressif SDK, but their documentation was in Chinese and my C skills are far from good these days.

It would be the best choice performance wise, but I want to finish this project and not get stuck up on details.

Lucky me, some guys made a framework for this chip called NodeMCU .
http://nodemcu.com This just flashes on it and you can easily program in a high level language called lua.

I never really used it, but it’s easy to understand and I like the node js style.
Learning from the documentation, the rest server was pretty easy to set up. Again, the source will be provided on github.

There is one issue though, the ESP doesn’t have a lot of memory and the LUA interpreter eats a lot. But the clever guys of nodemcu opensourced it.
So download it, remove a bunch of stuff like floating point and its a lot lighter.

The ESPlorer.

A great free IDE made by some Russian genius!

http://esp8266.ru/esplorer/

I made all the ESP code with this, certainly try it out.

App code

This will take the most work, but as a full-time Android developer this should be straight forward.

So the app will contain 2 parts, the app code itself and the SDK to communicate with these modules. By making the module logic as a library, other people will be able to use it very easily.

The SDK will contain basic network discovery and module registration logic, that’s about it. Most of it is written in RxJava, very handy when doing a lot of network operations.

The app code will implement the SDK and put on a fancy UI
And some basic code to control the module.

Great sketch design a friend made

Demo

It ended up looking something like this.

The board and leds in a cube, currently used as a nightstand.

That's it, there are some quirks left to fix in the app but nothing major.
The source code can be found here: https://github.com/christophesmet/ledsgetIton
and the library here:
https://github.com/christophesmet/ledsgetIton_library

I have a few extra completed boards around. If anyone is interested just message me.

I’ll upload the designs and code of the electronics later on.

Thoughts on IOT

This is a classic IOT product that you can find and can currently buy online. Don’t get me wrong, these things are fun. But in no way do they make an ecosystem that we call the ‘internet of things’.

Just like this one, they all have to make an implementation to connect and react with eachoter, most api’s aren’t even open source.
They should use a common framework. Unless they all use a framework such as Weave, I hardly see this ever taking off.
But the requirements like Weave and other platforms are still pretty high. It’s not possible to run it on a $3 piece of silicon like the ESP.
Maybe in the future when prices drop even more and the hardware gets faster.

It was a lot of fun to build though.

--

--