Friday, 29 November 2013

Running courses with an Arduino Mini Pro in Berlin

Once again, some of the nerds are off to Berlin.
This time, we're going to be running an introduction to electronics course, and getting people started with Arduino and microcontrollers in general. So the first thing we needed, of course, was some components and some Arduinos!


These Arduino clones use the AtMega328 mcu on a small form-factor board, for plugging into a breadboard. So they may not be ideal if you want to use one of the many existing "shields" for the original Arduino. But as a starter board, they're perfect - and super-cheap too. At the time of writing, an Arduino Pro Mini could be had for less than two of your finest English Pounds.

For £2 the board doesn't have a usb-to-serial adapter: you're expected to provide this yourself for programming or running a serial monitor. But another quick flick through eBay, and there are USB-to-serial converters for less than a quid!


(sometimes searching for "usb ttl" returns cheaper alternatives that might otherwise have been missed, if searching for just "usb serial" or even "usb uart")

All in all, we managed to get a load of Arduinos up and working for about £3 each. Not bad at all - especially when having to buy in bulk and pay for everything up front (people at the workshop will pay-on-the-day, so anything to keep the initial outlay down is a great help).


But it's not all plain sailing. The boards arrived yesterday, but it's not simply a case of plugging everything together and it all just works. For £3 an Ardunio, that would just be too easy! The first thing is, if you're using Windows 8, the built-in drivers for a non-FTDI based usb-to-serial converter may not work.
Ours show up as a Prolific USB-to-serial COM port (most converters use some kind of virtual com port)


When we first plugged the device into a Windows 8 machine, it said that the driver was up to date, but the device could not start. This was a little puzzling, so we did some digging about. No-one seems sure about why the newer drivers won't work with Windows 8, but the workaround is to download and use older drivers. We used the driver version 3.3.2


Great - now the board was installed and working. We fired up the Arduino IDE and the COM port was indeed recognised and we were able to select it as the target port for our programmer


Our boards are Arduino Pro Mini, running off 5v with a 16Mhz crystal. There are other variants of these boards available online, so make sure to select the right version of board!

But the fun hadn't ended yet.
With the usb-to-serial device working, and the Arduino connect correctly (tx-to-rx from the usb-to-serial device to the Arduino Pro Mini board) we tried to dump an amended "blink" example to the board, just to check everything was working. It seemed to spend a long time uploading the binary - and then stopped with a failed error message:


A bit like getting stuck on a crossword clue, it took a bit of messing about and trying different things before we gave up and asked Mr Google for the answer. Apparently, the trick with these little boards is to manually hold the device in reset before attempting to program. 

So to get the "sketch" onto the board, hold down the reset button on the Arduino Pro Mini board (they all come with a small pushbutton on them somewhere) and while the reset button is still pressed, hit the upload button in the Arduino IDE.

The IDE will compile the code - keep the reset button pressed. Once the code is compiled, and the IDE reports the message "Uploading...." release the reset button. The upload continues and (hopefully) the message will return to "Done uploading" without the crude avrdude error message in orange! Hopefully.... it did for us!

No comments:

Post a Comment