Displaying PWM signal

Hi, I want to display PWM waveform signal on 16x2 arduino lcd display. The idea is to user enter pulse width in miliseconds and then ardiono have to visualize PWM on screen. Any ideas? Whether there are functions for plotting pwm signals or manual programming of each pixel is required. Thank you in advanced :smiley:

Please research the number of custom characters that the display controller supports...

Possibly just enough custom characters (8)…

  • Short high going,
  • long high going,
  • Short low going,
  • long low going,
  • low
  • high…

Then a bit of code to setup your timebase and translate the edges into a mimic display.
Keep in mind your serial output has to be as fast as possible - to accommodate the incoming edge rate.

Be aware that the 16x2 lcd displays are not grafical displays. They only can display fixed characters, while only 8 of these characters can be freely defined. Also the distance between these characters is fixed and cannot be written to. There are only limited possibilities to visualize a PWM signal. What resolution to you want to achive?

Check what is available in the character set. You may need to program to display the whole character set on the particular display version to see.

For example, an underline.

Well, a PWM signal has a fixed period, only the transition in the middle will be changing, so it should be possible with the built-in graphic characters and custom characters.

Not really. It's not an oscilloscope. It just has to represent the PWM and the visual will be created separately from the actual PWM.

And, the "user" has to know how to interpret the visual. It's like snapshot of continuous high-speed action. It's intuitive to me because I've used 'scopes and looked at "waveforms" for a long time but I'm not sure it's obvious to the average person...

You are either going to display a single PWM period or perhaps 2 or 3 cycles.

The single period can show fairly high resolution but since the dots don't all join up it is a "bit horrible". But you will see the duty cycle clearly.
Showing several cycles will look like PWM. And some idea of the duty cycle.

Quite honestly, a 16x2 LCD is better with text e.g.
PWM = 25kHz, duty = 79.5%

David.

Fair enough… I was thinking OP was looking for a ‘real-time display’ of a PWM-like waveform on the serial output using ASCII art..

I don's see that it would be much different than a progress bar, with a fixed width and a certain percentage filled in.

Actually, the resolution isn't important so much. What matters is that is entire lcd screen is covered by the PWM signal.

Yeah, thanks for advice :smiley: