Author Topic: Controlling LED channels  (Read 8651 times)

0 Members and 1 Guest are viewing this topic.

Offline cio74

  • Administrator
  • Hero Member
  • *****
  • Posts: 523
  • Karma: 1

+Info

Controlling LED channels
« on: November 03, 2014, 10:20:52 PM »
I have to start controlling the LED driver board we have designed or any led board that uses 5v PWM signal for the dimming signals.

What is required is a RaspberryPi B/B+, the Adafruit PCA9685 board or any board with that chip and a LED driver that accepts 5v PWM signal and a RTC (Real Time Clock) module.

In my case I will be using an older rPi B along with an older ReefPi controller and the new LED board we have designed. Whatever you are using the basics are the same and programming wise there are no differences. Assuming you have a RaspberryPi, a PCA board and some Meanwell LDD drivers you're good to go. I would also start assuming the Rapsbian operating system has been installed on the Rpi.

The hardware connections have been explained in the past, all modules shares the I2C lines, these are

SCA
SCL

and we'll need to connect all modules GND lines.

RTC is useful to set the start and the end of our lighting time, there are some tutorials about how to tell rPi to use a hardware clock, good if no network connectivity.

I'll be continue tomorrow with an example of how to control 3 led channels and set independent dimming values, ideally with some pictures of the things running :)

Offline cio74

  • Administrator
  • Hero Member
  • *****
  • Posts: 523
  • Karma: 1

+Info

Re: Controlling LED channels
« Reply #1 on: November 03, 2014, 10:23:22 PM »
As a matter of fact I think Pete has already dome some work, if he likes to carry on, not sure if he got the RaspberryPi board.

Offline dentex

  • Newbie
  • *
  • Posts: 3
  • Karma: 0

+Info

  • Gender: Male
    • dentex's Blog
Re: Controlling LED channels
« Reply #2 on: November 13, 2014, 01:17:58 PM »
Hello,
Just a though: did you ever think about controlling your led builds with PWM signals directly generated from the RaspberryPi's gpio pins? This would simplify the design, not needing the PCA9685 board, and gives perfect results if you use the servoblaster library.
I'm already using this solution successfully, although not with LEDs drivers as the LDD-H, but with a simple LED strip connected to its 12V power adapter and a ULN2003A to do the "PWM to analog", dropping the 12V for the dimming.

Sorry if I'm missing something else. I joined this forum today and anywau I'm not an expert in EE, I'm just learning all I can :)
« Last Edit: November 13, 2014, 01:19:51 PM by dentex »
_dentex_

Offline cio74

  • Administrator
  • Hero Member
  • *****
  • Posts: 523
  • Karma: 1

+Info

Re: Controlling LED channels
« Reply #3 on: November 13, 2014, 10:32:08 PM »
It can be done but the lack of hardware PWM channels provided by the rPi board was the reason to actually look at alternatives. The PCA9685 chip has 16 channels all of them are 12 bit, 0-4095 range, this is very good for the aquarium.

There is a library provided by Adafruit, it's python, that can be easily adapted to our needs. I have done some tests and it works just fine.

We try to on use the i2c bus from the rPi, have it do the management of other hardware devices and not rely on itself to do the hardware tasks. if we stick to a protocol it won't really matter what device is doing what job, as long as they obey the command and return the feedback it's all fine.

Offline cio74

  • Administrator
  • Hero Member
  • *****
  • Posts: 523
  • Karma: 1

+Info

Re: Controlling LED channels
« Reply #4 on: December 01, 2014, 08:35:10 PM »
Getting some help from Abed with the web programming I have managed to control the lights over the network. This is a short video demonstrating 3 channels led control from a web page, a PHP script calling a shell script that controls the lights by sending commands over the i2c bus.

The page is loaded from a common unbranded tablet running Android, basically any browser in any platform will do.


« Last Edit: December 01, 2014, 08:38:42 PM by cio74 »

Offline promazine

  • Administrator
  • Sr. Member
  • *****
  • Posts: 292
  • Karma: 2

+Info

  • Gender: Male
Re: Controlling LED channels
« Reply #5 on: December 01, 2014, 10:00:42 PM »
Superb :) getting ever closer!


Sent from my iPhone using Tapatalk
Nothing good happens fast in a reef tank......

Offline pimass_

  • Newbie
  • *
  • Posts: 4
  • Karma: 0

+Info

  • Gender: Male
Re: Controlling LED channels
« Reply #6 on: December 03, 2014, 08:26:32 PM »
Hello guys, tell me, whether I understand how to connect Adafruit PCA9685 board to the driver LDD?


Offline cio74

  • Administrator
  • Hero Member
  • *****
  • Posts: 523
  • Karma: 1

+Info

Re: Controlling LED channels
« Reply #7 on: December 03, 2014, 09:25:41 PM »
The wiring is correct.
« Last Edit: December 03, 2014, 09:28:39 PM by cio74 »

Offline pimass_

  • Newbie
  • *
  • Posts: 4
  • Karma: 0

+Info

  • Gender: Male
Re: Controlling LED channels
« Reply #8 on: December 03, 2014, 09:39:26 PM »
Thanks  :)

Offline pimass_

  • Newbie
  • *
  • Posts: 4
  • Karma: 0

+Info

  • Gender: Male
Re: Controlling LED channels
« Reply #9 on: May 17, 2015, 02:49:08 PM »
Guys, tell me who what libraries are used to work with Adafruit PCA9685 board, that's not something I did not get :(

Offline jimbob

  • Newbie
  • *
  • Posts: 32
  • Karma: 0

+Info

  • Gender: Male
Re: Controlling LED channels
« Reply #10 on: May 18, 2015, 02:10:51 PM »
https://learn.adafruit.com/downloads/pdf/adafruit-16-channel-servo-driver-with-raspberry-pi.pdf
pg. 9

https://pythonhosted.org/RPIO/pwm_py.html

two ways to dim now they added pwm through dma timing on the pi..

the pi takes a long time to boot compared to a mcu.. just something to think about
« Last Edit: May 18, 2015, 02:25:01 PM by jimbob »
nuthen here