Monday, 26 May 2014

Countdown to Thursday - three days to go

I'm racing ahead with preparations for this Thursday's Kids Adore Ditch.

I've already had one small problem to overcome.

Poorly 3pi

When I looked closely at my 3pi on Friday I realised that the mounting bracket of one of the motors is broken. I've ordered a replacement but it will not arrive until Wednesday at the earliest. I had two 3Pi  demos in mind, and I'm a bit wary of reprograming on the day, so I decided it was time to get a second robot.

HobbyTronics offered the best price, and for an additional charge I asked for delivery on Saturday Morning. The new robot arrived on time and I started to prepare the demo.

Great documentation from Pololu

It's been a while since I did anything with these robots, so I needed to remind myself about how to program them. I love the documentation on the Pololu web site: it's simple, clear and correct, and covers Windows, Linux and OS/X users.

I have the GNU gc++ avr cross compiler and avrdude installed on my workstation already, so it took me less than five minutes to compile and load a simple LED blinker on the 3Pi. Another minute and I'd installed the Line follower.

Making tracks

I used the approach suggested on the website and laid out a simple track using A2 paper and black electrical tape. The robot did a good job of following the line, but the demo soon palls and I wondered if the Maze solver program might have more lasting appeal.

I quickly laid out a simple maze design and installed the maze example from  the Pololu library. As luck had it, my maze was close to perfect; the robot explored every path before it found the goal. Once it's mapped the maze, it shows the shorthand for the solution on its LCD display and then navigates as directly as possible from start to finish.

The 3pi shows off its brainpower

If I have time I'll make some more mazes, and maybe do a larger one A1 size.

Plenty more to do

First, though, I have other demos to prepare. I had to install a fresh rasbpian image on C3Pi, so I need to set up the wifi and install the relevant Python software on the on-board Raspberry Pi. At least the Arduino pro mini doesn't need reprogramming. I must also remember to install a fresh set of batteries in C3Pi, which is not a trivial task!

Once that's done I will need to mend the second 3Pi and prepare it. I have come up with a very different demo, but I will have to code it from scratch, We'll see if I can get it done in time!

Friday, 23 May 2014

Putting the 'See' in C3Pi

At last C3Pi can see, thanks to the wonderful Raspberry Pi camera module.

You're squinting, C3Pi

His first attempt at photography isn't going to win any prizes for composition, but no doubt he will get better with practice.

I need to add a robust holder for the camera, but it should mean that we can take some photos at the Kids Adore Ditch event on Thursday. If we're really lucky we may even have streaming video.

C3pi (a.k.a. Trackbot) is back in town

C3pi, a veteran robot of my own design, will be joining the Pololu 3pi and me at Kids Adore Ditch this coming Thursday.

C3pi a.k.a. Trackbot

Trackbot started out as an Arduino-controlled robot. I added a Raspberry Pi, and he became C3Pi.

An additional WiFi dongle on the Pi allows me to control him remotely.

C3Pi has made several public appearances over the years, and I hope he'll perform well on Thursday. He has one weakness; his batteries are buried in his tummy, so when they run out he needs major surgery. One day I'll come up with a better solution, but probably not this week!

The Pololu 3pi gets ready for the Ditch

I'm going along to Kids Adore Ditch next Thursday, and this 3pi robot from Pololu is going with me.

Pololu 3Pi

The 3pi comes ready-built, it's capable, and it's widely available. Its one drawback is that it's relatively expensive, and you need a programmer if you want to run anything other than the fairly limited demo program. I'll take a couple of less expensive alternatives along as well.

Wednesday, 21 May 2014

lobstar and 7 segment I2C display - part 1

One of the last projects that Quick2Wire worked on before the company ceased trading was a display based on the nxp SAA1064 controller and a 7-segment display. There's still a stock of the Quick2Wire boards over at SK Pang, but Quick2Wire never finished the 7-segment design.

I'm thinking of restarting that project and I spent a little time this afternoon looking at what would be involved.

It seems that the DIP version of the controller is no longer manufactured, and the only display I could find in my parts box is also no longer made. I don't think either of those issues is insurmountable; there seem to be a lot of the DIP chips for sale on eBay, and I guessed that the display pinout was probably the same as you find in more up-to-date displays from the same manufacturer.

I was fairly sure that the display was a common-anode type, which the controller requires; I quickly lashed up a test circuit using a lobstar and checked the connections.

lobstar and 7 segment display
Success! The display has the same pinout as the Agilent HDSP-521G, which is a current product.

I'll start by breadboarding a lobstar-controlled version and then look at what's involved in controlling it from the Raspberry Pi.

Tuesday, 20 May 2014

The lobstar - An OSH, low-cost, breadboard-friendly Arduino-compatible clone

There's a revolution underway in Computer Science education. The Raspberry Pi has generated a huge amount of energy and enthusiasm, but there's also a lot of interesting activity around the Arduino.

One great Arduino resource is the Shrimp, a low-cost compatible design aimed at educators and hobbyists with limited budgets.

Landing the Shrimp

You can find out more on the Shrimping It blog. It describes
'the Shrimp – a substitute for the Arduino Uno, which can be constructed for about a tenth of the price of the official board, shown here in stripboard and breadboard versions.'
Note the absence of a PCB version! That's deliberate: the idea is that you will lean more, and feel more of a sense of ownership, if you have constructed the shrimp from scratch.

That makes sense but I can see two situations where shrimp-catchers might prefer a PCB to work with.

  1. Some beginners starting out on their own might feel more confident building a PCB; an early win is important for building confidence.
  2. Old hands often want to put something Arduino-compatible at the heart of a prototype, and want a small and inexpensive system-on-a-board, ideally in a DIP format.

Enter the lobstar

The lobstar borrows unashamedly from the Shrimp's minimalist design; it has everything I want for prototyping, but no more. It has a header for In-system programming and a resonator to make the clock accurate enough for Serial comms, I2C and SPI. It plugs into a breadboard, and it has a reset button. And thanks to AVRISP, it has a bootloader.

No LEDs, no power regulator, no USB interface. I don't need them for what I want to do.

Fritzing it

The shrimp has a breadboard version so it was easy to capture and modify the design in Fritzing. I decided to use it as a pilot project while learning how to use Fritzing to generate a PCB design.

Of course, as always happens, I made a couple of mistakes.

Version 0.1 swapped ground and the 5v power on the FTDI header. Amazingly, nothing was damaged, and I was able to program it using a kludgy but effective stripboard.
lobstar v 0.2
Version 0.2 (the one I got made by ragworm) was a significant redesign and I managed to introduce an extra trace which I had to cut through with a craft knife.

Version 0.2.1 is currently on its way back from oshpark. (I used the lobstar as a way of trying out several different PCB fab shops, and will post about my experiences when the next lot of boards arrive.) There's a picture of version 0.2 in yesterday's post.

Even though v 0.2.1 is still untested I have open-sourced the design. You can follow its evolution on Github. oshpark generated a preview to show what the board will look like, shown below.
oshpark preview
The earlier versions are working well (after suitable surgery) and do just what I hoped.


If you want to learn or teach about Arduino on a budget, a shrimping workshop sounds like a great idea. If  you want a source of easy-to-make, easy-to-use, inexpensive Arduino-compatible clones, you can use Fritzing to create your own custom PCB. You could even make use of the lobstar design!    

Monday, 19 May 2014

Thank you, ragworm!

I've just had a nice surprise.

Last November I ordered and received a PCB from ragworm, and I've only just got around to assembling and testing it.

lobstar v 0.2
I'm very happy with the board. It was my first PCB design using Fritzing, and in this version I introduced a spurious PCB trace. It's turned out to be easy to fix. (I used the high-tech solution of cutting the relevant track with a craft knife.)

The area around the capacitor looks a bit messy because I soldered in a 100pF capacitor instead of a 100nF capacitor and had to remove it - it's not a manufacturing problem.

The project is a breadboard-friendly Arduino clone inspired by the low-cost, minimalist shrimp. I need a bunch of them - that's why I needed to install burn boot-loaders - and I have a batch of three boards with a corrected design on its way here from OSH PARK in the US. I will need even more of the boards, though, and this morning I spotted an old email from ragworm which has solved my problem.

I originally ordered a single board from ragworm, but they made four, just in case! The three spares have been waiting patiently on the shelf, and the email (sent last December) offered them to me at a very attractive price. Today I asked if the offer was still open, and got confirmation within minutes of my email. I've snapped up the offer, and three more boards are on their way to me.

Saturday, 17 May 2014

Burning an Arduino Bootloader with the phenoptix AVR ISP


In yesterday's post about the phenoptix AVR ISP I said I'd share the details of how I used it to install a boot-loader on a blank chip. I was preparing the chip for use in an Arduino clone of my own design. Watch this space for details of that project! For now I'll talk you though on the boot-loader instalation.

You will need
  • a computer running the Arduino IDE version 1.0.5
  • an Arduino board - in my case, an Arduino UNO SMD edition
  • a blank chip - the ATMega386p that I mentioned yesterday
  • the phenopix AVR ISP programmer, as described yesterday
  • the special phenoptix ISP sketch from Github (details below)
Arduino UNO, AVR ISP and ATMega328p

What you need to do

The process has four main stages:
  1. Set up the hardware.
  2. Prepare the Arduino.
  3. Burn (install) the boot-loader.
  4. Test the chip.

Set up the hardware

  1. Carefully insert the chip you want to prepare into the appropriate socked of the phenoptix AVR ISP shield. You may need to straighten the legs of the IC chip before you can insert it.
  2. Carefully plug the pins of the shield into the header sockets of the Arduino.
  3. Connect the Arduino to your computer using a USB cable. You should see the LED on the Arduino light up, and you'll also see some flashing on the LEDs of the shield

Prepare the Arduino

You'll need to upload a special sketch to the Arduino. Don't use the standard ISP sketch from the Arduino examples menu. You must use a sketch that's specific to the phenoptix shield. You can get that sketch from github.

  1. Click on this link.
  2. click on the button marked Raw
  3. Copy the text of the sketch to the clipboard.
  4. Create a new sketch in the Arduino IDE
  5. Paste the text
  6. Save the sketch. I called mine phenopitxISP.
  7. Upload the sketch to the Arduino.

Burn the Bootloader

Up to this point you've used the Arduino IDE in the usual way; you shouldn't need to change the port or board settings from those that you normally use.

For the next stage, however, the Arduino IDE needs to know about the chip you want to prepare, not about the Arduino that you're using as an ISP.

If you're preparing an ATMega328p, as recommended, you will need to change the board setting on the IDE to Arduino Duemilanove w/ ATmega328.

(For an ATMega8, which I also wanted to use, you'd select Arduino NG or earlier w/ ATMega8).


  1. In the IDE, from Tools/Board, select the board type that corresponds to the target chip.
  2. From Tools click on Burn Bootloader.
You should see a Burning Bootloader message appear on the status line at the bottom of the IDE. The lights on the shield will flash for quite some while - a minute or so. Once they stop you should see a message on the IDE status line indicating that the Bootloader has been installed.

Now you're nearly done, with one more phase left.

Testing your chip's bootloader

For this stage you will need to try the chip out in the clone where you plan to use it.

  1. Carefully remove the chip from the panoptix shield.
  2. Insert it into your clone board.
  3. Connect the clone board to the computer running the Arduino IDE. You may need to change the port setting on the IDE if you are using a different USB cable from the one you used with your Arduino.
  4. Using the IDE, install a test sketch on your clone. I edit the standard blink sketch to use delays set to 100 ms. The LED blinks rapidly and I can easily see that I've installed something other than the default version of the sketch on the chip.
Testing the chip in a clone board


The phenoptix board and software have proved easy to use, and I'm very pleased with the result. I'm now well on the way to preparing the set of Arduino clones I needed.

Friday, 16 May 2014

phenoptix AVR ISP Shield - First impressions

Yesterday I assembled and tested the phenoptix AVR ISP Shield. Here's what I found out while trying it out.

First, a bit of background. I needed to build a batch of low-cost Arduino clones. In the past I've bought basic DIY kits from oomlout which include pre-programmed chips, but this time I wanted to keep the cost as low as possible. That meant I needed to buy chips without a boot-loader (as mentioned in yesterday's post) and then install the boot-loader myself, using an existing Arduino as an In-System Programmer (ISP).

I've done that before using a breadboard, some jumper wires and a handful of extra components.  It's a fiddly process and easy to get wrong. This time I decided to get an ISP shield designed for the purpose. It added a little to the cost, but I though it would save time and money in the future and it was fun building it :)

There are lots of Arduino ISP shields on the market, including models from Adafruit and SparkFun. I decided to go with the version from phenoptix, for several reasons.
  • Phenoptix is a UK company, and I was keen to try out their service
  • The shield looked easy to build
  • It can be used on a couple of smaller AVR chips (the ATTiny2313 and the ATTiny85) both of which I want to use in other projects.

The kit

I ordered the kit on Wednesday and it arrived the next day.

The kit arrives
The kit has no printed instructions, but the label has a URL which takes you to the product page. That in turn has a link to an Instructable which describes the assembly process.

The Instructable is pretty good, though I hit a couple of minor issues to do with the Arduino headers.

The UNO is different

Issue number one is that modern Arduinos (like the UNO that I was using) have more header sockets that the older models. If you're unfamiliar with this change you might worry about the apparent mismatch between the number of holes for header pins in the shield and the number of sockets on the Arduino. It's actually not a problem so long as you break the supplied header strip to fit the shield, not the Arduino.

Once you've done that you can follow the advice in the Instructable and use the Arduino to support the header pins while you solder them into the shield. I disagree with the next bit of advice. It suggests that you solder just one pin on each header while using the Arduino as a jig, and then remove the shield to solder the remaining pins. That's the second issue.

Don't lose your pins!

The header pins fit very snugly into the Arduino sockets. If you've only soldered in one pin on each header, there's a risk that the remaining pins will stay stuck in the Arduino when you pull the shield out, leaving you with holes in the headers and pins in the Arduino. That started to happen to me. 

Fortunately I'd encountered the problem before, and stopped pulling out the shield before it lost any pins. I pushed it back and soldered each pin to the shield before removal, and everything was fine.

The assembled kit in use
Now I had an assembled shield and was keen to try it out. The remainder of the Instructable contains a script to use for the burning of the boot-loader, but there were no instructions about how to configure the Arduino IDE to do the actual boot-loader installation. I'd done this many times before, and found it easy to recall the details, but a newcomer might be very frustrated.

The author promised to explain what to do in a less product oriented Instructable, but I couldn't track it down. I'll ask about that; if it's still a work in progress I'll post details of what I did as a stop-gap!

The end result

I've used it to burn a boot-loader into an ATMega328p ( the chip that most clones use) and a venerable ATMega8. I have several Mega8s lying idle, and it will be great to put them to work at last!

The problems I had to work around were minor issues, and easy to fix. I'm very happy with the product, and want to explore the phenoptix range. I'm working on a justification for getting one of their robot arms, which look a lot of fun!

Thursday, 15 May 2014

Beating the UK ATMega328p shortage

There seems to be a dearth of Atmel AVR™ ATMega328 chips in the UK at the moment. with Farnell and RS Components both awaiting deliveries. I needed ten urgently, and found them at Rapid Electronics.

These are unprogrammed chips without a bootloader. If you want to use them in Arduino™ clones you will need to burn in a bootloader yourself.

I've been doing just that, using phenoptix' AVRISP board with an Adruino UNO.

 I'll blog about that tomorrow.