Getting Festive with some Addressable LEDs: the Fireplace

Not content with just one hardware hack this Christmas, I thought I should try to create something simpler, prettier and considerably less nerdy than the TfL Tree.

Back at the parents’ house we have a fireplace that I thought could do with a festive makeover. I found this 5m strip of LEDs on Amazon. It was surprisingly difficult to find LEDs that were well-separated: many of them were very close together, and therefore, very expensive. The set I bought had lights separated by about 3cm each, 150 LEDs in total.

The great thing with the WS2812B standard of LEDs (and similar) is that you can cut a strip to the exact length you want and solder them back together if you want. This particular strip had an adhesive back for more permanent applications, but since this was temporary I didn’t cut the strip, and I used Blu Tack to attach the strip around the fireplace. It worked well enough!

IMG_20191225_173353.jpg
I hid the strip badly behind a table and didn’t think about it again.

 

Espruino

Since this project didn’t need to talk to the Internet, I wrote a program using an Espruino Pico microcontroller that I bought after a JSOxford hardware hack day in 2015. The advantage of the Espruino over a Raspberry Pi is that it will start up and run the program instantly. It also runs JavaScript, which is probably more familiar to most people than whatever language you use to program an Arduino.

Continue reading “Getting Festive with some Addressable LEDs: the Fireplace”

Getting Festive with some Addressable LEDs: TfL Tree

This is a story of how a simple hardware hack got surprisingly out of hand.

Summer of Hacks 2019

It all started in the summer of 2019 during the Oxford Summer of Hacks. One of the events put on was a hardware hack day, where beginner tinkerers could learn about programming real things with the help of more knowledgeable people in the room. I was somewhere in the middle of the scale: I know how to program so I managed to teach a kid and his dad to write some code for a robot powered by a BBC micro:bit, but I needed help when it came to the most basic of hardware tasks.

I had a vague idea of what I wanted to work on during this hack day: after reading a blog post from the Raspberry Pi Foundation I ordered a small screen thinking I could get it to display the Tube status. However, that didn’t arrive in time, so I had to improvise with some LEDs instead.

Continue reading “Getting Festive with some Addressable LEDs: TfL Tree”

Spot me an EC2 instance

If you’re looking to save money on your AWS bill, consider switching to a Spot instance.

I’ve been running most of my websites on a single Amazon EC2 instance for about 2 years now. It’s been fine: there’s a bit of setup involved but I’ve become more familiar with Linux servers as a result; and if ever I encounter a problem the solution is never more than a single Google away.

The first year on AWS was great: by creating a new account you get some things in your first year for free. A t2.micro instance (1 CPU, 1GB RAM) was part of this free tier, and it comfortably ran 5 of my little Node.js hacks so long as they don’t get too much traffic.

The following year meant that that same server was no longer free. An ‘on-demand’ instance (where pay per hour that it’s in use) costs just over $9 per month, but if you know you’re going to keep it running for a year, you can pay some of the money up front and bring the effective cost down to $6.50 per month. I thought that was a reasonable price, so I paid that for the second year. Continue reading “Spot me an EC2 instance”

Hackference 2016, Part 2 – The Hackathon

<- Part 1: the conference
On Saturday, once everyone had got a good night’s ‘sleep’ (our hotel was just next to a loud club which only got quiet after 3am), we walked over to the Impact Hub.

Before I get started, I’m using the word ‘hack’ in the non-malicious form. Tabloids use the word ‘hacker’ to describe someone with malicious intent who steals data or takes down websites (for example, this article in the Mirror). We use it to describe someone who thinks the best way of learning is by doing. A hackathon is just a group of sleep-deprived developers playing with something new.

The event itself was free – paid for completely by the wonderful sponsors.

Before the hackathon started, not many people knew what they wanted to make (including me). Luckily the sponsors got a chance to inspire us with their products and announce their prizes. There was a variety of companies attending, each with some cracking prizes for the teams making best use of their services.

Continue reading “Hackference 2016, Part 2 – The Hackathon”

Hackference 2016, Episode IV: A New Hackference

Last weekend saw me heading to Birmingham to attend Hackference, a 3-day event for all sorts of programmers. There was a conference on Friday at the Electric Cinema, followed by a 24-hour hackathon at the weekend.

I’d never been to Hackference before, so I didn’t know what to expect. It’s a shame it’s probably going to be the last one though.

What follows is my account of the weekend, aided by plenty of tweets. The weekend was so jam-packed with stuff to blog about, so I’m going to split it up in two.

Part 1 – the conference

The Electric Cinema was a really cool venue. There were two screens, so two talks could happen at the same time. This was good because we could choose the talks that interested us most, but bad because most of the time I wanted to see both! Continue reading “Hackference 2016, Episode IV: A New Hackference”

Countdown API (because why not?)

I’ve updated my Countdown solver with a new word list that’s actually been designed for word games. The list is in the public domain and it claims to be compatible with the Scrabble rules, which I think are the same for Countdown. The problem is that it looks like it was last updated in 1993,  so if you want to play ‘selfie’ on my site, you’re out of luck.

Some point soon I want to add definitions to the words that get returned, because most of the time I see the results and have no idea what those words mean. In my research, I found a service called Mashape. The idea of this service is to enable discovery and monetisation of APIs. I found a word definition API that I want to use in the near future, but I got sidetracked by the thought of making an API that can solve Countdown puzzles.

So that evening I made my API. It didn’t take long to make because I’d already written a function that returned an array of the results – I just had to make it publicly visible. I also added more details to the results to aid filtering.

That’s over here if you want to make use of it.

Train Text-imonials

My train times site http://trntxt.uk is just over a year old. While I’ve picked up a handful of users, it’s fair to say that it’s not exactly gone mainstream. And that’s fine – it’s difficult to get people excited about a website that only has one function and doesn’t look visually appealing (by design).

I wanted to present trntxt at JSOxford‘s Show and Tell in May, but I knew that a black and white website wouldn’t make much of an impact. So I wanted to jazz up my talk with enthusiasm. Enthusiasm and memes.

Normally, the format of JSOxford’s Show and Tell session enables people to show off their personal projects by opening the live site in a new tab, without any slides, in about 2 minutes. And while this would have been OK, I really wanted to demonstrate the functionality on a smartphone, which is kind of difficult to do when there are about 50 people to present to.

Instead I used my slot to demonstrate trntxt in more of a ‘lightning talk’ fashion.

17 slides in 3 minutes.

trntxt presentation at jsoxford
Photo by Ryan Brooks

Continue reading “Train Text-imonials”

Imojify: my first JavaScript library

In which Dan finds a project other than Trntxt.uk to blog about, and says ’emoji’ 11 times.

TL;DR: I made Imojify, a library that converts emoji in :colon: notation into their graphical equivalents. It’s on GitHub, NPM and Bower.

On Monday morning I had an idea for a brilliant JavaScript library, but I couldn’t do anything with it because I had to go to work then I had a choir rehearsal. I got back from choir at 10pm with the idea still in my head along with some very catchy Christmas songs.

I had a working (but buggy) prototype by 1am.

The idea was a library that could convert colon notation emoji into their PNG image equivalent. For the uninitiated, colon notation is often used in chat services such as Gitter and Slack. It consists of a word or phrase wrapped inside a colon, such as :angry: or :stuck_out_tongue:. The big benefit of this sort of emoji is accessibility – if the picture isn’t rendered for whatever reason (e.g. for a blind person using a screen reader), it is still possible to understand what the author meant. Continue reading “Imojify: my first JavaScript library”

Sleep easier after screen time with f.lux

F.lux is an application that adapts the colour profile of your computer to the rising and setting of the sun.

Your computer screens produce white light, the same colour (albeit different intensity) as the sun. This is fine during the day – the colours look natural, but as the sun sets, should we really still be looking at the sun? This is essentially what we’re doing when we use our laptops, phones and tablets at night.

There’s a lot of scientific evidence that shows the effect of blue light on the body’s production of melatonin (the hormone that helps you sleep). I’m not going to go into detail about this, just know that blue light is not good for you if you’re trying to sleep.

This is where f.lux comes in. As the sun sets, the application changes the colour of your screen to match the colour produced by light bulbs instead of the sun. When the sun rises, the colours go back to normal. On first use, this makes the screen look orange and weird, but it’s not long before you get used to it and wonder how you ever lived without it. Seriously. Once you’ve used it for a few days, try disabling it. You’ll feel your eyes strain to adjust to the new colour.

Without f.lux, You don’t tend to notice that the screen is a completely different colour to its surroundings until you see it in a photo.

flux.jpg

On the left is my laptop with f.lux disabled. The white of the screen is a completely different colour to the surroundings. Then with f.lux (right), the laptop’s colour is a more natural fit. It is more comfortable to look at for long periods.

Unfortunately f.lux is only supported on computers. On mobiles it’s a different story. The team at f.lux have made an app for iOS devices, but it only works on jailbroken ones. Apple don’t allow it on the app store because it requires access to settings which aren’t allowed to be accessed by apps. The thing is users can’t access these settings either. One of my friends has a jailbroken iPhone with f.lux installed and it looks beautiful at night. I want it, but I also don’t want to compromise the security and reliability of my iPhone.

I understand where Apple are coming from – I also don’t think f.lux should be in the app store – but instead it should be installed and enabled by default on all devices. It should be there as a setting right next to the brightness slider for everyone so that people who use their smartphones at night can get a better night’s sleep. The research supports it, f.lux users support it, it just makes sense. If a smartphone was released that natively automatically adapted its colour temperature as the sun set, I wouldn’t hesitate to buy it.

Related news:

http://www.bbc.co.uk/news/health-34744859

http://recode.net/2015/11/16/apple-tells-screen-dimming-software-f-lux-to-shut-down-its-ios-version/

Download f.lux here (Windows, Mac, Linux):

https://justgetflux.com

Update: Apple have added a F.lux-like feature ‘Nightshift’ in their most recent iOS9.3 update

Trntxt Autumn Update

I’ve made a couple of updates to trntxt since July.

One of the things I noticed during my user tests was that people typed ‘bristol’ when they wanted information about Bristol Temple Meads, Bristol’s main station. Unfortunately ‘bristol’ is a closer match to the smaller Bristol Parkway station because it comes above Temple Meads alphabetically. Before August, there wasn’t a way to get the user to correct their search, but trntxt now has search suggestions!

The feature was implemented while being moderately inebriated by a single bottle of Henry Weston’s at the Meanbee hack night in Bath.

Now if you go to http://trntxt.uk/bathspa/bristol it will ask you if you meant Bristol Temple Meads instead of Bristol Parkway.

Just don’t ask for ‘London’.

20151002_205404000_iOS

The other new thing is journey times. Trntxt now shows you how long each journey takes, so you can identify the faster trains more easily. The number is calculated with preference to the estimated timings, so if a train is delayed, the time will adjust accordingly.

20151002_210611000_iOS

Next logical step – sort by arrival time instead 😉

I’m also looking to make trntxt’s suggestions cleverer. I’ve started collecting data about the devices that use the site and the inputs people give. I’m hoping to expand that to also collect and store data from the National Rail Enquiries API. Don’t worry, the information collected is not personally identifiable (unless your user agent string is “HI MY NAME IS DAN”).

Hopefully, after some more practice with MongoDB I’ll be able to draw conclusions predicting the stations people mean based on their input. For example if someone types /bristol/london, they probably mean London Paddington, whereas /southampton/london should take the user to London Waterloo instead.