MSP430 and DHT22 sensor

There are many types of sensors available for different measurements. Today we gonna use humidity and temperature (bonus feature) sensor DHT22 aka AM2302.

DHT22 Humidity/Temperature Sensor


Sensor has following key features:

  • 3~6V Power and I/O Voltages
  • Signal type: digital
  • Humidity: 0..100% RH (±2%)
  • Temperature: -40..80°C (±0.5°C)
  • Sensing period: ~2s

So it’s very convenient to use with MCU due to digital data protocol, suitable voltages. I’ve baught my sensor in site for ~10$. This version already contains some auxiliary parts such as 4-wire cable and pull-up resistor, soldered on PCB.

DHT22 (DX version)

DHT22 (DX version)

Accordingly to datasheet sensor has digital communication protocol with bits encoded as pulses lengths. You can read more information about all communication details here. We have two common approaches to implement MCU part of communication process. One way for implementation is using plain cycle delays when communicating with sensor. That way sensor utilizes MCU time into nothing, bad to say. Second approach uses timer modules in MCU. Thus, controller should be in standby/inactive mode for needed delays or do other things in the same time (except some interruptions, of course, which leads to overlaps with DHT22 interrupts).MSP430 also has timers support. I use MSP430G2553 chip with two timers (Timer0 and Timer1) and different work modes. I wrote my own little project to control L293D motor driver and read DHT22 sensor periodically by timer (project uses second Timer-based approach). You can get sources in github. Note that I haven’t implemented standby mode in that project, but it’s very easy modification.

Code contains comments and tested with real sensor and environment changes.


MSP430 Launchpad with AIR BoosterPack by Anaren

I have got two launchpads (rev. 1.5) and AIR BoosterPack by Anaren. In order to get it works I read many different recipes, articles, notes. Original firmware by Anaren contains lots of features and utilities so it looks too heavy for MSP430 device with your custom code.

AIR BoosterPack by Anaren

I found discussion topic about aforementioned BoosterPack at 43OHms forum


Lars Kristian Roland adopted some TI wireless examples to support CC110L and, in particular, AIR BoosterPack by Anaren. I prepared a very little but useful example of using LarsRF library. So, behold everyone! UART RF bridge firmware for TI MSP430 Launchpad. It creates wireless proxy channel between two launchpad boards. You work with those boards like with simple UART connected hardware (9600bps 8b1) but all packets explicitly go through wireless interface (868MHz CF, MSK Modulation, +12dB Power). So, convert your UART remote controller into wireless remote controller in few steps.

GitHub page: