Rapid Sensor Evaluation in 10 Minutes
Getting a sensor and an MCU to communicate can be a challenge especially if you are new to that particular MCU. However, the EFM8 MCU due to its straightforward architecture offers extremely rapid implementation of sensor based applications. I chose the EFM8 Sleepy Bee MCU because the application runs on a battery and needs to be ultra-low power. My first task was to evaluate a couple of different sensor options. The Silicon Labs EFM8 SB1 is a good choice due to the low-power and 12 bit ADC with 75ksps or 300ksps with 10 bit mode which was needed to take many rapid precise readings from the sensor.
Sleepy Bee a great fit for this application because the ADC can operate in low power modes which is a feature that is hard to find in a low cost MCU. The sensor will be powered by a 5V or 3.3V, depending on performance and signal coming from the MCU. The sensor will then divide this voltage based on how flexed it is and return a voltage somewhere in the .5-3V range. I evaluated 2 different flex sensors, one from Spectra Symbol part SEN-08606. The other was from Flexpoint Sensor Systems part number 176-3-001.
They sensors work as a variable resistor so as the bend of the sensor changes the resistance will change thus altering the voltage across it. From this voltage drop the program can determine how bent or arched the sensor is.
First I download Simplicity Studio which includes a free IDE and compiler. There is a reference design that comes with Simplicity Studio which made getting the ADC up and running easy. Loading the reference design was simple and it had the ADC configured with the settings I needed. The only thing that I had to change was the pin that the ADC was configured to. The reference program has the voltage printed to a terminal which made seeing the value of each sensor very easy.
This is an image of the quick sensor test setup. The red wire runs 3.3 volts to the sensor. The green is the input to the ADC. The brown wire goes to a potentiometer and then to ground, this is so that I can alter the pots resistence to create the largest voltage swing.
Like I mentioned earlier I had to change the ADC pinout. This was super easy. Below are two images for configuring the ADC and the peripherals that it needs.
I had to write no code to evaluate these sensors. All I had to do was select configuration options and check boxes.
This is a snippet of the final code that I ran. All of it was generated for me.
The last step was to run the code and read the output of the terminal. Below is the simple output that is displayed. As I bent the sensor the voltage drop across the sensor would increase thus the voltage that I read back decreased.
Now to Test power consumption. Energy Profiler in Simplicity Studio allowed me to see the power consumption of the program in real-time. Below is a snapshot of the statistics of the program after running for a short while. The code can be broken down further to provide insight into where the most power is consumed. This is a simple example where I am reading the ADC so the current is relatively flat. When I am ready to develop the application further this will be a powerful tool to extend my battery life.
To connect both sensors and compare their voltage swing took me about 10 minutes.. EFM8 with Simplicity Studio has a ton of examples that utilize its vast functionality like ADC, SPI, LCD and many more. It’s simple to start a more complex design from one of the many examples. Simplicity Studio is easy to navigate and supports Silicon Labs’ MCU and Wireless products.