0
votes

I am trying to connect MQ5 sensor to a Telosb and read the values, and i am using contiki os.
My problem now is:
I know that i need an ADC driver in contiki os, but i do not know how to do it or from where to start ?
Can anyone guide me please?

1

1 Answers

0
votes

The ADC driver for TelosB is already implemented in Contiki, you can find it in file sky-sensors.c and sky-sensors.h in contiki/platforms/sky.

See light-sensor.c and temperature-sensor.c for examples of sensor drivers that use this "sky_sensor" API. Basically you need to select which ADC input channel to use and what reference voltage to use, the rest is trivial: call sky_sensors_configure function and read from the right memory location mapped to an ADC input port. For example, by reading ADC12MEM4 you can access the ADC channel 4.