reef-pi :: An opensource reef tank controller based on Raspberry Pi.

Free Phyto Promo
Spend $39+ → free 16oz Phyto · Use code FREEPHYTO at checkout · $16.99 value · Densest 6-species blend · Free shipping on every order · 100% live arrival guaranteed Spend $39+ → free 16oz Phyto · Use code FREEPHYTO at checkout · $16.99 value · Densest 6-species blend · Free shipping on every order · 100% live arrival guaranteed
Shop Now Code: FREEPHYTO

Schreiber

Leviathan
View Badges
Joined
Jun 28, 2016
Messages
475
Reaction score
594
Location
Knoxville
Rating - 0%
0   0   0
On the topic of PCA9685... I can use the PWM output from the PCA for the L293d Enable, correct? That would free up a couple of GPIO pins for me if that's the case.


How do I set these jacks up in my configuration? I'm wanting to use outputs 12 & 13 from the PCA9685 as my PWM outputs for EN 1,2 & EN 3,4 on the L293D. In the Adafruit guide, pins 0 & 1 are being used with the RPi as the driver. I know I have to switch my driver to PCA9685, but are the pins I need to use 12 & 13? Or is the numbering scheme different here as well (like on the Pi, GPIO 18 is "pin 0"? I remember having a lot of trouble with the jacks when I was using the wrong pin in my previous build & I'm wanting to avoid that headache again!
 

sfgabe

Active Member
View Badges
Joined
Sep 7, 2018
Messages
178
Reaction score
258
Rating - 0%
0   0   0
How do I set these jacks up in my configuration? I'm wanting to use outputs 12 & 13 from the PCA9685 as my PWM outputs for EN 1,2 & EN 3,4 on the L293D. In the Adafruit guide, pins 0 & 1 are being used with the RPi as the driver. I know I have to switch my driver to PCA9685, but are the pins I need to use 12 & 13? Or is the numbering scheme different here as well (like on the Pi, GPIO 18 is "pin 0"? I remember having a lot of trouble with the jacks when I was using the wrong pin in my previous build & I'm wanting to avoid that headache again!
I use an L293D (H-bridge board) for exactly this to power my doser pump motors. The pins are entered into reef-pi as 0,1,2,3,4, etc just like the rpi driver, but there's more of them. You'll need 6 pins, ENA, 1, & 2, and ENB, 3, & 4 - which for me are 0,1,2,3,4,& 5 on the PCA9685. If you're powering something like a motor, EN will be the "power" switch and then you'll either end up with 1 dummy pin that's always set to "off" or be able to switch between forward and reverse by turning one high and one low and vice versa.
 

Schreiber

Leviathan
View Badges
Joined
Jun 28, 2016
Messages
475
Reaction score
594
Location
Knoxville
Rating - 0%
0   0   0
I use an L293D (H-bridge board) for exactly this to power my doser pump motors. The pins are entered into reef-pi as 0,1,2,3,4, etc just like the rpi driver, but there's more of them. You'll need 6 pins, ENA, 1, & 2, and ENB, 3, & 4 - which for me are 0,1,2,3,4,& 5 on the PCA9685. If you're powering something like a motor, EN will be the "power" switch and then you'll either end up with 1 dummy pin that's always set to "off" or be able to switch between forward and reverse by turning one high and one low and vice versa.

Interesting. I had been under the impression you had to use the GPIO pins for the Inputs on the L293D, because the PCA9685 was set to a much higher frequency.

So, if the PCA9685 outputs can be used in this way, what's keeping us from using them to control relay outputs as well?
 

Spathodus

New Member
View Badges
Joined
Oct 16, 2019
Messages
9
Reaction score
10
Rating - 0%
0   0   0
Thank you so much for the kind words. It means everything to me and rest of the folks who makes this project possible.

I think this is a bug in the pca9695 driver where we are not sending special instruction for 0 duty_cycle. https://github.com/reef-pi/reef-pi/issues/794
I plan to fix it as part of 3.0 release. If possible use a timer to cut off the power during off cycle.

Thank you for your quick response. I might route the incoming driver power through a timed relay then.
 

sfgabe

Active Member
View Badges
Joined
Sep 7, 2018
Messages
178
Reaction score
258
Rating - 0%
0   0   0
Interesting. I had been under the impression you had to use the GPIO pins for the Inputs on the L293D, because the PCA9685 was set to a much higher frequency.

So, if the PCA9685 outputs can be used in this way, what's keeping us from using them to control relay outputs as well?
As far as I understand, the PCA9685 is specifically for things that require a PWM signal (different from frequency), so basically leds and servos only.
 
OP
OP
Ranjib

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
9,876
Reaction score
16,680
Location
Pleasant Hill, Concord
Rating - 0%
0   0   0
How do I set these jacks up in my configuration? I'm wanting to use outputs 12 & 13 from the PCA9685 as my PWM outputs for EN 1,2 & EN 3,4 on the L293D. In the Adafruit guide, pins 0 & 1 are being used with the RPi as the driver. I know I have to switch my driver to PCA9685, but are the pins I need to use 12 & 13? Or is the numbering scheme different here as well (like on the Pi, GPIO 18 is "pin 0"? I remember having a lot of trouble with the jacks when I was using the wrong pin in my previous build & I'm wanting to avoid that headache again!
You need only two pwm pins, en1 and en2. IN1/2/3/4 all can be connected to pi GPIO if you want to contol the moto diection. For LEDs it does not make sense. You can just hook them up to 3.3V rail and GND,
 

sfgabe

Active Member
View Badges
Joined
Sep 7, 2018
Messages
178
Reaction score
258
Rating - 0%
0   0   0
You need only two pwm pins, en1 and en2. IN1/2/3/4 all can be connected to pi GPIO if you want to contol the moto diection. For LEDs it does not make sense. You can just hook them up to 3.3V rail and GND,
If you want dimming ability on LEDs it sometimes makes sense to use a PWM signal.
 
OP
OP
Ranjib

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
9,876
Reaction score
16,680
Location
Pleasant Hill, Concord
Rating - 0%
0   0   0
As far as I understand, the PCA9685 is specifically for things that require a PWM signal (different from frequency), so basically leds and servos only.
with 3.0 , we will be able to use pwm outputs as notmal digital output. In that case its basically 100% duty cyle or 0% duty cycle. So L293D could be entirely driven by pca9685 IC, or even relay contol. I have not tested this, theres a pca9685 driver bug that also i need to fix before i start field testing
 
OP
OP
Ranjib

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
9,876
Reaction score
16,680
Location
Pleasant Hill, Concord
Rating - 0%
0   0   0
If you want dimming ability on LEDs it sometimes makes sense to use a PWM signal.
yes, and thats why en1, en2 is the pwm input. Rest does not need to be, IN1/2/3/4 all can be simple 3.3v/GND
 

Urtoo

Well-Known Member
View Badges
Joined
Jul 1, 2019
Messages
688
Reaction score
865
Rating - 0%
0   0   0
HS300 is in hand. After maleficent movie night, I will solder a header to the pi zero and start getting running.
Pictures will be in my build thread, maybe tomorrow after RAP.
Speaking of which, anyone in here going tomorrow?
 
OP
OP
Ranjib

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
9,876
Reaction score
16,680
Location
Pleasant Hill, Concord
Rating - 0%
0   0   0
HS300 is in hand. After maleficent movie night, I will solder a header to the pi zero and start getting running.
Pictures will be in my build thread, maybe tomorrow after RAP.
Speaking of which, anyone in here going tomorrow?
Nope. Was in orlando.
 
OP
OP
Ranjib

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
9,876
Reaction score
16,680
Location
Pleasant Hill, Concord
Rating - 0%
0   0   0
As far as I understand, the PCA9685 is specifically for things that require a PWM signal (different from frequency), so basically leds and servos only.
with 3.0 , we will be able to use pwm outputs as notmal digital output. In that case its basically 100% duty cyle or 0% duty cycle. So L293D could be entirely driven by pca9685 IC, or even relay contol. I have not tested this, theres a pca9685 driver bug that also i need to fix before i start field testing
 
OP
OP
Ranjib

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
9,876
Reaction score
16,680
Location
Pleasant Hill, Concord
Rating - 0%
0   0   0
reef-pi 3.0 new pwm profiles:
Fixed: Constant intensity for given time period
Screen Shot 2019-10-20 at 11.40.01 PM.png


Interval: Linear interpolation of a set of intensities at used defined fixed time interval. (Like auto in reef-pi 2.0, but can be used with arbitrary time intervals, like 15 min).
Screen Shot 2019-10-20 at 11.51.56 PM.png



Diurnal:
Screen Shot 2019-10-21 at 12.03.44 AM.png

Sine:
Screen Shot 2019-10-21 at 12.48.58 AM.png


Random:
Screen Shot 2019-10-21 at 12.40.50 AM.png


Lunar: Like sine in daily intensity cycle, but max intensity changes with 27 days cycle. Graph is for three months. Each peak representing a daily sine cycle
Screen Shot 2019-10-21 at 12.50.04 AM.png


Composite: A set of sub-profiles each with a specific duration and min/max intensity. The example graph combines aiurnal, sine, random and fixed profiles.
Screen Shot 2019-10-21 at 1.08.09 AM.png


These things are now present in the backend/controller. We are working on building the UI.
 
Last edited:

Urtoo

Well-Known Member
View Badges
Joined
Jul 1, 2019
Messages
688
Reaction score
865
Rating - 0%
0   0   0
After too long of a delay... I am starting

first to solder some pins to my pi zero. I will overload my build thread with photos
045A2C5C-C341-4804-8AD8-CFBB413F4D8B.jpeg
 

Bigtrout

Valuable Member
View Badges
Joined
Dec 16, 2018
Messages
1,189
Reaction score
2,811
Rating - 0%
0   0   0
reef-pi 3.0 new pwm profiles:
Fixed: Constant intensity for given time period
Screen Shot 2019-10-20 at 11.40.01 PM.png


Interval: Linear interpolation of a set of intensities at used defined fixed time interval. (Like auto in reef-pi 2.0, but can be used with arbitrary time intervals, like 15 min).
Screen Shot 2019-10-20 at 11.51.56 PM.png



Diurnal:
Screen Shot 2019-10-21 at 12.03.44 AM.png

Sine:
Screen Shot 2019-10-21 at 12.48.58 AM.png


Random:
Screen Shot 2019-10-21 at 12.40.50 AM.png


Lunar: Like sine in daily intensity cycle, but max intensity changes with 27 days cycle. Graph is for three months. Each peak representing a daily sine cycle
Screen Shot 2019-10-21 at 12.50.04 AM.png


Composite: A set of sub-profiles each with a specific duration and min/max intensity. The example graph combines aiurnal, sine, random and fixed profiles.
Screen Shot 2019-10-21 at 1.08.09 AM.png


These things are now present in the backend/controller. We are working on building the UI.
This is something im really waiting for!

In other news, no problems whatsoever to report. My reef-pi just keeps humming happily along!
 

Schreiber

Leviathan
View Badges
Joined
Jun 28, 2016
Messages
475
Reaction score
594
Location
Knoxville
Rating - 0%
0   0   0
So I'm working with a PCA9685pw & it's driving me up the wall. I can get Adafruit's PCA9685 board to work, but when I try mine, it crashes.

Main PID: 981 (code=exited, status 1/FAILURE)

The weird thing to me is that using i2cdetect, I find the PCA9685 on 0X41 (I have address pin A0 jumpered, so this is expected). So the pi is seeing the chip, but reef pi still doesn't like it.

Using journalctl:
sudo journalctl -fu reef-pi.service
-- Logs begin at Thu 2019-02-14 05:12:02 EST. --
Oct 25 23:25:59 control1 systemd[1]: reef-pi.service: Failed with result 'exit-code'.
Oct 25 23:27:29 control1 systemd[1]: reef-pi.service: Service RestartSec=1min 30s expired, scheduling restart.
Oct 25 23:27:29 control1 systemd[1]: reef-pi.service: Scheduled restart job, restart counter is at 2.
Oct 25 23:27:29 control1 systemd[1]: Stopped raspberry pi based reef tank controller.
Oct 25 23:27:29 control1 systemd[1]: Started raspberry pi based reef tank controller.
Oct 25 23:27:29 control1 reef-pi[995]: 2019/10/25 23:27:29 Setting pca9685 frquency: 1500
Oct 25 23:27:29 control1 reef-pi[995]: 2019/10/25 23:27:29 ERROR: Failed to initialize pca9685 driver with mock i2c bus. Error: remote I/O error
Oct 25 23:27:29 control1 reef-pi[995]: 2019/10/25 23:27:29 ERROR: Failed to initialize controller. Error:remote I/O error
Oct 25 23:27:29 control1 systemd[1]: reef-pi.service: Main process exited, code=exited, status=1/FAILURE
Oct 25 23:27:29 control1 systemd[1]: reef-pi.service: Failed with result 'exit-code'.
Oct 25 23:28:59 control1 systemd[1]: reef-pi.service: Service RestartSec=1min 30s expired, scheduling restart.
Oct 25 23:28:59 control1 systemd[1]: reef-pi.service: Scheduled restart job, restart counter is at 3.
Oct 25 23:28:59 control1 systemd[1]: Stopped raspberry pi based reef tank controller.
Oct 25 23:28:59 control1 systemd[1]: Started raspberry pi based reef tank controller.
Oct 25 23:28:59 control1 reef-pi[1027]: 2019/10/25 23:28:59 Setting pca9685 frquency: 1500
Oct 25 23:28:59 control1 reef-pi[1027]: 2019/10/25 23:28:59 ERROR: Failed to initialize pca9685 driver with mock i2c bus. Error: remote I/O error
Oct 25 23:28:59 control1 reef-pi[1027]: 2019/10/25 23:28:59 ERROR: Failed to initialize controller. Error:remote I/O error
Oct 25 23:28:59 control1 systemd[1]: reef-pi.service: Main process exited, code=exited, status=1/FAILURE
Oct 25 23:28:59 control1 systemd[1]: reef-pi.service: Failed with result 'exit-code'.

1572061445184.png
 
Last edited:

TOP 10 Trending Threads

WHAT AMOUNT OF LIVE ROCK AND SAND SHOULD BE PRIORITIZED FOR OPTIMAL BIODIVERSITY/FILTRATION?

  • 100% live rock + bagged sand

    Votes: 38 26.6%
  • 100% dry rock + 100% live sand

    Votes: 48 33.6%
  • 50/50 live/dry rock, 50/50 live/bagged sand

    Votes: 32 22.4%
  • 75% live rock, 25% live sand

    Votes: 15 10.5%
  • 25% live rock, 75% live sand

    Votes: 10 7.0%
Back
Top