My project is a Dimmable LED Lighting System for a reef aquarium.
I'm using a Raspberry 3, a IO Pi Plus and a Servo PWM Pi Zero and temperature sensors.
My program is quite simple :
- I'm dimming LED in regards of the time, 09:00am = 0% / 12:00pm = 100% / 9:00pm = 0%
=> it works fine with my dimmer plugged on the "Servo PWM Pi Zero" using NodeJS library
- if the LED temperature is more than 30° (for example) I need to switch on a 12v Fan
=> it works fine with a relay pin plugged in the IO Pi Plus using NodeJS library
My problem is using this 2 cards togother, there is a bug or something I made wrong in my code because I have 2 problem :
1) when I'm dimming PWM, it's turning on/off my relay ! How it's possible ?
2) when I write on a pin of the IO Pi Plus, my relay doesn't turn on/off
I have made lot of tests, If I use only IO Pi Plus, I can manage my relay, If I use only Servo PWM Pi Zero i can dimme my LED, but If I want to use both card, it doesn't work ! It seems like a bus conflict.
Here is a part of my code :
var iopi = require('../nodeJS/ABElectronics_NodeJS_Libraries/lib/iopi/iopi');
var bus1 = new IoPi(0x20);
var servopi = require('../nodeJS/ABElectronics_NodeJS_Libraries/lib/servopi/servopi');
var pwm = new ServoPi(0x40);
pwm.setPWM(num-1, 0, pwm_bright); //pin n°num (pwm 0-15 = pin 1-16)