Robo Tank 0-10v PWM-Analog Converter Question

Brian71583

New Member
View Badges
Joined
Feb 18, 2022
Messages
21
Reaction score
25
Location
Pennsylvania
Rating - 0%
0   0   0
So I built my Pi in anticipation of adding my lights later and that time finally came. I got the Nicrew 150 and discovered the flickering issue due to being analog and not PWM. I found Robo Tank has what looks to be the answer. When I built my Pi I built a very custom comprehensive all-in-one type system and 3D printed an enclosure for it. I don't really have an option to add inside my current enclosure.

My thought is something like this picture I threw together. I would then only have to add an ethernet jack to my current Pi and then just have a second small box fed by the ethernet jack and house the converter. Then a TRS jack for how every many lights I would want it to control. Would this work, is this wiring correct for what I need? Obviously this only shows 1 light setup but I could expand for however many lights I would want to control. I don't see why it wouldn't work but want to be sure. I tried emailing Robo-tank and sending a message on here and haven't gotten a response.

Couple questions:

1) From what I've read other places I should be fine using ethernet cable for this purpose?

2) The Robo-tank board has a spot for Ground and "Controller ground"... Inside my Pi I have common grounds, can I just run one ground and jumper it to both spots on the robot-tank board

3) Any other opinions?

0-10v.jpg
 

Sral

Valuable Member
View Badges
Joined
May 2, 2022
Messages
1,006
Reaction score
976
Location
Germany
Rating - 0%
0   0   0
1) Ethernet cable should be fine if you keep it short (maybe 1m / 3ft max ?).
There is a way to use the twisting of the pairs for improved signal stability, e.g. you always run one signal and one ground in a twisted pair. That way you lose signal lines, but always have a signal and a ground closely together. That way disturbances register on both and the relative signal in relation to ground stays more stable. Not sure if that’s necessary for PWM signals though.

2) You should be fine to do that, since the LM Buck converter modules have common ground on input and output, as you said.
Those two GND on the board are there in case your power supply and signal have isolated grounds, I believe. Personally I would run a GND from the PCA9685 through the ethernet to GND on the board and a separate GND from my 12V power supply to controller GND on the board, just to be sure.

3) Should be fine. I wasn’t even aware that @robsworld78 sells something like this ^^
 

robsworld78

Well-Known Member
View Badges
Joined
Feb 14, 2020
Messages
952
Reaction score
1,281
Location
Edmonton, Canada
Rating - 0%
0   0   0
So I built my Pi in anticipation of adding my lights later and that time finally came. I got the Nicrew 150 and discovered the flickering issue due to being analog and not PWM. I found Robo Tank has what looks to be the answer. When I built my Pi I built a very custom comprehensive all-in-one type system and 3D printed an enclosure for it. I don't really have an option to add inside my current enclosure.

My thought is something like this picture I threw together. I would then only have to add an ethernet jack to my current Pi and then just have a second small box fed by the ethernet jack and house the converter. Then a TRS jack for how every many lights I would want it to control. Would this work, is this wiring correct for what I need? Obviously this only shows 1 light setup but I could expand for however many lights I would want to control. I don't see why it wouldn't work but want to be sure. I tried emailing Robo-tank and sending a message on here and haven't gotten a response.

Couple questions:

1) From what I've read other places I should be fine using ethernet cable for this purpose?

2) The Robo-tank board has a spot for Ground and "Controller ground"... Inside my Pi I have common grounds, can I just run one ground and jumper it to both spots on the robot-tank board

3) Any other opinions?

0-10v.jpg
Sorry to hear you didn't receive my reply, it likely went in your spam folder, unfortunately that happens sometimes. I don't log into R2R everyday but see your message from yesterday now. Here's the message I sent you, you sounded like a DIY guy so I also sent the schematic as you should only need to filter your 0-10v signal with some caps.
Hi Brian, glad to hear your build went well, if you posted it on R2R forum I think I know the one. Always feels good to build something.

Yeah what you are experiencing with the flickering is due to the PWM signal, it needs to be smoothed out to analog. I think you just need some caps to filter it out, I attached the schematic for my board, the opamp is just to bring it up from 0-5v to 0-10v.

My board would get you going but the catch is the input has to be 0-5v PWM, if it's 0-3.3v from a Pi or pca9685 powered with 3.3v you'll get 6.6v output.

You are correct about the redundant ground, just need one to your common ground. It requires the 12v to bring it to 10v and then just the input 0-5v PWM signals.

Thanks
Rob

Your diagram looks correct and if you have the extra wire having the multiple ground connections is a good. If you need anything else let me know.
 
OP
OP
B

Brian71583

New Member
View Badges
Joined
Feb 18, 2022
Messages
21
Reaction score
25
Location
Pennsylvania
Rating - 0%
0   0   0
@robsworld78 thanks for the reply. Hope my post did not come off negatively about you or your business. I have great respect for you and what you do.

For anyone curious, yes he did reply to my email quickly but my spam folder grabbed it, which rarely happens so if you use Gmail and you’re wondering why Rob didn’t respond. Check your spam box.

I think I may go with your idea of just smoothing out my PWM signal you messaged me. I built the system with more 0-10v capacity but only installed Jacks on 2 (or 4). So I have empty and available options to smooth out all ready to go. Considering the lights are chain-able I could even modify one of my outputs to be pwm and one to be analog so I’m ready for either version.

Thanks for that tip.

@Sral thanks for your feedback also.
 
OP
OP
B

Brian71583

New Member
View Badges
Joined
Feb 18, 2022
Messages
21
Reaction score
25
Location
Pennsylvania
Rating - 0%
0   0   0
So @robsworld78 if I am looking at this image correct I can run my current 0-10v pwm signal through a 10k resister then a 10uf cap then that output should be my analog signal.

Do this for each channel (white+blue) and I should be good?
 

Attachments

  • 75F73596-3BB9-4B81-8200-1A33F394BD3F.jpeg
    75F73596-3BB9-4B81-8200-1A33F394BD3F.jpeg
    52.9 KB · Views: 202

robsworld78

Well-Known Member
View Badges
Joined
Feb 14, 2020
Messages
952
Reaction score
1,281
Location
Edmonton, Canada
Rating - 0%
0   0   0
So @robsworld78 if I am looking at this image correct I can run my current 0-10v pwm signal through a 10k resister then a 10uf cap then that output should be my analog signal.

Do this for each channel (white+blue) and I should be good?
@Brian71583 no worries, didn't come off negative at all, just looking for a response. :)

Sounds like you have it right, should be "smooth" sailing.
 
OP
OP
B

Brian71583

New Member
View Badges
Joined
Feb 18, 2022
Messages
21
Reaction score
25
Location
Pennsylvania
Rating - 0%
0   0   0
@robsworld78 and @Sral and anyone else. Could you take a look at this and let me know what you think before I solder it all up.

Intent is to expand on the lighting guide in the “official” reef pi guides and this is in addition to that guide. The PWM coming from the PCA9685 would feed this board.

Top bar is grounds.

Row J is feeds from function reef pi lighting guide setup. I color coded my pins for white channel/blue channel.

The first two… white and blue are one light and set here for PWM

PWM would be achieved by leaving OPEN i1 and i2 but then jumper if D1 and D2 and also C2 and C3 (two jumpers required just for having to go 2 pins across.

Row B is always Jumpered and can honestly be soldered closed.

CONVERSELY, as you can see starting with j16

If Analog is desired i16 and i17 would be Jumpered D16 and D17 would be left OPEN and then D19 and D20 would be Jumpered.

As I said before row B is always Jumpered (or soldered)

Then row A would be your TRS hookups and wouldn’t change at all related to PWM or Analog.

Light 1 TRS is:
A4 is Blue Channel
A8 is Ground
A13 is White channel

Light 2 TRS is:
A19 is Blue Channel
A23 is Ground
A28 is White Channel
 

Attachments

  • image.jpg
    image.jpg
    272.3 KB · Views: 33

Sral

Valuable Member
View Badges
Joined
May 2, 2022
Messages
1,006
Reaction score
976
Location
Germany
Rating - 0%
0   0   0
@robsworld78 and @Sral and anyone else. Could you take a look at this and let me know what you think before I solder it all up.

Intent is to expand on the lighting guide in the “official” reef pi guides and this is in addition to that guide. The PWM coming from the PCA9685 would feed this board.

Top bar is grounds.

Row J is feeds from function reef pi lighting guide setup. I color coded my pins for white channel/blue channel.

The first two… white and blue are one light and set here for PWM

PWM would be achieved by leaving OPEN i1 and i2 but then jumper if D1 and D2 and also C2 and C3 (two jumpers required just for having to go 2 pins across.

Row B is always Jumpered and can honestly be soldered closed.

CONVERSELY, as you can see starting with j16

If Analog is desired i16 and i17 would be Jumpered D16 and D17 would be left OPEN and then D19 and D20 would be Jumpered.

As I said before row B is always Jumpered (or soldered)

Then row A would be your TRS hookups and wouldn’t change at all related to PWM or Analog.

Light 1 TRS is:
A4 is Blue Channel
A8 is Ground
A13 is White channel

Light 2 TRS is:
A19 is Blue Channel
A23 is Ground
A28 is White Channel
In principle this should work. A few caveats though:

1) It's probably easier and safer to have the jumper select by using 3 male headers in 3 columns. The PCA9685 PWM signal is in the middle column and by either placing the jumper left or right, one routs the signal directly to out, or through the RC integrator.

2) The capacitor looks like a 100 nF. To smooth out the PCA9685's frequency of around 1.5 kHz you would need at least a 66kOhm resistor or higher. This massively limits the signal's current and might lead to your lamp not reaching 100% power.

3) Currently you directly connect the capacitor to the output. If anything goes wrong, e.g. if you short the output, the whole capacitor charge goes rushing through that short, possibly injuring you or braking equipment if you're unlucky.

My proposed alternative: Judging from your previous post of @robsworld78's circuit, if you place the ANL jumper, you already smooth the input signal out with a sufficiently large resistance and capacitance.
(10kilo Ohm * 10 micro Farad = 0.1 second which is about 150 periods of the PCA9685's top frequency of 1.5kHz, so that's more than enough)
75f73596-3bb9-4b81-8200-1a33f394bd3f-jpeg.3211455


Try placing than ANL jumper and test if the Output is already DC, that way you can skip most of the soldering ^^

[Annotation]: I'd do the testing as follows: If you have a multimeter, test if the DC voltage is 5.0V at 50% PWM setting and test if the AC voltage is < 0.1V (there are typically different settings for measuring DC and AC voltage)
 
Last edited:

oreo54

5000 Club Member
View Badges
Joined
Sep 18, 2017
Messages
5,603
Reaction score
3,449
Rating - 0%
0   0   0
@Brian71583 no worries, didn't come off negative at all, just looking for a response. :)

Sounds like you have it right, should be "smooth" sailing.
Hey, did people actually calculate the r/c values that are err " best".
Most work but what about optimization of say rise time to the correct voltage?

Years ago I toyed with using one to convert the Typhon 10v pwm signal to analog.

Anyways my " helper" at the time just gave me some values which have been lost over time. Besides the Typhons 10v own was electrically odd to begin with as confirmed on an O scope at Steves
Well so much for history.

Found this.


Screenshot_20230625-165249.png



What do you think?

1k/10u plot

Screenshot_20230625-171222.png

Key point ...
Response depends on pwm frequency. Each filter needs tailoring to it.
Values of r/c will determine ripple and rise time.
Anyways fun toy ....

One more based on Aduino default Hz.
Screenshot_20230625-171857.png



I BET most know this but for the general public it may not even be considered.I didn't at first.
 
Last edited:

Sral

Valuable Member
View Badges
Joined
May 2, 2022
Messages
1,006
Reaction score
976
Location
Germany
Rating - 0%
0   0   0
Hey, did people actually calculate the r/c values that are err " best".
Most work but what about optimization of say rise time to the correct voltage?

Years ago I toyed with using one to convert the Typhon 10v pwm signal to analog.

Anyways my " helper" at the time just gave me some values which have been lost over time. Besides the Typhons 10v own was electrically odd to begin with as confirmed on an O scope at Steves
Well so much for history.

Found this.


Screenshot_20230625-165249.png



What do you think?

1k/10u plot

Screenshot_20230625-171222.png

Key point ...
Response depends on pwm frequency. Each filter needs tailoring to it.
Values of r/c will determine ripple and rise time.
Anyways fun toy ....

One more based on Aduino default Hz.
Screenshot_20230625-171857.png



I BET most know this but for the general public it may not even be considered.I didn't at first.
Very good reminder. My go to method is the following:
- If signal current is an issue, chose a low valued resistor first. e.g. a 1k
- Calculate the period of the signal frequency. E.g. 1.5 kHz -> 1/1500Hz = 0.000666s or 666us
- Calculate the absolute minimum capacitor value needed for smoothing this. E.g.
666us/1000Ohm=0.666uF or 666nF
- Chose a value above that depending on how ripple free you want the signal. my standard is 10times that, if you want very smooth or very long ramps go 100 or 1000 times higher.
E.g. here I would use something like 10x0.666nF=6.6uF or 10uF for convenience.
Taking the 1000times results in a signal ramp that’s much slower, E.g. 1000x0.000666s=0.666s which would visibly ramp the signal for about that time every time one makes a change (both up and down, irrespective of the amplitude).


If signal current is not an issue, I typically start with a 10k or even a 100k instead, which is 10 times or 100 times larger and therefore requires 10 times or 100 times less capacitance for the same effect, so with a 100k one would for example get the same slow 0.666s ramp using a capacitor of 10uF/100=0.1uF=100nF.
 
Last edited:

robsworld78

Well-Known Member
View Badges
Joined
Feb 14, 2020
Messages
952
Reaction score
1,281
Location
Edmonton, Canada
Rating - 0%
0   0   0
Hey, did people actually calculate the r/c values that are err " best".
Most work but what about optimization of say rise time to the correct voltage?

Years ago I toyed with using one to convert the Typhon 10v pwm signal to analog.

Anyways my " helper" at the time just gave me some values which have been lost over time. Besides the Typhons 10v own was electrically odd to begin with as confirmed on an O scope at Steves
Well so much for history.

Found this.


Screenshot_20230625-165249.png



What do you think?

1k/10u plot

Screenshot_20230625-171222.png

Key point ...
Response depends on pwm frequency. Each filter needs tailoring to it.
Values of r/c will determine ripple and rise time.
Anyways fun toy ....

One more based on Aduino default Hz.
Screenshot_20230625-171857.png



I BET most know this but for the general public it may not even be considered.I didn't at first.
I don't know a lot about this stuff, my converter is mainly intendent for a pca9685. When I first made it I was using 1k resistor but if frequency was at low end (under 500) it would still cause minor flickering but got lucky that users could up the frequency to 1500hz and it was fine. Now I use 10k resistors which fixed that issue. Here's the difference with that tool.

Screen Shot 06-25-23 at 10.50 PM.PNG


Screen Shot 06-25-23 at 10.51 PM.PNG
 

oreo54

5000 Club Member
View Badges
Joined
Sep 18, 2017
Messages
5,603
Reaction score
3,449
Rating - 0%
0   0   0
I don't know a lot about this stuff, my converter is mainly intendent for a pca9685. When I first made it I was using 1k resistor but if frequency was at low end (under 500) it would still cause minor flickering but got lucky that users could up the frequency to 1500hz and it was fine. Now I use 10k resistors which fixed that issue. Here's the difference with that tool.

Screen Shot 06-25-23 at 10.50 PM.PNG


Screen Shot 06-25-23 at 10.51 PM.PNG
Your "problem" at 500Hz..
rcfilter2.JPG

So you can see .25V pp as flicker..I am assuming.
 
Last edited:

oreo54

5000 Club Member
View Badges
Joined
Sep 18, 2017
Messages
5,603
Reaction score
3,449
Rating - 0%
0   0   0
If signal current is not an issue, I typically start with a 10k or even a 100k instead, which is 10 times or 100 times larger and therefore requires 10 times or 100 times less capacitance for the same effect, so with a 100k one would for example get the same slow 0.666s ramp using a capacitor of 10uF/100=0.1uF=100nF.
Definitely a tradeoff between ripple and response time..Guess that makes sense since I assume larger the cap longer the charge time initially. Smaller the resistor the more ripple.
rcfilter3.JPG

Hard to read.. left 100k ,100nF .05sec (100%), 0.08V pp right 100k 1000nF, .7sec (100%), 0.008vpp 1500Hz
Well that was fun... :)
 
Last edited:
OP
OP
B

Brian71583

New Member
View Badges
Joined
Feb 18, 2022
Messages
21
Reaction score
25
Location
Pennsylvania
Rating - 0%
0   0   0
I soldered up my concept and tried it out and it works perfectly.

I have one light running an analog Nicrew 150

And another running a PWM Kessil H80

No flicker at all on the Analog Nicrew which I did have before.

Frequency is 1500 and I went with 10uf cap and 10k resistor

How did I choose those values? Simple… I looked at what Rob had on his diagram for his board. Haha

I realized afterwards that his is based off of 5V and pulled up to 10 afterwards and mine is running off 10v already pulled up. It works well. Checked those numbers on the calculator and get quite a smooth line. Response times are good.

@Sral you've mentioned safety a few times. Are you referring to safety in like a thermal way like fire hazard or are you referring to the risk of a short when plugging/unplugging the connector when powered?

I like how I have it and I was aware of that risk from even the original reef-pi guide setup. How else would you were the capacitor? Is there any way to mitigate that risk without a complete re-do? I’d like to make this as perfect as possible but a complete re-do isn’t gonna happen unless there is some sort of fire risk.
 

oreo54

5000 Club Member
View Badges
Joined
Sep 18, 2017
Messages
5,603
Reaction score
3,449
Rating - 0%
0   0   0
I soldered up my concept and tried it out and it works perfectly.

I have one light running an analog Nicrew 150

And another running a PWM Kessil H80

No flicker at all on the Analog Nicrew which I did have before.

Frequency is 1500 and I went with 10uf cap and 10k resistor

How did I choose those values? Simple… I looked at what Rob had on his diagram for his board. Haha

I realized afterwards that his is based off of 5V and pulled up to 10 afterwards and mine is running off 10v already pulled up. It works well. Checked those numbers on the calculator and get quite a smooth line. Response times are good.

Since I'm still obsessing here I was curious as to what effect voltage has in the calculations.
Seems doubling the pwm voltage doubles the ripple. Response time remains the same
Note ripple is still low.
.017v pp

You can get back to the same ripple doubling the capacitance but response time increases. Doubles to 0.46sec

Halving the resistance to compensate
5k, 20u, .017 ripple .23 sec.

Trying to get to like .008, .23sec is fruitless ATM
The math should be able to go "backwards" but defeats the ease of a " good enough" calculator...
You know like maybe " given a ripple and response time of x and y and 0-10v pwm what would the frequency be".
 

Sral

Valuable Member
View Badges
Joined
May 2, 2022
Messages
1,006
Reaction score
976
Location
Germany
Rating - 0%
0   0   0
Definitely a tradeoff between ripple and response time..Guess that makes sense since I assume larger the cap longer the charge time initially. Smaller the resistor the more ripple.
rcfilter3.JPG

Hard to read.. left 100k ,100nF .05sec (100%), 0.08V pp right 100k 1000nF, .7sec (100%), 0.008vpp 1500Hz
Well that was fun... :)
It’s a combination of R and C.

To be specific: time constant is R*C
therefore a 10k resistor with a 10u capacitor behave identical to a 100k resistor with a 1u capacitor.

The output or smoothed signal will take the time constant to register 63% of the change on the input.
If you switch the input, the output will be smoothly delayed by that time constant.
Any input signal that oscillates faster than that time constant will get damped. The bigger the difference in period to time constant, that larger the damping.

Since I'm still obsessing here I was curious as to what effect voltage has in the calculations.
Seems doubling the pwm voltage doubles the ripple. Response time remains the same
Note ripple is still low.
.017v pp

You can get back to the same ripple doubling the capacitance but response time increases. Doubles to 0.46sec

Halving the resistance to compensate
5k, 20u, .017 ripple .23 sec.

Trying to get to like .008, .23sec is fruitless ATM
The math should be able to go "backwards" but defeats the ease of a " good enough" calculator...
You know like maybe " given a ripple and response time of x and y and 0-10v pwm what would the frequency be".
Voltage is not relevant in an RC-circuit since it’s all relative.

Switching from 0 to 100% takes about 2-3 time constants to fully register.
Switching from 50 to 60% takes the same time to fully register.

Damping a PWM to reduce ripple is also relative: a 5V PWM will be reduced to e.g. 1% ripple (0.05V)
Applying a 10V PWM to the same circuit will result in the same 1% ripple (0.1V).

Ripple is highest at 50% duty cycle and zero at 0 and 100%. If you have a time constant (R*C) that is at least double the PWM‘s period ( for the calculation with correct units I can recommend SpeedCrunch) the ripple is approximately:
V_ripple/V_PWM = (1-cos(2*Pi*D))/8/f_PWM/tau

That makes the maximum ripple at 50%:
V_ripple/V_PWM = 1/4/f_PWM/tau

with tau being the time constant:
tau = R*C

So for your example above with 5V 500Hz PWM, 1kilo Ohm and 10uF
V_ripple = 0.05*V_PWM = 0.25V
 

Attachments

  • image.jpg
    image.jpg
    350.9 KB · Views: 31

oreo54

5000 Club Member
View Badges
Joined
Sep 18, 2017
Messages
5,603
Reaction score
3,449
Rating - 0%
0   0   0
Well...% ripple may be equal but to an led the actual voltage is what counts especially since the response is fairly instantaneous, ignoring phosphor quenching for a bit.

As an extreme example 10% ripple
of 10v or 10% of 3.3v.

1v vs .33v will have dramatically different measurable variations in light output.
Voltage is relevant to leds.
Picking at a nit.


Actual is more important than a ratio in a sense.

Give me a week and I may understand all of your writings. :)
Then maybe not.



Thanks though.
 

Sral

Valuable Member
View Badges
Joined
May 2, 2022
Messages
1,006
Reaction score
976
Location
Germany
Rating - 0%
0   0   0
Well...% ripple may be equal but to an led the actual voltage is what counts especially since the response is fairly instantaneous, ignoring phosphor quenching for a bit.

As an extreme example 10% ripple
of 10v or 10% of 3.3v.

1v vs .33v will have dramatically different measurable variations in light output.
Voltage is relevant to leds.
Picking at a nit.


Actual is more important than a ratio in a sense.

Give me a week and I may understand all of your writings. :)
Then maybe not.



Thanks though.
You’re very welcome ! If I might have explained parts a bit better, feel free to ask. I’ll happily try fleshing it out more if necessary.

Regarding the absolute vs relative ripple I would argue that for controlling lamps, relative is everything, since the lamp will ramp more or less linearly with the signal. If the signal ripples with 1%, so will likely the light output, if I’m not mistaken. PWM voltage is also typically given by the lamp’s control interface, so very little way of reducing ripple that way.
 

oreo54

5000 Club Member
View Badges
Joined
Sep 18, 2017
Messages
5,603
Reaction score
3,449
Rating - 0%
0   0   0
Regarding the absolute vs relative ripple I would argue that for controlling lamps, relative is everything, since the lamp will ramp more or less linearly with the signal. If the signal ripples with 1%, so will likely the light output, if I’m not mistaken. PWM voltage is also typically given by the lamp’s control interface, so very little way of reducing ripple that way.
Trust me it is me not you. :)

There are a lot more parts to this than my head was originally working with.

Having the simplicity of pwm "in" and pwm " out" ala meanwell ldd's sure makes life easier.
 

Reefing threads: Do you wear gear from reef brands?

  • I wear reef gear everywhere.

    Votes: 20 13.4%
  • I wear reef gear primarily at fish events and my LFS.

    Votes: 10 6.7%
  • I wear reef gear primarily for water changes and tank maintenance.

    Votes: 1 0.7%
  • I wear reef gear primarily to relax where I live.

    Votes: 23 15.4%
  • I don’t wear gear from reef brands.

    Votes: 84 56.4%
  • Other.

    Votes: 11 7.4%
Back
Top