Reading 3 PWM signals

Hello everyone
I’m new here, and quite new to programming in general, so I’m sorry if I ask some obvious questions.

I will start by stating what I want to do:

I’m making an RGB led strip controller. This will have several pattern settings (that are mostly already programmed). It will use 3 different PWM pins, one for each led-color.
My program makes heavy use of the millis() function.
Most of the settings define both color and brightness of the leds.

Now, to my particular problem:

One of the settings is a bit more complicated. It defines only the amplitude by making calculations, but the color is defined by an external led controller that sends 3 PWM signals.
I would like my arduino controller to read the 3 PWM signals and use those as starting points to make said calculations.

Therefore, I am wondering if there is a way to read those 3 PWM signals as inputs, make some calculations based on them, and define 3 PWM outputs with those new numbers.


More detailed information (Why do I want to do this?):

I have a system that already has a led controller, which has very nice controls and is already built-in into the system. But said controller only has the ability to define resulting led color, always at maximum amplitude.
I want to add more options, while modifying the system as little as possible. It would also be very important that said controls didn’t have to be modified, and could still be used.
And if I wanted to, I could just take out my Arduino controller and leave the system as it was before, with minimal effort (unplugging/re-plugging just a few cables).

For this reason, I decided to have the Arduino controller directly connected to the led strip to be able to have as many patterns as I wanted. But I don’t want to remove/replace the previous controller (in case I want to take my Arduino out). And, in order to be able to use the existing color controls without modifying the existing controller, I would like to get the PWM signal said controller gives, and use it as an input.

I’m sorry if I wasn’t very clear, I’m not sure how to explain the details here ._.

Therefore, I am wondering if there is a way to read those 3 PWM signals as inputs

What is it you need to know about the PWM signal? The duty cycle? Or is it a true variable voltage? What you are looking for determines how you read the signal.

I would need the duty cycle, from 0 to 100% (or 0 to 255). I read a bit about pulseIn(), and it won't work for me because I want my program to keep calculating, even when receiving a signal from the external PWM.

And, since I use millis() to drive my own program, I don't know if using interrupts to read it would affect my program's period.
No matter the duty cycle from the input, my programs period should stay fixed.

It's just a normal PWM signal to drive some leds, with fixed voltage and fixed period.

I'm willing to add a few electronic pieces (capacitors, resistances, whatever is needed) if there is no way to do it proframatically.

if there is no way to do it proframatically.

I don't think there is any way to do it "proframatically".

I don't know if using interrupts to read it would affect my program's period.

Then you don't understand interrupts. So, don't go there. (Though they are the only way...).

If the PWM signals were fairly low in frequency you could use pin change interrupts
to measure their timing and duty cycle.

However it might be simpler to route them into an RC low-pass filter and measure the
voltage with an analog pin.

What frequency are the PWM signals? Are they 5V logic levels?

PaulS:
Then you don’t understand interrupts. So, don’t go there. (Though they are the only way…).

I know I don’t understand interrupts, because I’m quite new to programming (only used to program with MatLAB for my job), but that’s exactly the reason I’m here. I want to learn. If I didn’t use it just because I don’t understand it, I wouldn’t even have an Arduno.

Ok, Ill check the frecuency of the signals, but so far a low-pass filter seems to be the best idea.
My main issue with interrupts is the fact that I depend quite a lot on the millis() function. And, also, that the input signal can have a value as high as 100% duty cycle, meaning continuous 5V voltage.
I believe it’s almost guaranteed that at least one of the input channels will be at 100% at any time, to keep brightness at maximum possible value with different colors.

So, anything I would need to know to make the RC filter, or just calculate the time constant I want and get an R and a C according to that?
What are the limits to the values of R, to avoid any kind of damage to the Arduino, and minimize signal distortion?

I’m sorry if my last question makes no sense…

I want to learn.

OK, That’s good.

My main issue with interrupts is the fact that I depend quite a lot on the millis() function.

The millis() function uses interrupts, too, in for form of clock ticks updating the data it returns. So does the arrival and sending of serial data. Lots of things temporarily interrupt the main processing.

Adding your own interrupt handlers, if they are properly written (lightening fast!), is not going to affect millis().

Where people get into trouble is assuming that they can take there sweet time in an interrupt service routine, using delay(), pulseIn(), or while loops waiting for things to happen.

Anbello262:
Therefore, I am wondering if there is a way to read those 3 PWM signals as inputs, make some calculations based on them, and define 3 PWM outputs with those new numbers.

Which PWM frequency?
Is it a 5V PWM signal you get?

The easiest solution would be:
Convert the PWM signals to voltages by using an RC low-pass filter (requires one resistor and one capacitor per signal), connect the voltages to analog inputs and read voltages by using Arduinos "analogRead()" function.

Edit: I just realized, same suggestion was already posted by MarkT in reply #4.

Yes, that is most likely what I'll do. And yes, it's a 5V PWM signal.

Thanks to all your replies, I'll make a low-pass RC filter and read these signals as inputs.
I still have to check the PWM frequency, but I won't be able to do it until next week, so I'll test it with arduino's PWM signals. At least that way I'll have more experience, and when I find out the real frequency I'll just have to adjust the R and C values a bit if necessary.

Thank you all.