Posts

Showing posts with the label filters

DIY: Generating Ramp/Sawtooth from PWM

Image
DIY: Generating Ramp/Sawtooth from a PWM signal Lack of any good tutorial to produce a ramp/sawtooth wave from a PWM signal, urged me to make one! This post was in fact a part of one of my recent ongoing project i.e Redesigning the Semiconductor CURVE TRACER,  here at CEDT, NSIT. I was to produce a sawtooth wave from a pwm signal using arduino nano and here are my observations: TASK:  To produce a sawtooth wave from PWM signal using Arduino Nano. PROCEDURE: Producing a ramp/sawtooth wave out of a PWM signal merely involves passing a PWM signal of varing duty cycle through a low pass filter. Here's the code I used : /*Code for prodcing a Sawtooth wave from PWM*/ int pwm_pin = 9;           int brightness = 0;   int upramp(int brightness) {   while(1)   {   brightness+=5;   delay(100);   analogWrite(pwm_pin, brightness);   if(brightness>250) ...