Back in July, in Enschede, Oliver and I gave a walk-through of Printcraft, the intriguing “make 3D models in Minecraft, then print them on a 3D printer” experiment, to a group at the Make Stuff that Matters unconference.
In the room that summer afternoon were Frank and Floris, father and son.
I am happy to report, via Ton, that Frank and Floris took the ball and ran, holding Meet2Minecraft this weekend in Utrecht and taking our little talk to the next level, with 40 kids gathering to craft in Minecraft and print in the real world.
I love it when ideas spread!
Assembling instructions from here and here, this is how I installed Node-RED on my Raspberry Pi to support my electric meter reading experiments:
wget http://node-arm.herokuapp.com/node_latest_armhf.deb sudo dpkg -i node_latest_armhf.deb wget https://github.com/node-red/node-red/archive/0.9.1.zip unzip 0.9.1.zip mv node-red-0.9.1 node-red cd node-red/ npm install --production
That last step takes a while – be patients and it should finish in 5 to 10 minutes, and it may look like nothing is happening.
Now install the serialport and Sqlite nodes for Node-RED:
npm install serialport npm install node-red-node-sqlite
To disable login-by-serial-port, which appears to interfere with the ability of Node-RED to read serial devices, edit the /etc/inittab file and comment out the line:
T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100
When this is complete, Node-RED should be installed. To have it start on Raspberry Pi bootup automatically:
wget https://gist.github.com/Belphemur/cf91100f81f2b37b3e94/download -O node-red-init.tar.gz tar -xzvf node-red-init.tar.gz sudo mv gistcf91100f81f2b37b3e94-f6cd047768778b48b25dd66c68fdcbb68ec15465/node-red /etc/init.d/node-red sudo chmod +x /etc/init.d/node-red sudo update-rc.d node-red defaults
To start Node-RED right now:
sudo service node-red start
You should now be able to see Node-RED from a browser at http://hostname-or-ip-address:1880/
Another useful step, cleaned from here, is to disable wireless drop-outs:
sudo nano /etc/modprobe.d/8192cu.conf
and paste in:
# Disable power saving options 8192cu rtw_power_mgnt=0 rtw_enusbss=1 rtw_ips_mode=1
This should make wifi much more stable.
The first time I saw Stephen Fearing perform live was in the Market Hall in Peterborough, Ontario in the late 1980s as part of Mike Barker’s excellent Folk Under the Clock series (still going on all these years later!). I was transfixed by his songwriting, his wit, and his skills on the guitar. I saw him live again at the Winnipeg Folk Festival in 1989 – his first of many appearances there, and I’ve been a fan ever since.
But obviously not a very devoted or active fan, as 25 years have passed since 1989 and that’s a pretty long gap to not see someone you purport to be a fan of play live.
I resolved to rectify that when I noticed that he was scheduled to play The Trailside this past Friday, but fate intervened, as I was scheduled to be in Truro on Home & School business that night. What to do?
Fortunately, I realized that I would be driving right by Sackville, New Brunswick the next night, and he had a gig scheduled there that would fit into my schedule perfectly.
So I left Truro around 5:30 p.m. on Saturday night, drove through the stunning fall colours of the Cobequid Pass, and arrived in Sackville around 7:00 p.m. After a quick Tofu Pulled Pork sandwich at Pickles (much better than it sounds like it will be), I arrived at the venue, George’s Roadhouse Kitchen in plenty of time to pick up a $20 ticket.
The venue is a odd one: right across from the VIA Rail station in Sackville, it’s closed most of the time, opening only for special events like this. It has a very “Jolly Hangman in the 1980s” feel to it – rough-hewn, a definite air of mold, a pleasant workaday bartender, an amiable doorman. Like the Trailside, but without the food, three times bigger, and more “people have probably gotten into fights here.” In other words, a pretty good venue for one of Canada’s preeminent singer-songwriters.
Fearing came on stage at 8:00 p.m. and played two sets, finishing up with an encore. We were all back out into the cool fall night by 11:00 p.m.
He did not disappoint: he played a selection of songs old and new. He has aged well, and his fingers are as nimble as ever, and his honey-golden voice as sweet. I’m so glad I took the detour at Aulac and spent 3 hours in his glow.
Node-RED is, like IFTTT and Yahoo! Pipes, a visual tool that lets you plug things together to create workflows. What sets Node-RED apart is that it’s specifically designed to enable workflows that reach into the physical “Internet of Things” world: data flowing in on a serial port, for example, or the state of GPIO pins.
It’s also something best illustrated by example, so here’s a walkthrough of how I created a display for the water meter in my office at The Guild in downtown Charlottetown.
To construct the water meter I used the following hardware:
- Grid Insight AMRUSB-1, a USB dongle that reads meters via radio and outputs messages that can be read on a serial port.
- Stock Raspberry Pi model B.
- PiTFT, a 2.8 inch touchscreen display.
- USB wifi dongle to connect to the Internet.
Here’s what the Node-RED workflow I created looks like when it’s done:
Each of the nodes in the workflow does something – reads data, processes data, outputs data, and so on – and they are wired together in a way that routes that data from node to node. Double-clicking on any node shows its details.
Read Data from the AMRUSB-1
The first node reads data from the AMRUSB-1 on the /dev/ttyACM0 device, 9600 baud, 8 bits, no parity, 1 stop bit:
The details of the serial port setup look like this:
This is set up to send one Node-RED message for every line that’s received from the device (lines end with “\n”).
Route by Message Type
The AMRUSB-1 received two types of meter reading messages, SCM and IDM. We’re only interested in the SCM messages, so we use a “switch” node to split the workflow into two based on whether UMSCM or UMIDM is found in the message:
Parse the SCM Messages
Each SCM message is a comma-separated set of values: the message type, the meter serial number, the meter type, and the meter reading; using a “csv” node, we split these into individual values:
Remove the Checksum from the Reading
The final CSV value, “reading,” has a checksum value appended to it, beginning with an asterisk; we need to remove this, so we use a “function” node containing a simple line of JavaScript:
msg.payload.reading = msg.payload.reading.split("\*", 1)[0]; return msg;
msg.payload.reading = msg.payload.reading.split("\*", 1)[0]; return msg;
Select only The Guild Water Meter
Looking at the actual water meter in the basement of The Guild, I found it has a serial number of 26771974; because I only want data for that single meter (the AMRUSB-1 will read any meter in the area), I use a “switch” node to filter for that serial number only:
Reformat the Message for Display
We want to display the message on an external display in the format Water Meter X m3 (Y m3 today) where X is the absolute value of the meter, and Y is the difference from the first reading taken. We use another “function” node to do this, using JavaScript to do the heavy lifting:
context.firstreading = context.firstreading || 0; var thisreading = msg.payload.reading; if (context.firstreading == 0) { msg.payload = "'Water Meter " + (thisreading / 10) + " m3'"; context.firstreading = thisreading; } else { msg.payload = "'Water Meter " + (thisreading / 10) + " m3 (" + ((thisreading - context.firstreading) / 10) + " m3 today)'"; } return msg;
Display the Message
Now that we have the message, we want to display it on the PiTFT display connected to the Raspberry Pi. To do this we use an “exec” node to call a shell script on the Pi, display-on-pitft.sh, that displays the message using the fbtext utility to draw into the framebuffer:
The shell script looks like this:
#!/bin/sh pkill -9 -f fbtext echo "$1" | /home/pi/fbtext/fbtext -d /dev/fb1 -i Inconsolata-38.bdf -
To start, I kill off any previously-running instances of fbtext; this means that processes don’t build up and keep running everything I update the display.
The $1 is the text of the message coming from Node-RED, fbtext is the executable (compiled from source obtained from here with guidance from here), /dev/fb1 is the PiTFT display framebuffer, Inconsolata-38.bdf is a bitmap font that I created from the Inconsolata OpenType using FontForge and the final dash says “read the text from the standard input rather than from the filename that I would otherwise specific here.”
Display Debugging
Messages can be routed to multiple nodes; to double-check what I’m sending to the display, I use a “debug” node to show the same message in the debug tab of Node-RED; it looks like this when the workflow is running:
Up and Running
Once I deploy the workflow in Node-RED, it starts listening for AMRUSB-1 messages; when it receives one, the messages are parsed and reformatted and then end up on the display of the Raspberry Pi:
To Do
The “today” measurement isn’t really “today’s” usage, it’s the usage since the workflow started to run; I’d like this to be smarter.
I’d like Node-RED to auto-start when the Raspberry Pi boots; that way I won’t have to start the workflow running from my Mac via a browser as I do now.
And it would be nice to have the display be more information rich, with a larger typeface for the meter-reading and perhaps some graphical representation of the measure.
On the list of things that can happen to someone like me, coming across an unexpected cache of paper maps – beautiful, richly colourful, paper maps on subjects ranging from the Northwest Passage to Polish geology to Ugandan agriculture – is right up there on the list of “greatest things ever.”
And that’s exactly what happened today: walking the halls of the fourth floor of the Taylor Family Digital Library here at the University of Calgary I spotted a door marked Spatial and Numeric Data Services.
How could you not walk through a door with such an intriguing title? It was like coming upon the Department of Dark Arts and Magical Incantations.
So in the door I did walk. Where I was warmly greeted by a friendly map librarian, who told me all about the services, spatial and numeric, that her section offers. I told her about maps at the University of PEI, and about Island Imagined. She told me about their aerial photographs collection and their GIS services.
And then I spotted a table in the middle of the room marked FREE MAPS.
Were they really free maps?, I asked. Yes.
And so I spent an ecstatic 20 minutes browsing through maps of north and south and east and west. Satellite maps. Topographic maps. Index maps. Maps of Africa (a lot of maps of Africa). Maps of northern Canada. Maps of Iberia.
I couldn’t take them all, but I also couldn’t pass up the opportunity to take some of them with me, even if it did mean carrying around a cumbersome roll of Polskie mapy geologiczne for the rest of the week.
I curated a nice little selection, rolled them up, and asked the friendly librarian where I might purchase a tube to carry them home in. She generously pulled an old one out of their collection – don’t tell anyone I told you this, as no ill should befall her for this kindness – and I was on my way.
With the cumbersomeness of the tube quickly becoming apparent as I walked around the library for the rest of the afternoon, at the end of the day I made my way to the local Shoppers Drug Mart Canada Post Outlet and invested $15 in postage to mail the tube home.
Be thus warned: I will likely be prone to holding forth on the geography of the maize growing areas of greater Kampala in the weeks and months to come.
Here is a strand.
Eleven years ago I attended a public meeting at the Delta Prince Edward hotel where Maritime Electric, Prince Edward Island’s electric utility, made its case for a dramatic increase in electricity rates.
As I related at the time in this space, the key line of the evening, for me, came when CEO Jim Lea, responding to my question about whether there would ever be a situation where it would be beneficial for the company if electricity consumption were to drop, answered, with commendable honesty, “no it would not be beneficial.”
That simple realization drove home for me that it was never going to be the utility that was going to drive electricity reduction efforts: if anyone was going to do it, it was going to be we the people.
Also in the audience at that meeting was Richard Brown, a fellow resident of downtown Charlottetown, a fellow computer programmer, someone interested in energy issues, and, at the time, a defeated Liberal MLA.
Six months later, Richard was elected to the Legislative Assembly again, and joined the Liberal opposition for a term before being reelected in 2007 and joining Executive Council.
Two years later, in 2009, Richard was named Minister of Environment, Energy and Forestry and I interviewed him as a part of a series on climate change I was producing.
I returned to Richard’s office two years later, in March of 2011, to discuss the possibility of having information about electricity load and generation, including wind energy, released as open data, returning to the thread that started in 2003: if it was we the people that were going to responsible for reducing electricity consumption, we were going to need access to data about generation and consumption to arm ourselves.
By July, still without access to this data, I created a hack that used New Brunswick data to provide a slice of the energy picture and created another hack, covered by CBC Spark, that allowed the energy flow to be visualized through techno music.
A year later, in June of 2012, the project I’d originally discussed with Richard bore fruit, thanks to the efforts of his department of of the province’s IT department, and open data on energy load and generation started to flow and I started to archive it.
Someone who noticed my efforts was Scott Bateman, a researcher in human-computer interaction at the University of PEI (and a colleague from many years ago when we both worked on the provincial website project). Scott proposed that we work together on a project to create an in-home appliance – an “energy thingy,” he dubbed it – that would use that open data to present “actionable feedback” about electricity usage. It might glow green when the wind was blowing and much of the electricity was being wind-generated, and glow red when the reverse was true. And thus help you decide when to turn on the clothes dryer.
Scott proposed the project to the NRC, it was funded, and now that “thingy” is a real thing: it has how-to manual, open source code, and you can build one yourself.
Meanwhile, I shifted my focus from the macro to the micro, applying for and being granted a City of Charlottetown micro-grant to fund The Social Consumption Project, a pilot effort to provide daily water and electricity consumption data to five households in Charlottetown.
All of which led to me spending this week in Calgary, in part with Scott’s academic colleagues in the Innovations in Visualization Laboratory at the University of Calgary, discussing both our “macro” and “micro” energy projects, with an eye to learning more about how their thinking in information visualization can be used to both improve the presentation of data and increase the likelihood of it spurring positive action.
We spent a very productive session with the team in the lab today, and already my head is filled with alternative approaches and interesting ideas: they are an insightful lot and, as I wrote the team afterwards, it was refreshing to discuss with interested others ideas that I had mostly, to this point, discussed only with myself.
Scott and I are presenting the “thingy” at the SurfNet conference later this week and I’m certain that we’ll find other opportunities for collaboration there.
I never could have imagined, when I attended a little meeting in a Charlottetown hotel, that I would end up, a decade later, pursuing the same strand, in a rich academic context.
This is the kind of thing I love doing – following stands, connecting dots, building digital connective tissue, meeting interesting people, following my curiousity.
Among other things, it has provided me with a route back into the academy after 30 years: I have finally found a way of engaging academia which, rather than being soul-dampening, as it was the first time around, is compelling in ways I never could have imagined.
Moral of the story: don’t be afraid to follow unlikely strands; they can lead you places you can’t get elsewhere.
Do stuff. Tell other people about it. Ask questions. Be patient. And see what happens.
In Rukavina family lore my paternal grandmother Nettie is famous for the distance she would walk to save money. From her house on Mary Street in Brantford she would walk to a Callbeck’s grocery store far across town to save 45 cents on a tub of yogurt. And think nothing of it. She came of age in the Great Depression, and habits forged there she never broke. And these are habits she passed to my father, who, in turn, passed them to me, albeit with some withering away of the more extreme elements in each generation.
And so when it came time to find a way from Calgary International Airport to my hotel across town this afternoon, I wasn’t looking for the fastest or most elegant way of traveling, I was looking for the cheapest way.
I could have taken a taxi ($40-45, says the airport). Or an airport shuttle ($15). But my eye was immediately drawn to Calgary Transit, which could do even better.
Option number one, which would take about an hour, involved bus #300 and the light rail line and would cost $8.50.
Option number two would take about 90 minutes, via bus #100 and light rail, was only $3.00.
As you can probably imagine, I opted for the $3.00 solution.
Except that as I was standing in front of the ticket machine at the airport, the man at the machine beside me asked if I was looking for a ticket for the #100 bus, and when I told him that I was he offered me the one he’d just purchased, as he’d decided to take the quicker, more expensive route.
So I ended up getting to my hotel for free. Nettie, I hope, would have been proud.
From the placement and lack of signage pointing the way to public transit, it appears as though the airport hasn’t wholly embraced this transport option. The Calgary Transit information desk, for example, was staffed by someone who seemed completely unskilled at giving directions. And the desk is located at the opposite end of the airport from the bus departure bay, meaning that rather than following the signs for “ground transportation,” you actually go the opposite direction. Even the bus driver himself seemed to treat my presence grudgingly.
But, that all said, it worked: the bus #100 goes to the McKnight-Westwinds light rail station, and from there it was an easy train ride downtown, a quick transfer, and a ride out toward the University of Calgary on the other light rail line. 90 minutes after setting out, I was happily checking into my hotel.
A curious set of circumstances will see me spending the next week in Calgary wearing two overlapping hats – Hacker in Residence and Reinvented – to engage in a rollicking good time amongst academics working in information visualization and surface computing, with an eye to developing collaborations around a number of projects, including the energy thingy that Scott Bateman has been developing for Reinvented, the Social Consumption Project that I’ve been funded by the City of Charlottetown to carry out, the Archiving Geopresence project that I’ve been working on for several years, and a variety of other projects and pipe dreams (including an idea that’s been floating around my head to someone illuminate the Samuel Holland township lot lines so that they can be seen from outer space: I’m pretty sure there’s a better approach than my “light a lot of bonfires” idea).
Two hats requires two business cards, so I’ve got the case packed with half of each. And which had I’m wearing at any given time – adventurous hacker or keen capitalist – will depend on the circumstance and my mood.
I’m taking the long way to get to Calgary, stopping in Toronto tonight, flying to Vancouver tomorrow and then immediately on to Calgary, and then, next Friday, flying back to Vancouver for a quick two-day stopover before arriving back in Charlottetown a week from Sunday.
Or at least that’s the plan: Air Canada has been sending me flight notifications all afternoon long moving the departure time for my flight to Toronto ahead. Projecting forward, at this rate I’ll likely be leaving after I come home.
A couple of days ago I received an email from AVIS car rental that pointed me to a website where they informed me that they had billed me $23.00 for passing through a Massachusetts Turnpike toll plaza on July 16, 2014:
I was, in fact, in New England that week, on business with Yankee Publishing, and I did rent a car from AVIS, so that much is true.
But I wasn’t in Massachusetts on July 16, and I know this because, since May, I’ve been archiving my “personal geolocation” to my own server, and looking at where I was at on July 16 you can see that my travels were limited to a triangle of Peterborough, NH (where my hotel was), Dublin, NH (where Yankee is) and Hancock, NH (where I had supper with my colleagues on the Yankee web team):
If my own geoarchiving wasn’t enough. Google is keeping track of me too (and with even more resolution), and Google Location History clearing shows me in Peterborough, NH at midnight, which would make it impossible for me to be in Massachusetts 9 minutes later:
None of this would likely hold up in a law court, but it was enough for me to be able to report to AVIS with confidence that the charge was spurious. So I called AVIS, and explained the situation. They told me that their records indicate that the charge was based on a photograph of a license plate, and that it was likely a mis-read, especially because the toll receipt shows me exiting the turnpike, but not entering it.
Not since the great Plazes geolocation event of summer 2005, which introduced me to Ton and Martin has having a device in my pocket keeping track of where I am been so much fun.
Remember Robert P. Haythorne, the most interesting Prince Edward Island premier you’ve never heard of? Well a bunch of modern-day Islanders from Haythorne’s stomping grounds in Marshfield are seeking to rectify this under the banner of PEI2014.
On Saturday, October 4 (rain date is Sunday), starting with a 4km walk on “Senator Haythorne Lane” at 1:15 p.m. and continuing with formal festivities at 2:00 p.m., the memory of Haythorne will be feted in the style he richly deserves:
- A talk by Jim Hornby, “Poore by Name – Rich by Nature.”
- Signing of a petition to name the trail right-of-way in honour of Haythorne.
- Musical entertainment and refreshments.
It’s all hosted by the Hillsborough River Association, the Marshfield Pioneer Cemetery Trust Fund and the Marshfield WI.