PCA9685

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
pascalspits
Posts: 88
Joined: Tuesday 24 February 2015 16:14
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Belgium
Contact:

PCA9685

Post by pascalspits »

hi,
is there a way to control this module from Domoticz on a Raspi ?

https://www.adafruit.com/product/815
Adafruit 16-Channel 12-bit PWM/Servo Driver - I2C interface - PCA9685

it's I2C so in theory it should be possible ... anyone knows how to do it ?
RasPi2 - Aeotec Z-Stick S2 - Fibaro multisensors - Fibaro RGBW dimmers - ETH08 relais boards
pascalspits
Posts: 88
Joined: Tuesday 24 February 2015 16:14
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Belgium
Contact:

Re: PCA9685

Post by pascalspits »

nobody ?

or any other way to add extra PWM ports to a Raspi ?
I need 8 additional PWM outputs ...
RasPi2 - Aeotec Z-Stick S2 - Fibaro multisensors - Fibaro RGBW dimmers - ETH08 relais boards
pascalspits
Posts: 88
Joined: Tuesday 24 February 2015 16:14
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Belgium
Contact:

Re: PCA9685

Post by pascalspits »

any other way to add extra PWM ports to a Raspi ?
RasPi2 - Aeotec Z-Stick S2 - Fibaro multisensors - Fibaro RGBW dimmers - ETH08 relais boards
pascalspits
Posts: 88
Joined: Tuesday 24 February 2015 16:14
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Belgium
Contact:

Re: PCA9685

Post by pascalspits »

I'm still waiting to expand the amount of PWM pins on my RasPi using this board ...
any way of controlling this I2C board ?
(maybe by scripting ?)
RasPi2 - Aeotec Z-Stick S2 - Fibaro multisensors - Fibaro RGBW dimmers - ETH08 relais boards
elmortero
Posts: 247
Joined: Sunday 29 November 2015 20:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.9639
Location: Spain
Contact:

Re: PCA9685

Post by elmortero »

You could use the python module for that https://github.com/adafruit/Adafruit_Ci ... on_PCA9685

And then setup like this.

PCA9685 <--> python <--> domoticz
pascalspits
Posts: 88
Joined: Tuesday 24 February 2015 16:14
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Belgium
Contact:

Re: PCA9685

Post by pascalspits »

ok, I've downloaded Adafruit driver but what would these python scripts look like, I'm a complete noob in coding ...

would appreciate some help ...

elmortero wrote: Tuesday 21 April 2020 11:37 You could use the python module for that https://github.com/adafruit/Adafruit_Ci ... on_PCA9685

And then setup like this.

PCA9685 <--> python <--> domoticz
RasPi2 - Aeotec Z-Stick S2 - Fibaro multisensors - Fibaro RGBW dimmers - ETH08 relais boards
elmortero
Posts: 247
Joined: Sunday 29 November 2015 20:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.9639
Location: Spain
Contact:

Re: PCA9685

Post by elmortero »

Sorry, can't help you there. DOn't have the boards myself.
I had a quick look at the manual, looks like with no previous experience (and google of course) should be possible to figure it out.
Might have to spend some time on it.
Good luck
pascalspits
Posts: 88
Joined: Tuesday 24 February 2015 16:14
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Belgium
Contact:

Re: PCA9685

Post by pascalspits »

could anybody give me a hand (or some usefull tips) on setting this up ?
I'm really a noob in coding ...
RasPi2 - Aeotec Z-Stick S2 - Fibaro multisensors - Fibaro RGBW dimmers - ETH08 relais boards
pascalspits
Posts: 88
Joined: Tuesday 24 February 2015 16:14
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Belgium
Contact:

PCA9685

Post by pascalspits »

progress update :

I've installed the Adafruit library on my Raspi and connected the board to the I2C bus ...
... and it appears to be working !

I can control the PWM outputs with the demo-scripts that came with the library, when running these scripts directly in Raspi.
I run them by using the command : "python3 pca9685_simpletest.py"
leds go on and off on the PWM board ... all parameters are working ... seems responsive ...

The next step is connecting these python scripts to Domoticz devices, so I copied the script to /home/pi/domoticz/scripts/python/pca9685_simpletest.py so Domoticz can reach it ...
I tried in the "On action" : "script:///home/pi/domoticz/scripts/python/pca9685_simpletest.py"
it doesn't respond, and when I look in the log, I see the error :
"Error executing script command (/home/pi/domoticz/scripts/python/pca9685_simpletest.py). returned: 32256"

what am I doing wrong ?

if you are one of the many python code-wizards on this forum, could you set me on my way, I would be forever gratefull !
I'm a complete newbie/noob at coding and python, but very eager to learn ... sorry !

Thanks in advance !
RasPi2 - Aeotec Z-Stick S2 - Fibaro multisensors - Fibaro RGBW dimmers - ETH08 relais boards
pascalspits
Posts: 88
Joined: Tuesday 24 February 2015 16:14
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Belgium
Contact:

Re: PCA9685

Post by pascalspits »

awesome, it works !!!

THANKS a million !

... learning all the time

this board has 16 PWM outputs, so I can dim 16 LED channels ...
should I now make 16 scripts (32 actually, 1 for ON and 1 for OFF) and link to them from Domoticz devices, or is there a way to controll all in 1 "central" script ?
RasPi2 - Aeotec Z-Stick S2 - Fibaro multisensors - Fibaro RGBW dimmers - ETH08 relais boards
pascalspits
Posts: 88
Joined: Tuesday 24 February 2015 16:14
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Belgium
Contact:

Re: PCA9685

Post by pascalspits »

or can I use the dimmer function ?

I read somewhere that there are 2 kinds of scripts in Domoticz : device scripts and time scripts ... "script_device_demo.py" and "script_time_demo.py"

so should I create a python script for each device, and having it read out the dimmer value of that Domoticz device and sending this (calculated to HEX value) to the output of the appropriate PWM channel ?

in this way I could use 1 script per device and immediately use it as a dimmer, instead of just an on/off switch ... right ?

how should I script this then ?
RasPi2 - Aeotec Z-Stick S2 - Fibaro multisensors - Fibaro RGBW dimmers - ETH08 relais boards
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest