pihome-shc / pihome

PiHome - Smart Heating, Ventilation and Air Conditioning (HVAC)
http://www.pihome.eu
Other
55 stars 25 forks source link

Multi Zone Relay Module #248

Closed twa127 closed 4 years ago

twa127 commented 4 years ago

I have been looking at the existing i2c relay code, with the aim of bringing it in-line with the GPIO relay code. This has made me realize that the existing i2c solution is hardware specific, the code is tailored for the ByVac BV4627 relay module and it appears that ByVac no longer trade, hence it's a bit of a dead-end. Their do not appear to be many alternatives available and any i2c module with multiple relays will have its own specific way of controlling the individual relays, for example the Sparkfun Qwiic Quad Relay (COM-15102) uses a specific single byte to control each relay, while the BV4627 uses a sequence of bytes to select a relay and set its state.

For systems which require a large number of zone relays, some type of interface would be required to avoid using a large number of GPIO pins. The interface could be i2c or SPI, or 1-wire (even RS232). My initial thought is using an Arduino i2c 8 channel relay driver shield https://www.robotshop.com/uk/8-channel-relay-driver-shield.html coupled with perhaps a Arduino Uno and an off-the-shelf 8 relay module. The Uno could be configured as a wireless node with or without a temperature sensor. The 8 channel relay driver shield is stackable so there is room for expansion. Any thoughts?

I've attached a single file python 3 i2c relay control for the BV4627 if anyone is in a position to test.

i2cRelay.zip

harvybob commented 4 years ago

Hi @twa127. I think I'm the only one using i2c at the moment - and im the only one with the ByVac boards!

ByVac has indeed stopped trading, DCS Electronics https://www.dcselectronics.co.uk/ has taken over the hardware and will be looking to manufacture these in the future, however they did not get the licence for software so not sure where that leaves the support for these going forward.

With regards to the i2cRelay file, will it be used in the same way? board number, relay number and then on/off?

twa127 commented 4 years ago

Hi

Yes should work exactly the same way

Sent from my iPhone

On 8 Jun 2020, at 09:16, harvybob notifications@github.com wrote:

 Hi @twa127. I think I'm the only one using i2c at the moment - and im the only one with the ByVac boards!

ByVac has indeed stopped trading, DCS Electronics has taken over the hardware and will be looking to manufacture these in the future, however they did not get the licence for software so not sure where that leaves the support for these going forward.

With regards to the i2cRelay file, will it be used in the same way? board number, relay number and then on/off?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

harvybob commented 4 years ago

Just downloading micropython as that is a dependency I do not have installed at the moment...

harvybob commented 4 years ago

Having problems with micropython -

I downloaded the latest one - 1.12

untar'ed it. cd mpy-cross make

let it complete then tried to run the i2c script and got the following:


  _____    _   _    _
 |  __ \  (_) | |  | |
 | |__) |  _  | |__| |   ___    _ __ ___     ___
 |  ___/  | | |  __  |  / _ \  | |_  \_ \   / _ \
 | |      | | | |  | | | (_) | | | | | | | |  __/
 |_|      |_| |_|  |_|  \___/  |_| |_| |_|  \___|

    S M A R T   H E A T I N G   C O N T R O L

********************************************************
*   I2C Interface Relay Support Communication Script   *
*   Build Date: 11/09/2019 Version 0.02                *
*   Last Modified: 06/06/2020                          *
*                                 Have Fun - PiHome.eu *
********************************************************

Traceback (most recent call last):
  File "i2cRelay.py", line 33, in <module>
    from micropython import const
ImportError: No module named 'micropython'
twa127 commented 4 years ago

ok I'll come up with a version without micropython

twa127 commented 4 years ago

version with no micropython

i2cRelay.zip

harvybob commented 4 years ago

Had to install some additional software: sudo apt-get install python3-pip

sudo pip3 install adafruit-circuitpython-busdevice

Once that was installed, the new i2c code works fine as follows: to switch on relay A (10) on board 32: python3 i2cRelay.py 32 10 1

to switch off relay A (10) on board 32: python3 i2cRelay.py 32 10 0

I switched each on board 32 and 33 without problems And i also learnt that you can turn off all relays with: python3 i2cRelay.py 32 18 1

and you can turn on all relays with: python3 i2cRelay.py 32 19 1

twa127 commented 4 years ago

glad it worked okay, does add much but brings code in-line with the GPIO relay

pihome-shc commented 4 years ago

@twa127 any further update on this? or can this be closed ?