I2C Anemometer cheap wind data logger

Not rated 24,271

I2C Anemometer cheap wind data logger
I2C Anemometer cheap wind data logger

The board is relatively simple and is based on a PCF8574, which provides the output of a CD 4040 counter to the I2C bus. A DIP switch is included to select the PCF8574 address, along with some LEDs for power and wind activity indication. The DIP switch was not soldered, resulting in the circuit having the address 0x27. After activating the anemometer, the green LED blinked, and a scan on the I2C bus confirmed that the PCF8574 was correctly detected. Subsequently, the anemometer was installed on the roof. Following the hardware setup, software development commenced. Due to insufficient I2C support in Perl (as CPAN could not locate Device::SMBus), the decision was made to switch to C(+) to complete the task using the i2c-dev interface provided by the Linux kernel. The program, named windlogd (wind-logger-daemon), reads counter values and outputs the current wind speed, as shown in the following log: [root@kynes windlogd]#. /windlogd -s 0x27 -d /dev/i2c-1 Thu Oct 21 10:53:56 2010: samples 108, 92: freq 5.333 Hz, wind speed 3.378 m/s Thu Oct 21 10:53:59 2010: samples 124, 108: freq 5.333 Hz, wind speed 3.378 m/s Thu Oct 21 10:54:02 2010: samples 140, 124: freq 5.333 Hz, wind speed 3.378 m/s Thu Oct 21 10:54:05 2010: samples 160, 140: freq 6.667 Hz, wind speed 4.156 m/s. The transfer function between the anemometer and the counter is defined in the source code. The -d argument specifies the bus to be used (defaulting to i2c-0), while the -s argument is mandatory and indicates the device address, which can be expressed in both decimal and hexadecimal formats using the 0x prefix.

The circuit design utilizes a PCF8574 I/O expander, which communicates with a CD 4040 binary counter via the I2C protocol. The PCF8574 allows for easy address selection through a DIP switch, facilitating multiple devices on the same I2C bus. The circuit is equipped with indicator LEDs that signal power status and wind activity, providing visual feedback during operation.

The CD 4040 counter is responsible for counting pulses generated by the anemometer, which translates wind speed into electrical signals. The output from the CD 4040 is fed into the PCF8574, which converts the parallel data into a serial format suitable for I2C transmission. This configuration enables efficient data communication between the hardware and a host system, typically a microcontroller or a computer.

The software component, windlogd, is designed to read the data from the I2C bus, process the counter values, and calculate wind speed based on the frequency of the pulses received. The program employs the i2c-dev interface, which provides a user-friendly method to interact with I2C devices in a Linux environment. The command-line options allow users to specify the device address and the I2C bus, making the setup flexible and adaptable to various configurations.

In summary, this electronic circuit integrates a PCF8574 I/O expander with a CD 4040 counter to create a wind speed measurement system. The combination of hardware and software effectively captures and displays wind speed data, making it suitable for applications in meteorology and environmental monitoring.The board is rather simple and is based on a PCF8574 providing to the I2C the output of a CD 4040 counter. A dip switch is provided to select the PCF8574 address and some leds for power on and wind activity. The DIP switch was not soldered thus the circuit will have the address 0G—27. After blowing the anemometer the green led was blinking and a scan on the i2c bus showed that the PCF 8574 was correctly detected. It was time to put the anemometer on the roof: After the hardware, it came the time to write the software. Due to the disappointing I2C support of perl (CPAN couldn`t find Device::SMBus), I`ve decided to switch to C(+) to get the thing done using the i2c-dev interface available from Linux kernel.

The program, named windlogd (wind-logger-daemon) reads the counter values and output the current speed, as show in the following: [root@kynes windlogd]#. /windlogd -s 0x27 -d /dev/i2c-1 Thu Oct 21 10:53:56 2010: samples 108, 92: freq 5. 333 Hz, wind speed 3. 378 m/s Thu Oct 21 10:53:59 2010: samples 124, 108: freq 5. 333 Hz, wind speed 3. 378 m/s Thu Oct 21 10:54:02 2010: samples 140, 124: freq 5. 333 Hz, wind speed 3. 378 m/s. samples 160, 140: freq 6. 667 Hz, wind speed 4. 156 m/s The transfer function between the anemometer is defined in the source. The -d argument sets the bus to be used (defaults to i2c-0), while -s is mandatory and is the device address (can be expressed both in decimal and hexadecimal using the 0x prefix).

🔗 External reference