Curcuit on high frequency PWM(10-0V) to (5-0V) , step-up and step- down

Dear all,

I am writing to ask the electronic circuit question based on the high frequency150khz PWM control

This is the post link that my arduino uno program discussion.
website:
http://arduino.cc/forum/index.php/topic,155700.0.html

As my project need to do the below tasks:
[1] Detect the 10V-0V pwm signal in high frequency 150kHz to arduino uno
[2] adjust the PWM duty cycle ( this is the program)
[3] generate back 0V-10V PWM new signal to MOSFET

in the tasks[1]
RC filter circuit how to create?( As I am new in RC filter)What is the circuit?
PWM signal through RC filter, change to analog signal and read by arduino.

in the task[3]
How to create back 0V to 10V PWM signal from 0V to 5V PWM output? Or what is the circuit of this?
I search that it should use op-amp to step-up the PWM signal.

But the question is will there be frequency range or limit on the op-amp which the op- amp not able to generate the perfect voltage with such high frequency?( as I also new in op-amp)

Do not use op-amp. Use NPN transistor and pull-up resistor to 10v supply.

For input you can use a voltage divider to get a 5V signal and use pulseIn() to measure pulse width directly. Using a filter to get an analog signal and measuring the analog signal is likely to be less accurate.

johnwasser:
For input you can use a voltage divider to get a 5V signal and use pulseIn() to measure pulse width directly. Using a filter to get an analog signal and measuring the analog signal is likely to be less accurate.

I'm not sure I can agree. The cycle time @150kHz is only 6.7us, so if a timer or other interrupt occurs during the pulseIn call, there is likely to be a substantial error. Even without interrupts, there will be a lot of jitter because of the time taken in the pulseIn loop (20 clocks according to the comment, which is more than 1us). Also, to get an accurate result, the PWM frequency would need to be stable.

Using an R-C filter an analog input, you can get 10-bit resolution, but at the expense of response time. How fast do you need the system to respond to changes in the PWM? This mechanism is potentially sensitive to the voltage of the PWM input, but you can avoid that by passing it through a logic gate prior to the R-C filter.

Thank You for advice.

According to your advice,use NPN transistor nad pull up resistor,

johnwasser:
Do not use op-amp. Use NPN transistor and pull-up resistor to 10v supply.

I want to ask NPN transistor use 2n3904 is it ok?
As I connected the 10V dc supply to C-gate through 1K ohm, and PWMOUT to B-Gate, and use CRO to measure the result at C-gate.
I found out the waveform is not what I want.. is it because the parameter of resistor setting wrong?

For the task3, input PWM detection:

dc42:
Using an R-C filter an analog input, you can get 10-bit resolution, but at the expense of response time. How fast do you need the system to respond to changes in the PWM? This mechanism is potentially sensitive to the voltage of the PWM input, but you can avoid that by passing it through a logic gate prior to the R-C filter.

As I need to continuous measure the PWM input and adjust it to new PWM output to MOSFET for the control of sepic converter in HID ballast, I think it is a must for the system to continuous supply PWM output signal such that the converter able to provide power to lamp. It may still ok even there is system delay.

Once again, Thank You for all advice.=]

If you need 8-bit resolution (the default Arduino PWM output resolution), then a filter comprising a 10K series resistor and a 47nF capacitor to ground will give you a low enough ripple voltage, and only delay the response by about a millsecond.

Thank You for advice.

If you need 8-bit resolution (the default Arduino PWM output resolution), then a filter comprising a 10K series resistor and a 47nF capacitor to ground will give you a low enough ripple voltage, and only delay the response by about a millsecond.

I will construct it and test it asap.

Now the question for the project are
[1] how can I get 5V PWM signal from 10V PWM before it pass through the RC filter?

[2] how can I level up the new PWM signal from 0-5V to 0-10V? ( Still not fixed)

If possible, I prefer to get both of the circuit diagram/ suggestion.

I get a really sneaky feeling that you won't get the response time you need and will need proper circuitry that does not rely on a programmed device (arduino or otherwise). I know nothing of HID's but guess it is like controlling a SMPS with a micro-controller, not usually done and a coarse result if you do. remember that the analog world does not have to care how many bits resolution it is working to, it just works to the precise point needed.

qq11011:
Now the question for the project are
[1] how can I get 5V PWM signal from 10V PWM before it pass through the RC filter?

[2] how can I level up the new PWM signal from 0-5V to 0-10V? ( Still not fixed)

If possible, I prefer to get both of the circuit diagram/ suggestion.

I want to ask is the PWM output at BC337 is inverted?
(As I use similar transistor 2n3904, the output waveform inverted..)

Yes, the PWM output will be inverted. You could always use another of the inverters in the 74HC14 package to invert the PWM signal going to the base resistor, if you want non-inverted PWM. Or just do the inversion in software.

I already constructed the circuit and it is true that the PWM signal is able to step up to 10V with the use of inverter and 2n3904.

But When I connect the Signal to the MOSFET in the Sepic converter with DC power supply, the steped up PWM signal decrease a lot with distort waveform. I think it is not able to drive the MOSFET, I want to ask why it happened.

I tried to reduce the frequency of the PWM signal, and i found that the the output of PWM signal get better but still have distortion.

How can I ensure to generate 10V PWM signal to MOSFET without distortion?

Thank You.

qq11011:
How can I ensure to generate 10V PWM signal to MOSFET without distortion?

Use a mosfet driver chip, such as TC4420.