While it’s neat to be able to turn the air conditioner on ahead of time to cool down the room, it would be better if I can get a reading of the temperature in the room. The RPiZ from the Raspberry Pi Zero remote for my air conditioner has plenty of GPIO ports left over, so this is a quick hack to install a temperature diode.
The circuit board
- IR blaster circuit from the previous post
- 10KΩ resistor - diode for the temperature diode.
- DS18B20 temperature sensor - I got mine from Amazon
The Soldered board
We are using one wire protocol to read from the DS18B20, and on GPIO port 22. We need to change the default one wire port on the raspberry pi with the following change to
I added it beneath the other GPIO definitions, so that section looks like this;
dtoverlay=gpio-ir,gpio_pin=24 dtoverlay=gpio-ir-tx,gpio_pin=23 dtoverlay=w1-gpio,gpiopin=22
reboot the system, and then enter the following to enable the appropriate kernels;
now check the following directory for the sensor;
In this case, my thermometer device is
28-3c01a8165e2a and I can get a reading by running the following command;
The second line,
t=28437 tells me that the temperature is 28.437C, or 83.1866F.
My air conditioner remote has the additional functionality of displaying current temperature;
82F is close to 83.1866F, which is within the ±0.5C as per the spec of DS18B20.
I’ve been simply checking the weather from the web before turning the AC on, but this way, I get to know what the temperature inside the apartment.
The temperature might not be exactly correct, but it’s close enough that I can use it to determine if I should turn the AC on and off.