you can’t touch this

my…my…my…music. hits me. so hard!

oh what memories come flooding back. the school trip to Isle of Wight. the day glo tee shirts. and M.C.Hammer explaining to the rest of the music world that he was now the zenith of popular culture. his reign only lasted until “Do the Bartman” hits the charts if I remember correctly.


anyway. i’m back Strathmore University‘s iLab today with the great guys from TipHub. (you can read about my previous trip here). we’re running this hack event across 5 locations simultaneously. With Kenya as the HQ, hacks are also taking place in HubAccra in Accra, Ghana, Impact Hub in Washington, DC and Opportunity Hub in Affiliation with Georgia Tech University, Atlanta, GA.

i offered to fly, Phil Collins-style, between all the hacks, but the budget wouldn’t stretch that far and with the traffic in Nairobi, even Concord couldn’t get me to Atlanta in time.

however due to the time zone differences and Bluemix’s mighty DevOps powers of Git-integration, once today’s hacking in Nairobi crescendos and peters out, the baton (and the well-documented code) will be passed to the other teams so apply polish to the awesomeness we’ve created.


these hacks are all focused on addressing real problems that affect Africa dubbed the Diaspora Day of Civic Hacking. the projects are supported by diaspora (African’s who currently live abroad) who want to pool the creativity, energy and innovation of African’s burgeoning developer community.

the team has chosen a very worthy problem for their hack: creating a solution to help teachers in Africa take their teaching on students to the next level. this includes teaching disadvantaged in rural areas and nomadic tribespeople, who are unable to get into classrooms, and so use Mobile to bring the class to them.

the sponsor setting this particular challenge is Asante Africa, a non profit organization that provides underprivileged children in Kenya and Tanzania with access to education.

i’m here to show the how the latest tools and techniques – like the almighty Bluemix with his powers of DevOps, MBaaS and other awesome techwordsdejour as well as his ingenious side-kick  Node-RED – can help them achieve their goals faster, innovate collaboratively and be able to scale.


for the solution, the hack team have focused on creating a great experience to engage the students, enabling them to learn using phones and tablets, at their own pace, and take quizzes and exams from the phone, delivering the results straight to the teachers. subsequent plans include revamping how teachers create, store, share and rate lesson plans, as well as bringing textbooks in Africa into the 21st century.

what the team realized they needed was an extensible content management system, that they could integrate with databases, email as Web and Mobile apps. Bluemix to the rescue with it’s new WordPress capability. the hack team were able to get started with Bluemix’s WordPress service rapidly, getting them from ideation to a wording environment in minutes.

so… why the reminiscing about MC Hammer?

last night i realized i needed to refresh the demos i’ve been using, and decided to tackle one i’d wanted to create last time i was in iLab but never got time to finish couldn’t figure out how to get working.

it’s a trivial app, of course. but a use case that could be extended and expanded by someone with far more time than me more skills that me. i call this masterpiece: WHO MOVED MY PHONE!!

so… the use case is that you want to create a solution to avoid someone taking your phone. of course, this could be extended to bags, cars, cats, cheese and girlfriends.

in other words – regarding my phone and with this solution in place – “you can’t touch this” with me knowing about it. see what i did there?

first stop. fire up the mighty Bluemix and climb astride its awesomeness (head over to sign in, if you’ve got an account. or repent bitterly and lightly slap yourself with alternate open palms if you’ve not got yourself a Bluemix account yet. ok, good? feel better now?


now go to the catalog page. you know, this one. get yourself the power of the Internet of Things. first grasshopper, deploy the Internet of Things service boilerplate right at the top of the Bluemix sweetshop. this is what will open up the giddy world of Node-RED. name it. deploy it, and you’ll be able to launch Node-RED by clicking on the URL of the app (look under the funky name you gave it on the dashboard) and brace yourself for an overdose of awesome.

next go back to the Bluemix sweetshop (catalog). scroll right down to the bottom. here you’ll find the Internet of Things Foundation. get it. now. this sucker is going to register your phone (you know, the one we’re creating an app so we don’t let anyone touch it… can’t touch it….remember? ok.) and manage it and all sorts of great stuff that i know everything about need to read up and learn.

ok so now we need to put some code-type-stuff on your phone. calm down. it’s gonna be ok. it’s just the IoT Starter. if you’re an iPhone head, head over here. if you’re an Android head, then this is the one for you.

now i need to hand you over to the experts for the tricky stuff. don’t forgot about me, ok? you sure? alright… follow Mike’s excellent instructions, and remember i got this working first time at 10pm on a Friday night with jetlag, so you’ll do just fine. ready? ok – go and follow the steps for the IoT Starter demo here.

are you back? ok… wow… thanks i thought i’d lost you. it was ok wasn’t it? good.

now you have a cute little sensor doohicky running on your beloved mobe. and you’ve set this baby up to report to it’s mummy, the IoT Foundation.

the IoT Starter app has just turned your phone into a multi-purpose sensor and there’s looks of cool stuff it can sense. we’re going to focus on the accelerometer – the gizmo that can detect movement in your phone. and no just how much motion, but in what direction on 3 axises as well.


ace. now we want to create an Internet of Things app to make the magic happen.

go back to your Bluemix app – the one that’s running your Node-RED instance.

next painstakingly re-create these gorgeous Node-RED flows, taking care to make sure the connectors between the nodes are in nice sweeping arcs and everything is nicely proportioned.


or just import this Node-RED XML, by copying to the clipboard and using the importing menu thus:


ta-dah! oh yeah. you rock. have you ever considered a professional (Node-RED) modelling job? i know some people…

[{"id":"b07579df.b727","type":"twilio out","service":"_ext_","twilio":"",
"from":"","number":"+123456789","name":"Text Ben","x":927,"y":260,"z":"c3a0ff77.0a54b",
"wires":[]}, {"id":"3f5a5b7f.d13aec","type":"debug","name":"","active":true,"console":
"false","complete":"false","x":660,"y":93,"z":"c3a0ff77.0a54b","wires":[]},{"id":"b38ee693.22178","type":"ibmiot in","authentication":"apiKey","apiKey":"",
"format":"json","name":"IBM IoT App In","service":"registered","allDevices":true,"allApplications":"",
"z":"c3a0ff77.0a54b","wires":[["3f5a5b7f.d13aec","6a28aa89.8317ec"]]}, {"id":"6a28aa89.8317ec","type":
"function","name":"Has someone moved my phone?","func":"if (parseFloat(msg.payload.d.acceleration_y) > 2) 
{ msg.payload = \"WHO's TOUCHED MY PHONE!!\";}\nelse return\nreturn msg;","outputs":1,"x":444,"y":269,
"z":"c3a0ff77.0a54b","wires":[["3f5a5b7f.d13aec","6bc0d04.533193"]]}, {"id":"6bc0d04.533193",

right. so we’ve got an input node. go into the settings and configure it with the credentials you got from the Internet of Things Foundation.

cool. now got to the javascript function node and check you have code that looks like this:


alright. this is going to capture one of the accelerometer values from the phone and see if it’s detected some movement. sure – fiddle with the value if you want to get it ultra-touchy. at this setting, the act of merrily picking it up should raise the alarm. but make it more snarky if you want. it’s your phone.

now decide how to you want to be notified that someone is cruising (for a bruising). i’ve gone for SMS, but you can use the Twitter, Email or HTTP nodes.

configure your alarm raiser. if SMS, rock on over to Twilio and invite those great people to furnish you with a lovely virtual number and the power of Twilio. whack your virtual number in the “from” box and the number of your other phone, or the number of your personal body-guard, or local friendly lynch mob into the “To” field.

whatever you’re using, forget the limit node at your peril. this little fella will stop you accidentally sending yourself 30,000 text messages. i’ve been there. twice.

so there it is. your Node-RED debug window should print nothing at all, until your blessed, precious mobile is fondled by some devious troublemaker, at which point the alarm is raised and a text alert is dispatched.

disclaimer: i accept no responsibility for loss of phones. (the system is not 1000% full proof).

if you can figure out how to improve on this let me know. i mean, anything is possible. for example, can you extend this so that the mobe’s front phone camera takes a picture of the offender and uploads it to the Twittersphere so that social media mob justice swiftly follows? go on. i double dare you (no returns). of course, if you have Dobermans you could wire this baby into the remote control for their gate and unleash the very Hounds of Baskerville whenever your mobe is in a.n.other’s grubby mitts.

next i’d like to talk about how the other day, i was walking along the road and – STOP! hammer time!


One thought on “you can’t touch this

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s