The minimum build PianoForte - just 20 components |
PianoForte is an experiment in hardware. It is the combination of several ideas, using the latest wireless modules and hardware, in order to create a platform for developing new, exciting physical computing devices.
This post introduces the hardware and some of the design decisions needed to turn a concept into a working design.
Here are some key points about the PianoForte design:
1. It uses a popular ARM microcontroller, capable of about 20 times the speed of an Arduino Uno.
2. It's designed to be battery powered - for greater portability and flexibility
3. It offers various wireless modules including WiFi, BLE and 433MHz low power FSK
4. More GPIO pins, more memory, faster clock, better peripherals and huge possibilities.
5. Builds on the vast Arduino ecosystem and community using the Arduino_STM32 extension to Arduino IDE
6. Also highly compatible with Gordon Williams' Espruino - a javascript interpreter for the STM32Fxxx series of microcontrollers http://www.espruino.com/
That's why I'm excited about PianoForte.
PianoForte offers a stepping stone from Arduino into the rapidly expanding world of 32 bit ARM Cortex M3 and M4 microcontrollers. It uses the Arduino_STM32 extension to the Arduino IDE - allowing you to write Arduino code for any of the STM32103xx range of microcontrollers.
These low cost STM32F103 ARM Cortex M3 micros have greater speed and a richer mix of peripherals than the Atmel AVR - which is now showing its age. The ARM chips offer:
1. 32bit processor
2. 4.5 times the clock frequency
3. 3 USART, 2 SPI and 2 I2C
4. On chip USB
5. Real Time Clock
6. 12 bit ADCs
7. 40 GPIO lines compare to 20 for Arduino Uno.
I have however pitched it firmly in familiar Arduino territory. This is still a microcontroller on which you can do "bare metal" programming and have direct access to the rich mix of peripherals offered by a modern ARM chip. It's definitely not a Raspberry Pi equivalent or replacement - more of a souped-up Arduino, which uses the same Arduino IDE, language, libraries and shields.
In the last few weeks, I have designed and developed a prototype pcb as a means to test out some of the hardware features, in particular the wireless modules. It's getting increasingly tricky to prototype with surface mount modules - so the solution was to bite the bullet and have a small board made that can accommodate the various options.
This first prototype is not perfect, I never expected it to be. It has one or two easily corrected bugs, but will allow me to hone my ideas, and produce a board that is commercially manufacturable in volume. Over the next few weeks I expect to rationalise and simplify the design, to produce something that can be sold for about $25 to $30.
Lower cost ARM boards are available, but they lack the wireless options, the microSD, the Lithium Ion battery charger and the flexible boost converter. It is the mix of these additional components which makes the board a lot more useful when it comes to exploring new ideas.
About Arduino_STM32
This is an extension to the usual Arduino IDE which makes it possible to write Arduino-like code which is then compiled for the STM32F103xx range of microcontrollers.
This simple extension opens out a wide range of new powerful 32bit ARM processors to the Arduino community.
Arduino_STM32 owes its heritage to the work done by Leaf Labs with their Maple and Maple-Mini dev boards. It has been further developed by a small team of unpaid enthusiasts - including Roger Clark and Bob Cousins.
Arduino_STM32 may be downloaded from Roger Clark's Github repository.
Update 23-5-2015
A couple of days ago, by happenstance, I rediscovered Espruino - a javascript interpreter for the STM32F range of microcontrollers. I had seen the Espruino kickstarter back in September 2013 just when I was starting out my voyage of discovery with ARM processors. For some reason, I forgot all about it, until I was investigating Node.js prior to attending a NodeRED workshop.
The good news is that Gordon Williams javascript interpreter is very compatible with the Piano Forte board - and a few lines of js will have you blinking it's LED.
More about Espruino running on Piano Forte in a later post.
So, What makes a good Dev Board?
The Arduino was good in it's day. A simple 28 pin processor, with clock oscillator, reset circuit, power supply and programming interface connected. All of the 20 GPIO pins were broken out to SIL sockets - reasonably well arranged by function into Analogue and Digital pins.
This was a good clear arrangement, and the hardware abstraction layer, contained in the boards.txt file allowed the GPIO to be sensibly mapped to the physical pin arrangement.
That worked well for a 28pin IC, and the technique can easily be extended to ensure a clear programming model for a 64 pin IC.
Converting a fairly complex 64 pin IC into a much simplified programmer's model is a major part of producing a good dev-board. Here's how I approached this.
A Minumum Setup
Every microcontroller needs a minimum setup in order to receive updated code and execute it. The ARM series of microcontrollers are provided with an in-built bootloader, which allows code to be programmed over a simple serial connection - using a FTDI or similar USB to serial adaptor.
The microcontroller needs the following support circuitry:
1. Power Supply. 3.3V applied to all of the five Vss pins, and all of the Vdd pins connected to 0V
2. Clock Oscillator - an 8MHz clock connected to the clock pins with 22pF loading capacitors
3. Serial USART - the Tx and Rx pins from the USB- Serial cable connected to PA9 and PA10
4. Reset Switch - connected to NRST pin with 10K pullup and 100nF reset capacitor.
5. Boot Switch - The Boot0 line is normally pulled down with a 10K resistor - this switch pulls in up to VDD
6. On the STM32F103 range of microcontrollers Boot1, (PB2) should be pulled down with a 10 K resistor.
Once these initial pin conditions are met - we have a minimal microcontroller system that can be programmed with a low cost USB-Serial adaptor cable.
The bootloader requires that Boot0 is high, when the mcu comes out of reset. This is one by pressing both the Boot switch and the Reset button, and ensuring that the Reset button is released before the Boot switch. This puts the board into Bootload mode - using USART 1 on PA9 and PA10 to communicate with the PC.
For completeness, I have added an LED to PC13 through a 470 ohm resistor, and a miniature speaker to PA5 via an NPN driver transistor. This gives visual and audible feedback that things are working.
PianoForte I/O Scheme
There's are 49 usable GPIO pins on the 64 pin STM32F103 package. We need to create some sort of sensible programmer's model from all of these pins.
Some of the GPIO pins on the STM32Fxxx processor are best reserved for special use - here's my intention:
PA9 USART1 TX - used for bootloading
PA10 USART1 RX - used for bootloading
PA11 USB DM - this is the USB D- signal
PA12 USB DP - this is the USB D+ signal
PA13 SWDIO - STlink programming/debug interface
PA13 SWCLK - STlink programming/debug interface
PB2 BOOT1 - tie this low via 10K pulldown for reliable bootloader operation
PC13 User LED A red LED in series with a 470 ohm resistor
PC14 32.768kHz clock
PC15 32.768kHz clock
So already, 10 of the GPIO pins have been assigned to a dedicated function.
Now lets look at the pins that have 12 bit ADC capability
On most of the STM32Fxxx range of microcontrollers, we find ADC inputs on PA0-PA7, PB0, PB1 and PC0-PC5 - so we can have 16 analogue input pins.
Once the analogue pins with ADC and DAC functionality have been separated out, that leaves predominantly the digital I/O pins. These have 5V tolerance, and to reinforce this capability, they should be placed away from the analogue pins that are only 3V3 tolerant.
Digital Pins
PA15
PB3 - PB15
PC6 - PC12
That's a further 21 pins that can be dedicated to GPIO/digital signal connection.
So if we tie up at least 4 or 5 of these for a SPI bus - to communicate with a microSD card we have reduced the whole I/O scenario into a easy to remember arrangement of 16 analogues and 16 digitals.
A slightly daunting 64 pin microcontroller, simplified to 16 analogue inputs, 16 digitals and a handful of dedicated lines.
On the STM32F103 there are a few other signals in addition to the 48 regular PA0-PA15, PB0-PB15 and PCO-PC15 GPIO ports. We need to account for these signals and use them appropriately.
PD0 - Osc In Connect an 8MHz crystal
PD1 - Osc Out Connect an 8MHz crystal
PD2 - an unused GPIO line perhaps another User LED or a chip select for a SPI peripheral.
NRST - the Reset line - active low
BOOT0 - pull high prior to reset to enter the serial bootloader state.
In addition to the signal pins, we have 5 pairs of power pins, which need to be connected to Vcc and 0V (VDD and VSS).
The VDD and VSS pins should be stitched through to the low impedance power planes and decoupled/filtered with a closely coupled pair of capacitors (10uF and 100nF) and a 1Kohm 300mA ferrite bead.
There is also the Vbat pin - for battery backup. This needs to be connected to a supercapacitor.
A minimalist board could be made to support this about 3.0" long x 0.9" wide.
Additional Features Added to the PianoForte Design.
PianoForte is much more than the minimum feature set.
1. Provision for ESP8266 WiFi, HM-11 BLE and RFM69CW low power 433MHz wireless
2. LiPo battery and charger interface
3. Boost converter for powreing down to 0.6V
4. microSD connector
5. As a Pi-HAT can be plugged into a Raspberry Pi as an I/O coprocessor
No comments:
Post a Comment