Subscribe to EDN
RSS
Reprints/License
Print
Email
PDF Version

Accelerometers and temperature sensors fight SIDS

A simple microcontroller-based design may be a weapon in the fight against a dreaded problem.

Manish Shakya, Emmanuel Tuazon, Mohammed Bhatti, and Subra Ganesan, Oakland University -- EDN, February 17, 2011

At A Glance

  • A microprocessor-based monitor can give peace of mind to parents who want to prevent SIDS (sudden-infant-death syndrome).
  • The baby monitor collects data from a variety of sensors and transmits it wirelessly or through a wired connection to the control module.
  • The monitor comprises a temperature sensor, an accelerometer, and a wireless transmitter/receiver in a microcontroller.
  • Lightweight, stackless “protothreads” implement a sequential flow of control without complex state machines or full multithreading and provide conditional blocking within a C function.
SIDS (sudden-infant-death syndrome), or crib death, is the sudden and unexplained death of infants from causes that forensic and death-scene investigation cannot explain (Reference 1). It is one of the leading causes of death during infancy, with an estimated 2500 SIDS-related deaths annually in the United States and thousands more worldwide. Although these rates, in the United States, are at an all-time low and have fallen by about 50% since 1983, the number of infants dying from SIDS remains a cause for concern. Globally, especially in developing nations, where access to quality medical care and accurate information is far lower than in the United States, SIDS-related deaths remain high.

Although there is no agreement on a single cause for SIDS, factors linked to the phenomenon include babies’ sleeping on their stomach; overheating from excessive sleepwear and bedding; tobacco-smoke exposure following birth; maternal smoking, drinking, or drug use during pregnancy; poor prenatal care; prematurity or low birth weight; and maternal age of less than 20 years. Some of the suggested causes behind SIDS are related to choices that parents make—smoking, early pregnancies, and poor obstetrical care—and can be addressed through better education about the impact of lifestyle choices. Other suggested causes relate to the environment in which an infant sleeps; the parents can address these causes by monitoring the infant and intervening when necessary. Current research suggests that a variety of preventive measures, such as ensuring that infants sleep on their backs rather than their stomachs and removing from the crib blankets, pillows, or other objects that might cause the infant to suffocate, are the best means of reducing the potential of a SIDS-related death.

With advances in computing technology and the plummeting prices of components, other available products can supplement physician-recommended preventive practices. A microprocessor-based baby-monitoring system fulfills demand from parents looking for peace of mind. Using this system allows parents to better monitor their infants and act more quickly to pre-empt some of the suggested causes of SIDS. The system can monitor both babies sleeping on their stomachs and those who are overheating.

Monitor Design

Accelerometers and temperature sensors fight SIDS figure 1In its basic configuration, the monitor comprises a control unit and a baby-monitor unit (Figure 1). The baby monitor collects data from a variety of sensors and transmits it wirelessly or through a wired connection to the control module. The control module receives, analyzes, and displays this data and activates various alarm and warning modes.

The baby-monitor unit comprises a temperature sensor, an accelerometer, and a wireless transmitter/receiver in a microcontroller. An LCD allows users to monitor both the data the monitor receives from the sensors and the status of the system. Status includes whether communication with the control unit exists and whether an alarm is present. Using this system, the parent attaches the unit to the infant by bringing the sensors into contact with the baby.

The position sensor connects to the analog input on the microcontroller, and the temperature sensor is the built-in sensor available on the microcontroller. A serial interface transfers this data to the wireless HRTF (head-related- transfer-function) module. The HRTF module then transmits or receives data using FSK (frequency-shift-keying) technology to an identical HRTF module that attaches to the control unit.

Accelerometers and temperature sensors fight SIDS figure 2The control unit is responsible for menu functions, adjusting various settings, and updating and alerting the parent or guardian of the infant’s status (Figure 2). The control unit includes another microcontroller, an LCD, a hexadecimal keypad, an accelerometer, and a multi-tone alarm. The wireless HRTF module that attaches to the microcontroller receives data from the infant-monitoring unit and routes it to the microcontroller through a serial interface.

Software displays various parameters on a menu on the LCD that attaches to the microcontroller. The parent uses the keypad to browse through the menu, access various options, and enter input. The alarm activates when the values of certain monitored parameters exit a predetermined safe zone. The accelerometer resets the LCD to the default view when the user shakes the device and so offers an easy way to exit the various menu options a user might be adjusting or viewing.

Implementation

Accelerometers and temperature sensors fight SIDS table 1The system uses two Hope Microelectronic HCS12 Mini-Dragon-plus2 development boards employing the Compact MC9S12DG256 board with a solderless breadboard, two RS-232 ports, one CAN (controller-area-network) port, two H bridges, and four servo connectors and headers (Reference 2). The board offers both an LCD interface and a keypad interface, which allow for easy integration of those peripherals. The MC9S12DG256 offers a 16-bit CPU; 256 kbytes of flash memory; 12 kbytes of RAM; 4 kbytes of EEPROM; and SCI (serial-communications-interface), SPI (serial-peripheral-interface), and CAN 2.0 ports.

One wireless module attaches to the baby-monitor unit, and the other attaches to the control unit. Both units can both transmit and receive. The HRTF module functions on FSK technology in half-duplex mode in the ISM (industrial/scientific/medical) band. The user can select the transmitting-frequency deviation, the receiver bandwidth, and the data range. The HRTF module is compatible with either TTL (transistor-transistor-logic) or RS-232-logic levels. The compact and lightweight HRTF module is practical for use as a baby monitor. Table 1 shows the pin definitions of the 24×43-mm wireless module.

Accelerometers and temperature sensors fight SIDS figure 3The HRTF module has a working voltage of 5V. If the Config pin is high at power-on, the module enters the configure mode to allow a user to set up work parameters. This system uses the default parameters. If the Config pin is low at power-on, then the module enters normal mode for data transmission. The Enable pin serves primarily as a means of regulating power consumption. When you set the Enable pin, the wireless module immediately enters sleep mode. This circuit does not use the Enable pin.

The default configuration for the HRTF module is a baud rate of 9600, 8 data bits, no check or parity bit, and one stop bit. It caps the data-burst length at 32 bytes. The HRTF module works in half-duplex mode and immediately transmits data upon receipt of 32 bytes from the serial port. If the module receives less than 32 bytes of data, it waits for 30 msec to ensure that the data package is complete and then transmits the data. The HRTF module automatically switches to receiver mode, after transmission, in approximately 5 msec (Figure 3).

Accelerometers and temperature sensors fight SIDS figure 4The system uses two KXPS5 triaxis accelerometers with a full-scale output range of ±3g (Figure 4 and Reference 3). The accelerometer measures 5×3×0.9 mm; the operating-voltage range is 1.8 to 5.25V dc, and the optimal operating voltage is 3.2V dc. The connection to the controller is straightforward (Table 2). Communication with the chip can be through either an I2C (inter-integrated-circuit) interface or an SPI and can trigger analog-to-digital conversions, set threshold delays, or manage power consumption. The ASIC triggers acceleration thresholds when the device exceeds acceleration limits.

With the accelerometer, the monitor unit acts as a position sensor, which you attach to the infant to detect whether the infant rolls over from his back to his stomach. In this application, the data from the Y and Z axes are the most relevant. You determine the orientation of the baby depending on the values from the ADC.


Accelerometers and temperature sensors fight SIDS table 2LCD and keyboard

 The system uses two LCDs for displaying system-status information, various infant parameters, and menu options. One LCD connects to the baby-monitor unit, and the other connects to the control unit. An advantage of having integrated LCDs in both modules is that it provides the ability to debug the system while you are programming it. Table 3 shows the pin assignments of the LCD and the microcontroller.

The system uses one hexadecimal keypad for input and menu selection (Reference 4). The keypad is on the control unit and connects to Port A on the microcontroller. Ports 0 to 3 are input ports, and Ports 4 to 7 are output ports (references 5 and 6). The design uses internal pullup resistors from the microcontroller rather than external resistors.

Accelerometers and temperature sensors fight SIDS table 3
The basic principle behind the operation of the keypad is as follows: A 16-character array stores the keypad codes. Firmware reads this array through a loop and assigns various codes to Port A. The microcontroller reads the codes after a few milliseconds and compares them with those in the previous values. If the comparison indicates identical values, then a key is pressed.

If the comparison is not equal, the key is not pressed. The keypad performs several functions in the system. It acts as the primary input peripheral for the user to set and reset the password, set the alarm to snooze mode, reset the alarm if it goes off, and select various tones for the alarm. It also resets the data-transmission counter on the LCD and can find use in debugging. Key A on the keyboard enables the keyboard to snooze for 10 seconds; Key B, 30 seconds; and Key C, 60 seconds. Key D stops the alarm.

Software implementation

The firmware uses C and assembly language, employing “protothreads” (Figure 5 and references 7 and 8) in programming the control unit. The lightweight, stackless protothreads provide a blocking context on an event-driven system without the overhead of per-thread stacks. Protothreads implement a sequential flow of control without complex state machines or full multithreading and also provide conditional blocking inside a C function.

Accelerometers and temperature sensors fight SIDS figure 5

In memory-constrained systems, such as deeply embedded systems, traditional multithreading may have too large of a memory overhead. In traditional multithreading, each thread requires its own stack, and each is typically overprovisioned. These stacks may use large parts of the available memory. In contrast, the main advantage of protothreads over ordinary threads is that protothreads are lightweight: A protothread does not require its own stack. Rather, all protothreads run on the same stack, and the system performs a context switch by stack rewinding.

This feature is advantageous in memory-constrained systems, in which a stack per thread might use a large part of the available memory. A protothread requires only 2 bytes of memory per protothread. Moreover, protothreads are implemented in pure C and require no machine-specific assembler code. For a description of the format for transmitting accelerometer data from the monitor unit, see sidebar “Transmission of data.”

Accelerometers and temperature sensors fight SIDS figure 6Interrupts can be external or internal. External interrupts occur when the external circuitry sends an interrupt signal to the CPU. Internal interrupts come from the hardware circuitry inside the chip or from software errors. The system uses various interrupts to coordinate I/O activities as well as for periodic data acquisition. Both the monitoring unit and the control unit use three interrupts each: interrupts 7, 13, and 20. Interrupt 7 is a real-time interrupt to deal with the timing issues of the system.

Upon every real-time interrupt, the system increments a Tick variable, from which all system-timing information is derived. Interrupt 13 uses enhanced capture timer Channel 5 for tone generation, generating various frequencies by appropriate reloading values. Interrupt 20 is the SCI at Port 0 for wireless communication.

Accelerometers and temperature sensors fight SIDS figure 7The wireless modules in the baby-monitor system are relatively easy to configure, and data transmission between the two units is efficient. The two units can communicate with each other over approximately 100 feet, through walls, and in the presence of other electrical equipment. The prototype can monitor only one baby (Figure 6).

Adding a wireless sensor network allows you to monitor any number of babies. From a marketability standpoint, the prototype is too bulky (Figure 7). Size issues arise primarily from the size of the microcontroller-prototype boards (references 9, 10, and 11).


Acknowledgment

The authors would like to thank Professor Richard Haskell of Oakland University for his support during this project.


References
  1. American SIDS Institute
  2. HCS12: MiniDRAGON-Plus2 Development Board,” EVBplus.
  3. Hope Microelectronics
  4. www.kionix.com
  5. LTC2990 Temperature, Voltage and Current Monitor, Linear Technology.”
  6. EVB Shopping Accessories, EVBplus.
  7. Dunkels, Adam, “Protothreads: Lightweight, Stackless Threads in C,” 2008.
  8. Protothreads,” Wikipedia.
  9. Oakland University
  10. Shakya, Manish; Emmanuel Tuazon; and Mohammed Bhatti, “Anti-SIDS Demo,” YouTube.
  11. Haskell, Richard, and Darrin Hanna, Learning by Example Using C.

Authors' Biographies

Manish Shakya headshotManish Shakya is currently working on his master’s degree in embedded systems at Oakland University (Rochester, MI). Previously, he worked as a firmware-design engineer at Real Time Solutions (Nepal), where he designed and implemented embedded software. You can reach him at mshakya@oakland.edu.



Emmanuel Tuazon headshotEmmanuel Tuazon is a test engineer at Cobasys, where he has worked for more than five years. He is also pursuing his master’s degree in electrical and computer engineering at Oakland University (Rochester, MI). Tuazon earned a bachelor’s degree in electrical engineering at Wayne State University (Detroit). You can reach him at etuazon@oakland.edu.

Mohammed Bhatti headshotMohammed Bhatti is pursuing a bachelor’s degree in electrical engineering at Oakland University (Rochester, MI). He currently works for Costco Wholesale, and his interests include electronics, geopolitics, hiking, running, and reading. You can reach him at mzbhatti@oakland.edu.


Subra Ganesan headshotSubra Ganesan is a professor of electrical and computer engineering at Oakland University (Rochester, MI) and director of the realtime- embedded-DSP-systems lab. After graduating from the Indian Institute of Sciences (Bangalore, India), he served at many universities and research laboratories as a scientist and professor. You can obtain more information about him at www.secs.oakland.edu/~ganesan.


RSS
Reprints/License
Print
Email
PDF Version
Canon Resource Center

Featured Company


Most Recent Resources

Advertisement
Related Content

No related content found.

  • 0 rated items found.
Advertisement

KNOWLEDGE CENTER

Datasheets.com Parts Search

185 million searchable parts
(please enter a part number or hit search to begin)
Engineering Careers
Jobs sponsored by
Advertisement
About EDN   |   Site Map   |   Contact Us   |   Subscription   |   RSS
© 2012 UBM Electronics. All rights reserved.
Use of this Web site is subject to its Terms of Use | Privacy Policy

Please visit these other UBM Canon sites

UBM Canon | Design News | Test & Measurement World | Packaging Digest | EDN | Qmed | Pharmalive | Appliance Magazine | Plastics Today | Powder Bulk Solids | Canon Trade Shows