PWM Control of Ventilation via i2c

1Set up the Raspberry Pi
2Electrical Connection of Sensores and Actuators
2.1AD Converters connected via SPI
2.2Relay on GPIO via Opto-Coupler
2.3PWM Control of Ventilation via i2c
2.4OneWire Temperature Sensor
2.5Ultra-sonic Distrance Measurement
2.6Serial RS232 connection
2.7Stepper Motor Control
3Heating Control
4Ventilation Control (Paul Lüftung, Thermos 200)
5 z-wave


PWM Control of Ventilation via I2C bus

The better approach to set the ventilation level continously is to utilize a LED dimmer:

Raspberry_PCA9530.svg
R1 = 100 kOhm, R2 = 10 kOhm

Activate the I2C bus

There are many good explanations in the web on how to bring up the I2C bus.
Essentially it takes some steps like:

sudo su
raspi-config under the "Advanced Options" enable I2C and SPI.
nano /etc/udev/rules.d/51-i2c.rules
KERNEL=="i2c*", GROUP="gpio", MODE="0660"
nano /etc/modprobe.d/raspi-blacklist.conf
#blacklist spi-bcm2708
#blacklist i2c-bcm2708
nano /etc/modules
snd-bcm2835
i2c-dev
nano /boot/config.txt
dtparam=spi=on
dtparam=i2c1=on
dtparam=i2c_arm=on

Install tools for I2C

apt-get update
apt-get install i2c-tools
apt-get install python-smbus
apt-get install libi2c-dev

Initial test of the I2C bus:
i2cdetect -F 1
i2cdetect -y 1

If it should not work, perhaps it takes one more reboot.
On first trial I only got response "UU" at address 0x1b. After some testing I finally found out, that at the RESET pin of the PCA9530, the 3.3 V potential was missing, so my dimming IC was in permanent reset. After some re-soldering, I got

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: 60 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- -- 

 

Patch Paul "Thermos

To control the ventilators via my PCB, I had to patch the connections of my Paul Thermos unit.
Opening the cover with the Paul logo you"ll see: ThermosKlemmen.jpg

PaulThermosPatch.svg
Of course the transistors are on the PCB, not in the Paul connectors box.

Test the ventilation control

To set the ventilators to 50%, using address 0x60 on bus 1 you may set all registers in one run:
i2cset -y 1 0x60 0x11 0x00 0x80 0x00 0x80 0xe i
where:
0x11 auto increment flag and both output logics with pull up resistors
0x00 frequency of PWM0
0x80 PWM0
0x00 frequency of PWM1
0x80 PWM1
0x0e xxxx1110 set output0 to PWM0 and output1 to PWM1

Or set one PWM by i2cset -y 1 0x60 0x02 0x80
and read back that register
i2cget -y 1 0x60