--- layout: post.html title: "RTHack" date: 2015-04-14 tags: JavaScript JSOxford RTHack HackDay summary: "Last Saturday I spent the day at [JS Oxford](http://jsoxford.com)'s RTHack day. The theme was to explore and build upon real time web technologies. " --- Last Saturday I spent the day at [JS Oxford](http://jsoxford.com)'s RTHack day. The theme was to explore and build upon real time web technologies. When we arrived there were many [examples](https://github.com/jsoxford/RTHackPack) provided for us (one which I had added) using a range of real time technologies such as [Pusher](https://pusher.com/), [PubNub](https://www.pubnub.com/) and [Socket.io](http://socket.io/). After a brief intro a few pitched some ideas they had for the day and we joined into groups. I joined with [Max](https://twitter.com/omgmog) to work on some real time, web connected hardware using Arduino's etc. I had brought along my awesome [Spark Core](https://store.spark.io/?product=spark-core) which is a mini, cloud connected device. I hooked up a [DHT11](http://www.adafruit.com/products/386) temperature/humidity sensor which had a handy Spark Core library available. {{> tweet id='586829181226524672' }} The data from this sensor was then made available by registering events using the Spark cloud's `publish` function which I then listened for on a server and forwarded all messages to Pusher for use by others. I hooked up a simple web page that would display each of the messages as they came in and cobbled together a [D3](http://d3js.org/) graph that plotted the temperature in real time. We quickly discovered that the DHT11 was *slow*. Very slow it seemed. I first thought it was a bug in my code but after putting the device in the fridge we started to see a change in the temperature output, but with something close to a 30 second delay. Hardly **real time**. I switched to using a TMP36 temperature sensor, one lacking a handy library. It took me *WAY* too long to get this working as I needed to find the right equation to convert the output voltage to degrees Celsius. "*Hardware is hard!*" But in the end I prevailed!!! {{> tweet id='586913832121008129' }} We gave demos at the end of the day. Mine was short and sweet but some of the others were pretty cool. [Dan](https://twitter.com/danielthepope) made a cool game where you fight to set the background colour. {{> tweet id='586901707285725185' }} [Ben](https://twitter.com/benjaminbenben) and [Gil](https://twitter.com/LuRsT) made a cool way of displaying what people are tweeting about. {{> tweet id='586926991020003328' }} We also had a Countdown clone, modern minesweep, twitter walls with flamingos, various chat rooms and an interactive [Ben's mind palace](http://www.bensmindpalace.co.uk/rt/). When all was done and we had wrapped up a few of us headed over to Joe Perks for some well deserved (custom) cocktails. {{> tweet id='586955640024788992' }} This did end up turning into a Ruby hack... {{> tweet id='586994376812933121' }} All-in-all it was a great day! I learned not to muck around with hardware at a JS hack day (although that may change now I've received my [Espruino Pico](http://www.espruino.com/Pico)) and there are some pretty quick and powerful things you can do with technologies like Pusher.