Microblog: A very long article Wikipedia article on the orientation of toilet paper [Jun 7th, 22:52] [R]

Sunday, November 14th, 2021

New Leffakone Infrared Receiver

Categories: [ DIY/Arduino | TV/Leffakone ]

Several months ago, the leffakone infrared receiver started to misbehave. There were a lot of errors in syslog about spikes in the signal, and the problem seemed to come from the serial port on the motherboard rather than from the homebrew IR receiver, connected to the serial port, that I had built in 2002 or 2003 and that I had been using with lirc ever since. One of the symptoms was that unloading the lirc-serial kernel module caused the computer to freeze, while testing the receiver with an oscilloscope seemed to show that it was working correctly. For many months, I was too lazy to do something about it, as using a keyboard with a long enough cord was enough to control leffakone. During the last autumn vacation, I tried to test the receiver with the serial port on minikone, but the latter seems to deliver only 1.2V signals, when the receiver expects at least 7V to power its onboard voltage regulator. So that was not very conclusive.

leffakone_ir_receiver

At the same time, I had the idea of building a CO2 monitor using a Jeenode I had lying around, and somehow I wondered if the IR receiver module would not just fit into one of the Jeenode's ports. Guess what? It fits perfectly, allowing to use the IRQ pin as the input, which is exactly what the Arduino-IRremote library suggests to use. Writing the software was a bit of a headache, because the library assumes that the compiler would run with the -flto option (and the compilation ends with an error if it is not set), but my custom Makefile somehow fails to compile the code correctly if I enable that option. Thankfully, you can get around the problem with #define SUPPRESS_ERROR_MESSAGE_FOR_BEGIN. After that, the program is quite straightforward: configure it for the RC5 protocol (as this is what my remote control produces), read a code and write it to the serial port if it matches the RC5 address. I also added a new feature: if the code is the power on button, it would set a pin to HIGH for a short while, allowing to switch the computer on. I used the Jeenode USB as it has an on-board USB-to-serial adatpter, which makes it perfect to connect to a modern computer. I had one reed relay left from the timer and despite being rated for a 5V control voltage, it works with the Jeenode's 3.3V signal. The Jeenode is connected to the computer with a USB cable where I have replaced the USB Type A connector with a Molex connector so that I can use one of USB headers on the motherboard. Crimping the very small contacts was difficult as I don't have a crimping tool, but the connections seem to be working despite having done quite a poor job of it.

Yesterday, I installed the extra reed relay and the Jeenode onto the PCB that holds the relays of the timer, and now it's inside leffakone and working well. And since I forgot to take a picture, there is no image of what it looks like. In addition, I'm quite happy I have been able to do this project by using only bits and pieces I already had (the Jeenode, the headers, the reed relay, the IR receiver module, the USB cable, the Molex contacts and housing).

[ Posted on November 14th, 2021 at 11:56 | no comment | ]

Trackback Address

https://weber.fi.eu.org/blog/Bricolage/Arduino/new_leffakone_infrared_receiver.trackback

Comments

No comment

Tuesday, November 2nd, 2021

CO2 Meter

Categories: [ DIY/Arduino ]

CO2_Meter_ext

The last issue of Make: magazine had an article about building a CO2 monitor. The concentration of CO2 is apparently a good estimator for the concentration of SARS-CoV-2 in the air, which is correlated to the risk of transmission. The article suggests keeping the concentration of CO2 under 800 ppm when people are wearing masks.

The Make: article proposes a green-yellow-red light indicator, where the light is green when the concentration is below 1000 ppm, yellow above that level and red when it goes above 2000 ppm. These values are rather about indoors air quality and not directly related to limiting the transmission of SARS-CoV-2.

An article from NIST however indicates that the 1000 ppm limit has no basis whatsoever so I decided to use the 800 ppm limit instead and a rather arbitrary limit of 1300 ppm based on looking at Figure 2 in this article which seems to indicate that some cognitive abilities drop around that concentration.

Description

CO2_Meter_int

The device itself is quite simple: it has an on/off switch and a single two-color LED indicator, red and green. The yellow color is obtained by turning on both green and red colors at the same time. It also has a small hole where a paperclip can be inserted for triggering the calibration procedure. The holes next to the power switch expose the CO2 sensor and its temperature/humidity sensor.

Inside the box there is an Arduino-like Jeenode I had lying around with an AA Power board (I have no idea if these are still sold, I've had them around for over ten years). The AA Power board is meant for a single AA battery, but it cannot provide enough current, so I removed the battery clips and connected it to a 2-AA battery holder, via the switch. It seems to be working well with two NiMH rechargeable batteries.

The CO2 sensor is a Sensirion SCD30. It is quite expensive (about 50 EUR), but has an easy to use I2C interface and is the most accurate of the sensors presented in the Make: article. The software is quite trivial (if you except the calibration procedure, see below), and available here. The device automatically makes a measurement ever two seconds, the program reads it and updates the LED accordingly. That's it.

Calibration

There is an automatic calibration procedure that requires to keep the sensor powered for at least 7 days and put it in fresh (outdoors) air at least an hour per day. This is not very practical given that I've estimated that the batteries would last about 25 hours (20 mA for the ATmega, 17 mA for the SCD30, 10 mA for the LED at 3.3 V, with maybe a 80% efficiency for the power board with two 1900 mAh batteries at 2.4 V). There is however also the possibility to expose the sensor to air with a known CO2 concentration and tell it the actual value it is measuring. It then uses this value as a reference point for subsequent measurements. The device is apparently sensitive to changes in shape (e.g. when subjected to mechanical stress during transport) so as a portable device it probably needs to be regularly re-calibrated.

The calibration procedure is simple: place the device outdoors, wait about 2 minutes for it to settle, then introduce a paperclip into the hole and press the button underneath it; the LED will be flashing red. The device will take repeated measurements every 2 seconds, and when a succession of 10 measurements is considered stable enough (i.e. the absolute value of the difference between the first and last of those is at most 1, and the sum of the absolute values of each measurement with its previous one is at most 10), it sets the calibration value to 416 ppm (which seems to be about the average value in 2021). As the device is accurate to +/- 30 ppm, the exact value does not matter so much. The device then returns to its normal operation mode, showing a green, yellow or red light.

What next?

Put a sticker on it with some indications about the LED colors and the reset button hole.

[ Posted on November 2nd, 2021 at 23:22 | 2 comments | ]