PWM interceptor to output modified duty cycle

Hi,
I'm really new to arduino and trying to make a wee project to modify a pwm signal.

What I'm trying to to is intercept an injector signal and then output a new signal with a modified duty signal,

Ideally I would like a 0-5 volt signal input and at different voltages be able to change the output duty cycle by a certain percent dependant on the input voltage.

The signal im rying to intercept is 12volts, what kind of conditioning circuitry would I need to input this in the arduino?

Would someone please be able to help me with the code or point me in the right direction?

Thanks

since an Arduino operates at 5V, a simple resistor voltage divider can be used to reduce the nominal 12V input to < 5V so that it can be read.

it's not clear to me if the 12V signal is a PWM or simply a voltage from 0-12V.

for the later, analogRead() can read it's value and you can then map() that input value, in the range of 0-1023, to a PWM output using analogWrite() in the range of 0-255.

Do you have another input?

crystal ball:

You have a PWM signal coming in, and you want to send it out, but fattened or slimmed somewhat according to another input.

Yyou’ll have to watch and time the PWM input, convert the control voltage to digital (analogRead) and synthesize the adjusted PWM output, all pretty much on your hands and knees.

Or I have it all wrong and wait with others for more on this intriguing matter. Tell us what’s the what.

a7

The signal I want to intercept is a pwm injector signal on a diesel pump. I want to intercept this signal and stretch the duty cycle depandant on another 0-5volt signal with will be the map sensor or pressure sensor of the engine. It would be nice to have a list of different pressures where I can then input a percentage amount of the duty to be modified at those given values from the pressure sensor input, and then output this stretched pwm signal via a fet back to the original injector

Does this make better sense?

Thanks

How many pulses can the modified pulse lag behind the measured pulse?

-jim lee

As minimal lag as possible ideally

As long as the pulse is still in sync it wouldn't matter too much but minimal is best

Does the period between pulses vary with RPM? I'm thinking they must. And the width controls fuel flow?

-jim lee

May be some of the information in this thread is also relevant to this activity:

Duplicate External PWM Signal's Frequency, Phase, but not Duty Cycle

Yeah the width changes with rpm and other factors, boost pressure, temp, etc. That's why I just want to modify the factory signal as that's all done by the factory ecu

OK!

That’s what my crystal ball did say.

What is the range of frequencies you expect? I assume this is directly related to RPM.

What is the minimum and maximum pulse width?

It looks like you can succeed with

measure incoming pulse width
read the control voltage analogRead to get factor
(improve after, here’s where some math and tables will help you adjust)
synthesize output pulse

The output pulse will be one behind. I say improve later because it would be good to…

Try to get your Arduino functioning as a pass through, forget about modify the pulse, just recreate it.

This will allow full development of the hardware and basic prog structure.

Then, go to town on the maths between measure and synthesize.

BTW you may know that you are placing this device in harsh and hostile circumstances, watch out for noise and power problems. It might be worthwhile to provide a simulated PWM signal during dev. You could use an instrument your lab may have, or another Arduino or (not my pick) a simple 555 based multivibrator.

HTH and cool idea. Did you look around to see who already did it? :wink:

a7