Reef Pi dimming test problems and Raspberry pi native two hardware PWM vs PCA9685

SpyLand

Community Member
Review score
+0 /0 /-0
View Badges
Joined
Nov 21, 2022
Messages
34
Reaction score
47
Review score
+0 /0 /-0
Location
London
Rating - 0%
0   0   0
Running some tests with my new Nicrew HiperReef 100W with 0-10V from Reef Pi I found some odd sort of problems like using a test manual Light raising up with only shows light when on 4, but if I jump to 10 and came back to value 2 it dims even less than the initial 4 value and works... strange. Anyway the lower value that I can have light is with 2, using 1 switch's off.
My connections are the PWM pins from Raspberry connected to a PWM to 0-10V board and from this board to the Nicrew light.

So my first question, is this normal? There is some bug for sure that when going from 0 to 2 there is no light and the first value giving light is 4 but coming from a higher than this value to 2 works and is the lower dim I can get, even lower than the initial 4.

Second question, using an PCA9685 board should give me more precision on all PWM going up or down? Also can I lower the dim value to 1 and still have light on, or this could be a thing from the Nicrew HiperReef light natively?
 
Orphek OR3 reef aquarium LED bar

robsworld78

Well-Known Member
Review score
+0 /0 /-0
View Badges
Joined
Feb 14, 2020
Messages
921
Reaction score
1,222
Review score
+0 /0 /-0
Location
Edmonton, Canada
Rating - 0%
0   0   0
Running some tests with my new Nicrew HiperReef 100W with 0-10V from Reef Pi I found some odd sort of problems like using a test manual Light raising up with only shows light when on 4, but if I jump to 10 and came back to value 2 it dims even less than the initial 4 value and works... strange. Anyway the lower value that I can have light is with 2, using 1 switch's off.
My connections are the PWM pins from Raspberry connected to a PWM to 0-10V board and from this board to the Nicrew light.

So my first question, is this normal? There is some bug for sure that when going from 0 to 2 there is no light and the first value giving light is 4 but coming from a higher than this value to 2 works and is the lower dim I can get, even lower than the initial 4.

Second question, using an PCA9685 board should give me more precision on all PWM going up or down? Also can I lower the dim value to 1 and still have light on, or this could be a thing from the Nicrew HiperReef light natively?
That sounds like a driver issue rather than a bug in reef-pi. If you connect a volt meter to the PWM pin you'll probably see it's doing what it should. Not sure what driver the Nicrew uses but if it's just mosfet driver as lots of cheap lights are then it typically takes more PWM output to wake them up which is likely why it stays lite when you go down to 2.

The PCA9685 wouldn't help with this, I think the Pi PWM is software driven so the number of bits may be programable, either way in reef-pi it's 0-100% so if it was 4095 steps you wouldn't be able to select most of them as 1% would be 41 steps, 2% 82 steps etc...
 

Sral

Well-Known Member
Review score
+0 /0 /-0
View Badges
Joined
May 2, 2022
Messages
589
Reaction score
678
Review score
+0 /0 /-0
Location
Germany
Rating - 0%
0   0   0
I agree, you have several components here:
  • The Pi generating a 3.3V PWM signal between ~GND to ~3.3V
    • that's likely to work since it's just MOSEFT and a pull-up resistor
    • easiest way to test this is to try different PWM ports on the Pi and the PCA9685
  • The 3.3V PWM to 10V converter
    • what exactly does it do ?
      • does it take the PWM and put out a 10V PWM ?
      • does it filter the PWM to DC and amplifies this ?
    • a lot can go wrong there
    • try measuring it's output with a multimeter using VDC, VAC and PWM measurements if available
  • the light
    • I have seen other lights that offset their "zero", like the ReefBreeders Photon V2
    • this is done so that the light is fully off, even if there is some noise on the input line
    • so the light will only turn on at an offset value, pretty much like you are experiencing
 
Zoanthids.com
OP
S

SpyLand

Community Member
Review score
+0 /0 /-0
View Badges
Joined
Nov 21, 2022
Messages
34
Reaction score
47
Review score
+0 /0 /-0
Location
London
Rating - 0%
0   0   0
I agree, you have several components here:
  • The Pi generating a 3.3V PWM signal between ~GND to ~3.3V
    • that's likely to work since it's just MOSEFT and a pull-up resistor
    • easiest way to test this is to try different PWM ports on the Pi and the PCA9685
  • The 3.3V PWM to 10V converter
    • what exactly does it do ?
      • does it take the PWM and put out a 10V PWM ?
      • does it filter the PWM to DC and amplifies this ?
    • a lot can go wrong there
    • try measuring it's output with a multimeter using VDC, VAC and PWM measurements if available
  • the light
    • I have seen other lights that offset their "zero", like the ReefBreeders Photon V2
    • this is done so that the light is fully off, even if there is some noise on the input line
    • so the light will only turn on at an offset value, pretty much like you are experiencing

The 0-10V board is one that has PWM input and 0-10V analog output.
Now I connected the PWM to this board from a PCA9685 one and the lower value from Reef pi that gives light is 3 but only if I had a higher first, example going to to 6 which is the first that turns the light on from 0 then coming to 3.
Doing this I notice the reducing on intensity so his doing something.
This 3 value gives the lowest dim possible before turning off, and measure with the multimeter I get 0.30v on the 0-10v analog output.

I tried also different frequencies on the driver for the PCA9685 board but the behavior is the same more or less, some values puts the the minimal value to turn on from zero at 1 o 2 before or further.

This is the boards I'm using with the normal connections recommended from Raspberry pi to the PCA9685 and from this one to the 0-10v one:

1669479213856.png


1669479259173.png


I don't mind the minimum value being 3, what I don't like is to use it I have to put first some other bigger value being 6 the first that turns the lights one and them I can go down to 3. :eek:
 
Last edited:

Sral

Well-Known Member
Review score
+0 /0 /-0
View Badges
Joined
May 2, 2022
Messages
589
Reaction score
678
Review score
+0 /0 /-0
Location
Germany
Rating - 0%
0   0   0
Hm, do you have a name and/or link to that PWM to 10V Analog board ?
If it is the culprit we might be able to tweak it, I do see a promising potentiometer there ^^

Another thing: you mention measuring 0.30 V on the Analog line. Was that using VDC measurement ?
For completenes I would always try to measure all VDC, VAC and PWM (Frequency and Duty Cycle, e.g. %), since most of the time you can't be sure what kind of signal you have. Measuring 0.30 VDC could either be 0.30 VDC OR 3% duty cycle on a 0-10V PWM signal.
 
OP
S

SpyLand

Community Member
Review score
+0 /0 /-0
View Badges
Joined
Nov 21, 2022
Messages
34
Reaction score
47
Review score
+0 /0 /-0
Location
London
Rating - 0%
0   0   0
Hm, do you have a name and/or link to that PWM to 10V Analog board ?
If it is the culprit we might be able to tweak it, I do see a promising potentiometer there ^^

Another thing: you mention measuring 0.30 V on the Analog line. Was that using VDC measurement ?
For completenes I would always try to measure all VDC, VAC and PWM (Frequency and Duty Cycle, e.g. %), since most of the time you can't be sure what kind of signal you have. Measuring 0.30 VDC could either be 0.30 VDC OR 3% duty cycle on a 0-10V PWM signal.
Hi, this is the link to the PWM to 0-10v analog board:
www.amazon.es/gp/product/B09Z28KRQP/ref=ppx_yo_dt_b_asin_title_o02_s00?ie=UTF8&psc=1

I always measure the output using the multimeter on DC mode since is analog output and has polarity.
The pot you are saying is to tune the output voltage since variates and depends the power source voltage we use (i use the 24v that exits from the same plug used to connect on the Nicrew lamp) and PWM frequency (in my case I have 1000Hz setup for the PCA9685 driver on Reef Pi), so needs tuning so at maximum/100% PWM signal the output has exact 10v DC.

Tomorrow going to do further tests but this time using an Arduino direct connected to the 0-10v module since has also many ports with PWM 5v logic with some code for sending same test values from 0 to 255 (0 to 100% PWM) since is the values used on the Arduino PWM ports and see the lowest value it turns on the lamp and also if it suffers the same problem like need form zero to go to an higher value and only from there I can go back to the lowest possible.

Since the Nicrew is brand new I don't want to open it and check the inside which drivers use, They can be replaced by fantastic LDH700 or LDH1000 from Meanwell for sure or something around that.

These Meanwell are the ones I'm using on my old DIY LED lamp and I have a controller that I create using an normal ATmega328P connected directly to them, and I mean the led's turn on with the first 1% of PWM with really low intensity, there are top for controlling any array of led's with fixed current of 700mA or 1000Ma depending the led type and drivers (LDH700 or LDH1000).
 
Last edited:
AquaCave Logo Banner

Sral

Well-Known Member
Review score
+0 /0 /-0
View Badges
Joined
May 2, 2022
Messages
589
Reaction score
678
Review score
+0 /0 /-0
Location
Germany
Rating - 0%
0   0   0
The "manual" on Amazon actually specifies calibration with the potentiometer at 50% PWM to 5V DC Output. Maybe you can try that instead. If that doesn't work you can also try to calibrate the output voltage to something slightly below (4.9V) and above 5V (e.g. 5.1V), since your multimeter might be slightly off, and test if the lamp still only starts at 6%.

The test with the Arduino sounds good, even though I don't expect the PWM signal itself to be the problem.

Next you can try to Feed the lamp the Arduino PWM directly over a 1 kilo ohm and a 10 micro farad capacitor to smooth the 1 kHz PWM to a DC, e.g. the Arduino feeds the resistor, that resistor feeds the capacitor (whose other side is on GND) and you connect the lamp input to the point between the resistor and the capacitor (and GND of course). You will need to cross check the voltage at this point with your multimeter as well, since it might be off due to any current the lamp might draw from this.
Since the Arduino can only give you 5V at 100%, you will reach the previous threshold of 0.60VDC not at 6% but at 12%, e.g. something like 30 to 31 of the Arduino's 255 PWM values.

If you are unsure about the last test, I can give you a diagram and a photo of the necessary connections.
 
OP
S

SpyLand

Community Member
Review score
+0 /0 /-0
View Badges
Joined
Nov 21, 2022
Messages
34
Reaction score
47
Review score
+0 /0 /-0
Location
London
Rating - 0%
0   0   0
I understand do a circuit to transform the direct PWM from Arduino to a 0-5v analog without using here the 0-10V board.
Because the Arduino voltage on this signal never going to reach more than the 5V the lamp never going to reach max intensity.

Anyway the test result with the Arduino but still using the 0-10v board is that I have the lamp turn on when I do a:
analogWrite(ledPin, 14);

but after being on I can go down until (which is the lowest dim I can get from the lamps):
analogWrite(ledPin, 5);

and they turn off after with:
analogWrite(ledPin, 4);

Did also the calibrating to 5V with 50% PWM ( analogWrite(ledPin, 127); ) but the diference is that it only starts giving light now with analogWrite(ledPin, 16); and manage to go back to a max of analogWrite(ledPin, 6); so it's a 2 units difference from having the 100% PWM calibrated to 10V.

UPDATE: New calibration to 7.50V at 50% PWM and now the light gets on with 6 and I can back lower to 2, since 1 turns it off.
At 100% PWM still have 10v on the board output, so looks like that the pot adjusts/shifts the middle (50% PWM) and the bigger voltage set I manage to start having light at lower PWM values.
Anyway it doesn't go up than the 7.50V I use now.
So the conclusion is either this 0-10v board as some problem and it doesn't react correctly sending values from zero or the driver itself inside the lamp has this problem.
 
Last edited:

Sral

Well-Known Member
Review score
+0 /0 /-0
View Badges
Joined
May 2, 2022
Messages
589
Reaction score
678
Review score
+0 /0 /-0
Location
Germany
Rating - 0%
0   0   0
I understand do a circuit to transform the direct PWM from Arduino to a 0-5v analog without using here the 0-10V board.
Because the Arduino voltage on this signal never going to reach more than the 5V the lamp never going to reach max intensity.

Anyway the test result with the Arduino but still using the 0-10v board is that I have the lamp turn on when I do a:
analogWrite(ledPin, 14);

but after being on I can go down until (which is the lowest dim I can get from the lamps):
analogWrite(ledPin, 5);

and they turn off after with:
analogWrite(ledPin, 4);

Did also the calibrating to 5V with 50% PWM ( analogWrite(ledPin, 127); ) but the diference is that it only starts giving light now with analogWrite(ledPin, 16); and manage to go back to a max of analogWrite(ledPin, 6); so it's a 2 units difference from having the 100% PWM calibrated to 10V.

UPDATE: New calibration to 7.50V at 50% PWM and now the light gets on with 6 and I can back lower to 2, since 1 turns it off.
At 100% PWM still have 10v on the board output, so looks like that the pot adjusts/shifts the middle (50% PWM) and the bigger voltage set I manage to start having light at lower PWM values.
Anyway it doesn't go up than the 7.50V I use now.
So the conclusion is either this 0-10v board as some problem and it doesn't react correctly sending values from zero or the driver itself inside the lamp has this problem.
Nice progress on finding a solution. Sounds like the PWM to 10V analog board might be the problem.

Now to nail down if that is the case I would recommend the direct drive with the Arduino PWM. As you mentioned, this will not allow you to set the light to full intensity (yet), but it will tell you if your problem is caused by the lamp itself, since there would be basically nothing in between the PWM source and the lamp (except the smoothing circuit).

Do you need advice on this, e.g. a circuit drawing and a photo of the components connected on a breadboard so you can make sure that you don't damage your light ?
 
World Wide Corals
OP
S

SpyLand

Community Member
Review score
+0 /0 /-0
View Badges
Joined
Nov 21, 2022
Messages
34
Reaction score
47
Review score
+0 /0 /-0
Location
London
Rating - 0%
0   0   0
Thanks, but I can handle, from you description is enough.
So tomorrow I'll try to replicate that circuit to smooth and convert the direct PWM signal from Arduino to a normal analog.

Also I'm going to test with a voltage regulator board (those with a typical LMxxx and a pot to regulate the output voltage) using source from the 24V that exists on the 3.5 jack from the lamp and starting ramping from 0v to see what is the first value that turns it on and if I have the same behavior like after going back from that voltage to even a lower value if the light still stays on until turns off.
 
OP
S

SpyLand

Community Member
Review score
+0 /0 /-0
View Badges
Joined
Nov 21, 2022
Messages
34
Reaction score
47
Review score
+0 /0 /-0
Location
London
Rating - 0%
0   0   0
Well, I just receive an email from Nicrew support and the information they sent me is going to change all that's being tried and tested so far. :eek:

" Hello,

Thanks for your contact.

This is 0-10 V PWM.

Hope it can assist you. Have a nice day.

Kind regards,
Sara "

Not counting with the wrong general information that is around regarding the Nicrew HyperReef lamps. :frowning-face:

So now I'm going to make new tests with some sort of a 10V power supply and a MOSFET receiving the normal PWM signal either from the PCA9685 using Raspberry Reef Pi or the Arduino. Both will be 5V but will control the MOSFET to give a 10V PWM to the lamp.

Let's see after what's going to be the new behavior for everything.
 

Sral

Well-Known Member
Review score
+0 /0 /-0
View Badges
Joined
May 2, 2022
Messages
589
Reaction score
678
Review score
+0 /0 /-0
Location
Germany
Rating - 0%
0   0   0
Alright, that changes things.

You could use the same 24V plug that you used before to siphon off some power, drop that to half using something like two 1k resistors (160mW power dissipation per resistor, watch the power limits there, the resistors will become a little warm) and connect a 10V regulator to this "12V". Buffer both "12V" and 10V with something like a 16V ready 10µF capacitor (it's in the datasheet of the regulator). For further security you might connect a 11-12V zener diode in parallel to protect your lamp input from over-voltage. This gives you a good enough 10V source.

Then you could connect this to GND over a 10k resistor and a 10V capable optocoupler. Drive the input side of the optocoupler with the PCA9685 and a suitable resistor to limit the current (mind possible internal resistors already on the PCA9685's output). This would give you your 10V PWM in a secure way. Maybe even a standard PC817 migth do the trick, even though it would be almost at the limit transmitting a 1kHz PWM with it's 3µs rise time. This rise time would limit your PWM stepwidth to something like 1% @1kHz. If you want a higher PWM frequency you would need a faster Optocoupler / Optoisolator.

If you want I can draw you up a circuit diagram for this.
 
AquaCave Logo Banner
OP
S

SpyLand

Community Member
Review score
+0 /0 /-0
View Badges
Joined
Nov 21, 2022
Messages
34
Reaction score
47
Review score
+0 /0 /-0
Location
London
Rating - 0%
0   0   0
Yeahh, going to use some of this boards just to save work and not do a 100% manual circuit with a typical IRL mosfet (logic voltage RDSon):
www.amazon.es/gp/product/B09Z28T5VT/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&psc=1
I'll test it either from a 5V PWM pin from Arduino or the PCA9685 board conected in Raspberry Pi runnig the Reef Pi.

To get the the 10V from the 24V coming from the lamp I use a board like this:
www.amazon.es/-/pt/dp/B07X233TP2/ref=sr_1_14?keywords=voltage+converter&qid=1669659096&qu=eyJxc2MiOiIxLjg5IiwicXNhIjoiMC4wMCIsInFzcCI6IjAuMDAifQ%3D%3D&s=electronics&sprefix=voltage+%2Celectronics%2C108&sr=1-14
 

Sral

Well-Known Member
Review score
+0 /0 /-0
View Badges
Joined
May 2, 2022
Messages
589
Reaction score
678
Review score
+0 /0 /-0
Location
Germany
Rating - 0%
0   0   0
Yeah, that should do the trick exactly the same way I suggested. The Optocoupler on the MOSFET board seems to be exactly the standard 817 Optocoupler I thought of, so you might run into problems at Frequencies above 1kHz, but should work fine if you aren't looking for extremely fine light control (as mentioned you will probably achieve something a bit below 1% stepwidth @1kHz).

You should definitely connect the 10V to this module over a 10k resistor, because I believe the MOSFET is likely build to completely short the input, pulling the 10V to GND and going of in a puff of magic smoke :grinning-face-with-sweat:

Best of luck and please report how it goes !
 
OP
S

SpyLand

Community Member
Review score
+0 /0 /-0
View Badges
Joined
Nov 21, 2022
Messages
34
Reaction score
47
Review score
+0 /0 /-0
Location
London
Rating - 0%
0   0   0
This is the chematiq of the MOSFET board:

1669686266115.png

You mean having a 10K resistor from the + 10V power supply to the + in the LOAD side of the board?
If is this, there is already a 4.7K resistor in series with a led.
Is the 10K still necessary?
 
Top Shelf Aquatics

Sral

Well-Known Member
Review score
+0 /0 /-0
View Badges
Joined
May 2, 2022
Messages
589
Reaction score
678
Review score
+0 /0 /-0
Location
Germany
Rating - 0%
0   0   0
This is the chematiq of the MOSFET board:

1669686266115.png

You mean having a 10K resistor from the + 10V power supply to the + in the LOAD side of the board?
If is this, there is already a 4.7K resistor in series with a led.
Is the 10K still necessary?
Those 4.7k resistors protect the LED and optocoupler from overcurrent and limit the voltage on the MOSFET gate.

You are right though, I did mix up some things in my mind. The 10k resistor should be connected as a load and the lamp connected preferably to the LOAD MINUS so that it will never be able to see high currents. The MOSFET will then pull the lamps signal to GND and if the MOSFET closes, the 10k load resistor will pull the lamp signal to +10V, but limit any current flowing into the lamp to 1mA.

This will off course invert your PWM signal, but Reef-Pi has a simple button to account for this.
 

Sral

Well-Known Member
Review score
+0 /0 /-0
View Badges
Joined
May 2, 2022
Messages
589
Reaction score
678
Review score
+0 /0 /-0
Location
Germany
Rating - 0%
0   0   0
Sry, I probably didn't explain it without unnecessary convolutions.

My initial suggestion to put a 10k resistor between the DC power supply's V+ (e.g. +10V) and the D4184 Module's Input Pin 1 is probably wrong, because it would starve the LED and Optoisolator of electrical power.

You will need a load resistor between the D4184 Module's Pins Nr 1 and 2 though (that's the LOAD noted in your schematic). That's where you have to put the 10k (in my oppinion). Doing so will result in an inverted PWM Signal between the D4184 Module's Pins 2 and 3 that can't supply more than 1mA, which protects your lamp.
 
Nutramar Foods
OP
S

SpyLand

Community Member
Review score
+0 /0 /-0
View Badges
Joined
Nov 21, 2022
Messages
34
Reaction score
47
Review score
+0 /0 /-0
Location
London
Rating - 0%
0   0   0
Ahhh, so the 10K resistor is in parallel with the 10V PWM that goes to the lamp?
In between pin 1 and 2 of the module, like for example on this picture in yellow where it says LOAD is the 10K resistor and also the 10v (- equal GND and + equal PWM signal) going to the lamp:

1669722786280.png
 

Sral

Well-Known Member
Review score
+0 /0 /-0
View Badges
Joined
May 2, 2022
Messages
589
Reaction score
678
Review score
+0 /0 /-0
Location
Germany
Rating - 0%
0   0   0
Ahhh, so the 10K resistor is in parallel with the 10V PWM that goes to the lamp?
In between pin 1 and 2 of the module, like for example on this picture in yellow where it says LOAD is the 10K resistor and also the 10v (- equal GND and + equal PWM signal) going to the lamp:

1669722786280.png
You could put those in parallel, but that would make both the 10k resistor and your lamp signal port a load. If anything goes wrong, the lamp can then simply sink the DC supply's maximum power and go up in flames. I expect the lamp's signal port to be high in resistance, so it shouldn't do that, but it is better to be safe than sorry.

I would therefore connect ONLY the 10k resistor as the load. The lamp signal can then come of Pins 2 and 3, so basically in series with the 10k load from Pin 1 to Pin 3. This 10k in series will limit any power going into the lamp to 10mW, making sure that it can't go up in flames:
1669723755900.png


As noted, the lamp signal will then probably be inverted. You can simply account for that in Reef-Pi when defining the Jack, just klick 'Reverse' and Reef-Pi will invert the signal by itself:
1669724019943.png
 

How do I get smarter in the hobby?

  • Experiment with reefing

    Votes: 161 57.5%
  • Read books

    Votes: 106 37.9%
  • Subscribe to magazines

    Votes: 53 18.9%
  • Read Reef2Reef

    Votes: 218 77.9%
  • Talk to other reefers

    Votes: 163 58.2%
  • Watch YouTube videos

    Votes: 189 67.5%
  • Listen to podcasts

    Votes: 70 25.0%
  • Other

    Votes: 21 7.5%
Top