11 May 2013, 14:54

I generally don't do 'inspirational', but RoboHand, well, just watch the video

#“I generally don’t do \“inspirational\“, but RoboHand, well, just watch the video”

Oh dear, I appear to have a hair or some grit in my eye.

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

07 May 2013, 08:17

Controlling an i-racer RC car using a Wii Balance Board and @Raspberry_Pi

#“Controlling an i-racer RC car using a Wii Balance Board and @Raspberry_Pi”

I love watching ideas bounce back and forward between people on Twitter and see them grow. The best for me recently started when The Verge posted a story about an OpenSource Android App which basically turned a Wii Balance Board into a Withings weighing scales, including RunKeeper and Fitbit integration. I retweeted it and it was picked up by Joe Desbonnet. He realised you could also do some interesting things with the Balance Board and a Raspberry Pi and started hacking. Which of course made me realise I could control the i-racer with it!

Here’s a wee video of it in action:

httpv://youtu.be/8cdn_LFKQXI

Apologies for the mobile interference in the audio. I was using my new SGS4 to SSH to the Raspberry Pi to kick off the Python code. The ConnectBot guys really need to fix the microscopic font on screens like the SGS4!

The car isn’t very fast in the video as the Lego added a lot of weight and I hardcoded the speed to 50%. We’ll try again next weekend using a lighter shell, full speed and tarmac instead of cobblelock.

Technical Nitty Gritty (not too Gritty!)

My initial experiments with the Balance Board did not go well. Eventually I discovered that the version of the cwiid Wii library that is available on Raspberry Pi (and Ubuntu etc) is not able to deal with the Balance Board. See this bug. I applied the patch and re-built my own deb files. To use them, just unzip them on the raspberry pi and install like so:

wget https://github.com/conoro/iracer-controllers/raw/master/iracer_balance_board/cwiid_for_balance_board.zip
unzip cwiid_for_balance_board.zip
sudo dpkg -i *.deb
The rest of the time was just spent tweaking the numbers so that I could interpret someone leaning in various directions irrespective of their weight. It's still not great but works for me, a 7yo and a 6yo. All the old i-racer Bluetooth code carried over unchanged from our Cheese Controlled Car. Follow the instructions there for installing various Bluetooth bits and bobs on the Raspberry Pi. I was very surprised that I could talk to both the i-racer and the Balance Board over the same $2 Bluetooth adapter. I was sure I'd end up having to use two adapters. You can, as ever, grab the code from Github. The only changes you need to make in the code are to set the Bluetooth MAC addresses of both the Balance Board and the i-racer. Sidenote: The Android App was a dead end. It doesn't work on Android 4.2 because Google decided to upgrade their broken Bluetooth stack and actually managed to make it worse. Any questions, leave a comment.

Only if you really need it: Building those cwiid libraries yourself


sudo nano /etc/apt/sources.list

Add the following line:


deb-src http://archive.raspbian.org/raspbian wheezy main contrib non-free rpi

Then do the following:


mkdir ~/build
cd build
apt-get source python-cwiid
apt-get build-dep python-cwiid
cd cwiid-0.6.00+svn201/

Then edit these three files and add the changes from https://launchpadlibrarian.net/115501163/balanceboard.patch (or run “patch” if you are familiar with that)


nano libcwiid/cwiid_internal.h
nano libcwiid/process.c
nano libcwiid/thread.c
dpkg-source --commit
dpkg-buildpackage -us -uc
cd ..
sudo apt-get remove python-cwiid
sudo dpkg -i *.deb

03 May 2013, 07:45

Fun and games with LiPo batteries and cheap Android Tablets

#“Fun and games with LiPo batteries and cheap Android Tablets”

The replacement LiPo battery arrived for my daughter’s Eken T02A ultra-cheap Android tablet yesterday. Only 2 weeks from China which isn’t bad.

As I mentioned before, the Eken’s battery life iscatastrophic Sometimes less than 45 mins. Even at idle, it dies in no time at all. I’m guessing one of its two cells isn’t actually functional.

The eBay replacement quotes 3500mAh which I’ll take with a big grain of salt. But at least it was bigger and heavier than the 2x “2000mAh” that were in the Eken.

$T2eC16hHJIQE9qUHu0VFBRZTd8Hccw~~60_12

Swapping out seemed to be a doddle, just two wires to solder. Most of the eBay batteries come with a PCM (Protection Circuit Module) built-in. This ensures that the battery never completely drains and also doesn’t get overcharged. Both are lethal for LiPo batteries.

I charged the Eken up with the new battery, which took forever on USB. But I saw this as a good thing. Then I pulled the power and tried to boot. Zip. Nada. Not even a flicker.

I started getting paranoid that the 2x batteries in the Eken were actually wired to give 7.4V and not 3.7V. But some multi-metering confirmed 3.7V on the originals. I wired them back in and the Eken booted fine. Weird. When I checked the new one disconnected from the Eken on the multimeter, it reported 3.7V too. But when it was connected to the Eken it said 0.8V.

Then I had a brainwave. I tested the connections on the battery side of the PCM. Aha, 3.7V. So something weird was happening with the PCM. My worry was that is was actually doing it’s job and the battery couldn’t supply enough current to power the Eken.

But deep intake of breath and I swapped the PCM from the old battery and put it on the new one. Result! Eken booted and battery did not explode or melt.

I’ve been unable to figure out if all PCMs are generic for a particular voltage or if they are specific to a battery type. I’m hoping the former. Anyone know? I’d hate for something to go wrong with this one.

And now for the really good news. 2.5hrs mixed usage with the new battery and we’re still at 64%!

 

28 Apr 2013, 20:26

An evening in the company of the delightful Mr Samsung Galaxy S4

#“An evening in the company of the delightful Mr Samsung Galaxy S4”

I’m sure you’re dying to know how I’m getting on with the S4. How many of you struggled to sleep last night with the anticipation?

Where to start? That screen, OMFG that screen. 5” of bright full 1080p HD. I played the classic Big Buck Bunny 1080p video and everything was crisper than crisp. I haven’t used it in bright sunlight yet but I’m sure it’s as crap as all modern phones.

How does the phone look? I couldn’t give two hoots. I buy phones as tools, not fashion accessories. Having said that, I wouldn’t be seen dead with a white one ;-)

gal_03

The lightness of the S4 can be disconcerting when the buzzer gives haptic feedback but I’ll happily take lightness over a brick in my pocket any day. Oddly, the phone doesn’t feel big at all. In some ways it feels smaller than the HTC Sensation.

Whilst I always hated HTC Sense and far prefer the Stock AOSP Android experience, I don’t find TouchWiz that objectionable. Given that I spend 95% of my time on a phone inside apps, it doesn’t really affect me that much. It still has the powerful system-wide sharing features of Android and the still excellent (but now very cluttered) notification bar.

Of course it comes with a ton of Samsung junk Apps, just like HTC. I tried them all (Hub, Fitness, Story Book etc etc) but just can’t see the point of using single-vendor apps when I can use third-party ones from Google, Endomondo, Evernote or Amazon and bring everything with me if I switch to another vendor in the future.

Games, as you’d expect are blazingly fast and look gorgeous. I did find one or two that crapped out at launch tho. I’d love to know why.

I’ve read a lot of negativity about the “gimmick” features involving hand swipes and eye tracking but I was surprised to find that I really liked both.

By tracking the location of your eye, it can auto-scroll web-pages etc when it notices your head tilt. I was easily able to start, stop and rewind a web-page using it. The big down side is that it only seems to work in Samsung apps. I’d love to see this in Twitter apps in particular.

The hand-waving is more gimmicky and allows you to scroll through photo albums etc. I just liked the ability to check the lock-screen for messages/missed-calls by waving my hand over the phone on my desk.

I’m looking forward to trying out Bluetooth 4.0 on my Fitbit. I don’t think the sync is currently working but they said on Twitter that they are going to test this week. I also don’t know if Android finally has BLE support to avoid big battery drain onconnecteddevices.I’m a big fan of the idea of NFC for payments so I’ll give that a go when I have a chance.

Another gimmicky thing that I like is the IR blaster built into the headphone socket. My eldest daughter thought it was pointless but I liked being able to change channel/volume on the TV without hunting for the remote.

One annoyance, not specific to the Galaxy is the term “16GB”. This is total storage so you only start out with 9GB user storage, which I have already filled. Hence the absolute need for an SD card slot. I have a 32GB microSD on the way from Amazon. Side-note: This is a UHS-1 card which has 48Mbs throughput in certain cameras. Standard Class 10 SD is only 10Mbs. So I’d love to know if Samsung has implemented a UHS interface on the S4 or if it’s normal SD.

A big word of warning on the Dropbox integration. I just discovered that 4GB+ of the storage used on the phone was because it decided to auto-sync everything from Dropbox. Everything! Eventually I ran out of storage on the phone and it stopped syncing. To avoid this, disable the “DocumentSync” feature in Settings->Accounts->Cloud. Stupid stupid default Samsung, what were you thinking?

The phone is LTE and it should be fun to check out the download speeds the next time I’m in London. Given that I’m in Old Chapel, I can’t even get GPRS without major arm-waving. I’m looking forward to the 30Mbs that Pat Rabbitte has personally guaranteed we’ll all have, as a minimum, by 2015.

And now, back to reality.

I haven’t had much chance to try out the camera. But the few initial pics were superb. I’ll definitely be giving 1080p 30fps video a try out this week. Here’s a quick example in bad light in my office:

20130428_201032

A few other notes. The charger is 2 Amp and a useful compact size. The charger cable useless at a metre too short. The phone uses microSIMs so make sure you leave the shop the right kind.

I’ll try out some of the more obscure features in the next few weeks and then promptly forget about them.

Vodafone will force you to “upgrade” to Red Essentials at a minimum if you are on an older cheaper plan. So I’m now paying 5 a month extra for 500MB a month less data. You stay classy Vodafone.

One final note to Samsung. It would be a huge help if you’d do a phone-specific Samsung-branded sports armband, particularly since you now have this sports app. I’m really shooting in the dark with ordering on Amazon.

Look, you can’t really go wrong with most mid to high end Android phones nowadays. If you get the S4 or the One or the Z or the Nexus4 or the whatever, you’ll probably be more than happy. The S4 packs an amazing raft of features into a pleasantly small package. I think I’m going to be happy with it for the next two years.

 

27 Apr 2013, 14:07

My Smartphone evolution from N95-8GB to Samsung Galaxy S4 #SGS4

#“My Smartphone evolution from N95-8GB to Samsung Galaxy S4 #SGS4”

smartphones

My first actual “Smartphone” was a Nokia N70 but it has the dubious pleasure of being the only phone I ever lost. The one that really got me using Apps and understanding the importance of SoLoMo was the classic N95-8GB which I loved despite its numerous flaws. It was also the most I ever spent on a phone.

When I realised that Android would be an unstoppable juggernaut, I got a HTC G1 back in Nov 2008, shortly after it was released. Still a fine phone and I do love that slidey keyboard.

I followed that with the HTC Desire which was many people’s first Android phone and still afirmfavourite with lots of them. Our 13 yo has had it for the past 2 years and the only thing he dislikes even now is the lack of storage to install Apps.

I bought an Orange San Francisco (ZTE Blade) for my Dad as a test intro to Android. He took to it no problem and now has a Nexus S. Our 11 yo has had the Blade for the past year. A shockingly solid piece of kit for something that cost 99 without contract.

In Aug 2011 I was chuffed to learn I had won a HTC Sensation from Vodafone. That’s what I’ve been using until today. It was and is a superb piece of hardware let down by pretty awful software from HTC and some really ropey build quality. It is alsounfortunatelynot that popular with the creators of custom ROMs and I’ve never had a ROM which works 100% reliably with all the features. Bluetooth is a particular pain in the ass. But the Cyanogenmod ROMs still beat anything HTC themselves released.

And then we get to 2013. It’s currently a three horse race for most people between the HTC One, the Sony Experia Z and the Samsung Galaxy S4. On paper based on raw specs, the S4 wins. The other two are better looking phones and apparently are better built. I don’t trust Sony in general with maintaining products and they always overprice, so the Z is out. Loyalty should have me buying the HTC One but three drawbacks have forced me into the arms of Samsung for the first time.

The first, and worst, is that you cannot ever replace the battery in the One. This isn’t like the iPhone where it’s awkward and requires tools. You have to physically destroy the HTC One to get at the battery. In a world where people are starting to return to the idea of repairability in products and owning things for longer, this is a disastrous decision by HTC. I have had spare batteries in my pocket for my phones since N95-8GB days, I can’t go back to worrying about my phone running out of charge.

Add to that the lack of an SD Card slot and a weirdly de-specced 4MP camera and I’mafraidHTC will be sold for spare change to someone like Microsoft before the end of the year.

So SGS4 it is. Hands-on in the shop was a very impressive experience. But I haven’t even turned it on at home yet. More when I do.

27 Apr 2013, 13:24

Amazing kuvitteellinen prizes to be won if you can guess what this is.

#“Amazing kuvitteellinen prizes to be won if you can guess what this is.”

And bykuvitteellinen, of course I mean the Finnish for imaginary.

What do you think this is:

IMG_20130427_122738

Hint: It’s not crystal meth, washing soda, fish food or a new type of running shoe compound.

 

23 Apr 2013, 09:00

Your prayers answered, Old Chapel temperature server now online

#“Your prayers answered, Old Chapel temperature server now online”

I must get 20 emails a day asking the same question: “Conor, what temperature is it,right now, outside your office window?“. Thankfully, after literally several minutes work, you have your answer.

Courtesy of an Arduino Nano, Ethernet adapter and Sparkfun temperature breakout board, I can exclusively reveal the temperature is12.44C and 54.39F i.e. about 2C higher than reality.

To get something more accurate I’ll need to put the sensor away from the building, away from the ground, out of direct sunlight and with good air flow. Then I’ll auto-post the values to Open Weather Map and COSM.

DSCF2602

I was genuinely surprised on Sunday at the level of interest in the Arduino web-server I mentioned. I think a mixture of the tiny cost and 8-bit nature of the whole thing intrigued people. It was also trivial to puttogetherwith some sample code. The only difficulty I’ve found with Arduino in general is handling floating point values easily.

nano2

Of course it doesn’t really make sense to have low-powered nodes being read by anyone. As several people pointed out on Sunday, a DDoS (heck, even a DoS) attack would be ridiculously easy. The nodes should either be reporting to central server(s) or queried on a regular basis by a small number of systems. That’s phase 2 for my little side project and it’s a bit more complex than temperature. More updates in a few weeks.

 

21 Apr 2013, 15:48

What the inside of an 88 Android Tablet looks like

#“What the inside of an \u008088 Android Tablet looks like”

My daughter’s Eken T02 is still going strong after nearly a year but it still has the same two problems as ever. [a] the accuracy of the touch screen is awful and [b] it barely lasts 45mins on battery.

I don’t think I can do anything about the first problem but I decided last week to sort out the second one. Particularly considering Scribblenauts is now fiiiiiiinally available on Android (currently requires a US VPN, Market Enabler, Amazon App Store and a US virtual credit card. Slick ;-p )

IMG_20130421_151828

I popped it open quite easily by removing 4 screws and a few plastic tabs. It’s surprisingly neat inside but has a really weird smell!

Obviously the batteries are garbage based on how long they last so I ordered a replacement on eBay. It’s a “3500mAh” unit with the usual proviso that Chinese mAh tend to be a bit different from the mAh the rest of the world measures in. It’s also the usual China story where they’ll arrive at some indeterminate point in the next few weeks. Should only take a minute to swap them. Fingers crossed it sorts the problem out.

I’ll let ye know how it goes.

 

14 Apr 2013, 14:02

Adding an audio amplifier to your @Raspberry_Pi

#“Adding an audio amplifier to your @Raspberry_Pi”

We have a treadmill setup in our house which has always faced some sort of media centre setup. It’s the only way I don’t lose my mind with boredom when running during Irish bad weather (August to June).Originallyit was an XBOX-1 with XBMC on a 14” Philips portable CRT. Then it became a Patriot PBO connected with a HDMI-VGA adapter to an LCD monitor and now it’s a Raspberry Pi running Raspbmc connected to the same monitor.

The problem in all these setups has been audio volume. When I’m pounding my featherlight torso on the treadmill deck, I need lots and lots of volume to hear anything. I bought a 2.1 Speaker thingy from Lidl a good while back and that helped but it still wasn’t loud enough on some media.

Then I got a Fiio E3 battery-powered headphone amp and that worked well with the PBO. The big downside was that it chewed through the single AAA battery in no time at all and was unusable with rechargeables.

I came up with a really coolsolutionto the battery problem. I got one of these adjustable voltage regulators from DX, cut the head off an old Nokia charger and wired it in. Then I used a multimeter on the output and twisted the potentiometer until I got 1.5V out. I used crocodile clips to then connect to the Fiio.

DSCF2592

I can’t recommend that voltage regulator highly enough. If you, like me, have tons of old power supplies from long dead electronics, it can scale down anything to the voltage you need. I’m getting another one to power the Raspberry Pi from an old Linksys 12V wall-wart as most of my phone chargers simply don’t have enough juice. At 2.90, it’s super value.

The problem with the PBO as a media player is that its UI is garbage. It feels like something from the 90s. In particular, it’s missing a simple but crucial feature we love in XBMC - a tick mark to show you’ve already finished watching something or you are mid-watch. The PBO is also terribly crashy and struggles regularly with SMB network shares.

So we finally moved to Raspbmc and it works really well. Well almost. The only big problem is the analogue audio, it has no amplification on it at all. So even with the Fiio and the Lidl speakers up full, it is very hard to hear on the treadmill.

I had a go with using a USB audio adapter but that was a disaster. Audio out of sync and the GUI mis-behaved the whole time. It was louder tho!

Then I went looking for something with more welly than the Fiio. That company has other devices but they are even more expensive than the RPi itself.

I then built this:

IMG_20130302_190848

But after much gnashing of teeth with no output and then mono output, I realised that a loudspeaker amp is totally different to an inline headphone amp and just cannot work in that configuration. So much for 6 years of Electronics in UCD ;-)

Weirdly I could only find loudspeaker amps on DX, eBay and Amazon. A bunch more googling and reading on audio/hifi/hobbyist sites and fiiiiiinally I found a headphone amp design called the CMoy which (a) looked easy to make (b) looked cheap to make and © had very detailed instructions for idiots like me.

I ordered the various bits online from the usual suspects (eBay, DX, Farnell) and put it together last week on a mini-breadboard. Shockingly for me, it worked first time! The only difficulty in the instructions is that they are customised for a very specific Radioshack board and I had to translate that to my simple breadboard.

IMG_20130407_203620

Then yesterday I sat down to build the final circuit on some stripboard I got yonks ago in Maplin. I’ll be honest, it took a while. Particularly translating the layout to a very small bit of board. But yet again, magically, it worked first time. I have it powered with another old Netgear 12V wall-wart. It’ll take anything from around 9V to around 30V which is really handy.

DSCF2590

A bit of glue-gunning on to the unused lid of a Raspberry Pi case and I have a finished product.And boy is it loud! We’ll need to be careful we don’t blow the amp inside the Lidl speakers or damage the speakers themselves. Mrs D’Wife, who ran 10 miles on the treadmill today (10 miles!), approves of the improved volume level too.

DSCF2596

I highly recommend the CMoy kit if you are struggling with audio volume levels on anything, not just the RPi.At some point I’ll draw out my layout to save others the hassle of figuring out the original layout. Hit me with any questions below.

UPDATE 1: I completely forgot to do a costing on this. Whilst the overall spend for me was 32.45 (incl P&P), this includes some giant packs of resistors, capacitors and LEDs that I have been using on multiple projects. If you can manage to get exactly the amount of each thing you need, then the entire amplifier only costs 6.59. That’s obviously excluding the power supply, solder, tools and the glue from the glue gun. You will find it difficult to just buy 1’s and 2’s of things. You can do it in Maplin but it’ll cost you a lot more. You can also do it on sites like Farnell but they have a minimum order of 20.

So either buy the bigger packs on the basis that you’ll be making other things or do it as part of something like a Coder Dojo where lots of you pitch in together to make lots of these.

12 Apr 2013, 18:44

Endo2Atom - An Endomondo ATOM/RSS feed to post your activities via tools like IFTTT #OpenData

#“Endo2Atom - An Endomondo ATOM/RSS feed to post your activities via tools like IFTTT #OpenData”

I was very disappointed to realise that Endomondo has no API. The best they can do for pushing your activities elsewhere is built-in Facebook/Twitter and some widgets. When will companies learn that lock-in is not how you keep customers?

I’d like to be able to push my activities to sites like App.net, Tumblr or anywhere really. The best way to do that is with ATOM/RSS and great tools like IFTTT and dlvr.it.

A bit of poking around last night led me to good old screen-scraping. Their widgets are publicly accessible so it wasn’t too hard to scrape one of them and generate an ATOM feed. I used it as an opportunity to try out Bottle. If you need to build a simple web-app fast, with minimal overhead and you use Python, I think you’ll like it. For kicks and giggles I decided to put it up on Heroku - my first time to do so properly. That’s a very nice deployment flow indeed.

marathon

So here you go. If you want the ATOM feed of your public Endomondo activities, just grab your numeric user ID from your profile page and tack it onto http://endo2atom.conoroneill.com

For example, my Endomondo profile is http://www.endomondo.com/profile/8922951 so my ATOM feed is http://endo2atom.conoroneill.com/8922951

Code, as ever, ison GitHub.

I have also created a simple IFTTT Recipe for auto-posting those activities to App.Net. I’ll try some other targets over the weekend.

It has only been tested on treadmill running, treadmill walking and road running. There is no error checking so it may fall over on non-distance-based activities. Let me know if it does and I’ll improve. The code is also limited to the first page of activities and doesn’t crawl backwards on the other pages. That should be easy enough to add.

Hope you find it useful.