A (Pre)production Unit

With the end of year 2016 some more folks wanted to have a tracker on board and therefore I started to ponder how to build more units in a nicer or even, let’s say – a professional form.

The amount and complexity of code was growing while not only 8kB nor 32KB FLASH was not enough. 1000 bytes of RAM would be still enough but various almost-undetectable problems started to arise – mainly rare unexpected memory leaks followed by a bit more expected watchdog reboots. It was the highest time to leave the Atmel AVR realm and move to some other, unexplored area where code can be debugged better that by prints into serial terminal.

A new design based on mighty STM32 microcontroller was born. In this case it was the STM32F042 chip – possessing 32 still well-solderable legs, 64kB of FLASH, 32kB RAM, clocked up to 48MHz – a “perfect” embedded supercomputer until the moment 64kB of FLASH was not enough again.

Having spent some considerable amount of time on thinking, searching and comparing various ICs the choice was obvious – STM32L152. It is a low power (good!) microcontroller with 128kB of FLASH, 32kB RAM. Its 48 tiny legs with considerably smaller pitch among them (and that is not so good).

During January a perfect schematic was drawn in Kicad with even better layout. Having double-checked the dimensions of everything at hand I ordered PCB manufacturing and waited. As soon as the boards arrived I’ve started ordering all the parts. This day entered history as Mr. Farnell who claimed to have the L151s readily available for shipment gave me a call that those are not available anymore and asked if I wanted to wait for another 6 months. Luckily are the ST comrades quite smart so the missing hole can be (relatively easily) replaced by the ubiquitous F103.

Physical footprint match is one thing. The architecture is other.  While the F042 is Cortex-M0, the F103 is Cortex-M3 which means all the libraries accessing particular registers need to be again rewritten to reflect all the bloody nuances of that or the other architecture. Shit hit the fan.

Moreover, its March and season is so close..


First Prototype

The first prototype was created in April 2016. Initially based on Atmel’s ATMEGA8 which had to be replaced once the program did not fit its 8kB of FLASH by ATMEGA328 (on which, by the way, the famous Arduino is based). It was time of struggle with timers, SPI and I2C registers that maliciously differ in teeny tiny details.

Two trackers in form of wiring hell and radio modules on long stretching legs can be seen in the front. A quarter-wave antenna on the top, an almost half-wave counterbalance became one of the legs. One of the trackers still based on M8, the other already running on M328. A bit chaotic setup, but the end justifies the means, right?

And because everything worked as intended it was the right moment to put it all together and up in the skies!

Powering the box from USB cable was the best initial idea (which actually proved to work very well). Later on all other components were completely replaced (besides the radio module). Starting with GPS module with antenna borrowed from local bakery owner, pressure sensor from an experimental variometer, perfboard made of paper, all inside a soap box.  It was a great prototype which served perfectly and reliably.

Now, under the cumulus clouds, gray shit or in clear blue skies can be seen with the “PK” livery 🙂