Jon Thomasson's Build Log


I like that case, could definitely see it being mounted on a wall.


I finished designing the first prototype for my home automation node/sensor network. On my last post I had started the research portion of the project. In this post I’ll go over a few design decisions that led to the finished prototype.

At the time I had narrowed down my choice of microcontroller to either the STM32L0 or the Microchip ATSAML21. Both chips are optimized for low power and would be fine for this application. Many factors came into play in deciding which microcontroller would be chosen, such as community support, code samples, availability of cheap dev boards, range of features and ease of use. In the end I decided to go with the STM32L0. The ATSAML21 looks like a great alternative, and I do hope to use it at some point in the future. Something I really like about the STM32 line of microcontrollers is the ability to fine tune the feature set down to one that makes sense for your project. They offer several versions of STM32L0 in the LQFP48 package and each version is pin compatible with the other versions. So for example in this project, I chose the STM32L052 which has integrated USB support, 10 ADC’s and a DAC, but skips features like LCD controllers which are available in the STM32L053 part. This way I can fine tune the microcontroller to fit with the project needs and pay only for what I’m using.

For the power supply I chose the Intersil ISL91127IR buck/boost converter. This particular component had a few things going for it. First it had a low quiescent current of only 30uA, perfect for a low power setup. Second, it shows a nearly 95% efficiency at the anticipated VIN and load current for my project. Third, it has built in short-circuit and over temperature protection. Lastly, it could switch seamlessly between buck/boost mode, with an input voltage range between 1.8 and 5.5 volts. This last feature enables the system to run off a wider assortment of power options, such as lithium primary cells, li-ion rechargeable, and USB. I wanted to have the option of using primary cells when practical because of their low self discharge rate, as well as their ability to withstand greater temperature swings and harsher environments. USB would be a nice feature in areas where power could be supplied via an outlet. For added protection I decided to also include an inline fuse. They are cheap, and a bit of an added insurance policy against the unknown.

To make the board as flexible as possible, and maybe save on future revisions, I decided to add in some extra footprints which may come in handy for future projects. I added in an optional sd card, usb, power switch, vin header, and external oscillators for the STM32. The power switch comes in 2 versions, one which can be mounted with the actuator vertical, and then a horizontal option so it could potentially protrude through the side of the enclosure. I also added some 0 ohm jumpers to add options for switching between different boot and power modes.

Here is the finished schematic:

And the PCB:

The enclosure was something I decided to find early on. I’m not sure if that’s the order this is usually done. My thinking though was that it would be easier to find an enclosure first and then have that set the constraints for my pcb layout. Since I don’t have access to a 3D printer, I’m a bit limited in resources to design a case from scratch. Instead I looked for cases that were pre-built that seemed like they would be good candidates for the project at hand. I also wanted the availability of enclosure’s that could hold up to harsh winter weather. After doing some searching I found some great enclosures on polycase that fit my requirements. I started off with the WP-31F, and then looking through the other case options I realized that the same PCB would actually work for 8 other enclosures. The enclosures are made from either polycarbonate or ABS plastic and come with mounting bosses and a PCB template which can be used in creating your own custom PCB. They also have options for flanged, unflanged, and IP65-IP67 specs. Another nice feature that polycase provides is that they are able to customize the enclosure for you, such as making cutouts for the edge connectors, as well as printing custom designs on the case itself. Here are the “supported enclosures” for this project:

I had some fun when it came to branding. Since I plan on using a Raspberry Pi as the hub that talks to these nodes, I code named this project the Smartie Pi Sensor Node, which when complete, will be part of the Smartie Pi Home Automation System. For the logo I wanted to convey an attachment to the Raspberry Pi, and also a sense of the wireless nature of the project. The final logo is a PCB with pads and castellated edges in the basic shape of the Raspi logo. Then in lieu of the leaves at the top, I have two dish antenna’s transmitting in either direction.

Here are a few 3D glamour shots of the board.

board front

board fully loaded

fitted in the enclosure

Here’s the link to the github repo for those interested. Until next time…


This is an excellent write up. I agree with your approach on selecting the enclosure. Even that can be a challenge with the amount of possibilities of manufacturers and styles. Simple has to be better.


Thanks Steve. Yeah, I had no idea just how many options there were for enclosures. I’ve never really needed one for a project up until now. There are other add on’s available as well, such as vents and cable glands which I’m thinking I may need at some point. In any case it’s been a fun learning experience since it’s opened up a new side of the hobby that I hadn’t really thought much about .


Have had a few other ham radio related projects vying for time recently, but thought I’d give a quick update on the SmartiePi Node. I haven’t ordered the boards yet, but I have had a chance to prototype the firmware using a Nucleo-L073RZ board.

After experimenting with the online MBED development environment to get a blinky example working, I ultimately settled on Atollic True Studio because of its ability to set break points and step through the code as it runs on the device. I’m also using ST’s CubeMX software to setup some boilerplate code for GPIO, clock, and drivers for peripherals.

As a simple first application of the node I want to create a driveway monitor/alert system, to alert me if someone is coming up the driveway. The node would simply transmit a message back to the hub whenever motion was detected. To accomplish this I bought one of these PIR motion sensors from Adafruit. This particular sensor has an output pin that goes high when motion is detected. To interface this pin with the Nucleo board, all that had to be done was hook it into one of the GPIO and configure it to trigger an external interrupt with the CubeMX software. To test out this setup I wrote a simple program which toggled the onboard LED on the Nucleo whenever motion was detected.

After getting the motion sensor working, the next step was to port my SX1238 driver from the Arduino. I used the ST HAL SPI and GPIO drivers to communicate with the SX1238. Most of the code seemed to port fairly easily which was nice. For testing I setup the Nucleo to transmit a packet via the SX1238 module each time motion was detected. On the receive end, I used an Arduino hooked up to another SX1238 module. Here’s the finished prototype.

This should hopefully make testing the PCB’s easier when they arrive.