Dr. Arne Jachens

Set up the Raspberry Pi

no warranty for any of the provided information

Keine Erläuterungen gefunden.

"""
PWM to control Ebmpapst ventilators in Paul Thermos 200
Dr. Arne Jachens
2020-06-20
"""

#import  smbus
from smbus2 import  SMBus

class HvcSendI2C:
    def  __init__(self):
        self.bus = SMBus(1)              # 0 = /dev/i2c-0 , 1 = /dev/i2c-1
        self.ADDRESS  = 96 #0x60         # address on bus, check: i2cdetect -y 1
        self.REG_MODE = 17 #0x11         # auto increment flag, output logics with pull up resistors


    
    def  setPWM(self,level):
        """
        Set the ventilation level [0:1], where 1 is maximal,
        here both ventilation levels are set equal.
        """

        #level percent to integer
        levelInt = []
        for  i,lev in enumerate(level):
            levelInt.append(int( 255*(1.0-lev) ))

        #compose message bytes
        values=[]
        values.append( 00 )     # frequency of PWM0
        values.append(levelInt[0]) # PWM0
        values.append( 00 )     # frequency of PWM1
        values.append(levelInt[1]) # PWM1
        values.append( 14 )     # xxxx1110 set output0 to PWM0 and output1 to PWM1

        #send message
        self.bus.write_i2c_block_data(self.ADDRESS, self.REG_MODE, values)


"""
for  testing
"""
if __name__ == "__main__":
    I2C = HvcSendI2C()
    I2C.setVentilation(0.5)

python

1HvcControl.py
2HvcHCSR04ultrasonic.py
3HvcMain.py
4HvcMotorDriver.py
5HvcOneWire.py
6HvcOperationMode.py
7HvcRaw2phys.py
8HvcReadSPI.py
9HvcSendI2C.py
10HvcSetGPIO.py
11HvcTables.py
12HvcWeather.py
13makeDoc.py

php

1HV_Admin_Login.php
2HV_colorMap.php
3HV_composeH2Oplot.php
4HV_config.php
5HV_H2Olevel.php
6HV_readOperationState.php
7HV_restart.php
8HV_serviceLog.php
9HV_setParameters.php
10HV_showHouse.php
11HV_showLog.php
12HV_showWeatherForecast.php
13HV_TempCal.php
14index.php
15readFilenames.php
16readNamedData.php

Der gesamte Sourcecode darf gemäß GNU General Public License weiterverbreitet werden.