18 Jan 2014, 13:36

When a 10 year old tiny utility program saves your ass

#“When a 10 year old tiny utility program saves your ass”

After many many years on a barely-used 1024-bit GPG/PGP key, I decided to go full-blown 4096-bit recently. More for the principle than anything else, but also to mess around with some secure apps like Retroshare, as mentioned by Cathal Garvey.

Whilst I was as it, I moved to a new much improved longer password and made sure to drill it into my brain over and over.

Yeah, that worked brilliantly………..

Last night I went to setup Retroshare properly and it rejected the password. 50 attempts later I was no closer to getting in. But I was sure I had the general pattern of the password correct.

Normally you are screwed when this happens, but a bit of googling found program called “Rephrase” which was last updated in 2003. You give it the general patter of your password along with possible character variations and it brute forces all of the possible combinations against GPG. e.g. (T|t)this(I|i)s(M|m)y(P|p)assword. And whaddya know, I was close, I just had a capitalisation wrong! Hurrah.

 

12 Jan 2014, 17:14

The FrankenLego RC car is progressing nicely

#“The FrankenLego RC car is progressing nicely”

The idea behind this was to highlight how Lego could do something really powerful for a much wider range of kids than the insanely priced Mindstorms.

I started with this really impressive Lego Technic Dune Buggythat some of my kids assembled ages ago.

8048-1

I then butchered it and added a geared motor, a motor shield, an Arduino Uno, a LiPo battery, an nRF24L01 transceiverand a servo to create FrankenLego:

frankenlego

The basics work ok. Finishing the steering is next along with an improved connection of the wheels to the motor.

All for a fraction of what Mindstorms costs. Yes I know you can get motors for Technic but they are missing a big middle ground here by insisting on sticking with the over-thought over-designed over-priced under-achieving Mindstorms.

04 Jan 2014, 13:28

DisplayPort to DVI to HDMI to VGA to Monitor - And it works

#“DisplayPort to DVI to HDMI to VGA to Monitor - And it works”

Yesterday I got caught out in a meeting by having an MBP and a DVI adapter whilst the customer had a VGA projector. Luckily someone else saved the day with a proper Windows laptop with a VGA port :-)

For giggles I just tried daisy-chaining a bunch of adapters I’ve collected from various Chinese sources over the last two years. It works. Inconceivable! That’s $29 fewer dollars in Apple’s cofffers.

adapters

01 Jan 2014, 20:33

My Pebble watch just fits, in every way.

#“My Pebble watch just fits, in every way.”

I have hovered over the Buy button on the Pebble site more times than I’d like to admit. But I always stopped at the last minute. $150 is a lot of money for a watch when you haven’t worn one in years, even if it’s a “Smart” watch. The dreadful reviews of the RunKeeper App didn’t help, since that was going to be my main use case.

running_2013

Then, just at the beginning of December, I got one as a gift and put it to use the following day with the self-same RunKeeper App in the Clonakilty Half Marathon. That App is indeed close to useless since you cannot start or stop runs with it - the main function most people would be looking for to avoid fiddling with armbands at the start/end of a run.

Disaster then struck as the screen broke and turned into a kaleidoscope of colours and starbursts. I spent much of the run prepping my blogpost on their terrible QA. Despite this I did like seeing/squinting-at my time/pace etc as I trundled slowly around rural West Cork. Somehow, after the race, the display fixed itself. That evening I discovered yet again that I’m a moron and found out that the LCD display does that when viewed through polarising lenses, like for example, sunglasses :-)

Similar to most people, I immediately installed some silly watch-faces.

bbc-face

I particularly liked the Fair Weather one which uses an App on your phone as an internet proxy. That’s a really really smart use of a low-power device. I’m expecting to see many more uses of that proxy method over time.

pebble_fairweather

In the end I settled on the Glance App which gives me a summary of texts, emails and calls along with the time and overall weather/temperature. I also use Music Boss to control what’s playing on the phone.

IMG_20130606_214732-236x300

The killer feature for me is, surprisingly, the SMS/Phone/IM/etc Alerts. I had thought they were going to be useless since they just replicate what the phone is doing. Except, my phone spends most of its time in my pocket or on my desk, not in my hand. There is something very very cool about getting an alert on my wrist that my phone is ringing or someone is IMing me when my phone is at the far end of the house/office. I still can’t figure out how Bluetooth LE is getting such incredible range. Better than our house Wifi! I have the email alerts turned off for the obvious reason. It’s also much easier/safer to glance at the alerts whilst driving.

I still find it a bit annoying to have people constantly picking up their phone to check alerts/emails/etc when in conversations. In contrast, a quick glance at the Pebble is far less obnoxious and doesn’t interrupt the flow of conversation at all.

I’m getting 4-5 days on a charge and have already bought a second charging cable. The Pebble has died on me once over Christmas due to forgetting to charge it. Actually, they really need to add a mobile-phone-style charge level on the main screen to avoid this. The other concern I have is the hardness of the front bezel. I already have some marks around the edges after a few weeks. Gorilla Glass for V2.0?

A nice touch is the backlight which only comes on if it detects lots of motion. So a quick flick of the hand shows me the time at night. Almost reminiscent of the original red LED watches :-)

I’d love to play around with the SDK but haven’t had a minute to do so. The fact that they have an RTOS on this baby sends me back to my early career of embedded development. The upcoming App Store should also be a big improvement to the current method of trawling the web for Apps etc.

The main reason I love it is because it just fits. I don’t mean physically, I mean into my “lifestyle”. It has zero learning curve and immediate tangible benefits. You can’t ask much more from a piece of technology. Now if only it was half the price!

25 Dec 2013, 13:43

Our first Arduino Christmas Turkey

#“Our first Arduino Christmas Turkey”

Take one turkey, an oven with the temperature markings rubbed-off, a food thermometer with a broken probe and you have a recipe for either incineration or salmonella.

Enter an Arduino Uno, a K-Type thermocouple, a sample MAX31855 IC, some dodgy soldering from a few weeks ago, an Adafruit library and a Sparkfun LCD and you get this:

2013-12-25 12.43.45

All rustled up in 15 minutes.

Code and circuit to follow.

I haven’t bothered to average out the values so using a bit of human judgement on the instantaneous ones.

UPDATE: So the turkey ended up very dry. I’m not sure if the cooking time was excessive or the thermocouple was reading low. I wasn’t impressed with its accuracy at room temperature (+/- 2C at least) but I suspect it may have been 10C or more off at 180C. Hmm, just tried it on boiling water and it read 100-104 so perhaps I just cooked the turkey for far too long.

Also, if you want to try this, do yourself a favour and get the Adafruit MAX31855 breakout board. Soldering to the chip directly was a pain in the ass.

CODE (based on the Adafruit and Sparkfun sample code):

[sourcecode] /*************************************************** This is an example for the Adafruit Thermocouple Sensor w/MAX31855K

Designed specifically to work with the Adafruit Thermocouple Sensor —-> https://www.adafruit.com/products/269

These displays use SPI to communicate, 3 pins are required to interface Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit!

Written by Limor Fried/Ladyada for Adafruit Industries. BSD license, all text above must be included in any redistribution ****************************************************/

#include "Adafruit_MAX31855.h" #include <SoftwareSerial.h> #include<stdlib.h>

int thermoCLK = 5; int thermoCS = 4; int thermoDO = 3;

// Initialize the Thermocouple Adafruit_MAX31855 thermocouple(thermoCLK, thermoCS, thermoDO); SoftwareSerial mySerial(6,2); // pin 2 = TX, pin 3 = RX (unused)

void setup() { mySerial.begin(9600); Serial.begin(9600); delay(500); mySerial.write(254); // move cursor to beginning of first line mySerial.write(128); mySerial.write(" "); // clear display mySerial.write(" "); mySerial.write("Hello, Thermocouple!");

// wait for MAX chip to stabilize delay(1000); }

char tempstring[16]; void loop() { // basic readout test, just print the current temp mySerial.write(254); // move cursor to beginning of first line mySerial.write(128); mySerial.write(" "); // clear display mySerial.write(" ");

double c = thermocouple.readCelsius(); if (isnan©) { mySerial.write("T/C Problem"); } else { mySerial.write("C = "); mySerial.write(dtostrf(c,4,1,tempstring)); Serial.println©; mySerial.write(" "); }

delay(1000); } [/sourcecode]

01 Dec 2013, 13:20

Slightly obsessing about the Doctor Who theme music

#“Slightly obsessing about the Doctor Who theme music”

I watched a superb Culture Show documentary on Doctor Who last week. Several people really stood out for me including Delia Derbyshire, the absolute genius who, at the BBC Radiophonic Workshop in 1963,turned Ron Grainer’s simple tune into the iconic music that is burned into my brain since I first heard it around 1972, aged 4.

Delia-Derbyshire

I’ve just been wondering this week how she did it. Has anyone tried to re-create it using the technology available to her back then? I found this clip showing how they did it in 1980 with analogue polyphonic synthesisers and vocoders but that tech is far beyond 1963 and, to be honest, doesn’t sound as good to my ears.

httpv://www.youtube.com/watch?v=dIZIu72Clp4

In any case, here’s a bunch of them back to back, starting with Delia’s masterpiece

httpv://www.youtube.com/watch?v=a1AnTi1X2QM

And a BBC Radio 4 Documentary on Delia. Sad that you have to go to YouTube to listen to it!

UPDATE: You really have to listen to that BBC R4 documentary, it’s wonderful. Her co-workers give a good description of how the Doctor Who theme was created too.

01 Dec 2013, 12:18

Introducing the Bandon Bluetooth Button (BBB) using RN42 HID

#“Introducing the Bandon Bluetooth Button (BBB) using RN42 HID”

TL;DR - A Bluetooth-enabled Button/Joystick to control music/podcasts on your phone whilst driving.

bbb01

One thing I find very dangerous in the car is changing tracks etc on my phone when it’s in its screen mount. It’s impossible to do so without taking your eye off the road even for a second. And it’s illegal in many countries. I used to love the steering column controls for the old car radio but they don’t work over A2DP or AVRCP Bluetooth to my phone which streams to my Lidl car stereo.

I’ve made three attempts at solving this and I finally succeeded today.

The first attempt involved one of those cheap Chinese Bluetooth Serial modules like HC-05 or HC-06. I got pretty far with this and was able to send commands to my phone. But that’s where I got stuck. I would need to write a native Android App to take those commands and broadcast them as media commands in the phone. I made some progress there but I was way out of my depth.

Whilst in the midst of that, Adafruit announced the Bluefruit. We know how that turned out for me, but if you want to make something like my BBB, I’d recommend that route since you get almost everything out of the box.

Finally I settled on the Microchip Roving Networks RN42 HID Bluetooth module. It only cost 16.50 ex-VAT from Farnell Element 14 in Ireland. As usual with Farnell, you need to bump the order over 20 to get free (fast!) deliver. My big concern was to make sure I’d get the right variant since there are quite a few. But since May 2013 it looks like the HID one is what they ship by default. Of course the big drawback is that this is an SMD module which isn’t really designed for hand soldering into a hobby project. You can get them on breakout boards but it adds a lot to the cost. In the end the soldering was fine since it only really involved 4 wires and a stiff drink ;-) (Power, Ground, Serial Receive, Serial Transmit).

So what does it do? It’s really very simple. You pair it to your phone and it appears as a combo Keyboard/Mouse device. You then send commands using an Arduino Nano to the RN42 and it sends them to the phone. The trick here is that the commands are “Consumer Report” ones which means Play/Pause, Next/Prev Track and Volume Up/Down (amongst many others). It’s all powered by a LiPo battery I salvaged from some broken kids toy.

httpv://www.youtube.com/watch?v=IuH-1LcZlYo

It works beautifully and will take pride of place attached to my steering wheel as I wend my way around the country. Update: Just tested on an emergency drive from Bandon to Mount Mellary to collect a sick Boy Scout.

2013-11-30 19.41.41

I have tested on an SGS4 but there is no reason it won’t work on an iDevice unless Tim and Co have not implemented Consumer Report HID on iOS. Update: Tested and working beautifully on an iPhone 5 with iOS 7.

The only real issues I have so far are that it won’t auto-connect to the phone (I think this is the SGS4’s fault) and I haven’t implemented any power saving. I’m trying to sort auto-connect by using an NFC sticker to force the Samsung to connect. Not much joy yet. Power-saving should be easy to do since the joystick itself could be used to wake everything up. In the meantime I’ll just unplug when not in use and charge the battery every once in a while from the cigarette lighter socket using one of these very neat $3 USB LiPo chargers from the usual crew in DX in China.

bbb02

One thing I haven’t figured out is why it won’t work with a 3.3V Arduino Pro Mini. The RN42 is a 3.3V device but only works with my 5V Arduinos like the Nano and the Uno. Is it possible the UART pins need 5V?

The Bill of Materials is as follows:

Wiring is beyond easy: TX on Arduino to RX on RN42. RX on Arduino to TX on RN42. 3V3 on Arduino to VCC on RN42. GND on Arduino to GND on RN42.

My code is trivially simple and uses my improved version of an existing Arduino library called BPLib to talk to the RN42. I had to modify the library to work on anything other than an Arduino Mega but that was a simple search/replace. I also added a bunch of the Consumer Report functions to the library if you want to make use of them. They are:

  • void volumeUp();
  • void volumeDown();
  • void muteAudio();
  • void playPause();
  • void nextTrack();
  • void prevTrack();
  • void stopAudio();
  • void fastForwardAudio();
  • void rewindAudio();
  • void keyRelease();
My Arduino sketch and library are available on GitHub here. Edit the ino file to suit yourself e.g. shorten a lot of the overly conservative delays or add proper power management. The BPLib directory should be dropped into the libraries sub-directory of your Arduino IDE installation.

One thing to be careful of is that most Arduinos only have one serial port. So if you have the RN42 attached to the serial pins and powered up, then you won’t be able to program the Arduino using the IDE until you disconnect power or RX/TX to the RN42.

As always, any questions, let me know in the comments.

UPDATE: I’ve been using it for two days now and I love it! One problem I’ve run into which should have been obvious is that once I pull the power, the BBB forgets what it has been paired to. So when I reconnect power, the phone thinks it is paired but the BBB doesn’t and therefore connection fails. So I have to un-pair and re-pair. The solution is obviously to implement strong power management so the LiPo lasts more than the current 48hrs. I’ll post new code when I have that figured out.

The other tiny problem is that play/pause on Android by default uses your main Music app rather than the last audio app you ran,. In my case I want it to control the Doggcatcher Podcast player. It’s no biggie, I just have to manually open Doggcatcher at the start of a journey and then the controls work perfectly.

17 Nov 2013, 13:32

[No Longer] a Product and Support failure by Adafruit with the Bluefruit EZ-Key

#”[No Longer] a Product and Support failure by Adafruit with the Bluefruit EZ-Key”

UPDATE: Incredibly fast response and resolution from Adafruit. Feel free to ignore my negative post below. But still some good tips for any biz about handling product change and support. Back in? with Adafruit.

I’ve been working on a simple-ish project recently which required Bluetooth comms between some hardware and a phone. I’ve had lots of success with those cheap HC-05/HC-06 modules from China and made some progress with a Slave module. The problem was having to write native Android code to take the info from Bluetooth and “action” it.

Then mid-project, Adafruit announced theBluefruit EZ-Key HID module which solved everything (I thought) in one fell swoop. I immediately ordered one and it arrived quickly from the US. I had it paired and sending key-presses to my PC and phone within a few minutes.

Then I moved to using it in the actual project. I needed to be able to send Play/Pause music commands over Bluetooth. I opened up the key definition file and there was no mention of media controls. The file referenced another filename which I googled and found. A short while later I realised that a HID keyboard can’t send media commands, it requires just a slightly different HID Consumer profile (a simple setting). But I couldn’t see how to change the Bluefruit profile and asked how on their only Support method for paying customers - the Adafruit forums. Crickets. One non-Adafruit person tried to help but I’d already failed with the method suggested. Strike 1 for Adafruit support.

After a delay of a few weeks whilst I focused on Halloween tech, I finally got back to it last week and rolled up my sleeves. Back I went to the Adafruit site to get as much info as possible to see if there was any way to add the “Consumer” profile to Bluefruit. I was stunned to see they had released two new versions in less than 4 weeks. The first to add the mouse profile and the second to add the (yup, you guessed it) Consumer profile. So a feature I asked about, to which they never replied, is now part of the product!

Naturally I went straight to the forums and asked how I could upgrade my 4 week old device to the new firmware. Response: you can’t. My basic response: you’re kidding me. As I said on the forum:

I really have to express my annoyance about this. You released a non-user-upgradable product and then iterated it twice in the space of a few weeks? So anyone like me who bought v1.0 was basically a beta-tester without realising it? I feel very let down here by a company I have huge respect for.

As someone who works in product management I know that this is a sure-fire way to kill a product stone-dead. Why would anyone even buy v1.2 if they suspect there might be a v1.3 next week? Did you do a beta cycle with real users at all? The features of v1.1 and v1.2 would have been obvious additions to anyone who even played with it for 5 minutes.

Now if this was a standard hacker product, there would be new firmware available to burn or instructions for hardware mods or whatever. Not in this case. This is effectively a consumer product. It is “non-user-serviceable”. Once you buy it, that’s it, it will be forever fixed function, like a vacuum cleaner.

This type of product is a new departure for Adafruit and they have royally screwed it up. Any normal consumer product company would offer a full or partial replacement/exchange for the people who bought the first incomplete versions. Adafruit’s attitude seems to be “tough luck, caveat emptor dude”. The almost complete lack of questions about Bluefruit on the forums tells me it is either so perfect that no-one needs any support or (more likely) very few people have bought them. So the cost of keeping a few customers happy and loyal would have been minimal.

My final comment to them was “I’ll continue to buy Adafruit products that I can hack myself but you’ve really soured me with anything black-boxed like the Bluefruit.”. And that’s my advice to others. Until Adafruit make the necessary organisational changes to properly release and support products like this, you should stick to their excellent motor shields, Floras and other devices instead.

Of course yesterday I discovered a similar Roving Networks productvariant that does exactly what I want and was released 2 years ago! And it comes with full configurable HID support unlike the still fixed-function HID of the Bluefruit (v1.7 next week?). The RN42 is also available here on a breakout board. Then I found that HID is now built-in by default to the RN42 and I can get it for 16.50 in Farnell in Ireland. Sure it’ll need some soldering etc, but I can live with that.

For me, two of the brightest lights of the Maker movement have been Sparkfun and Adafruit. After this experience, one of those LEDs is just a little dimmer.

03 Nov 2013, 17:33

Adding a realtime clock to the Raspberry Pi and the Sweetbox II

#“Adding a realtime clock to the Raspberry Pi and the Sweetbox II”

I got one of these $3 RTC modulesa few months back and I finally set it up this weekend. It simply has a battery-backed clock so when your Raspberry Pi (or Arduino) boots up, it has the correct time immediately. For a network-connected Pi, it’s not really necessary as you can have the time updated regularly via NTP but not all Pis spend their life connected to the network. So if you are working away locally on your Pi, your files will no longer look like they were all created in 1970. This Adafruit tutorial explains exactly how to do it. You could even get their RTC module instead.

rtc1

On a totally unrelated note, I finally got my Sweetbox II case for the Raspberry Pi which I backed on Kickstarter. It’s a minimalist low-profile case that comes with cute heatsinks and a cut-out for the header pins. I’m not a huge fan of the semi-translucent look of the plastic but I do love how little space it takes up. And unlike many cases, you don’t have to take it apart to plug/unplug the ribbon cable. And finally, it’s nice to have more good tech coming out of Greece.

rtc2

03 Nov 2013, 17:11

The very real danger of cheap Lithium Polymer (LiPo) batteries and accessories

#“The very real danger of cheap Lithium Polymer (LiPo) batteries and accessories”

We’ve all heard the horror stories of phones exploding in people’s faces and it turned out to be due to aftermarket cheap LiPo batteries. TBH I’ve always pooh-poohed that stuff and figured they had been doing something stupid with their phones.

I was wrong.

When my wife moved from iPhone 4 to iPhone 5 recently, she discovered [a] the iPhone 5 battery life is awful and [b] of course her Mophie battery pack case wouldn’t work due to the new connector. As a marathon runner, she needs the phone to be still working after 26 miles of music, GPS and Runkeeper. The iPhone 5 isn’t up to the job.

The original Mophie cost 70+ in Dixons and is still working well on the older phone. My ideas around hacking out the iPhone 4 connector and replacing it with a Lightning one were just plain stupid. So I went cheapskate and got her a $23 Mophie knock-off on DX.com. I guessed the 2200mAh would turn out to be fantasy but even if it gave her an extra hour or two running, it would be worth it.

We were really surprised to discover that it actually worked well and hugely extended the usability of the iPhone 5. It just about fit into an oversized running arm-band too.

That was until Friday.

That afternoon, the battery case was on her computer desk, charging. Our 11yo son was using the computer. Then the case started smoking. He went down to my home office to tell me but I was on a call and he decided not to bother me! So he calmly went back and pulled the cable out of the charger. He then went and got a glass of water, in case it went on fire. He’s some kid. Zero panic. OK, we had to explain about water and different types of fires to him afterwards but overall, incredibly impressive.

lipo01

 

Less impressive was the melted plastic of the case and USB cable. Less impressive again was the state of the LiPo battery inside the case when I cracked it open. It was buckled and distorted. Yes I’m an idiot for doing so, it could have blown up in my face.

 

lipo02

Whilst it’s during charging that LiPo batteries seem to be at their most dangerous, who’s to say that it wouldn’t have gone on fire or exploded when my wife had been running?

What would have happened if my son hadn’t been there on Friday?

I don’t want to turn into my parents’ generation where many of them unplug the TV, toaster, oven and microwave every night but it really does make me think about the huge number of devices in our house that sit charging most of the time: laptops, phones, MP3 players, Bluetooth headsets, Nintendo DSes etc etc.

At the very least, I am never doing unattended charging of any non-mainstream-brand that has a LiPo inside from now on. There’s a reason a Mophie costs 70+ and it’s not all about margin. There is a brand new one winging its way from Amazon as we speak.