Stavros' Stuff

Angry rants of programming and other things.

The Bus Stop Bus

The wheels on the bus get cut off to make room for a USB port.

A few years ago, I came across a post by John Graham-Cumming, in which he had used a router to run a bus arrival time display that basically showed the time that the next bus would be arriving at the bus stop closest to his house.

I thought that was a fantastic idea, and I especially liked the unorthodox choice of a router as a controller. The project stayed in the back of my mind, and it resurfaced recently, as I started dabbling in hardware. Since I’ve been looking for fun little projects to do, this one was quick and easy enough, so I started looking into it.

(By the way, this post uses Expounder, so if you want an explanation on words with a dashed underline, click on them)

Of course, if you’ve been reading my posts, you’ll know that my microcontroller of choice tends to be the ESP8266, and usually not a router. The ESP8266 is a microcontroller (basically a tiny computer with CPU, RAM, storage, the works) that includes a comfortable amount of memory and storage, is tiny, doesn’t need much power and has built-in wifi, which is extremely useful.</span> This was the obvious choice for this project as well, so I bought a small OLED screen from eBay and started

Continue reading…

Turning everything into a mobile phone: Redemption

Just puttin' phones in things that don't have phones in them.

If you have been following my erudite writings, you will know that I find great pleasure in taking things that don’t have computers in them and putting computers in them. I put a computer in a doorbell so I can order food, in a LED strip so I can play games better, an RC car so I can map out my living room, a room fragrance sprayer so… I can spray my room with fragrance, etc.

You will, of course, remember the iRotary, an old rotary phone that I turned into an amazing rotary mobile phone. You don’t? Well here it is:

You will also remember the irrigation controller that has the potential to revolutionize agriculture more than the Mesopotamian dude who said “I wonder what will happen if I put a bunch of seeds into the ground” 20,000 years ago but then was too lazy to do it. It probably won’t revolutionize it as much as his brother, who actually did it, but I’ll take what I can get.

Anyway, the problem with those two projects is that they use an Arduino, which is ancient 2014 technology, so they might as well be using a piece of flint on a stick. The iRotary prototype, more specifically, is a bunch of wires that I literally duct-taped on the Arduino because I figured I might want to use the GSM shield again (possibly to make an irrigation controller), so I’ve always wanted to improve on the two.

The obvious improvement would be to design a custom, extensible GSM PCB that I can program and easily solder to other things to make GSM-enabled devices, but who has the will, knowledge or time to do something huge like this? Well, I do, damnit, because I went and learned all these things while somehow managing to trick my girlfriend into believing that yes, I am spending enough time with her.

After the long and excessively meandering introduction, I am ready to take you through the detailed journey of how I made just that: A custom-built, programmable, GSM-enabled PCB, wrote the software for it and now make it available to you for free so you can make your own crap.

Let’s start!

The requirements

Continue reading…

A WiFi-enabled RGB LED strip controller

Ever wish your house lights could flash along with your game? Now they can.

A while ago, two unrelated things happened: I got one of those cheap RGB LED strips from Ebay, and I became interested in hardware hacking. If you aren’t familiar with the LED strips, they’re basically a long string of LEDs connected to a controller that usually supports an infrared remote control, which can be used to set the color and intensity of the lights.

When I started tinkering with hardware, I noticed a change: I started looking at common, everyday things around the house and thinking “I bet I could put a controller in that and write an API for it”. This led to a button that orders food when pressed, a rotary mobile phone, a wifi-enabled room fragrance sprayer (I haven’t written that one up, it was too simple), a self-driving RC car

Continue reading…

Building a cheap home sensor/controller

Sense light and motion in every room!

After designing my first PCB, I went on a designing spree. It turns out that making PCBs (printed circuit boards, basically a piece of plastic that includes all the connections of your components in it. It helps make your project smaller and cut down on the amount of wires floating around) is so enjoyable, I’m PCBing all the things! The next victim for PCBfication is a circuit I had originally built on an Arduino and subsequently migrated to an ESP8266.

The circuit is a home sensor and controller. It can sense light, temperature, humidity and motion, and includes an RF controller (at 433 MHz) and an infrared LED so you can control your TV and other home devices. In this post, I’ll go into some detail about the build and how it connects to other sensors and controllers around the house.

This post is also a test of my new Expounder concept library. Throughout the post, various terms will be underlined like this (with a dashed underline), and you can click on them if you’re unfamiliar with the underlined term. After clicking, some text will expand and explain the term.

Let’s continue to

Continue reading…

Hungry? There's a button for that!

The amazing, the delightful emergency food button!

I recently received my shipment of the ESP8266 and NodeMCUs I had ordered, and I started playing with them. My overall experience is coming soon in another post, but the verdict so far is that it’s fantastic and I love it for ever.

Since the ESP8266 is pretty much a $2, postage-stamp sized powerhouse, it’s usable in a wide variety of projects. I’ve been intrigued by the Amazon dash button ever since I saw it, and I wanted a hackable button like that for my own projects. So, I set out to

Continue reading…

Introducing: String Phone

"Nothing is as secure as a string phone" –The NSA

As you can probably tell from previous posts, I’ve been pretty into hardware lately. I’ve especially been building things like home sensors and controllers, so I have a central computer reading motion, temperature, humidity, light and other values in the house and deciding whether the lights or air conditioning need to be on or off.

I also want to be able to turn these on and off from my mobile phone, from anywhere in the world. The problem with that is that I need a way to ensure that only my phone can turn things on in my house. I wouldn’t want someone to be able to turn the heating on in my house at full blast when I’m not there and waste all my electricity bill (or set fire to something).

TLS is a pretty good solution, as it ensures confidentiality between client and server, but it does nothing for verifying the client or securing communications against a malicious server. I needed something better, and I couldn’t find something readily available. So I set out to write it. Thus, string phone was born.

String phone is a

Continue reading…

The iRotary Saga

Wherein the rotary phone acquires electronics to connect to the mobile network and can function wholly unmolested

Welcome to part four of the iRotary trilogy! This is the part where we complete the project, along with the OFFICIAL TRAILER at the very end (spoiler alert!).

The original goal of this post was to complete the project, but I have delayed writing it for so long, that I think it would be better if I just started from the beginning, and produced one, cohesive narrative.

As you may remember from part one, I am a very angry person. Especially when talking on the phone, I get easily pissed off, and nowadays there’s no good way to express my frustration. I miss the olden days, where you had a nice physical handset you could slam into the phone to relieve your tension, but mobile phones just don’t provide the same pleasure. Undeterred, I set out to create a rotary phone that was also a mobile phone.

Thus, the iRotary was born.

Continue reading…

Gweet: Messaging for your things

A message queue for the abhorrently named "Internet of Things"

As you may recall, I have hooked up various parts of my house to a computer so I can control them remotely. To do that, I have an HTTP server for which I open a port, and everything runs on this server, but what if I need to add another device? What if I need to have multiple devices listening for a command?

Having to open a port for each and every one of them, exposing them to the internet and configuring all this is a huge hassle, a security problem and very brittle. Wouldn’t it be much better if there were a centralized message queue where I could post messages and have an arbitrary number of devices read them?

It turns out, the excellent folks at

Continue reading…

iRotary - Part Three

Phone slam 3: The slammening

In part two of project iRotary, we actually got the phone to make calls, but we couldn’t talk or hear the other person. In this part, I promised you some hardcore microphone-to-headset action, and that’s exactly what I won’t deliver!

Instead, what I did was to procure the gorgeous phone you saw in the previous posts. That’s right! All this series so far has been a ruse! I didn’t have that phone to start with, I didn’t have it at all!

However, I do have it now, and I managed to enclose the Arduino in the actual phone. Let’s see how that happened.

Continue reading…

iRotary - Part Two

Working towards a phone I can slam

In part one of project iRotary, we got the Arduino to detect pulses from a rotary dial and turn them into a phone number, all in the name of turning this phone:

into a mobile phone I can use on the go. In part two, we will actually connect the Arduino to a GSM shield and place calls with the rotary dial like it’s 1993. I have seen the future, and it is the past. Read on for details!

Continue reading…

iRotary - Part One

Finally, a phone I can slam again!

Lately, my mobile phone (an HTC One) has become very slow. I think it’s mainly SwiftKey, which is slow like dog, but no matter. As a good consumerist, I must purchase a new phone. However, I am also an angry person, and I sorely miss the tactile sensation of slamming the phone on someone’s face.

Because of this, I decided to put my engineering degree to good use, and went out and bought a phone. Thus begins project iRotary, which aims to turn this:

Continue reading…

Get a text when there's motion in your house

Who needs friends when you have an Arduino?

Like every person, I have a burning desire to know who’s in my house when I’m not. A few months ago, I decided that I had had enough of the uncertainty of my extradomicilial activities, and that I needed to do something about it. I realized that I had two options. The first option would be to hire someone to be in my house 24/7, but that would get a bit embarrassing when I wanted to watch reruns of Desperate Housewives. The other option would be a motion sensor that texts me when it detects motion.

Luckily, this proved really easy to do with an Arduino. All I needed to get was

Continue reading…

Arduino-powered irrigation system

Control your field's irrigation system with your mobile

A few weeks ago, I was showing my dad my latest project, the Arduino RF remote control, and he lamented the fact that I still hadn’t made an irrigation system remote control for him. We have a few acres of fields that need irrigation, which is done with a system of pipes from a central water pump. At that point, however, the fact that he needed a remote control for the pump was as news to me as it is to you, so I asked him what he needed exactly.

He told me he needed a system that would allow him to call or text a phone number and turn the pump on and off remotely, as well as something that would text him if there was a problem that

Continue reading…

Remotely controlling IR/RF devices with an Arduino

Control your household devices: Arduino edition

If you’ve been following this site, you’ll know that I’ve been going through lots of alternatives in trying to achieve the Holy Grail of home automation, which is to get my garage door to open remotely with a Raspberry Pi. To this day, I haven’t managed to do that, but I did get some great guides going.

For example, I managed to turn the Raspberry Pi into an infrared remote and control my TV and AC unit with it, and, after that, the next step was to control RF wall sockets, which was also great.

After all this, I connected my house lights to RF sockets so I can control them from the Pi, but having a Pi running all the time is a bit of a hassle. It requires an SD card, a USB hub for the wifi, it freezes sometimes, etc, so I wanted a solution that was less of a complete PC. The obvious choice was

Continue reading…

Writing a FUSE filesystem in Python

Turns out FUSE filesystems are ridiculously easy!

If you’re a regular reader, you might have noticed that I’ve been on a quest for the perfect backup program, and ended up writing my own encryption layer over bup.

While writing encbup, I wasn’t very satisfied with having to download the entire huge archive just to restore a file, and still wished that I could use EncFS together with rdiff-backup to have true remote-mountable, encrypted, deduplicated, versioned backups.

Trying obnam again (spoiler: it’s still pretty slow), I noticed that it included a mount command. Looking at it, I discovered fuse-python and fusepy, and realized that writing a FUSE filesystem in Python is pretty much trivial.

The astute observer will have already realized where I’m going with this: I decided to write an encrypted filesystem layer in Python! This layer would be very similar to EncFS, with a few crucial differences:

Continue reading…

Encrypted, deduplicated remote backups

Why are secure backups so hard?

Note: Be sure to check the sequel to this post, about the program that will supersede this one and be compatible with all backup utilities.

Backing things up is important, and, luckily, there are many high-quality services geared to everyday people that are very easy to use and cheap. Unfortunately, I am not everyday people, as I am very paranoid and insist that absolutely nobody be able to see my photos of my dog and lawn. It’s a matter of privacy.

To that end, I’ve long been looking for a secure/encrypted backups service, but I haven’t managed to find a single service or tool that fulfils my requirements:

DIY internet-enabled bathroom scale

Wherein my weight is broadcast live to the good people of the internet.

A few days ago, I looked under the couch and found my dusty, disused Wii Balance Board. I bought it years ago, when I was a bit chubbier and thought Wii Fit might help me lose some weight and become fitter. It worked very very well, although I think it was mostly because I didn’t want to eat junk any more, as that would mean that the mind-numbingly boring hour of exercise I just did would be for naught.

For those of you who don’t know what a Wii Balance Board is, it’s the bastard offspring of a bathroom scale and a step pad. It connects to the Wii via Bluetooth, and it can weigh you and also tell which way you are leaning.

Seeing the board, I thought it would be fun to connect it to the computer and try to read the weight values from a script. I started by trying to pair it with the computer, and

Continue reading…

Use two-factor authentication for Mozilla Persona on your own domain

Lately, I have been very happy to see Mozilla’s new proposed authentication system, Persona, gaining popularity. I have tried it in both my capacities as a user and a developer, and, I have to say, it leaves me eminently satisfied in both.

As a developer, it is fantastically easy to integrate. Given how much of a pain all the password change, account creation, password reset, login, etc views (with assorted HTML) were, the 3-minute integration of Persona was a godsend. Since I also don’t need to preoccupy myself with securely storing people’s passwords, Persona wins hands down.

As a user, Persona is very simple to log in. It asks you for your email address, asks you to create a new account (and verify it) if you haven’t been there before (or your password if you have), and you’re logged in. To make things better, it recently got Gmail integration, which means that, if you use Gmail, sites that support Persona effectively now have become “Log in with Gmail” sites, without Google knowing which sites you authenticate on. That’s just fantastic.

There is a bit of a blind spot for people who use their own domains for email addresses, though. If your domain isn’t a Persona identity provider (and most aren’t, by default), you have to log in through the built-in provider. While it does the job, that provider is far from full-featured, only allowing you to sign in with one address and a few aliases.

I wanted something more powerful, so I built a new tool to help manage Persona authentication for your domain. I call it Persowna, and it has a number of very useful features for advanced users or businesses:

Continue reading…

Writing my first Android app: Control your Raspberry Pi from your phone

If you’re a regular reader of my blog, you will have noticed that I recently went on a Raspberry-Pi-fueled, hardware hacking binge, first using it as an infrared remote control and then applying the same principles to make it into a RF remote control, thus mostly controlling my entire house in this fashion.

This is the IR setup in action:

Continue reading…

How to remotely control RF devices with the Raspberry Pi

The RF transmitter/receiver pair

After my wildly successful post How to turn your Raspberry Pi into an infrared remote control, which was mainly a list of various resources and instructions on how to record and replay infrared signals with the Raspberry Pi, I am writing the second instalment, on controlling RF devices with it.

I’ve long wanted to control my garage door from the internet (because apparently I love making useless enhancements to things that run on electricity), but I couldn’t figure out the codes it sends. Even though I could, in theory, use the Raspberry Pi as a poor man’s RF transmitter (hint: don’t do this because of the noise, and it doesn’t work anyway because of kernel timings), I didn’t know what to transmit with it, and I couldn’t find the protocols anywhere online.

To help in this herculean task, I bought an RF transmitter/receiver pair (pictured on the right) from eBay for around 1 euro (with shipping), which can decode received signals (and send them again).

Continue reading…

How to turn your Raspberry Pi into an infrared remote control

A few months ago, I bought a Raspberry Pi, and it’s been the best recent purchase I made, by far. Not so much because I have that many things to do with it, but because it features a few GPIO pins, which you can control with software and make output ones and zeroes (basically high and low voltage).

This has opened a whole new world to me, as, before this, software and hardware were

Continue reading…

Developing a back-scratching robot

As with all men and many cats, I derive particular pleasure from having my back scratched. When I say “particular pleasure”, I mean that I am absolutely crazy for it. I just can’t get enough of it. Unfortunately, it is very tiresome for the person doing the scratching, so I never could get anyone to last very long. Even my girlfriend’s valiant efforts have been w

Continue reading…

A schemaless layer over SQLite

I’ve been hard at work these days, and to relax I decided to develop a small application/side project. As with many applications, I needed a reliable, persistent store, so I went with the most reliable, easy to set up, performant, and generally awesome store I knew: SQLite.

However, since this was a very experimental prototype, I got tired of the frequent schema changes and wished

Continue reading…

Book clouds

As someone who is on the road a lot, I frequently have a lot of downtime during road trips. I don’t like driving, because it’s mostly wasted time, so I thought I would do something useful while driving. Unfortunately, about the only useful thing you can do while driving is listen to music, but there’s something better: Audiobooks.

Audiobooks are a fantastic way to read (or, well, listen to) books on the road, and it’s largely made long car trips bearable, if not desirable. On the last trip, I decided I would listen to some Lovecraft, as I enjoy his writing and the genre of horror in general, so I loaded “At the Mountains of Madness” on my mobile phone and off I went. While listening, however, I was struck by his frequent use of words like “terrible”, “horrible” etc. I know he’s trying to convey a sense of foreboding, but, come on, Howard, not every rock has to be grotesque.

Continue reading…

Dead Man's Switch

After the amazingly successful omnisync, it is once again time to present you of another creation of the inimitable Poromenos Studios.

This time, it’s Dead Man’s Switch. As you’re probably aware, everyone carries valuable information in their heads. It might be about their work, financial information, etc. If anything were to

Continue reading…

File synchronisation

It is once again time to shake the world from its very foundations with my latest creation. I present to you… omnisync.

omnisync is a file synchroniser (something like rsync), only it’s not built to synchronise just files, but also anything else. It’s extensible through a simple plugin architecture, and you can have it synchronise anything to anything within a few hours.

Continue reading…

Printing "Hello world!" using curve fitting techniques (or: The "Hello world!" function)

Well, I have a computer architecture exam in six hours and can’t be bothered, so I figured I would realize a lifelong dream of mine, and make a program that prints “Hello world!” using curve fitting techniques. Enlisting the help of a good friend with numerous mathematical papers under his belt (ostensibly because he could not afford a tighter belt), MATLAB and a longing for p

Continue reading…

Gmail Checker Part II

Fans of Gmail Checker, rejoice. Your favorite Gmail notifier is back with a vengeance. The slew of changes I made in the last hour is a veritable deluge, but I will attempt to describe them in a few short sentences.

Version 0.1.5, codenamed “SUPER DUPER CHECKER EXTRA WITH 100% MORE PIMP” with IntelliMailAccountLoginPageDerivation technology is now able to ope

Continue reading…

Gmail Checker released

My newest creation, Gmail Checker, has just been released. You can get it from the downloads page.

Gmail Checker is (yet another) Gmail notifier. It sits in your system tray and checks your Gmail account(s), notifying you when you have new mail. It supports multiple (unlimited) accounts, Gmail for your domain, is open source (source will be posted s

Continue reading…