Hi there. I am working in a project that need specific requirements, so I need some help:
I need to make 2 PWM with variable duty cycle which are controlled by means of potentiometer, The PWM frequency should be 30 khz. I have done all of that but I can't do it with the following challenge. I need those 2 PWM to be shifted from each other half cycle. And running simultaneously with each other. This is my code:
I need to make one of the PWM shifted from the other half cycle. After days of research, I couldn't find it. I hope you can help me theoretically and with code modifications. Thanks a lot
No, My project is about controlling 2 parallel buck chopper, each is controlled by means of MOSFETS, these MOSFETS are switching On or Off according to the high or low of the Pulse came from my PWM. And The task is to phase shift between the 2 PWM while controlling their duty cycle by means of Potentiometer.
I am about a week of reading, watching and writing, and the using some oscilloscope simulation on my laptop to help, but in vain. Can you help with a code modification?
No absolutely not, According to my project, the overlapping is a mandatory when I increase the PWM Duty cycle of both, as it will offer higher voltage for the load. So there is no problem with the overlapping.
it really all depends WHERE OP want to phase shift the pulse... and that is why I asked for timing diagram as it may not be that straight forward as much as it could be!
I searched and searched, And now by the help of a software, I could make a shift, but then couldn't control the duty cycle effectively, here is an update if you can help.
The phase shift is almost done (I am not sure) But analogWrite is not effective in duty cycle controlling. as with any modification instead of 255, make no output at all.
Sounds tricky. You need 4 transitions at different times, all in sync with each other, and with the 180° shifted transitions overlapping the rollover, so most of the PWM modes won't work.
Maybe you could use timer1 in CTC mode with ICR1 (WGM=12) to set the frequency, toggle OC1A and OC1B on match, and also do some awkward interrupt trickery to update OCR1A and OCR1B when the matches happen to match the duty cycles.
How much PWM resolution do you need? Would a software PWM based on micros() or a counter be good enough?
Mode, As a newbie in Arduino development, I don't know what PWM mode is, But I will describe what I want do.
I want 2 PWM to operate at same time, one on pin 9, and the other on pin 10, that's for using Timer1 which is 16-bit timer and can generate higher frequency about 30 khz. The controlling over the PWM duty cycle will be done by using potentiometer, from 0 to 5v. I hope it well be the answer, and for that, I supplied my 2 written codes.
The PWM frequency should be 30 khz (high freq, I know) But is a mandatory, so I thinks it will be 16-bit for Timer 1, as timer 0 can't get this higher freq.