Close

Same Idea, Different Implementation

A project log for STM32L4 Sensor Tile

Small, connected device for smelling and hearing in any environment.

Kris WinerKris Winer 07/30/2021 at 22:170 Comments

It's been a while since I updated this project. In the meantime, we have been developing tools to make use of ST's relatively new line of BLE-enabled MCUs: the STM32WB55.  We developed basic hardware designs including a development board (Firefly) and a modular wearable (Katydid) using the discrete version of the STM32WB55. Designing with the STM32WB55 is straightforward but a bit complicated with an external SMPS circuit for lowest power usage, dual crystals, and an external matching chip and external antenna for the BLE. 

With the introduction of the STM32WB5MMG BLE module, all of this is integrated into a small (7.3 mm x 11 mm) package with 68 GPIOs, 1 MB of flash and 256 kB of SRAM and everything is included. The package is 0.435 mm pitch LGA and takes some care to mount but is straightforward. There are also some constraints on where to mount the module on the pcb for best performance. But we have used this module on 15 mm x 20 mm devices for consumer product research and on a 50 mm x 20 mm "Acoustics Lab on a Stick". Range and/or efficiency might suffer with "improper" placement but the BLE and MCU work pretty well regardless...

So it is natural I would indulge my interest in environmental sensing by using the STM32WB5MMG as the heart of a new "Sensor Tile" design. I call it Rodan:

The 34.5 mm x 34.5 mm pcb is designed to mount into a blue transparent  Hammond 1551-Q box. The STM32WB5MMG module with integrated pcb antenna is lower left. Programming is via USB (or tag connect) and the Arduino IDE using Thomas Roell's excellent STM32WB system layer and Arduino wrapper.

The board can be powered via USB and there is a switch-enabled 300 mA MCP1812 LDO for the purpose The board can also be powered by the AEM10941 HVOUT (3V3, 80 mA) when there is an AM-5412CAR solar cell source and 100 mAH LiPo battery attached. The idea is to program the board via USB (my preference) and then deploy outside with just solar cell and battery with the sensors collecting and storing data on the 8 MByte  MX25R6435FZAI QSPI flash for ~six months or so.

The sensors include the VEML6040 RGBW light sensor, LPS22HB barometer, HDC2010 humidity and temperature sensor, BMA400 accelerometer for motion detection, and the CCS811 for eCO2 and TVOC estimation. There is also an LC709204 battery fuel gauge for battery voltage and percent remaining charge monitoring, etc.. So this makes six I2C sensors and six interrupts to manage.

The strategy is to keep the STM32L4 component of the STM32WB55 dual core in low-power stop mode as much as possible only waking up on interrupt, either sensor data ready, battery alarm, RTC timer or general timer interrupts for logging and for sensors like the VEML6040 that have no interrupts.

I have one device assembled and I have verified that everything is working. I wrote a sketch to configure and manage the sensors and log data at such a rate that I can keep the device going for six months before the flash fills up.  This is worth a bit of discussion.

So the flash has 32767 256-byte pages. I have broken each page into 8 sectors of 32 bytes each and I am writing the essential data from all of the sensors including a time and date stamp using these 32 bytes. I am not capturing the accel data since I do not expect the device to be in motion when deployed, at least at first. I am capturing the InMotion flag (byte) though so I can tell when the device fell down or someone messed with it. This means that I can capture 32767 x 8 data samples, which at once per minute is 262,132 minutes of data, or 182 days of data.

I still need to add BLE NUS so I can periodically check on my device with a smart phone and I need to measure the average power usage to have some idea how much battery margin I have. I expect ~30 mAH of power generation now at the height of Summer ( ~4 hours at ~7 mAH/hour in ~16 klux light) but this will decrease with the approach of Winter and I am not sure if the device will make it through the entire six months. This will depend somewhat on where I place it, of course.

I will make a trial run over a week or so to make sure everything is working as I expect and that there is no show stopper before letting it go for months. I'll report once I recover the device and plot up the weeks worth of data.

Discussions