Easiest way to generate fixed PWM signal

Status
Not open for further replies.

juanMco

Newbie level 6
Joined
Apr 21, 2017
Messages
13
Helped
0
Reputation
0
Reaction score
1
Trophy points
3
Activity points
209
Hello all!

I need to generate a fixed high precision PWM signal, period T = 10 ms, time high TH around 300 us and amplitude 5 V.

I was doing it with a 555 timer with low tolerance components but the best signal I can generate has around +-0.02 ms error on period. I need to do exactly 10 ms period with error in nanoseconds or less range if possible (I dont need high accurate on TH).

Inside my circuit there is no MCU module (all analogic), so I am not sure what to do now. Some options:

- Add some specifical IC to generate this pulse better than 555.
- Add a really small microcontroler ONLY to do this job.

I want to do it in the easiest way. I know the best choice would be to add a microcontroller but I have limited development time to achieve that.

Would appreciate If someone can give me some ideas.

Regards.
 

555 and any similar device will use RC networks to derive the frequency and pulse width so the problem will still exist.

The first thing that comes to my mind is to forget about PWM per se, and use a crystal derived 10mS clock to drive a 300uS monostable. In other words, concentrate on 300uS and trigger it from a precise timing interval.

Alternatively, a small (6 or 8-pin) MCU with built in clock can be used. Some simple programming is needed but the timing should be stable and far more accurate than you need. I'm thinking even the humble PIC10F200 should be able to do it for < 1 Euro.

Brian.
 
Internal µC clock has error in % range, so crystal oscillator is mandatory for requested sub-ppm error, possibly with calibration and temperature compensation. I agree that µC with hardware timer output is the best single chip solution.
 
Hello,

I think I will choose the µC solution. I am looking for AVR ATTiny series and PIC10F series.

Assuming that I use a external crystal with 8MHz, F_CPU = FOSC/4 = 2 MHz,
If I am not wrong, maximum resolution for the ticks on Timer will be 500 nS, so this is the "potential error" whitout counting instruction cycle time.
Will be 8 MHz of frequency clock enough for maximum error on signal about µS-nS range?

If the answer is yes, I will try to get one µC connected to 8MHz crystal oscillator.
 

If I am not wrong, maximum resolution for the ticks on Timer will be 500 nS, so this is the "potential error" without counting instruction cycle time.
Using a hardware time output, the pulse will be crystal accurate. Interrupt generated pulse will have jitter, unless corrected in software.
 
Have you checked the "Timer Blox" devices from Linear Technologies?
 
"Precision", "accuracy" or both?

Precision would be from a high bit count divider.
Accuracy would be from a well controlled frequency
source (like clock-in-a-can CMOS oscillators). Since
you seem to want nice round numbers probably a
10.000MHz reference oscillator. A tiny FPGA or a
handwired counter lashup could do the job from there.
Looks like you want a 100uS final period and some
logic to combine three adjacent codes, to me.

A higher divisor ratio would let you use a higher frequency,
tighter clock with perhaps less jitter.

Another approach would be to use a ref clock, VCO, PLL
to "clean" the ref clock jitter. But this would probably be
over-elaborate if the clock-in-a-can presents adequate
jitter / PN performance (and logic noise doesn't ruin it).
 


The mains network is 50Hz=20ms, for 2 semicicles each 10ms.
Rectifying the AC you have 2x10ms that can be used to trigger a 555 generating the 300uS needd, or just using the 0V to comand a transistor through polarization.
I believe you understand rhe idea and that the mains precision is enough.
Good luck
 

Hi,

Best fit is:
Select a microcontroller with 16bit PWM module, where youcan adjust the TOP counter value
A PWM clock with multiples of exactely 10kHz.
Maybe from a 2MHz clock with divider 8 = 250kHz (or 4MHz ÷ 16 = 250kHz)
Then use a 16 bit PWM module.
Select the TOP to for a 10ms PWM period: 25000 counts
Then select the duty cycle for 300us: 75 counts

****
In general
* clock: 10kHz (× multiplier)
* TOP: 100 ticks ( × multiplier) --> 10ms
* duty cycle: 3 ticks (× multiplier) --> 300us

Klaus
 

The mains network is 50Hz=20ms, for 2 semicicles each 10ms.
Rectifying the AC you have 2x10ms that can be used to trigger a 555 generating the 300uS needd, or just using the 0V to comand a transistor through polarization.

Might work but only if the AC is 50Hz and from a stable source (ie, not a small generator). It gets a whole lot more complicated if the AC is 60Hz!

If this is ONLY to generate the timing signal, I still suggest a 10F200 or similar. It has a stable, trimmed oscillator and no interrupt system. Delays can simply be sequential in a software loop. Look at this: http://www.atv-projects.com/50p_SPG.html its a different application but shows what can be done. Even the resistors can be omitted for a simple pulse generator, they are only present in that design to produce a two-level signal.

Brian.
 
Reactions: AG-Tek

    AG-Tek

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…