Seamless TV DNS switching with dnsmasq and Home Assistant

Some Black Friday ago, I happened to buy a lifetime subscription to Getflix. It’s a service that allows you to bypass Netflix regional restrictions by using their DNS servers. The advantage is that you don’t get stuck with lower speeds as you probably would with a VPN. The service has been working pretty well apart from a few outages some time ago (looks like Netflix is actively working against them) and I use it to watch US Netflix and Prime Video from Italy. I think there are other similar services so this guide will apply to those too.

When I’m on my PC, I use DNS Jumper to switch between Google and Getflix DNS servers. However, when I wanted to watch US Netflix on my LG TV I had to manually change the network configuration, not very comfortable with a remote. I couldn’t either leave the Getflix DNS always configured, as my family wouldn’t want to have English-only flicks nor lose some Italian-only movies Netflix probably offers.

The solution was to use my Raspberry Pi as a DNS server, point the TV to it and integrate a script into Home Assistant so I could manage the whole thing from my phone together with other lights and switches in my house.

Continue reading

New ATX Breakout Board PCBs (with some improvements!)

Hello everyone, I’ve got some good news today!

I released a newer version of my ATX Breakout Board. After receiving a lot of requests, I also printed some PCBs (10x blue, 10x red) and will print more after thorough testing of the current revision.

Features and additions added from the older version:

  • Thickened many traces, removed pin headers in the middle of the board and added one behind each binding post (up to 5 output pins per voltage line, with no risk of burning any traces).
  • Added resistors to the USB ports (on the back of the board). You may want to use them for USB identification, as they are cheaper and easier to find than the TPS2513. Adafruit link for more info:
  • Moved LM317 so that you can mount it horizontally + used a footprint with longpads, should you want to solder wires to an external voltage reg + heatsink.
  • Prototyping area added at the top left of the board. Not sure if it will ever come useful, but I had some empty space there. You have easy access to the 3V3 and 5V lines.
  • Moved/rearranged several parts (pot, switch, LEDs) in order to draw shorter and cleaner traces.

New parts list:

  • C1, C3: 0.1uF 0805 SMD capacitors.
  • C2: 1uF 0805 SMD capacitor.
  • F1, F2, F3, F4: 1812 SMD PTC resettable fuses. (Littelfuse ones should work just fine, I used Bourns instead which are a bit larger).
  • J1: 24-pin ATX connector.
  • JP1, JP2, JP3, JP4, JP5, JP6: 5-pin headers, male or female as you prefer.
  • JP7: 3-pin header (voltmeter output).
  • LED1, LED2, LED3, LED4, LED5, LED6, LED7: 0805 SMDs, choose the color you want but make sure to use appropriate resistors. You may not want full brightness and sure enough you don’t want magic smoke.
  • R1, R3, R4, R5, R7: 3.3K ohm, 0805.
  • R2: 330 ohm, 0805 (value may change – double check LM317 voltages or calculate your own).
  • R8: 10k ohm, 0805.
  • R9: 9/10W power resistor, not needed in my case.
  • R6: 1.2k ohm, 0805.
  • R10, R15: 43k ohm, 0805.
  • R12, R14, R17, R19: 51k ohm, 0805.
  • R11, R16: 75k ohm, 0805.
  • T1, T2, T3, T4, T5, T6: binding posts with 4mm hole. You may want some red ones for the positive lines and a black one for GND.
  • U1: LM-317, through hole.
  • U2: TPS2513 from Texas Instruments. If you don’t have it, install resistors R10-R19 for the same functionality (not both!).
  • VR1: 2k ohm, PCB mount potentiometer, 9mm (click)
  • X1, X2: USB female connectors, through hole.
  • SW1: 8x8mm pushbutton (got mine from Tayda.)

I bought all of my components from Tayda Electronics, except for the ATX connector and the PTC fuses (check Sparkfun or eBay!)

Time for some pictures:

Sexy, aren't they?

Sexy, aren’t they? Also, colors!

The whole batch.

The whole batch.

And here’s a fully assembled one (terrible soldering on fuses and LM317 because I recycled them from a previous build):

An assembled board.

An assembled board.


PCBs will be available in the store and on Tindie soon.



Home temperature monitoring using openHAB on RaspberryPi, ESP8266 and HDC1000.

It’s been awhile since I’ve wanted to start making my home “smart”.

I figured I could put some of my past projects together to build something nice, so I installed openHAB, a very known and powerful home automation software, on my raspberryPi.

Installing OpenHAB

There are plenty of guides on how to do it, so I’m just telling you the basic commands:

Installing an MQTT broker

Install the latest mosquitto binaries:

Setting up OpenHAB

(code adapted from here)

Let’s copy the default config file:

Open it in your favorite text editor, scroll down to the MQTT transport section and add this line:

Create a sitemap file:

Now the items file:


OpenHAB is now configured to read the two values from the MQTT broker and is subscribed to the “home/temperature” and “home/humidity” topics, which have been assigned to the two items.

The “<humidity>” icon does not exist but I googled one and uploaded it to “/opt/openhab/www/webapps/images/”. Neat!

Start openHAB by typing:

This will take a couple of minutes but this is how the interface looks like:

The openHAB interface.

The openHAB interface.

NodeMCU Code

The NodeMCU MQTT code is bugged in 0.9.5 so you most likely need to update your ESP8266 with a newer release (click!). I flashed nodemcu_float_0.9.6-dev_20150331.bin because the latest version also had problems connecting to the MQTT server. Just remember to get the float version.

Let me make this clear, coding for NodeMCU is a pain in the ass. You are going to get LOTS of “out of memory” errors and watchdog timeouts as soon as you implement a program which is bigger than an example.

However, after a lot of trial-and-error, I’ve been able to make a working program.

To do this, we need to split the program into different files and compile them separately, then call the compiled files from the main program, in order to reduce memory usage.

(I really hope I’ve been doing this wrong and there is a better way. If you know any, please tell me.)

  1. Upload my NodeMCU module (named “HDC1000.lua”). Instructions here.
  2. Create a file called “main.lua” with the following content:
  3.  Now a “connect.lua” file, which handles the WiFi connection:
  4.  And last but not least, the main loop of our program, “loop.lua”
    This sends MQTT messages to “home/humidity” and “home/temperature” every 60 seconds.
  5.  Now we need to compile all those files. Run these commands (press the “Send to ESP” button  instead of the “Save to ESP”):
    Ignore all the errors/reboots, they are “normal”.
  6.  You can then test your program by doing:

And that’s it. If you want your program to start at boot, you need to rename your “main.lua” file to “init.lua”.

You should do this so that the program starts again if it crashes, but be sure your code works as you might get stuck into infinite loops.

You can monitor MQTT messages by running

on your RaspberryPi.

Yay, it works!

Checking MQTT messages…

Now open your openHAB page: http://raspberrypi:8080/

…Yay, it works!


Finally, everything works! I loved building this from the ground up: from the breakout board, to the NodeMCU library, to a fully working system!

Tomorrow I will place my ESP8266 and HDC1000 sensor outside and find a way power them (USB charger? Solar panel + LiPo?)

I hope to add more sensors and features (light and curtains control would be awesome) in the following weeks.

Note: I’m now learning how to program the ESP8266 in C. It may not be very straightforward or “Arduino-like” but will definitely save me some headaches and will allow me to take advantage of the full power of the chip.

Let me know what you think and if you have any questions or feedback!

NodeMCU library for the TI HDC1000 sensor!

It’s been a while since I received my NodeMCU development board but I have only been able to get my hands on it lately.

I soon downloaded the ESP uploader and after reading some Lua docs (and finding out some weird things such as that the “not equal” operator is actually “~=” ) I started writing my own code for the board.

Writing and uploading software to the board is easy and fast. The only concern is that after flashing the NoceMCU firmware you are not left with a lot of memory available.

So I wrote a NodeMCU library (they call them modules) for the TI HDC1000. The code has been merged to the dev branch of the nodemcu firmware and it should go to the master soon, but I’ve set up a repo too (click!).

Continue reading

HDC1000 temperature and humidity sensor breakout, with Arduino library!

Some time ago I came across a new chip from TI, the HDC1000. It’s a temperature and humidity sensor with I2C interface and requires little to no additional components. It comes in an 8BGA package: we can all agree it’s pretty small.
Some of the peculiar characteristics of this chip are that it has a DRDYn pin which goes low any time there is a new reading from the chip (so you can precisely time your requests) and that the sensor is located on the bottom of the IC, so that it’s not exposed to dust and other agents that may false the readings. Also, it has an integrated heater that can remove humidity from the sensor.

So I developed a very small breakout board for this chip as well as an Arduino library (yay, my first one! raspberryPi and nodemcu might come next).

The breakout boards.

I learned quite a lot about PCB design and soldering, effectively putting my new hot air station to good use.

Board layout

The boards were again fulfilled by DirtyPCBs, perfect for this kind of small projects.

Continue reading

LSF0204 breakout board: a bidirectional, multi-voltage level converter!

Hello everyone!

I needed a small, fast and reliable multi-voltage level translator (mainly for connecting ESP8266 boards to the Arduino, got tired of resistor networks pretty quickly) so I built a breakout board for TI’s LSF0204(D).

Datasheet and info here.

The LSF0204 is a nice little chip. It can translate up to 4 signals to and from the following values:

1.0 V ↔ 1.8/2.5/3.3/5 V.
1.2 V ↔ 1.8/2.5/3.3/5 V.
1.8 V ↔ 2.5/3.3/5 V.
2.5 V ↔ 3.3/5 V.
3.3 V ↔ 5 V.

Here’s a picture of the board design:

Board layout


It’s very easy to use: connect the reference voltages to VA (1.0-4.5V) and VB (1.8-5.5V), and your signals to A1/2/3/4 or B1/2/3/4. It will translate and output them to the opposite A or B pins.

Continue reading

Goodbye Arduino: ESP8266 development boards are coming – with Lua firmware!

The ESP8266 is a tiny, cheap MCU with integrated WiFi and impressive specs (datasheet here) and a lot of modules have been on the scene for quite a bit of time.

There are different versions of them, and this is the most common one:

An ESP8266 module

An ESP8266 module.


The fact is that, even if those modules have mostly been used for WiFi-to-serial communication with Arduinos, the chip can do a lot more than that. In fact, it’s a 32-bit MCU, which has a lot of horsepower compared to your average Atmega. Also, many of the modules don’t have all the pins broken out (10 GPIOs).

I actually thought about designing a proper breakout board for this chip, but many people from the community preceded me.

There is a toolchain you can use to write bare C to the chipset and access all of its functions (including all the GPIO pins). It’s been out for quite a few time and many firmwares have been developed, extending and improving AT commands.

One of the best news I came across this week is the release of a new firmware for the device, called nodemcu, which supports Lua commands: programming becomes Arduino-easy!

The guys over at nodemcu also developed a nice breakout board: I just bought one and I hope it comes here soon. It has a CH340G USB-to-serial converter on board together with a microUSB connector. All pins are also broken out on pin headers!


The nodemcu dev board

The Nodemcu dev board.

This is very exciting news and, in my opinion, the start of a new era for makers! This is what I’ll use for all my future projects.

You can find more info on the ESP8266 forums.


My holiday project: Internet-controlled lights using different flavors of Arduino.

Brace yourselves, Christmas is coming.

Even though it’s been a while since I’ve last felt the magic atmosphere of Christmas, this year I want to celebrate it in a quite different way.

In the era of IoT, I’m building some internet-controllable lights using all the Arduinos I have.

The main point is that there will be different “light clients” which are Arduino that can be connected to different light sources such as analog LED strips, 3/10W RGB LEDs (my custom driver might come in handy!) and WS2812B addressable strips (provided that they come in time).

Each of these devices can receive commands over TCP. This means that they can be controlled from any internet-connected device. I am building a “controller box” which will have some analog controls and can choose which light client to connect to, and control it through user input (sticks and pots, yay!) and will also host a web interface.

Available lighting modes will be: manual mode, fade mode (single or from one color to another), random mode, strobe mode. I might add some photo/sound sensors if I have time.

Continue reading

Worklog #2: Handling joystick input on Arduino and LinkIt ONE.

After expanding the LinkIt ONE and Arduino analog inputs, I had to find a proper way to handle user input. The easier and most convenient way was using an analog joystick, so I ordered one off AliExpress.

As I figured it will take way too much time to get here, I decided I’d open up my Xbox 360 controller and use its joysticks in the meanwhile.


Butchered 360 controller. Red = VCC, Violet = GND, Yellow = A0, Orange = A1.

Butchered 360 controller. Red = VCC, Violet = GND, Yellow = A0, Orange = A1.

Joysticks are made by joining two analog pots together (one for vertical movement, and one for horizontal) and a tactile button.

Continue reading

Building a 3-channel, high power RGB LED driver

Hey guys,

I built another board, which is a 3-channel (RGB) LED driver based on an inexpensive chipset called PT4115 (you can find them on eBay or Aliexpress).

The circuit is very simple and looks like Sparkfun’s PicoBuck. However, I used beefier components and a different chip. You may say it’s pretty much the same thing, but I made it to learn some more about PCB design.

Datasheet here. LED current is set through a sense resistor. The output current I is equal to 0.1/Rs. I wanted ~300mA for each channel so I chose a 0.33 ohm resistor. If you want 350mA, choose a 0.27ohm resistor.

Each channel can be controlled via PWM (you can solder male/female headers on the board), for example with an Arduino.

You can input up to 30V and control 3W/10W/20W LEDs.

The bare boards.

The PCBs.

Continue reading