Sunday, August 09, 2015

Holiday Hacking - A Survivor's Guide

I'd forgotten I was packing so many platforms.....
The Hackers Survival Kit was an idea that simultaneously occurred to me and Les Pounder @biglesp - me stranded in Greece for 2 weeks, with my brain idling, and Les thinking about a combined Hacker's blog where they contribute details of their minimal means to provide a hacking environment. Just the essentials for a Hacker's Toolbox, to help teach physical computing and coding to newcomers.

The idea being that with a minimum kit of parts, easily carried, and perhaps some online guide, that it would be possible to set up virtually anywhere and learn how to code, by practical experimentation.

At the end of July, I had travelled to Rhodes, armed with a few dev boards, a breadbord, some components and a netbook, which I considered to be the minimum I could get away with and yet do some serious hacking.

As it Stands....

Presently, there are two main physical computing platforms, Raspberry Pi and Arduino, which between them, probably covers 90% of all hack applications, however there are some newer arrivals, mostly 32bit ARM based platforms, that offer some interesting new middle ground to explore as the basis for hacking projects. These will we covered later.

The Lunchbox has landed....
On the menu...

BOB - an ARM M7 breakout board
A small bomb disguised as an  EE Powerbar
Essential FTDI cable
Two breadboards
jumper wires
all served on  small raft of wire- ended components.

A Minimum Solution.

You can do a lot with an Arduino, a USB cable and a laptop or netbook PC. To me I feel this offers a minimum solution that provides a basis for experimentation. However an Arduino on it's own, lacks any real interactivity - there's only so much that you can do with a single flashing LED. We need to add a few more bells and whistles.

The Arduino Experimenter's kit (this one from Adafruit - but lots of others to choose from) seems a close approximate to what is needed, as it provides Arduino, breadboard and a selection of components and jumper wires that allow a fair amount of experiments to be performed. Add to this a Netbook, with the latest Arduino IDE loaded, and you have a minimum portable package that can be taken on the road.

Add a couple of your favourite shields, and you have a compact playkit that will easily fit into a plastic sandwich box.

The Arduino however is now showing its age, and lacks a lot of user interactivity. A better package would be a Raspberry Pi and a Pibrella - which includes a bunch of LEDs, switch and small speaker. By connecting the Pi to the PC, either with a USB or network cable you have a hackable platform, with the netbook PC providing a workable screen and keyboard, for code development. This was the arrangement we used at a recent node-RED workshop, hosted by Dr. Andy Stanford Clark and Dr. Lucy Rogers.

The Pi on it's own also lacks any real user interaction - unless you have keyboard and screen attached, and it also requires quite a lot of current to operate. This means that you probably won't be able to power it off a netbook USB port, which means finding a mains adaptor or some sort of alternative supply. Fortunately there are now a number of LiPo battery solutions being made available for the Pi to greatly extend its portability. At a pinch, you might be able to power one for a couple of hours from a mobile phone charging pack.

Then there is the question of what components to take, for maximum interactivity.  LEDs, both individual, such as for traffic light displays, or 7-segment or matrix are also good for creating visual effects. Simple rows of LEDs, driven individually from a port pin are good for chaser effects (Knight Rider) and bargraph displays.

Switches, sensors and sounders also allow for a lot of creative coding. Last week in Rhodes, I knocked up a simple thermometer using a thermistor, resistor and an Arduino, and soon I could tell that it was 32C in the shade. Adding a couple of 7 segment displays would have made for an interesting self contained project.

As technology becomes more sophisticated, it is natural that hackers want to explore its bounds. One idea might be a colour LCD touchscreen that provides the user interactivity. Products such as Gameduino and Gameduino2, allow a platform even as humble as an Arduino to host an arcade style game- with the processing grunt to handle the display provided by the Gameduino.

It's a question of personal choice, given a restriction of how much kit you can take, would you opt for low level hacking of hardware, or spend time writing higher level code for simple games?


Hanging On the Telephone.....

The other possibility is that a Smartphone could be used for interactivity. This is the route suggested by the recent Microbit platform promoted by the BBC. Whilst it provides a simple LED matrix and a couple of switches, it could readily be connected to a mobile phone that provides a simple coding interface. Additionally it is powered by a small ARM processor with on chip Bluetooth LE, so board to board, and board to phone communications are achievable. An accelerometer and magnetometer compass sensor is provided on board, so interacting to motion and direction is also an area to explore. PC connection is via a USB cable and the interface is a web browser.

The inclusion of BLE on board allows this platform to connect with both Android and iOS smartphones - BLE being the common accessible link.

Microbits provides sufficient interactivity for fun-based hacking, and its relatively low power consumption means that standalone, battery operation is possible.  This opens out possibilities for free-roaming robots, controlled via BLE, or battery powered sensors, communicating back to a phone or laptop via BLE.

Hopefully with the 1 million Microbit roll-out  distribution to Year 7 students in UK schools, then this will inspire a new generation to explore the new world of physical computer hacking.

The good news is that the manufacturers intend to make Microbits available to anyone who wants to buy them - after the initial BBC rollout to secondary schools.

As soon as we start to see some real information, and tech specs, circuit diagrams of Microbits, then the hack community can go to work on this new device. I really hope that it succeeds, and that these little hack-buddies don't just go straight to landfill.

 It's early days - so time will tell.

New Horizons

Arduino is a great beginner's platform but is now in it's 10th year, and starting to show it's age. It can easily be hacked with parts on a breadboard or additional functionality on a shield. It is low power, and the IDE is self-contained and usable for even the inexperienced coder. However, so much more can be achieved by moving on to platforms based on 32bit ARM technology.

Raspberry Pi, being a considerably more powerful processor and GPU, allows for the hosting of operating systems and high level languages, with video and graphics. Now in it's fourth year, there are an increasing number of Pi HATs available, for user experimentation.  The GPIO is not as robust as that of the Arduino - so you have to treat it with a little more respect- nobody enjoys fried Pi!

Other platforms are available, that cover some of the middle ground between Arduino and Pi. These are 32 bit ARM based platforms which in some cases can be programmed with a modified Arduino IDE. Alternatively some host, scripting languages, (the Espruino - which runs JavaScript) which allow reasonable high level code development. The mbed online compiler, is another solution, which allows you to code in a fairly friendly environment, provided that you have internet access.  There are not many resorts in Europe where you can't find a cafe or bar with wifi access. mbed supports a wide range of ARM platforms, including microcontrollers from FreeScale and STMicroelectronics. The low cost (<£10) ST Nucleo platforms are not only Arduino shield compatible, but offer 5V tolerance on all but the ADC pins and a lot more grunt than the Arduino.

Smartphone interactivity, WiFi, BLE and touchscreen displays will further enhance what can be done with these small platforms, making them an attractive addition to any Hacker's survival kit.

The laptop or netbook is the centre of your hack environment. Make sure that you have preloaded it with all the software apps that you might need whilst away from base. Mine has the Arduino IDE, Termite- a  terminal emulator, EagleCAD and CooCox COIDE - an IDE for ARM code development. Irfanview is also great for photo handling. With Open Office/Libre, and using your smartphone as a camera, you can achieve a surprising amount with minimum tools. This blog was written in Notepad++ whilst no wifi was available and then ported to my blog when I got to my favourite bar.

Powerful Solutions

Electronics doesn't work without power, and in the case of a laptop or netbook, you will be looking to recharge every few hours.  Don't forget to pack the charger and the travel adaptor for whichever continent you are visiting.

Don't wait till you get to the airport where they will fleece you £7.79 for something you can buy in Poundland. Speaking of which, Poundland is also a good source for microUSB cables and ear-plugs - stock up whilst you are there for some emergency spares.

If your laptop battery is down to 10%, find a cafe or bar, and have a snack or a drink for an hour, having either cased the joint for power outlets - or asked the staff politely. It will cost you about 4 Euros (£3) but that is the cost of an opportunity charge. Don't forget to plug in at night, if you are staying in an apartment.  If you are roughing it - consider the possibilities of a small solar charger - there are some good ones about the size of a Kindle, or some of the new power packs - used for topping up mobile phones.  If you are seriously hacking - find a nice, cool place to work - with a mains outlet.

Packing it Up

Taking hacking supplies abroad presents few if any real problems. Provided that you are careful, there's not many things that you can't pack in a suitcase. Pack your boards and bits into a small box, and put them in your hold luggage. Any tools you carry, screwdrivers or cutters, should also go in hold luggage. Try to include any original packaging, so that if your cache of boards is investigated, it can be clearly seen that they are commercial products - and not an IED. Any wires or components should be put in plastic bags - clearly visible, and not at all bomb like. Take special care with any LiPo batteries you are carrying - make sure they are secure and cannot short to any metallic object.

A few days after I got to Rhodes, there was a news story concerning faulty smartphone rechargers - the PowerBar distributed by EE.  A particular batch had proven to be faulty and had to be recalled, as about 1 in 100,000 had an overheat/explode tendency. That's my "faulty" PowerBar (green&yellow) at the centre of the sandwich box. I will be particularly careful when packing that back in my hold luggage - though the risk is miniscule.

It is very unlikely that your hold luggage will go through an extensive search - but don't take any chances.  I know a girl hacker in the USA who walked into airport security with a bit of wearable technology, and was very close to being shot by nervous armed guards.

Laptops, netbooks and tablets present little security threat, and can readily be carried on as hand luggage. The Airbus I travelled on provided WiFi, and provided that the GSM phone functions are disabled in "Airplane Mode", most airlines will now accept WiFi, BLE and other 2.4GHz device communications for the majority of the flight.

If you are on holiday - don't forget to do the usual holiday things too, but often, once away from the usual work environment, your brain finds spare capacity to think of new ideas, that can be planned and put into action upon return.


For extra Geekiness....In the top photo - top row

STM32F4 Discovery - low cost STM32F407 ARM M4 Cortex based
WiNode - Arduino based with 433MHz wireless (one of mine)
ServoNode - Arduino based - designed by my firm's student intern - in his first week :)
ARMiGo  - ARM M4 Cortex designed for breadboard friendliness (one of mine)

Centre

BOB  - a breakout board for the STMF7  (one of mine - making international debut)
Nanode  - Arduino based - a friendly hackhorse I designed in 2011

Bottom Row - hatrick

PianoForte - an ARM M4 Cortex based I/O Pi HAT format supercharger for the Raspberry Pi WiFi/BLE/RFM69 connectivity - one of my DIYs.

No comments:

Post a Comment