Archive for the ‘Arduino’ Category

New Arduinos

September 25, 2011

The Arduino team announced some new Arduino’s:

The “Arduino Leonardo” is simpler, and should be significantly cheaper than an Arduino because it uses an ATmega with on-board USB. This looks pretty much like a “Teensy” from PJRC but with an Arduino UNO board layout.

The “Arduino Due” uses an ARM Cortex-M3 processor, in this case an Atmel SAM3U4. Unfortunately, that chip is quite big, 100-pin or 144 pin, so cost might be an issue. Atmel might give them good discounts,. We will see. It is forecast to be available by end of year.

From the brief spec, I think it is a 144-pin part, the SAM3U4E. That gives lots of Input and Output (I/O) pins. I am very interested in small robots, so that is quite big for a micromouse.

Compared to the ARM Cortex-M3 I am working with already, the ST Micro STM32F103, the exciting new feature of the Atmel SAM3U is high-speed USB (480Mbits) on-board, and it runs at 96MHz.

In other STM32F comparisons, I think the STM32F is slightly better for my areas of interest, though I would have to use a 144-pin STM32F part to get the full external memory interface.

The SAM3U does not have any Digital to Analogue Converters (DACs), whereas the comparable STM32F103xC (high density) part has two. Comparable STM32F has three 12-bit Analogue to Digital Converters (ADCs) which is slightly better than the SAM3U4 two ADCs. There is an interface to good quality audio chips called I2S. SAM3U4 has one I2S interface, while STM32F103 has two. What does this all mean? If you want to build audio projects, the STM32F might be a better starting point.

It is extremy useful for robots to keep track of their own position by measuring wheel movement (odometery). The technique often used is the same as older ‘ball’ mice. Internally a ball mouse has two orthogonal small wheels which rotate when the ball rotates. The two orthogonal wheels have slots. Light shines though the slots, and each time the light beam is broken, movement is detected. By using two beams and two sensors on each wheel, it can tell which direction the ball is moving. This technology is a quadrature encoder.

Quadrature decoders are very useful to track and time the quadrature encoder. STM32F103 timers can each implement a quadrature decoder, and hence some parts can provide upto 6. I had thought I’d misunderstood the SAM3U4 datasheet, but Atmel have confirmed it only has one quadrature decoder. This is not an issue, unless you want to build robots which ‘know’ where they are.

I am very pleased that the Arduino team are working on ARM Cortex-M3. I think this will encourage a lot more people to use the 32-bit ARM platform. Coretx-M3 is capable of so much more than the 8-bit ATmega, that I expect a significant flurry of new projects next year when the Arduino Due is fully developed.

Meanwhile, I’ll keep working on STM32F, and watch out for results from the Arduino Due .

Arduino in Schools at DD&T Conference

September 20, 2011

I had the great pleasure of leading two Arduino workshops for the DD&T Conference, on 12 July at Sheffield Hallam University.

I lead two sessions where I spoke about the background of Arduino, and the importance of Open Source. Then everyone got their “hands dirty” wiring up simple electronics and programming the Arduino. The attendees were D&T teachers, D&T support centre consultants and technicians.

Traditionally, schools use some version of the PIC microcontroller, but, I am told, schools teachers are being asked about Arduino. This is an intriguing development. It is good that there are folks out there encouraging education to get involved with Arduino, which has a very different image to the PIC-based systems.

As well as traditional breadboard-based electronics, we also tried Paul Gardiners ‘Explorer” modules. I have designed a simple Arduino shield which plugs into the Arduino, and enabled people to very quickly construct electronic systems using Paul’s electronics modules. Paul has developed almost 50 modules, so there is a lot of scope, and they can be combined to explore and develop an idea quite quickly.

The effect is transformative. Using Paul’s modules, the activity uses most of the time for programming and debugging the code. When I use breadboard-based electronics, I usually find a lot of the time is spent debugging the elctronics.

The sessions were welcomed, and worked quite well, though they were too short to cover as much ground as I would like. We have a solution to this though, because I am doing another workshop for teachers at the weekend.

Tutorials on USB, SPI, I2C, CAN, LIN, etc.

April 21, 2011

Thanks to the Arduino, and others including Maple, lots of new users, beyond traditional developers and engineers, are using microcontrollers. Microcontrollers are mind-boggling pieces of equipment, genuinely worthy of the moniker ‘only limited by your imagination’. Many users create amazing projects using the excellent libraries and existing electronics. Some need to go further. They want to understand how to make the hardware do even more and different things.

I have always been the type of person who likes to understand how things work. I like to read manuals. Even as a child I read the manuals for my brother’s HiFi so I knew how to do make it do pretty much anything possible. I like looking at low-level code, and digesting Microcontroller manufacturers manuals. I like reading technical stuff, especially over a balmy Holiday Weekend.

I sometimes work with folks with technical backgrounds in software not hardware or low-level embedded systems who want to do more. They have all the knowledge and skills to program the hardware, but the hardware manuals are too hard a place to start. It is surprisingly rare to find good introductory material for low-level technology which is both approachable and also detailed enough to enable non-specialists to go further.

I was pleased to stumble into a set of resources for embedded systems at “EE Herald”

It includes a section of “On line Courses” on common embedded communication interface ‘standards’. The tutorials include USB, I2C, SPI, CAN, LIN, Serial, and RS232. Those standards are used to communicate with individual chips such as accelerometer sensors, other microcontrollers, host PCs, SD memory, Wii controllers, controllers in manufacturing plant, and parts of cars. There are also section on ‘IEEE 802’ local area and wide area networking standards.

The sections I’ve skimmed seem to have good coverage and a decent level of details. The tutorials include some helpful diagrams, which helps folks like me a lot, and are written at useful level of technical detail without going down to the manufacturer specific hardware.

For example USB is covered in

I have only skimmed it, but it reads as good coverage of USB 2.0 from history to physical hardware, electrical levels, signalling, end-points and protocol including packet formats. It isn’t as detailed as the USB specifications, but I don’t think many people would want to start their! I like to get a good overview of the way a system works before digging into the detail, and I like to have a broad technical understanding to stitch detail into.

The USB article at EE Herald isn’t perfect. It includes a very brief overview of USB On-The-Go (OTG), but not enough to feel I could properly understand the STM32F USB OTG hardware. USB On-The-Go includes the more complex host-side of USB, so it would be impressive if they had got that too. I feel that is a minor and common weakness.

It is a readable alternative to
USB in a NutShell at
USB made Simple at

These won’t replace the manufacturers manuals (e.g. ST Micros STM32F RM0008), but they cover generic technical detail, and look pretty good. I’m hoping they may be enough overview for anyone who wants to read low-level code or hardware specific manuals like STM32F RM0008 or the Atmel ATmega 48/88/168/328 manual.

I briefly looked at some other articles in the EE Herald design guides, and they are not all good quality. I felt disappointed by the ‘MEMS based motion sensing design’. It had almost no useful detail; I thought it was weak even as marketing ‘puff’. I wouldn’t feel ready to tackle a manufacturers MEMS datasheet after reading that.

EE Herald have some links to other sites, including this useful looking article on 1-Wire Interfaces from Maxim which has a lovely list of 1-Wire Application Note links at the end. Ideal Holiday Weekend reading 🙂

OROne – Cortex-M3 robot controller (STM32F103)

April 6, 2011

I was lucky enough to get some financial support to design and prototype a robot controller. I got outstanding help and advice from Dr Tony Wilcox, Chris Evans and Roger Thomas of Birmingham City University. Chris did a lot of the PCB routing, and much of the board construction. Tony generously shared his wide experience of developing robot controllers, and embedded and electronic products. Roger was a font of knowledge on PCB design and manufacture, and electronics. Thanks also to Pete Harrison for his always helpful comments and suggestions.

I learned a huge amount from them. This is the result.

OROne STM32F Robot Controller

OROne STM32F103 Robot Controller - without 0.1" headers

It is based around an ST Micro STM32F103CB Cortex-M3 microcontroller. This version has 128K Flash, 20K RAM, USB, CAN, 3xUSART (serial),15xPWM, 16xADC, 2xI2C, 2xSPI, and JTAG in a 64-pin package, all ticking along at 72MHz.

The board adds dual DC-motor drive, seven LEDs, two buttons, two servo sockets, as well as sockets for six analogue input, two quadrature encoders, and headers for JTAG and Serial. The two 30-pin 0.1″ headers (missing from the photo) gives access to all of the microcontroller signals and power on a veroboard friendly grid. The microcontroller can be powered over USB, or via an external power supply or batteries. The board also has independent on-board voltage regulation for the servo’s and motor drive chip.

Like an Arduino, it is ‘self-programming’ over USB once the bootloader has been installed. I installed the bootloader over the microcontrollers on-board serial interface using an ordinary FTDI USB to serial cable. So it doesn’t need JTAG or an in-circuit programmer, ever.

It is based on the Maple from LeafLabs. LeafLabs have built an IDE using the same Processing-derived IDE as Arduino. It sits on top of GNU GCC. They have also implemented most of the Arduino base-libraries, so Arduino programs may move across to Maple with minimal or sometimes no changes. To top it all, they have developed a bootloader which enables the STM32F103 to program itself over USB. The whole software environment, libraries and bootloader are Open Source, and runs on Windows, Linux and Mac OS X.

Maple is a magnificent piece of work. My board ‘came up’ in a couple of hours (after we found and fixed a couple of my PCB errors).

Chris did much of the construction; he has a very steady hand. We used the ‘Mini-oven SMD technique’. Paul Gardiner of Finham Park school in Coventry did a workshop a while ago, and this is the biggest board I’ve made using it.

I’ll describe some of our experiences, and where-to-next over my follow-up blogs.

Dev8D 2010

February 23, 2010

I am very excited to be running five Arduino Workshops at Dev8D 2010 in London this week.

I’ll be running three hands-on Beginner’s Workshops on Thursday, Friday and Saturday. The electronics will not require a lot of knowledge, it’ll assume that folks remember there are two connections on a battery, and they are different. I’ll be using my favoured, ultra low-cost, Maplin breadboards, so we won’t be soldering. We’ll provide Arduino’s (Feeduino’s), electronic components and tools.

I’ve run these before, and I believe we can do most of the core Arduino language, and build some electronics, in a few hours. We’ll write programs for digital input and output, analogue input and output (PWM), and use the Arduino millisecond and microsecond clock. The electronics will be LEDs, squeaky speaker, resistors, potentiometers, light sensors, and lots of wire :-).

I’ll be running a couple of ‘Advanced Arduino Workshops’ on Thursday and Friday afternoon. We’ll use a small driver chip to power a motor (or 100+ LEDs), use ‘time division multiplexing’ to drive many more LEDs than an Arduino has pins (without using any external electronics), and recognising Infra Red Remote Control signals. These are all based on things people ask me about, so I hope they are useful. We’ll provide Arduino’s (Feeduino’s), electronic components and tools.

If you really want to drive motors in an even fancier way, get hold of an L293D, and we can experiment with that too. If you have something that responds to Infrared Remote Control, bring it and it’s control along, and we can drive it from the Arduino (if the data to generate the Infrared signal is on the web, we don’t need a control. For example, the specification for things like Nikon camera’s are available, and we can work the rest out ourselves).

I’ll be around all day Saturday, so if anyone wants some help, or wants to try any of the ‘Advanced’ projects, please come find me.

A lower-cost, ARM-based Arduino alternative?

December 15, 2009

I stumbled across this NXP press release for the LPC134x which is based on the ARM Cortex-M3. The press release says “The on-chip USB drivers support both the Mass Storage Class (MSC) and Human Interface Device (HID) class. Furthermore, these drivers are incorporated in ROM, saving customers approximately 5-6 K bytes of user code”

Looking at this presentation, (slide 25), the chip shows up under Windows (and they say Linux) as a Flash drive to provide “Drag and Drop Flashing”. It has this capability built in at manufacture! No need for a bootloader, JTAG, or a second chip, like the FTDI USB to serial interface on an Arduino. Put an LPC134x on a board, connect USB, and it should ‘just work’ (TM :-))!

An entire USB-based micro-controller board only needs an LPC1342 or LPC1343, a crystal, voltage regulator, a few passives and PCB. The LPC1342 is available from Farnell for £2.20 and LPC1343 for £2.70 or £3.30. So a board could be smaller than an Arduino-Nano, and lower-cost.

I haven’t read the datasheet in detail, but overall these micro-controllers are more powerful than Arduino’s comparable Atmel ATmega168 or ATmega328, with 16K or 32K of program memory, so this is the best I’ve found to achieve the goal of sub-$10 micro-controller (at one-off prices).

The NXP parts have plenty of advantages over the Atmel parts. The LPC134x runs at 72MHz vs the ATmega’s 16MHz, and both execute instructions in one or two cycles. The LPC134x is a genuine 32-bit processor, whereas the ATmega is an 8-bit processor, so this means some calculations will go much faster on the ARM. I don’t think this is a huge benefit, as my Arduino’s spend most of their time waiting around for something to happen, but it may mean some programs are smaller on the LPC134x.

The LPC134x looks like it has much faster (40x) Analogue to Digital Conversion (ADC), opening up a range of interesting sensors and experiments. The LPC134x has significantly more RAM; LPC1342 has 4KB vs the ATmega168’s 1KB, the LPC1343 had 8KB vs ATmega328’s 2KB.

Both families have a set of timers. Timers are used to implement analogWrite, millis, micros, delay and delayMicroseconds in the Arduino language, but they are also used to control servo motors, stepper motors, modulate Infrared LEDs, and time external events.

The LPC134x have 2 × 32 bit timers, and 2 × 16 bit timers vs the ATmega’s 1 × 16 bit timer, and 2 × 8 bit timers. The LPC134x timers look more flexible than the Atmega168/328. The LPC134x comes in a package with more pins, so there are more PWM pins, and more pins to time external events.

The on-board LPC134x USB is 12Mbit/second vs 0.115Mbit/second for the FTDI chip on an Arduino.

The rest of the comparison between LPC134x shows similar peripherals to the Arduino’s on chip. They both have I2C, SPI and USART. So overall the LPC134x looks as good or better than comparably priced ATmega’s (at one-off prices).

There is a free, Open Source, GNU toolchain for the ARM, which is based on the same compiler as the Arduino IDE uses. So it looks like there are no real obstacles to making a lower-cost, ARM-based Arduino alternative. Of course, there is a plenty of work in porting the Arduino language libraries, like analogRead and analogWrite, but the core functions, which we use the most, would probably be only a few weeks.

I’ve ordered a low-cost NXP development board, LPCXpresso, to do some investigation. This is a similar price to Arduino’s, at £18.34 from Future, or £17.86 from Farnell (plus VAT). This is an encouraging price because the LPCXpresso contains much more technology than an Arduino. The LPCXpresso has a JTAG debugger which supports much more sophisticated debugging than available on an Arduino, and it probably costs as much or more than the LPC1343 itself.

There is a free downloadable LPCXpresso development environment available, so it should be practical to get a better understanding, and discover the disadvantages that datasheets never show for very little further cost. I’ll try to make some time to investigate this in more detail after Christmas.

Please don’t misunderstand. I love my Arduino’s, but the ability to significantly reduce its price, and make better technology available to an even wider audience is compelling.

Ourduino Wiki – Google Code Project Open

October 23, 2009

I’ve started transferring my projects handouts to the Ourduino project at Google code. My aim is to transfer five or maybe six projects by Christmas. Most of the content is documentation, the code is pretty simple.

The projects won’t be finished in a convenient sequence because some of the content is shared, and the construction of some shared parts is quite time consuming. For example re-shooting some of the pictures will be a while because I don’t have a good set up for macro photography (though the discount Canon A470 is much better than my old camera, so I hope the results will be good).

As well as the projects themselves, there are a lot of contextual pages to set up , covering electronic parts, suppliers and bits of theory. One of my collegues at fizzPop, the Birmingham (UK) Hackspace, asked me what value resistor to use for an LED in electronic projects. That’s a great question. I thought I should try to make sure that is answered because folks ask it all the time.

I like answers which give plenty of information so that I can solve more general questions, but I also like direct concrete answers too. The analysis involved a few reasonable assumptions about how much current a LED uses, how much voltage is dropped across a LED, how much power is reasonable for an Arduino pin to supply, and of course Ohm’s Law. The explanation and details are included in the Ourduino page about Resistors, but for those who’d just like an answer, here’s a summary:

  • 330 ohm, or bigger, will be fine for Arduino pins, and Arduino voltages (up to 5 Volts)
  • 680 ohm or bigger will be fine for 9 Volt batteries (which I often use to power an untethered Arduino)
  • 1K ohm or bigger will be fine for 12 Volt supplies (I sometimes use a 12 Volt ‘Wall Wart’ to power my Arduino).
LED torch, using a 330 ohm resistor.

LED torch, using a 330 ohm resistor.

All of these are quite conservative, and the resistor could safely be smaller. One nice feature is these resistor values allow pretty near the same current through the LED, so they should all look about the same brightness next to each other. If you’re making an LED torch, but with a 6 Volt battery, 330 ohm’s will be fine.

I’m off to Manchester Science Week Robot Festival this weekend. I’ll be with Stewart Dunn who’ll be showing the Kre8 construction system. I’ll be demonstrating the Arduino-based SenseBoard and Scratch to folks. I hope to get the opportunity to help young people learn a bit about Arduino’s, programming and electronics. I hope to see you there.

Postscript – I was ill over the weekend (not good timing), and missed the event. Stewart said it was great. Oh well 😦

Freeduino Nano – Just Arrived

October 16, 2009

I have a bunch of full size Arduino and Freeduino boards which I use in workshops, but I am always on the lookout for something more breadboard friendly. I couldn’t resist the Freeduino Nano from

Freeduino Nano - Top

Freeduino Nano - Top

I haven’t used it yet, but it looks very close to ideal for  Ourduino projects where I avoid soldering. All of the 28 pins are on a breadboard-friendly 0.1″ pitch. The rows of pins are 0.6″ apart, so it should fit into a 28-pin DIL socket, making it perfect for veroboard (Warning: I haven’t tried this yet).

It comes with both pin headers (for breadboard) and female headers like the ones fitted to standard Arduino’s. I’ll probably fit the pin headers, or buy female headers with long pins.

It is fitted with an ATmega328, so it has double the flash program memory (32K), RAM (2K) and EEPROM (1K) of the ATmega168 on my older boards.

Freeduino Nano - Bottom

Freeduino Nano - Bottom

Unlike some of the alternatives, it has a voltage regulator on board, so it should be easy to use in battery-powered projects where we often use 9volt batteries. It has the usual 16MHz crystal too, so timing-sensitive projects (like IR remote) should be okay.

It uses an FTDI USB chip like other Arduino’s and Freeduino’s, so there shouldn’t be any driver clashes. A nice touch is they include the USB to mini-USB cable in the box. so it’s good value for money.

This looks like a very good ready-made board, but as a basis for a DIY kit, it isn’t quite my ideal. The changes I’d like are:

  • increase the size of the SMD resistors, LEDs and small capacitors; these parts are a bit too small for school children (and me) to use,
  • use an SMD Crystal and put it on top, and
  • use a slightly smaller voltage regulator, and move it to the top too.

I think we could make a single sided PCB in schools, using wires for jumpers, and solder it in my mini-oven.

I am pretty excited about this. I was about to start designing a PCB, and this turns up! Isn’t the Internet wonderful?

(BTW – the service from nuelectronics was very good, with less than 48 hours from order to delivery. I’d like to add, I have no relationship to nuelectronics.)