"I-Feel" sensor for air-conditioner

Submitted by:

Omer Ran

Hila Cohen

 

Summary:

We programmed the TelosB board to keep the room temperature in a specified range by measuring the current temperature and responding with IR commands to the air-conditioner.

We used the following interfaces:

·         UART interface with a PC (for monitoring and debugging purposes).

·         I2C-like interface with the onboard SHT11 temperature sensor.

·         Infra-red PWM-based communication with an air-conditioner.

Demonstration:

waiting for sensor...

Temperature:   30 degrees Celsius

Rel. humidity: 62%

Temperature:   30 degrees Celsius

Setting temp. to 24

Temperature:   30 degrees Celsius

Setting temp. to 24

Temperature:   30 degrees Celsius

Setting temp. to 24

Temperature:   29 degrees Celsius

Setting temp. to 24

Temperature:   29 degrees Celsius

Setting temp. to 24

Temperature:   29 degrees Celsius

Setting temp. to 24

Temperature:   29 degrees Celsius

Setting temp. to 24

Temperature:   28 degrees Celsius

Setting temp. to 24

 

 

Details:

1. Monitoring the board's status:

We used UART status messages (at 9600 baud, 8-N-1 mode) and the green and red LEDs to monitor the board's different activities.

Upon idle operation, the green LED blinks.

 

2. Communicating with the SHT11 temperature sensor

Communication with the SHT11 temperature sensor is done with an "I2C-like" protocol, on an exclusive channel (meaning the SHT11 sensor is the only slave), and instead of

specifying the slave's address, the CPU specifies one of two commands: '3' for temperature and '5' for humidity.

To communicate with the SHT11 sensor, the TelosB uses pins 1.5 and 1.6 as I2C data and clock ports, respectively, and pin 1.7 to supply power to the sensor.

We also noticed that the sensor requires some time to initialize before communication can begin.

The boards sends to the UART port a message specifying the measured temperature.

  

3. Setting up the IR transmitter

To set up an LED in PWM mode, we needed it to be able to set an on-off cycle of 38 KHz.

Since the TelosB's crystal oscillator-derived timers can only be set as high as 32 KHz, we used the crystal oscillator-derived timer to calibrate the DCO and TimerA so that TimerA

generates an interrupt at 32 KHz, and using the CCR1 compare/set register, sends reset/set signals to the board's GIO2 port which in turn, operates external LEDs.

The external LEDs are connected to the board's U2.1 and U2.9 pins (Analog VCC and Analog Ground) and U28.3 pin (GIO2).

 

4. Examining the remote-control IR protocol.

Using the original AC's remote-control and oscilloscope, we recorded several IR commands.

We noticed that the commands consist of two identical 65-bit strings, prefixed by a 'sync' signal.

Each command is a complete 'state', consisting of mode, temperature, and other parameters (such as the blinds movement).

The structure of the command is:

[sync]10000000|10001000|0TTTTT00|00000000|00000000|0000PPPP|0000BBBB|CCCCCCCC|1

 

[sync] is a long (8 ms) 'on' signal followed by a shorter (4 ms) signal.

1's and are represented by long (~1.6 ms) 'on' signal followed by a short (~0.6 ms) 'off' signal, and 0's are the short 'on' signals followed by a long 'off' signal.

TTTTT is the 5-bit temperature in Celsius, encoded in big endians.

PPPP is the power status, where 1100 is 'on' (possibly also, 'cool' mode) and 0011 is 'off'

BBBB is the vertical blinds status (i.e. the motor that moves the blinds up and down), where 0011 is 'automatic' and 1100 is 'off'.

CCCCCCCC are checksum bits, which we were unable to interpret.

 

5. Sending IR commands

To send a temperature command we used a 66-bit buffer in memory (the first bit reserved for the 'sync' signal), and for each bit we determined the length (in 38 KHz cycles) of the 'on'

phase and 'off' phase according to the current bit.

When a command is sent, both red and green leds are lit, and the board sends to the UART port a message stating the temperature.

 

6. Combining Logic

We set up the program so that every 10 seconds we measure the temperature.

If the room temperature is lower/higher from the target temperature (25) we send a temperature-command to the air-conditioner at one degree above/below the target temperature.