I have some (unlucky) plants in my workroom to make it more convenient but sometimes I forget to water them. I have always wanted to create a watering reminder, but I had more important projects all the time so I kept procrastinating it. I can see now I am not the only one engineer who has problems with keeping the plants alive. It’s high time to make up for it. Some months ago I had seen an introductory video about the new EFM8 8-bit microcontroller then I entered the contest to try it.
The goal is to create a low power application which can measure the soil water of my plants furthermore it can warn me when it becomes dry.
I have chosen SLSTK2011A starter kit for my application. The kit equipped with a nice Sharp memory LCD, Si7021 temperature and humidity sensor, RGB LED, joystick, push buttons and last but not least EFM8SB20F64 microcontroller. It has a 4352bytes RAM and 64kB flash and it is based on 8051 core.
Contrary to the EFM32ZG starter kit, it is contains everything what you need for the first run (3V coin cell and mini USB cable).
Let’s see the software side.
I had already installed Simplicity Studio before but only with ARM components. I had to add further EFM8 packages. It is easy as one by one with Add/Remove packages button in the top right corner of the Simplicity Studio on the Simplicity perspective.
The kit arrived with a pre-programmed clock demo. I would rather had seen something more interesting, so I opened the space invader demo project then I pushed compile button. Surprisingly I got error message:
At this point it became clear why I had the following message after installing the components for EFM8 kit. Simplicity Studio uses Keil tool chain to compile the C code for EFM8 microcontrollers, fortunately it provides a possibility to register a full license for this tool free of charge. Good!
The licensing procedure takes some minutes and then the activation code arrive in e-mail. At first the code didn’t work, but it was my fault, the copy-paste takes the carriage return character from the end of the code…
It is important to clean the project before rebuilding and finally the space invaders compiled successfully. It runs smoothly on the EFM8 SB2. So far so good.
To measure the soil water of my plants I chose a simple voltage divider method. I did a simple sensor from a piece of prototyping board.
To prevent the electrolysis I just set voltage with one of the IO pins for the time of the measurement. The resistance of the sensor after watering was around 300kOhm so I put another 300kOhm resistor to divide the voltage in half. When the soil becomes dry, the resistance of the sensor rises and the voltage of the analogue input as well. In this way it is easy to find a threshold for alarm.
To store more nice notification images the 64kByte of flash memory comes in handy.
To keep the project simple and portable I prefer to supply the circuit with battery. At this point the low power possibilities of the CPU become important.
In active mode with LCD the setup requires 4.4mA
In Idle mode with LCD the current consumption goes down to 2.46mA. It is better, however, for a battery powered application it is still high.
Finally in suspend mode with LCD I see a value that is much better.
As regards the software side it was a pleasure for me to use the same IDE to EFM8 microcontroller as the EFM32 micros. Good getting started videos and well prepared demos help the user in the first steps. During developing low power application the integrated Advanced Energy Monitor is a very helpful tool to check the current consumption of the system. Using the VMCU pin to supply the external hardware makes possible to test the complete project energy hunger.
This EFM8 SLEEPY BEE starter kit contains a lot of possibilities to play with. The 20 pin expansion header makes more comfortable to connect our external hardware without soldering. If it is not enough, it is easy to solder a pin connector to the upper and lower side of the development board where all of the microcontroller pins are broken out accompanied by power supply and GND.
Thank you, Silabs, for the opportunity to try your new product.
2 MCU cool features
In this part of review i want to talk about Happy Gecko MCU itself.
Let’s check what we got here:
New USB controller. It’s device mode only with 3 + 3 endpionts, which means you can make up to 3 bidirectional devices (e.g. keyboard + virtual COM port + mass storage). You barely can put more functionality on such small memory device.
There is a good demo which implements 3 USB classes composite device.
Code compiled with GCC is 42K Flash and 4K RAM.
With optimisation for size it will be 26K and 4K respectively.
What is interesting there are 1.5K RAM for endpoints’ FIFO and dedicated DMA controller, so USB subsystem should consume a huge part of the die area.
There is 3.3V LDO build in with 50mA output, so you can power whole board from USB without external hardware.
USB should be capable to operate without external crystal, but I did not found a section about it in reference manual.
Basically MCU use Start-Of-Frame bits to tune internal RC oscillator.
The most interesting part of HG’s USB is a capability to automatically turn off clock while idle. It can save a ton of energy in low traffic application such as HID. And of course USB is connected to PRS and can generate interrupts on SOF.
For example in normal mode MCU will consume 7.27 mA as HID keyboard, but with low energy mode enabled it’s only 4.9 mA, good Gecko!
3 Fun project
So let’s do something fun! Writing reports are always boring and Happy Gecko wants to help us.
We gonna take USB HID keyboard demo from Simplicity Studio and modify it. Just open SS, connect the kit and press Software Examples button.
Choose usbdhidkbd and press finish. SS should copy all necessary files and open SS-IDE.
We should modify ScanTimeout handler to pass our own codes to PC.
PB0 will make COPY and PB1 will make PASTE.
descriptors.c contains all keyboard codes that Gecko should pass to PC.
You can find all of them on usb.org:
0x06 - is C, 0x19 - is V and modifier 0x01 is Ctrl.
Now copy-pasting should work.
Let’s also create a custom image, for this I will create 128x128 picture in GIMP and export it as .xbm
open it in text editor and you will see C array:
You can paste it into the code now.
Full project can be found here: https://github.com/uSasha/gecko_reporter
The board is pretty unique if we compare with other vendor’s starter kits. Modern evaluation boards are always bare PCBs with only necessary elements: MCU itself, debugger, couples of LEDs and button(s) if you are lucky.
Gecko series starter kits are full featured development kit, which content a lot of functionality besides this bare minimum:
I have old Giant Gecko starter kit, so let’s compare what changed in two generations of STKs:
First what I’ve noticed is that board became a little bit bigger. Now there are two 16 pin rows on upper and lower edge of the board with 32x2=64 pins total on breakouts instead of 22x2=44 pins total on older boards.
New board have two 1.27mm JTAG headers instead of one 2.54mm on older board. All headers are 20 pin standard. One is marked as DBG and another is not marked at all, schematics don’t know about it either. Lets just call it “Mysterious Header”
No light and LC sense on board because there is no LE sense on Happy Gecko.
No NAND Flash, because there is no NAND controller on such small device.
No OPAMP footprint as there is no OPAMP in HG. No backup domain with super cup also.
Expansion header is the same but on new board all pins are marked on the back side which is very useful.
MCU’s USB port is moved to the right and not covers breakout pins anymore which good too.
Segment LCD replaces with crispy graphics one.
My conclusion is that as 3 years before it’s best quality and feature vice starter kit with some usability improvements. Of course some Giant’s features are missed but hey, Happy Gecko is tiny MCU and the kit expose all it’s features. With new price point of $30 ridiculously cheap, even cheaper than J-Link EDU. Also I miss SWD 2.54mm header on this board, which was really helpfull.
1 Getting started
First, download new Simplicity Studio 3.1: https://www.silabs.com/products/mcu/Pages/simplicity-studio.aspx
Than connect HG-STK and SS will download and install all documentation, examples and software you need. After installation click demo button. It’s a good place to start playing with new kit, in few clicks you can run some fun demos and check system current consumption. My favorite is analog watch demo, there are also a lot of ready to use USB classes which is great.
Than I recommend to check MBED web page: https://developer.mbed.org/
You should register and add your board, then you’ll get access to online IDE with a lot of build-in libraries which are good for beginners or for prototyping.
Last but not least check University Program button in SS.
In my opinion it’s the best way to learn EFMs and one of the best for MCUs in general.
It’s very dense materials with presentations and hands-on examples about everything to start. I wish I have this materials when I started to learn MCU and coding.
The next step is to start a pet project and read application notes for specific peripherals and use cases.
There are 2 modules inside the box. Each mocules consists of :
- 1 motherboard
- 1 daughter board. I choose the 434MHz but there are 4 others versions (169MHz, 490MHz, 868MHz and 915 MHz)
All accessories are supplied:
- 2 micro-B USB cables for daughter boards
- 2 mini-B USB cables for main boards
- 2 batteries GP Lithium CR2032
- 2 antennas (434 MHz)
The main features of this starter kit are :
- USB and Ethernet connectivity (on mother board)
- low power capabilities
- CPU core : ARM Cortex-M4
- on-board J-link debugger
- energy monitor
- embedded temperature and humidity sensors
- power by USBs or battery. Choice is possible by a selector (BAT/USB/AEM)
- 128*128 LCD-TFT display
- Hardware AES accelerator. Very useful for IoT.
For more details, you can check on Silabs' website.
USB and Ethernet port can be used as VCOM (Virtual COM port). For using TCP/IP, the wireless starter kit can be accessed on port 4091 using telnet client. I will do some tests later on using TCP/IP on this board.
Simplicity is a powerful tool that can used for program, flash code or simply access to documentations relatives to your connected device.
1. download Simplicity
2. open simplicity. A prompt window appears. Choose "find a product".
You can access to this window by clicking on "Add/remove packages" button (on top right of the main window).
3. search your device's name by typing your reference. (example : EZR32) And select your kit. There are 2 parts of devices. Go to kits section if you need to connect your starter kit and choose the correct board regarding to your radio module (For me EZR32WG 434MHz).
4. click on finish and let it to install all needed packages
Simplicity need to restart after this step.
When your board is correctly installed you can see it on the bottom left side of Simplicity's main window (detected hardware section).
I expect to modify an existing project (maybe humitemp project) and add to it the ability to use wireless communication.
PB0 shows the temperature and humidity of the local board and PB1 shows the temperature and humidity of the distant board.
When I try to do this I encountered a problem. I can't exchange data between the two boards. I loaded the examples project. I loaded ezradio_direct_rx on one board and ezradio_direct_tx on the second board. When I pushed PB0 for sending one frame, the second board seems to received nothing. I will try to understand exactly my problem and I will give to you here an example of data exchange between two boards using LCD and push buttons.
The quality of LCD screen is very good. The screen is compact and the resolution is high enough for printing graphics or text clearly. The interfaces given with this evaluation board is very interesting (Ethernet, USB, GPIO, push buttons and LCD). You can acces to all of major I/O of the EZR32 from the board. So you can interface it with others sensors or event an Arduino board.
Simplicity studio is a good interface for work on the development board but there are a too many thing on the dashboard and It's not easy to take this tool in hand. You have many ways to flash your board : either through "demos" or through " softawares examples". In all cases you access to the same example. You can also flash directly your board if you have your executable (.hex) through "flash programmer".
I wasn't able to use "Radio evaluation". Rfeval project is not work on my board ( impossible to load it), I don't know if it's normal or not. I was able to load nodetest but I get an exception when I launch the test. Maybe I don't understand exactly how it work.
I need more time to understand correctly my problems and solve it.
The sensor puck is a nice peace of hardware in a tiny package. The features I'm mostly interested in are:
Additionally the schematics for the hardware is available as well as the source of the firmware running on the SENSOR-PUCK which is always good in case some things needed changing.
The sensor puck comes pre flashed with a demo application that is sending the sensor readings via BLE broadcasts. It is really easy to download and install the corresponding application form the android app store. As soon as the application is launched it shows the current readings from the selected SENSOR-PUCK:
The SENSOR-PUCK Users's Guide is very detailed and no question is left after reading it. Seeing the actual schematics of the SENSOR-PUCK is nice an adds greatly to the understanding of the capabilities of the SENSOR-PUCK beyond what the demo firmware provides.
5. Usage as a Beehive Monitor
The SENSOR-PUCK is a great demonstrator of the capabilities of SILICON LABS. The power consumption of the SENSOR-PUCK while measuring and broadcasting the sensor data (indicated by the green flashing LED) is average 1.5 mA which means according to the Users's Guide the battery on the SENSOR-PUCK will last approximately five days. Which is really great knowing the measurement is taken every second. So that makes approximately 432,000 measurements and bluetooth broadcasts on a single 3V coin cell battery. When it comes to beehives and environmental changes the update rate of 1 Hz is a bit of an overkill for the application as a beehive monitor. An update rate of about an hour would be sufficient which could mean a battery life of greater 60 days. I hope I can change the firmware to match my application needs and try the SENSOR-PUCK under some harsh conditions like the one in the picture below.
Thank you Silicon Labs for letting my try out this great product.
I am new to C programming and also MCU development. I started by reading the information to give me a starting point to learn how to code and make the MCU do what I would need it to do. I ran through all the sample projects and found they were pretty simple to do. They made the MCU work in a different way each time. Once I got the examples to work then I actually tried walking through them with the debugger to see what they did and when. This was a great learning experience as it taught me a little more about how to read the code and understand what was happening. Overall I believe the examples and tutorials were great but I think they could have been a little more in depth and actually had some to walk through and build your own type of examples. Once I started manipulating the LED's and started understanding how to turn the LED's on when I wanted to or have them on until I wanted them off, I was able to continue with working on seeing if the MCU would be capable of doing what I want it to do. I am hoping to continue working with this so that I can create something that will allow me to monitor my newborn baby’s vital signs and set off an alarm if there is an abnormality. I am still working my way and I have picked up some sensors and I have some bread boards that I am working on wiring up and starting to work on the whole picture. I have already burned up quite a few batteries and sensors trying to figure out the power portion of the sensors and how much is needed to trigger then. I want to be able to set the sensors in the vicinity of the baby and it monitor via infrared sensors. If I can do this without the sensors having to physically touch the baby then I think it would be best. I will do my best to keep this blog up to date as I go.
1. Expansion Board Components
The two main parts of the board are the Si7013(U2) which is a Humidity/Temperature Sensor and the Si1145(U4) which is a Proximity/UV/Ambient Light Sensor. Both of them have got a I²C interface. Furthermore there are two other chips on the board. The first one is a boost converter(U6) which boost the 3.3V up to 5V. This higher voltage is needed for the three IR – LEDs(DS1-DS3). There are also 5V available from the expansion connector but they are provided over USB and when your application is powered from a battery, there are only 3V so you need a step up converter. The second IC is a serial EEPROM(U3). There is even a footprint for a further chip on the board but this one isn't assembled. Furthermore there are three connectors on the expansion board. Two of them are the 20 – pin expansion connectors(JP3,JP4) and the third one is ribbon connector(J6) for other I²C sensors. Moreover there are two pins “TP1” and “TP3” for connecting an external thermistor.
2. Getting Started
connect the expansion board with the Zero Gecko STK
make sure that the power switch of the STK is on the right position (DBG)
connect the Starter Kit with your computer via USB
start the Simplicity Studio
or download Simplicity Studio from SiLabs website http://www.silabs.com/products/mcu/Pages/simplicity-studio.aspx
and install it
select the correct MCU (EFM32ZG222F32)
you don't have to type it in, only click on “Detect Connected Device” and select the STK and press “OK”
open the tool “Demos” and select “STK3200 weatherstation”
choose if you want to Run the demo under Energy Profiler or not.
the Simplicity Studio will then flash the demo program to the MCU
If you ran the demo under Energy Profiler, you are now able to analyse the power consumption of this application. Unfortunately the code correlation does not work with the Zero Gecko STK, because the ARM Cortex – M0+ does not support it.
3. Weatherstation Demo
To start the application you have to follow the instruction on the LCD. You can press PB1 or hover your hand over the sensor board. In this mode, the power consumption of the application is much less than in active mode (~130µA). If you started the demo by one of these two actions, you are now able to switch between three windows: Temperature, Humidity and UV Index.
You have to move your hand from left to right or from right to left over the sensor board. It's also possible to use PB0 to switch between the windows. You can also switch the unit in the Temperature window by swiping down. When the application is running, the current consumption is about 3.6 mA.
If you don't move your hand over the sensor board for a while, the demo will go into sleep mode to save energy. To exit this mode you only have to do the same as before. It's also possible to power the demo with a CR2032 coin cell. The program will even tell you if the voltage of the battery is too low.
4. EFM32TG STK + Weatherstation Expansion Board
It's even possible to use the demo board with a Tiny Gecko Starter Kit if you have one like me. I chose the Tiny Gecko because I'm using it in my diploma project and I possibly use the Si7013 and the Si1145 as well.
There is the same example available for testing the demo board with the Tiny Gecko STK. The Tiny Gecko demo even displays the level of the supply voltage by the little battery symbol on the display.
I wrote a simple demo program for the Tiny Gecko STK, which displays the relative humidity and the temperature on the LCD.
start LETIMER interrupt
wait for interrupt
when an interrupt occurs
→ read out Si7013, update LCD
The LETIMER interrupt occurs every 8 seconds. The average current consumption of one period is about 17µA.
The interface of the Si7013 is very similar to the SHT25 which I used before. So it was very easy to implement the sensor in my own demo application.
Furthermore I have noticed one difference. If you want to read out RH & T from the Si7013, you only have to measure RH and then you can read out T without the use of an extra measurement. Because T is also measured when you measure RH. So the I²C communication is shorter than with the SHT25.