Tuesday, 11 March 2014

C++ STL on Arduino

Since moving to the new Arduino IDE beta, I've also been looking at using the C++ STL on Arduino, specifically the Mega 2560. There are several ports around, but the one which worked out-of-the-box with the new compiler is StandardCplusplus.

It includes a variant of oserialstream called ohserialstream, which allows you to stream data out to the hardware Serial ports by defining cout in the main sketch:

namespace std
  ohserialstream cout(Serial);

Admittedly the ATMega2560 chip only has 8kB SRAM, and embedded systems don't like memory fragmentation so I'll be avoiding repeated container edits, but limited use of the STL should allow for some code structure simplification at the expense of code size.

Looking forward to full C++11 compatibility in the main Arduino IDE!

Thursday, 6 March 2014

Arduino IDE gets a new compiler at last

When installing the latest Arduino IDE version 1.5.6-r2, the nightly builds caught my eye, and while researching the latest changes I came across this interesting thread. The AVR toolchain has been updated to GCC 4.8.1, and the Arduino IDE nightly build is now available with that backend for Windows here (for other platforms see the post here).

My Arduino Mega 2560 project went from 51,886 (1.5.6-r2) to 51,330 bytes (nightly with GCC 4.8.1), and the reported SRAM usage dropped from 2434 to 2186 bytes, and the program appears to run exactly as before.

It looks like the update will bring efficiency and memory savings, so let's hope it's incorporated into the main IDE release channel soon!

Monday, 7 October 2013

Pi on the move

I know quite a few people have already used the obsolete Motorola Atrix dock as a means of making a Raspberry Pi-based "laptop", but here is my setup to add to the mix.

First the connectors. These are the main problem as the dock has a male micro USB and a male micro HDMI connector, which were designed to plug into sockets on the appropriate Motorola smartphone. The earlier Pis didn't allow power to flow in via the USB A sockets, but the later ones like mine, do, and this makes things easier as you don't need to cut and solder any cables at all.

I found the following on Ebay:

  • a micro USB extender cable which connected to the dock's male micro USB connector
  • a female micro USB to male USB A adaptor, which connected the end of the micro USB extender cable to one of the Pi's USB A sockets
  • a female micro HDMI to male mini HDMI adaptor
  • a female mini HDMI to male HDMI adaptor

The first HDMI adaptor is quite chunky, so I had to remove some of it with a Dremel (other small grinding gadgets are available) to allow it to plug in cleanly without fouling the USB plug. The Pi is quite light, and the two HDMI adaptors can support it quite easily, but it is obviously fragile so care is needed.

The micro USB plug on the dock is strangely tight in the extension cable socket. The two ends of the cable can be plugged together easily, so I suspect something is up with the connector on the dock, and will be trying not to unplug the sockets attached to the dock if that can be avoided.

Once everything is plugged together, just open the lid to enable the power, and away you go! The two USB sockets on the back of the dock are recognised and Raspian auto-mounts USB sticks through them, so it's a good solution for backing up data from the SD card.

I think that the Atrix dock will be a boon for using, setting up, and backing up Pis as you don't need to worry about finding cables or spare keyboards.

Friday, 12 April 2013

Cornish Language Weekend 2013 - An Bennseythun Gernewek 2013

Don't forget that it's the Cornish Language Weekend in Newquay this weekend - details here.