Recently I did a video attempting to describe and compare the differences in a digital PWM signal and an analog signal. To supplement my recent video, I am sharing another video I recently found while traversing the tubes.
This video is about using PWM with FPGA’s— it’s not directly related with micro-controllers and is a bit technical. For us though, Mrs. Shelly gives a good definition, examples and usages of PWM and the info could be helpful to those who still lack a good understanding of what PWM is doing. The first 4:30 of the video is the only relevent part to us in the *duinoverse, after that it’s just about software implementation of FPGA’s …
Signals come in two basic types – Analog and Digital. Analog signals are capable of being any value, where Digital signals are called “discrete”, meaning they capable of being in only one of two states! The terms for these two states of a Digital signal are varied but include; ON/OFF, TRUE/FALSE, 1/0, HIGH/LOW, etc.
So what’s that mean? A good example of a Digital signal is a light switch in your house. You can either flip the light switch ON, or flip the light switch OFF. To follow this line of thought, an example of an Analog signal would be a light with a dimmer switch. With a dimmer switch you can adjust how bright or dim the light is, anywhere from completely OFF, to completely ON.
Okay… The Arduino is capable of analog and digital INPUT, but only capable of digital OUTPUT. When working with the Arduino we see that there are 6 analog pins and 14 digital pins. (It should be noted that if you have no need of analog INPUT; you may use the analog pins as extra digital OUTPUT pins — declaring them as digital pins 14 – 19)
So, if we are only capable of digital OUTPUT on the Arduino, how are we able to dim a LED?
dimming LED with digital PWM
ENTER PWM!! (Pulse Width Modulation) Some, but not all pins on the Arduino are capable of Digital PWM OUTPUT. Basically, PWM is the digital way of mimicking an analog OUTPUT.
To better show the difference between Analog and Digital PWM, I put together a simple LED dimmer circuit and hooked up an oscilloscope to view the Analog and Digital PWM signals. I took some video of everything in action to better serve as an example.