Boomerang ADC Example

From TinyOS Wiki
Jump to: navigation, search

Moteiv's Tmote Sky module includes a number of on-board sensors (optionally populated) and default sensors. In this document, we describe how to convert values obtained from the sensor network into SI units.


In TinyOS, Moteiv provides the "Oscilloscope" application that samples from all of the sensors on Tmote Sky and sends the results over the radio. To use Oscilloscope, install one node with the code available at:


Install a second node with TOSBase, as per the Tmote Sky QuickStart Guide. Connect the TOSBase node to your PC.

Start running SerialForwarder, as per the QuickStart Guide. To show the readings, run the Oscilloscope java application while SerialForwarder is still running.

java com.moteiv.oscope.oscilloscope

If no readings can be seen:

  • check the "scrolling" checkbox
  • click the "zoom out y" button to see values > 1024

Internal Mote Voltage

The internal voltage sensor uses the microcontroller's 12-bit ADC. To convert the raw value of the ADC to the corresponding voltage, perform the calculation:

(1)  value/4096 * Vref

where Vref = 1.5V

The internal voltage sensor monitors Vcc/2, so multiply the resulting voltage value by 2 to get mote's supply voltage (Vcc).

Internal Temperature

Similar to the internal voltage, the internal temperature sensor is an uncalibrated thermistor that is sampled using the microcontroller's 12-bit ADC.

Note that the sensor is not calibrated, although the following formula works well for most applications:

 T =  (Vtemp - 0.986)/0.00355

Temperature is specified for degrees Celcius.

PAR/TSR Light Photodiodes

The TSR and PAR sensors are also measured using the microcontrollers 12-bit ADC with Vref=1.5V. The photodiodes create a current through a 100kOhm resistor. By calculating the raw voltage using equation (1) above, convert the voltage into a current using V=IR:

(2)  I = Vsensor / 100,000

where Vsensor is the voltage calculated with the raw value and converted using equation (1). The Moteiv datasheet includes curves for converting the photodiode's current into light values (Lux).

Based on the graphs available in the Hamamatsu S1087 datasheet, the current of the sensor, I, may be converted to Lux.

S1087    lx = 0.625 * 1e6 * I * 1000
S1087-01 lx = 0.769 * 1e5 * I * 1000

External Humidity and Temperature Sensors

Humidity and Temperature sensors are located in the external Sensirion sensor. Their readings can be converted to SI units as follows:

For Temperature, Oscilloscope returns a 14-bit value that can be converted to degrees Celsius:

(3)  temperature = -39.60 + 0.01*SOt

where SOt is the raw output of the sensor.

Humidity is a 12-bit value that is not temperature compensated.

(4)  humidity = -4 + 0.0405*SOrh + (-2.8 * 10^-6)*(SOrh^2)

where SOrh is the raw output of the relative humidity sensor

Using this calculation and the temperature measurement, you can correct the humidity measurement with temperature compensation:

(5)  humidity_true = (Tc - 25) * (0.01 + 0.00008*SOrh) + humidity

where Tc is the temperature measured in degrees Celcius from equation (3), SOrh is the raw output of the relative humidity sensor, and humidity is the uncompensated value calculated in equation (4).