Raspberry Pi B+ and Altoids

Raspberry Pi B+ and Altoids tin

Just in case you have not noticed the hype that is all over our corner of the internet, there is a new version of the Raspberry Pi, called the “B+”. I won’t bother going into detail about its features, that’s covered very well by many others including Adafruit, Gordon Henderson, Carrie-Ann Philbin and, of course, the Foundation.

I hope to do a bunch of stuff with this new board in the coming weeks, but for now I shall just answer one burning question:

No, despite its new rounded corners it still does not fit in an Altoids tin. Sigh.

A busy evening with the Ipswich Makerspace

On Thursday I popped along to the latest “Soldering irons and Software” evening with the Ipswich Makerspace group. This was easily the best attended so far with a wide range of projects in various stages of completion. The thing I found most intriguing about the number and variety of people was how quickly we have reached a sort of “critical mass”. Despite little or no pre-planning several people quickly found someone else there who was in a great position to help with their projects.

Makerspace bat detectors

In my own case, I took along the ultrasonic distance sensor which have recently been playing with. Mainly I intended to fiddle with it and try to get a better, more linear and higher resolution, response for its use as a human input device. What actually happened was that someone sat down beside me with a big box of possibly-working bat detectors. If you have read many of the older posts here, you are probably aware that I’m very interested in bat detectors, so we had some fun discussions. Most interesting of all, though, was the way that I was able to set up my ultrasonic rangefinder to repeatedly “ping” so it could work as a passable “bat simulator”. All that was needed was to point one of the detectors at the distance sensor to quickly find out if it was working. Operational detectors gave out a clear clicking in time with the transmission from the distance sensor.

Other people found themselves in similar situations, and the result was a great social atmosphere and some real progress made on several projects.

Now I’m looking forward to the next meeting even more.

Arduino Mini Pro and ultrasonic distance sensor

I’ve not blogged here for a few days. Unfortunately my “real job” got very busy. In the meanwhile I received another package of bits I had ordered from China weeks ago and mostly forgotten about ;)

Among other things in this package were some clone Arduino Mini Pro boards. These little boards have a SMD Atmega 328, crystal, LED, caps and a reset button, on a board which brings out all the inputs and outputs to 0.1″ pitch. Designed for embedding in small projects, these do not have pins or sockets fitted, but the ones I ordered came with pin strips for both sides and an angled header for an end-mounted power and serial connector. I’m still astonished by the prices of these things. I got five of them for £7.77, with free postage. That’s a bit over £1.50 each, no way I could even consider making one for that price.

Arduino Pro mini with ultrasonic ranger

Of course, these boards are not as friendly to use as a “full” Arduino, such as a Uno. They do not have USB, and do not come with a bootloader. Luckily this was not much of a problem. After all the effort I have spent on playing with bare ATmega chips recently, all it took was to connect up my “Xinda” USBTiny programmer to the correct pins (as described here) and I could program the board straight away. I tried out a few blinking LEDs and the like just to prove that it works.

Next, though, I wanted to try out the HC-SR04 Ultrasonic distance sensor boards I got in the same package. These have just four pins on them: the obvious power and ground, and two labelled “Trig” and “Echo”. A bit of looking around found a web page with a wiring diagram and example program. I connected up the sensor, simplified the example program a little, and programmed it on to the Arduino pro micro board.

HC-SR04 Ping distance sensor]
VCC to arduino 5v; GND to arduino GND
Echo to Arduino pin 7; Trig to Arduino pin 8

#define echoPin 7
#define trigPin 8

void setup() {
  Serial.begin (9600);
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);

void loop() {
  // send a pulse on the trigger pin to initiate measurement
  digitalWrite(trigPin, LOW);
  digitalWrite(trigPin, HIGH);
  digitalWrite(trigPin, LOW);

  // the length of the pulse on the echo pin is proportional to the distance
  long duration = pulseIn(echoPin, HIGH);
  long distance = (duration/2) / 29.1;

  if (distance >= 200 || distance <= 0){
    Serial.println("Out of range");
  else {
    Serial.println(" cm");

However, there's a gotcha. The code sends its output over the Arduino serial port, so the user can see the results on a terminal emulator. Unfortunately, because I was connected to the device using an ISP, there was no serial connection. So I could not see whether it was working or not.

The next step, then, was to connect the serial pins to a USB/serial adapter. I found one attached to a Raspberry Pi and connected it to the serial header conveniently placed at the end of the Arduino board. Once the PC had recognized the USB device, I could open up the serial monitor in the Arduino IDE and see the reported distance values. Looked roughly accurate too!

At this point there really seemed to be to many wires, so I took the opportunity to use the USBTiny to write a bootloader to the AVR chip, so next time I can just connect the four wires from the USB/serial connector and take care of all the programming and serial I/O.

So far I am pretty impressed with both these items. the Arduino Pro Mini is so small and (most importantly) so cheap that I can really see myself building it into all sorts of projects. It's especially nice that it does not come with the pins attached, so it can easily be wired direct

Building a “xino” Arduino clone kit

You’d think I would be fed up with Arduinos after all that messing about with one connected to a Raspberry Pi, but while playing with that it occurred to me that some months ago I had bought a nicely cheap Arduino board kit (Xino Basic for Atmel), assembled it, but not managed to program it, so I had tossed it back in the “later” box.

Xino components

Assembled Xino board

My initial attempts at programming used the five-pin power and serial programming connector mounted on the edge of the board. Despite trying several serial interface boards, and as many combinations of cable connections as I could think of, I could still not get it to respond to the Arduino IDE. Since then both my skills and my collection of equipment have improved, so I reckoned it was time to have another go.

Step one was to program a chip using my hand built “Arduino ISP” to check that the board assembly was correct. Blinking LEDs and my two way serial port test program showed that everything was OK in that department. Continually pulling the chip out of the socket was clumsy, though, and, despite my best efforts, was beginning to bend the legs a bit. So step two was to leave the chip in place and program it that way. The Xino board has solder pads for the 2×3 Atmel ICSP header, so it looked like I just needed to solder in some pins. Luckily I have one of the more recent versions of this board (it says (c) 2012 IoT Research), so I can connect both the ICSP and serial connectors at the same time. Apparently on the 2011 version of the board, the two connectors overlapped and could not be fitted at the same time. You can see a picture of one at the Ciseco page for this board.

Xino board being programmed using Xinda "USBTinyISP"

My first attempt at ICSP programming was a failure, but then I noticed the tiny pin numbers and realized that I had got the connector the wrong way round. After that I could program and re-program to my heart’s content.

Now that I have this board working, the more I look at it, the more I like it. It’s cheap and comes with everything you need apart from the MCU, crystal and capacitors, but I have plenty of those now, and I can always run the ATMega chip without a crystal if I want to. I can also leave off most of the other components and connectors if I don’t want them. Even better, the board has a small but useful prototyping area and through-hole pads for all the Arduino pins so it would make a very easy and low cost way to embed an “Arduino” in a project.

I might just order a few more…

Kickstarter and LPLC PIC18 development board

It looks like this is a good time of year for Kickstarter projects to turn up. Not only did I receive my MoPi board yesterday, but today I got three of Mike Hibbett’s LPLC PIC18 development board in the post.

LPLC PIC18 board and PICKIT3

I must admit that I am a complete newbie when it comes to PIC development. I kind of know what a PIC is, but somehow I have managed to avoid ever working with one. When I saw this project on Kickstarter I thought I might as well give it a go. This in turn has raised a bunch of issues, though. Unlike the development boards with which I am familiar (Arduino, Freescale FRDM, Raspberry Pi and so on) there seems to be no easy way in to developing with PIC chips. It seems you need at least a hardware programmer and a specialist IDE to even get started.

The best I have managed so far is to solder on a programmimg header only to find that the connector on the programmer has a different number of pins! A few bumbling questions on twitter to the creator of the board and I think I have an answer as to how to connect the programmer, but now comes the hard bit of making something actually work.

I know that several people at the Ipswich Makerspace have experience with PICs, so if I really get stuck I’m sure I can ask for help, but I’m quite looking forward to the challenge of new discoveries and new skills. Wish me luck!

MoPi has arrived

A pleasant surprise today – I received two packages. One was a bunch of stuff from Cool Components, who are having a summer sale for just a few days, and had tempted me to spend more cash. I’ll work through those bits another time.

MpPi box next to a Raspberry Pi

The smaller, but potentially more interesting package was the MoPi board I had backed on Kickstarter. It came in a cute little box with the flying Raspberry logo, which shows how small the board is.

MoPi box contents

Inside the box was the MoPi board itself, two 9V battery connectors with flying leads, a small instruction sheet and, in my case at least, a personal message from Hamish Cunningham, creator of the MoPi. I have not powered the board up yet, but looking at it the design has certainly progressed from the Kickstarter picture which I used in my previous blog post. In particular, the second bank of boles labelled “GPIO thru” has become some long pins on the single GPIO connector.

The supplied battery leads are intended to connect with some screw terminals which hide under the MoPi board. On the one hand this is clever placement, as it makes use of some otherwise wasted space. On the other hand, though, it does make it tricky to attach or detach power sources with the board in situ.

Problem with the new Raspberry Pi Compute board

I suppose it’s what you get for being an early adopter, but today I received a slightly worrying email from Farnell:

Important Product Information for the Raspberry Pi Compute Module Development Kit

Replacement Display and Camera Adapter Boards

Please be aware that there is a fault with the display and camera adapter boards included as part of the Raspberry Pi Compute Module Development Kit. The adapter boards do not function correctly, and may damage the camera module when connected.

We are working with the product designers to produce a new set of display and camera adapters which will be posted to you free of charge. In the meantime, we recommend that you do not attempt to use the adapters with a camera module.

Please note: These issues are isolated to the display and camera adapter boards only. The Raspberry Pi Compute IO Board and Compute Module are unaffected by this fault, therefore you can continue to use them in the design of your application.

Luckily, I haven’t attempted to connect either of my camera modules to the Compute module development board yet. I guess I should wait for a bit.

First demo of my display screen project coming up

It seems a long time ago, but my plan when I first worked through installing and using node.js on a Raspberry Pi was to put the groundwork in place for a system of multiple information displays, centrally managed and connected over a network. The Raspberry Pi is great choice for this sort of thing, as it is cheap, small, can easily be added to wired or wireless networks, and has built-in HDMI to drive all modern flat-screen displays.

I had hoped to be further ahead with this project, but life got in the way and I suddenly find myself called to demonstrate (informally, at least) my progress on the project. It’s a problem of mine that I get too attracted by the challenges of the low-level nuts and bolts, so I have been having lots of fun building a distributed, self-updating infrastructure allowing any screen (and its attached Pi) to be switched on or off at any time, and still find the right information to display.

One of the hold-ups, however, has been the actual display of the pages. My infrastructure doesn’t care what format of information it is distributing and updating, but for the whole system to work, something needs to display stuff on the physical screen. I had thought about using a browser in “kiosk mode”, and got into some interesting discussions around this at an Ipswich Makerspace meeting There were some suggestions of building something a bit more custom using one of the many Raspberry Pi graphics libraries, but that felt a bit much for a “minimum viable product”.

When faced with an impending demo, though, I have decided to go with Screenly OSE as the display front end, at least for the moment. It’s not as full featured as the commercial version, but it should get me out of a hole for now. It can display images, web pages and videos, either stored locally or from a remote server, and has a simple but pleasant web-based management interface.

So, I’m still beavering away at my display system, but if you are interested in the possibilities of using a Raspberry Pi to control an unattended display screen, you should take a look at Screenly.

Another university visit – Loughborough

Not much of a blog today, as I have spent the whole day travelling. Either driving the 150 miles each way from home to Loughborough University, or walking (and more walking) round what they claim is the largest university campus in Europe. It certainly felt that way!

As well as visiting general facilities (Students’ Union, accommodation, the lovely new library etc.) my daughter and I spent time in the Computer Science and Electronics departments, which was very interesting. Unlike Reading, which we visited last week, Computing and Electronics are kept very separate, Electronics lives with other engineering disciplines, as well as physics and maths, at one end of the campus, while Computer Science is over a km away, almost at the other end. They seem equally far apart organisationally. Despite the overlap of course content (The Computer Systems Engineering course includes software, for example, while the Computer Science course includes AI and robots) neither department seemed at all interested in the other. This is a shame, as otherwise the university seems a lovely place, with a very high student satisfaction score and good academic and career prospects too.

This choosing a university lark is not as simple as it seems :(