Custom PWM Programming

Hi All,

I have got a project coming up for an exhaust valve controller. Is it possible to program the Arduino to get a PWM signal at 50% duty cycle with a frequency of 2.4khz? It would need to be a pulse of around a second once a button has been pressed.

I have the existing valve controller which uses a Nuvoton N76E003AT20 Microcontroller, but I want to make my own controller.

Kind Regards,
Mike.

Yes. Its easier on the Teensy series of Arduinos which have analogWriteFrequency() built-in. For other Arduinos you need to do a lot of work on PWM registers or find a library which does this for you. What did Google find for you?

Thanks for your reply.

I' ll have a look into the Teensy boards.

I have done a few searches but can't seem to get my head around some of the jargon. Just when I think I'm getting somewhere a load more jargon pops up and throws me off.

I have been trying to get my head around the TimerPWMCheatsheet

Mike.

tone(pin, frequency)

tone(pin, frequency, duration)

FantomT:
tone(pin, frequency)

tone(pin, frequency, duration)

Thanks FantomT

I just simulated this on Tinkercad and looked like I was getting the right signal. I'll upload it to the Arduino and test it out with the scope tomorrow.

Mike.