Winter is coming! - written by on 2019-10-02

Winter is coming!

Upgrading an old, battery-powered thermostat

Winter is coming, and so does cold. It's time to turn on the heating and to enjoy a hot cuppa. But not without first automating and controlling with our phone our home's heating system.

My current thermostat only allows me to program a 24h schedule, without regarding the temperature at all.

Old thermostat

Wiring is as simple as joining the two wires found inside the thermostat; a relay will be perfect for this. I'll be using a NodeMCU as the controller as it has WiFi, and allows me to quickly set everything up before the tea goes cold.

Choose any digital pin of the NodeMCU, and connect the relay to it. Then, connect the heating cables to the relay. It should look like this:

New thermostat

After closing the case...

New Thermostat closed

It's time to flash the NodeMCU firmware. The code is available here Don't forget to set your WiFi SSID and password!

Now it's time to control it. I'll be using a Telegram bot, that will allow us to turn on or off at any moment the heating. We will also be able to set a basic schedule. Files are available here To spin up the Telegram bot, you'll need an API Key from the Botfather. Also, don't forget to configure the NodeMCU Ip address.

When finished, the bot will be able to control your heating. No more cold cuppas ensured!

There's still a lot of work to be done on the bot, allowing to individually schedule each day or with recurring times. Another nifty improvement would be a temperature sensor, to stop heating when necessary.

If you are having any trouble using this bot drop me a line in the comments and we'll solve it!

Tagged in Hardware. 0 comments

Repurposing an Amazon Dash Button - written by on 2018-01-21

Repurposing an Amazon Dash Button

The most known, cheapest and best IoT button, repurposed.

Amazon's Dash Buttons are quite incredible. For just $5 you can modernize such a common task as shopping. With a single press, you can order from dishwasher to toilet paper, instantly and effortlessly. These buttons connect via WiFi to Amazon servers, and when they're done, they shut themselves off.

Taking advantage of this, we can easily repurpose them for all of our IoT needs, in a cheap way. The process is as follows:

  • When the button is pressed, it connects to the WiFi access point
  • We detect that connection
  • We act accordingly

Simple, isn't it? Let's get it working

First we have to configure the button. For this we'll follow Amazon's instructions, but when prompted to choose a product to order, just quit the app, so no product will be ordered.

We'll also need the button's MAC address. With this code, every device connecting to the network will be displayed. Just run it and click the Dash Button a few times.

from scapy.all import *

def arp_display(packet):
  if packet[ARP].op == 1:
    print('ARP Probe detected: ' + packet[ARP].hwsrc)

sniff(prn = arp_display, filter = 'arp', store = 0, count = 0)

We've got the MAC address. Great! Now, slightly modifying the code, like this:

from scapy.all import *

def arp_display(packet):
  if packet[ARP].op == 1:
    if packet[ARP].hwsrc == '50:f5:da:df:0b:80': # change this
      print('Button has been pressed!')

sniff(prn = arp_display, filter = 'arp', store = 0, count = 0)

Will make the code only react to the Button's address.

Dash 2

With this, now it's just a matter of tailoring the script to suit your personal needs. From sending an email to controlling another IoT appliance, the possibilities are endless.

Tagged in Hardware. 0 comments

Upgrading a mouse with a 555 timer - written by on 2015-12-20

Cookie Clicker is fun, but it is necessary to click a lot so my finger gets tired and my mouse broken. So, why not use a 555 timer to automate clicks?

I've been playing Cookie Clicker for the past hour. It is very addicting, but it advances quite slow. It is also necessary to click a lot, so mi finger gets tired and my mouse, destroyed. So, why not use a simple 555 timer to perform automatic clicks? Let's go!

The 555 timer is one of the most sold and used ICs in the world, due to its low cost, ease of use and application diversity, that ranges from a delayed switch to an oscilloscope. Here's a datasheet for the chip.

The timer has several working modes, monostable, bistable and astable. The one we need is the astable one.

In this mode, the chip will provide a constant pulse sequence specified by us. This is what we want to achieve, fast and constant pulses, just as if we were clicking the mouse.

Here's the circuit:


Quickly making this circuit on a breadboard, and connecting the output to an LED (instead of the mouse) we get this:

Breadboarded circuit

Breadboarded circuit

What frequency is being achieved with this circuit?


Wow! 18.5 Hz! Quite impressive, isn't it? That's a huge improvement over the manual click. Oh, and don't forget the period:


Furthermore, we can calculate charge and discharge times:



After all this calculations, and checking that the circuit is working properly, let's solder everything. In short, you must first check that there is room inside the mouse to house the circuit. It will be powered by the USB bus power itself. The following photos describe this process:


This mouse is very easy to open. Just 4 screws on the base and the top just pops off.

Opened mouse

Next, remove the board from the case and analyze where cables should be soldered (V+, V- and signal).


V+ and V- come directly from the USB, and the signal wire should be soldered to the push button contact. This way, the button will preserve its original behaviour, but when we press the new added button, the signal will be sent through the original, performing the clicks. After connecting everything, we proceed to the reassembly.

Everything in place

Be careful when accommodating the cables! Oh, and, my finger is pointing to the new button. After everything is again in place, my mouse looks like this:

Finished mouse

And last, but not least, quick check on


Tagged in Hardware. 0 comments