Toggle navigation menu. MENU

With the availability of compact sensors and inexpensive micro-controllers (MCU), it has become possible to measure and control things that were unreachable before.  A microcontroller is a device that contains one or more central processor units (CPU), memory and input/output peripherals. You can now create a device that measures and analyzes noise and vibration of a system and relay that information to the cloud for remote analysis. Or measure the motion of a controller arm over time and report it to an observer many miles away. Some devices can receive commands and act on the world. Such as opening a valve to water the garden.  The device may also behave autonomously by accepting inputs, making decisions and executing those decisions.

An example of this is the microcontroller-based incubator, a device used to store fertilized chicken eggs in the correct environment until they hatch. While it is possible to create an analog circuit to control the temperature inside of an incubator, a microcontroller allows for much more flexibility and features. The MCU based incubator can allow the selection of the egg to be incubated then determine the conditions required, monitor and record data and indicate when the gestation period has been reached.  For instance, there are system on a chip’s (SoC) that incorporate wireless protocol stacks to allow the device to communicate over Bluetooth, WiFi or other technologies. With this, it is possible to monitor and control the incubator with a smart-phone, tablet, or computer.

Some considerations for any sensor development:

  1. Communication Interface
  2. Power consumption and battery life
  3. Computing power
  4. Peripherals
  5. Prototyping
  6. Programming

Communication Interface

The device may need to communicate with something else to send data or receive commands. Many battery-operated devices use Bluetooth to achieve this communication.  Bluetooth allows for low power bi-directional communication between devices.  It allows for many topologies, with the simplest being a central-peripheral relationship.  While there is the possibility to use WiFi for the communication, it is not common when long battery life is required.  WiFi is more common for devices that have an external power supply and power consumption is less of a concern.

Power Consumption and Battery Life

Power consumption is a critical factor in selecting hardware for a battery powered device. When selecting the hardware and communications protocol, care should be taken in the operating current of the components and the ability to disable them when not required.  For example, a sensor that uses a VL53L0X time-of-flight sensor to measure distance would consume 19 mA when actively ranging but would only 0.005 mA when in standby mode.  Similarly, the micro-controller itself can be put in a low power mode.  Many have several modes of operation so that they can continue to monitor inputs and wake as needed.  Radio usage should be minimized to reduce power consumption also.  For many SoC the Bluetooth radio is the largest single power consumer.  While it may be tempting to send large amounts of data, each time the radio transmits it consumes 20 mA.  There are many ways to control the power consumption of the radio, but that will be reserved for another time.

Computing Power

While it may be tempting to use the fastest, largest memory device for the design, this will also consume more power.  For a battery powered device this may not be the optimal choice. A 32-bit Cortex based with 512 KB of Flash memory is sufficient to process the data from several sensors while running Bluetooth and ANT simultaneously.  The specific micro-controller will depend on the power and processing requirements as well as the desired communication protocol.

Peripherals

While the MCU is the brains of the device, it has no ability to sense or control the environment.  That is where the peripherals come into play.  There are many sensors readily available to measure everything from atmospheric pressure to water level.  To act on the environment, the device will usually require driver or switching hardware. For instance, an MCU can only power very small motors directly.  For larger motors, a motor controller will need to be chosen for the amount of power required.  In the incubator example the MCU uses a thermistor to measure the temperature and solid-state relay to power a heating element form AC power.

Prototyping

Once you have decided what is to be measured, controlled and how to communicate with the device, it is time to build prototypes.  There are many development kits available to build a prototype, but not every chip is available in the form factor desired.  Nordic Semiconductor has a large number of development kits available for their MCUs, but they are larger than Adafruit Feathers, so to build a compact prototype we have chosen the Feathers instead to the Nordic development kits.

 

Programming

There are many development environments available for writing the firmware. While C is the industry standard, Python, Javascript and other languages can be used.  For ease of development the Arduino IDE can be used.  There is a large ecosystem of software and hardware that can be used in Arduino, but as the complexity of the firmware grows another IDE may be more appropriate.  Several MCU manufacturers have their own IDEs or licensing agreements with commercial IDE providers.  SEGGER Embedded Studio is a more flexible development environment which allows for low level control of the firmware and is licensed for use with Nordic Semiconductor devices.  When used with a J-Link it is possible to read and write the memory of the chip and perform low level debugging.

Conclusion

There are several factors to consider when developing a MCU based device.  These factors are interrelated to the desired goals of the sensor.  Once the goals are established decision on components  can be made.