About Us Knowledge Base Community Forum Electronics Toolbox FAQ Shipping & Delivery

Community Forum

Share your projects and post your questions

Search
Register or Sign In
Forum

IO Pi Plus and Servo PWM Pi Zero with NodeJS

2458 Views - Created 15/10/2016

15/10/2016

Posted by:
yann

Users Avatar

Hi,

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);
bus1.setPortDirection(0, 0x00);

var servopi = require('../nodeJS/ABElectronics_NodeJS_Libraries/lib/servopi/servopi');
var pwm = new ServoPi(0x40);
pwm.setPWMFrequency(1000);
pwm.outputEnable();
....
bus1.writePin(num, state);
....
pwm.setPWM(num-1, 0, pwm_bright);                //pin n°num (pwm 0-15 = pin 1-16)
-------

Regards
Yann

16/10/2016

Posted by:
andrew

Users Avatar

Location:
United Kingdom

Users Twitter  Users Website  

Hi Yann

Sorry, there was a bug with the Node.js libraries that caused it to use the wrong I2C address when you tried using different libraries at the same time.  I have updated the Servo Pi and IO Pi libraries on github with a new version that should be working correctly.

https://github.com/abelectronicsuk/ABElectronics_NodeJS_Libraries

 

AB Electronics UK Tech Support

17/10/2016

Posted by:
yann

Users Avatar

THANKS Andrew !

Note: documents in Portable Document Format (PDF) require Adobe Acrobat Reader 5.0 or higher to view, download Adobe Acrobat Reader or other PDF reading software for your computer or mobile device.