Saturday, May 17, 2014

Make Life Easy, Make it Modular

This is a follow on to a post I wrote back in March 2014.  

As integrated circuits get smaller, and more powerful, it becomes increasingly difficult for the hobbyist to utilise them easily. Soldering tiny SMT parts is a challenge for many - so let's try to find a way to make life easier.

Why not make our microcontrollers modular - so you buy what you need that matches your application, and at a price you can afford. Unbelievably you can now buy an Arduino Nano or Pro-Mini from China, cheaper than you can buy the microcontroller IC from a Western supplier.

So if you want to quickly hack stuff together, standardised modules are one way to go.

A standard module footprint across different manufacturers.

This would really open up the competition between the various microcontroller suppliers.  Whether it's PIC, TI or Atmel, they all release a reference design for a standard module, and an accompanying IDE based on a common standard, so that you can easily, and seamlessly swap between devices.

So let's speculate about a series of standardised modules, which can offer varying degrees of performance, choice of microcontroller and yet are available in a compact, breadboard friendly, dual in line (DIL) footprint. For interchangeability, the power pins, reset and uart pins need to fixed, whilst the remainder of the pins can be general purpose I/O, perhaps arranged into a row of analogue function pins on one side, and a row of digital on the other. SPI interfaces should preferably be assigned to 4 consecutive pins for convenience. 

32 bit versus 8 bit. 

32 bit ARM microcontrollers are now virtually the same cost as older 8 bit devices, yet offer a many fold increase in performance, as a result of their 32 bit architecture and faster clock speed. In addition to this, they come with a rich set of peripherals, making them ideal for more demanding applications.

For the hobbyist who may have first gained exposure to microcontrollers via 8 bit products such as the Arduino, the move to 32 bit may appear a little daunting.  However we all have to progress and keep up with the times, so forget 8 bit and 5V logic and get into the world of 32 bit devices running at 3.3V - or less.

The Arduino shield idea was a good move to gain standardisation and traction within the Maker Community, but as we move to more powerful microcontrollers, the original shield pin-out is no longer appropriate or desirable. Perpetuating the non-standard header spacing this long after the original mistake was made is questionable.

At 68x53mm, the original Arduino form factor is starting to look a lot on the large size - particularly when you want to compact it into a small device, such as a robot. Fortunately this has been addressed, and the very compact Pro-Mini and Nano are clearly a step in the right direction.

In an ideal world we ought to be able to buy standard modules, that come in 28, 32 or 40 pin DIP packages, that offer whatever speed and resources we need. A 40 pin DIP is about the maximum convenient size, and with 35 or 36 I/O pins available it's well suited to the pin-out requirements of 48 pin microcontrollers, and offers nearly twice the I/O of the original Arduino in a footprint that is a quarter of the size. A smaller format uses a lot less pcb material, increases the density of the hardware, and allows manufacturers to focus on supplying a high-end microcontroller in a usable package,

In the Arduino world, the Pro-Mini and Nano, go some way to pin compatibility, at least they have the power pins and most of the I/O lines appearing on the same pins.

All it would take is someone to define a popular standard, and everyone else produces compatible hardware.

There will obviously be a requirement for more sophisticated boards, generally of the Raspberry Pi and BeagleBoard format, where a high-end ARM, running an operating system, is combined with external RAM, flash and a host of external peripheral interfaces. For these devices a different solution will emerge, but first let's focus on the easy stuff.

Keep it Modular - So easy to upgrade.

When your 16MHz ATmega328 module can no longer hack it, you search the suppliers for an upgrade. Do you stick with Atmel, or switch to TI, STM or Microchip? You select a module with the right footprint, Flash and RAM resources and clock frequency and do an instant upgrade.  All of your existing code is easily ported to the new module.

I wanted to explore the module concept further, so set about designing my own.

Getting Started.

The plan was to make a standard plugable component, that gives users the power of a 32 bit ARM, but in an easy to use and breadboard friendly module. I reckoned that a 40 pin DIL module would be about the right format for most small projects.

I elected to use the STM32F3xx range of microcontrollers from ST Microelectronics.  They have a great mix of both digital and high speed analogue ADC peripherals and are good value for money.

Initially I bought a Discovery F3 development board, which uses a 100 pin STM32F303 processor and has  compass, accelerometer and gyro devices on the board. It was exceptionally good value at under $11 from Newark.  However, whilst it provided a platform to get me started writing code and getting the framework to support my application built, it was just too big and the double row headers are not the friendliest of connectors to use. I didn't need all of the 80 lines of I/O provided by the 100 pin device, so I settled on the 48 pin part, offering 35 I/O lines, which was somewhat smaller, cheaper and more manageable in terms of pcb layout.

My solution was to create a 51mm x 19mm  double sided pcb, which mounts the STM32F303 microcontroller,  its clock and reset circuits and USB/programming connectors. This small breakout pcb, converts the pins from the 48 pin LQFP to an easier to use 40 pin dual in line module, and provide the minimum of features to get the STM32 to load and run code.  

This approach is not new and has been used in minimalist products such as the Maple Mini, Teensy and the Arduino Pro Mini and Nano, all of which have been around for some time.

I decided to name the board "ARMiGo" in respect to its user friendliness and I designed the ARMiGo to be as open and flexible as possible, so that it can be used as a core for incorporation into other designs.  The essential parts of that core are the microcontroller, the 8MHz crystal, the reset circuit, USB connection and programming header. 

The first of the prototypes arrived this week, and now working running some simple test code.

ARMiGo uses the STM32F303 Cortex M4 ARM device which runs at a maximum of 72MHz.  The pcb will also support the cheaper STM32F103 which is based on the M3 core and does not have such a rich mix of analogue peripherals.

The board is the same size as a standard 40 pin DIL format IC - making it ideal for breadboarding, and small enough to be used as a plug in module in a 40 pin socket, on a larger board.

All 35 I/O lines of the ARM chip are brought out to standard 2.54mm spaced headers.

The 5 pin right angle header on the left accepts the clock and data signals from the "ST-Link" programmer/debugger device.  These are available very cheaply from ebay/taobao/deal xtreme etc.
However it is relatively simple to use the embedded STM bootloader and program it via either the mini-B USB connector on the right or via one of the USART channels.

There is a really rich mix of on-chip peripherals, particularly analogue ADCs, op amps, comparators and programmable gain apmplifiers, which gives these small ARM parts tremendous flexibility - including the following:

Full speed USB interface on chip - no need for FTDI or equivalent

4  Fast (5 Msps)  12bit ADCs, each with up to 4 input channels

4 Programmable gain op-amps and 7 comparators

2  12 bit DACs


3   SPI

2   I2C

RTC with 32768 Hz oscillator and dedicated output pin for "alarm"

10 timer channels,  2 basic,  6 general purpose and 2 advanced:5  General purpose  16 bit timer channels with up to 4 outputs for PWM generation, timing, counting etc.

1 general purpose 32 bit counter/timer - for optical encoder reading etc

2 advanced 16 bit timers for complimentary PWM generation etc.

In addition, the analogue section of the IC contains programmable gain op-amps and comparators which feed the ADC channels, and can be used to replace external analogue circuitry.

This small 48 pin packaged part contains 128KB of Flash and 40KB of SRAM - of which 8K can be battery backed up when the rest of the IC is powered down.

In the attached picture, most of the lower row of pins is the analogue I/O, and the upper row is mostly digital, although there are many options for allocating the peripheral functions to different pins.

With 5MHz 12 bit analogue interfaces it offers greater resolution and much faster sampling speed than Arduino. Additionally the 72MHz clock and 32bit wordsize will all make for a much faster data thoughput.

The combination of 35 I/O lines, on chip USB and a user friendly module, should make ARMiGo the starting point for a wide variety of new projects. Prototypes can now be breadboarded or easily built on stripboard, and the module just plugged straight in.

If you want more details about ARMiGo - please drop a comment.  I expect to release the upated EagleCAD files shortly.


Anonymous said...

Very nice. Looking forward for the EagleCAD files. Keep doing this great job !!!

Anonymous said...

Very nice idea, Great work. Keep it up... Expecting your module here in India soon.

Chris said...

Any plans to sell some of these ?
And to provide an extension to Arduino 1.5 to support it, like teensy3 and panstamp ?