Light Controller not with Reef-Pi

j3tang

New Member
View Badges
Joined
Mar 21, 2022
Messages
5
Reaction score
3
Location
Toronto
Rating - 0%
0   0   0
Hi all

New here and I've been exploring the world of reef-pi, and while I've been contemplating switching to the Reef-Pi I was trying to understand how the light controller works. I was wondering, even if i don't switch to reef-pi, could I still achieve the same by going through the guide and doing it with an ESP8266 board through ESPHOME instead of using Reef-Pi

Based on the schematic in the Lighting guide, the pins used on the Pi are the SDA and SCL i2c pinouts (aside from power and ground) and the ESP8266 has them too. In my uneducated mind, it's as simple as just replacing the Pi with an ESP8266. Assuming that it is possible, the difficult part would be coming up with the sketch that needs to be developed in ESPHOME. The motivation for this is that I would much rather have this controller interface with my Home Assistant setup and be controlled there instead.

I can understand there may not be much appetite for the Home Assistant integration, but would still appreciate insight as to whether or not an ESP8266 would be a possible replacement for the Pi.
 

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
9,843
Reaction score
17,058
Location
Pleasant Hill, Concord
Rating - 0%
0   0   0
Yes you absolutely can . But you have to do all the features by yourself (even for light controller ) and you are limited by micro controller ecosystem (c or circuit python or nodemcu) . If you don’t use those features , it will be lot easier yo just automate a specific type of lighting with Esp32 . I’m not sure if you need pca9685/i2c
 
OP
OP
J

j3tang

New Member
View Badges
Joined
Mar 21, 2022
Messages
5
Reaction score
3
Location
Toronto
Rating - 0%
0   0   0
I'm definitely not capable of coding in C or python, hence my motivation to have the ESP device tie into HomeAssistant :)

My understanding was that the pca9685 would be able to do multi-channel, so that would give me the option of expanding to additional lighting. I assume with just the 1 ESP board only, I'd only be able to do 1 channel? Or am I confused?
 

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
9,843
Reaction score
17,058
Location
Pleasant Hill, Concord
Rating - 0%
0   0   0
I don't know. there are components involved that I have never used and am not aware of the integration mechanics. The only way for me to lay confidence is by doing an end to end test or from someone who has done it.
 
OP
OP
J

j3tang

New Member
View Badges
Joined
Mar 21, 2022
Messages
5
Reaction score
3
Location
Toronto
Rating - 0%
0   0   0
Fair enough!

I’ve just begun piecing this together, but so far the ESP device powers and finds the pca9685 in the i2c scan. So far so good :p

Also curious as to why 10V isn’t just directly plugged into the pca9685 through the v+ and gnd at the top of the board instead?
 

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
9,843
Reaction score
17,058
Location
Pleasant Hill, Concord
Rating - 0%
0   0   0
Fair enough!

I’ve just begun piecing this together, but so far the ESP device powers and finds the pca9685 in the i2c scan. So far so good :p

Also curious as to why 10V isn’t just directly plugged into the pca9685 through the v+ and gnd at the top of the board instead?
pca9685 is rated for 5v
 
OP
OP
J

j3tang

New Member
View Badges
Joined
Mar 21, 2022
Messages
5
Reaction score
3
Location
Toronto
Rating - 0%
0   0   0
thanks for that Ranjib, I ended up going back to read the spec sheet on the board again just to see if there was anything else obvious I was missing.

I've been putting this together slowly and testing things bit by bit ... for now I've got just 1 channel hooked up and some things seem a bit off ....

Instead of the PI, I have an ESP board powered by USB and from the board, the 5V, gnd, SDA and SCL connect to the VCC, gnd, SDA and SCL on the pca9685. When I measure the output across the PWM pin and gnd, I see that at 0% lighting, I get 0V -- check! When I ramp it to 100% lighting, i get 4.5V -- check!

The in-between percentages are 0.65V @ 50%, 2.0V @ 75%, etc. The numbers don't seem unreasonable but look very exponential because there is hardly anything below 50%, but then again maybe hard to say because PWM is not a constant voltage so not easily measured by the multimeter ...... ???

Anyhow, next I introduce a 12V/2A source to a buck convertor and tweak the output of it down to 10V. Then I take the PWM output and connect it to a breadboard with all the resistors/transistors for the 1 channel. From the Vout off of the transistor collector leg I measure across to ground and I get ~ 9.70V ........ while the lighting is at 0%. When I ramp it all the way up to 100%, the voltage changes marginally (by 0.1V) .... in the wrong direction. I get ~9.6V @ 100%

I double checked to make sure it was an NPN transistor. I also tried flipping the transistor around but that resulted in a permanent 7.5V regardless of the lighting level. Next thing I was going to try to do was put in another buck converter and tap off of the 12V/2A and use it to power the ESP board, but I don't think that has anything to do with the issue .....


Assuming the pca9685 is functioning correctly, what could be wrong with the remainder of the circuit?
Not sure if a pic of the wiring would help, but I kinda assumed that with it being pretty simple to connect up I didn't screw that part up .. haha, if needed, I can get a photo ...
 
OP
OP
J

j3tang

New Member
View Badges
Joined
Mar 21, 2022
Messages
5
Reaction score
3
Location
Toronto
Rating - 0%
0   0   0
Not sure what happened, but while I was cleaning up the wiring things started to work properly … LoL

anyhow, I also decided to mount the esp onto the breadboard too in order to conserve space. So now it’s 2 buck convertors, a pca9685 and a breadboard. There’s still additional space for more channels on the board too.

one other thing that didn’t happen according to plan was that when the lights were controlled off, the output voltage was at its max 10V, but when controlled on, the output voltage was at 0 V. only thing necessary was to put in an invert command on the outputs and everything worked perfectly.

now the only thing left to do is find a nice compact project box for all of this:

A63873D4-C203-43E1-B6E6-C81ABB5D8AEA.jpeg


And the esp sketch for the controller in case anyone sees this in the future and is looking.

i2c:
sda: 4
scl: 5
scan: true
frequency: 10000

pca9685:
id: 'pca9685_hub'
frequency: 1500
address: 0x40

# Individual outputs
output:
- platform: pca9685
pca9685_id: 'pca9685_hub'
id: "PWM0"
channel: 0
inverted: true
- platform: pca9685
pca9685_id: 'pca9685_hub'
id: "PWM1"
channel: 1
inverted: true

light:
- platform: monochromatic
name: "Reef Blue"
output: PWM0
- platform: monochromatic
name: "Reef White"
output: PWM1

sensor:
- platform: wifi_signal
name: "WiFi Signal ReefLight"
update_interval: 60s
 
Last edited:

Creating a strong bulwark: Did you consider floor support for your reef tank?

  • I put a major focus on floor support.

    Votes: 40 41.7%
  • I put minimal focus on floor support.

    Votes: 21 21.9%
  • I put no focus on floor support.

    Votes: 33 34.4%
  • Other.

    Votes: 2 2.1%
Back
Top