Simple PWM display

Arduino projects on the go
User avatar
Phil_G
Posts: 302
Joined: 15 Feb 2018, 23:32
Contact:

Simple PWM display

Post by Phil_G » 16 Aug 2019, 13:43

This is so simple its hardly a project at all, it came about when I needed to measure two servo pulse sources simultaneously. I have an MT01 which is very handy but only displays one, so I needed another 'right now' :D

Its so quick & easy, that choosing a suitable font for the display took longer than assembling the PWM meter!





IMG_20190816_120643.jpg



Above the MT01 is a much smaller PWM meter using only 3 parts, a £1 promini, a £2 128x32 OLED and a junkbox servo lead, total cost £3. It shows the pulse-width coming from whatever source its plugged into, or 'No pulse' if there is power but no pulses which is typical of 'failsafe' on cheap receivers like the Oranges.



IMG_20190816_115907.jpg


IMG_20190816_115921.jpg


The folded white thing between the boards is double-sided tape!
IMG_20190816_120406.jpg


IMG_20190816_120433.jpg

IMG_20190816_120223.jpg


The display can be mounted above the promini, where the holes for A4/SDA and A5/SCL align, so
two short, stiff wires can be used as stand-off supports, or a 2-pins from a header strip. Of course there are differing promini layouts so use whatever is most convenient. Theres a bit of insulative double-sided tape between the two boards then the whole thing is wrapped in transparent heatshrink.



servo_pwm_meter.jpg



Usually we get away without them, but for the first time, and only on the promini, I had to add the 1k I2C pull-up resistors on SDA and SCL. The same sketch on an ebay 'Strong' didnt need them.
They are part of the I2C spec so really ought to be there, but we often dont bother. Its just a couple of the smallest 1k resistors you can find, both with one end to vcc (+5v) and the other ends to SDA and SCL (or A4 and A5, whichever is easier)
The symptom is the display occasionally locking up - the promini was still working, I can tell because even during a lock-up the promini's onboard D13 LED still correctly indicates 'pulses' or 'no pulses'. The pull-ups are a 100% fix.

Arduinos are great for making things on the fly as & when you need them - for example I recently needed to revisit the old Frsky SBUS frame-rate divider project, and I have no SBUS gear... but its so cheap & easy to emulate with a promini, problem solved :D

Finally just a reminder that the 5v input wont take a 5-cell NiMh voltage so if you use high voltage packs, feed the promini positive on Vin (sometimes called 'raw') rather than Vcc. In other words take the red of the servo lead to 'Vin' or 'Raw' rather than to 'Vcc'. The display is still powered from Vcc.
All my own gear is either a 5v BEC, a 4-cell Nimh or a single Lipo cell so it suits me as drawn above.

Cheers
Phil
Attachments
servo_pwm_meter_128x32.ino
(851 Bytes) Downloaded 25 times

User avatar
Wayne_H
Posts: 296
Joined: 17 Feb 2018, 05:26
Location: Temora, NSW. Australia
Contact:

Re: Simple PWM display

Post by Wayne_H » 16 Aug 2019, 14:08

Elegantly simple :ugeek: - gotta make at least one, just to keep in the field box!

thanks Phil 8-)
Cheers,

Wayne
Once a Retrobate, always a Retrobate............ :roll:

User avatar
RON
Site Admin
Posts: 552
Joined: 12 Jun 2017, 15:09
Location: Guisborough North Yorkshire

Re: Simple PWM display

Post by RON » 16 Aug 2019, 14:13

Superb Phil, and so simple. I have 3 of those displays, I’m gonna have a play around. No pro minis though, so a nano it will have to be.
Ron.
If you would like to contribute a small amount toward the upkeep of this valuable forum then please click the Donations link at the top of the page, just below the mode zero logo. All donations are kept anonymous. Thankyou

User avatar
tiptipflyer
Posts: 206
Joined: 16 Feb 2018, 22:49
Location: Germany

Re: Simple PWM display

Post by tiptipflyer » 16 Aug 2019, 14:33

Great Phil,
I think I have all parts here, so I will try one out.
Well done.
Frank

User avatar
RON
Site Admin
Posts: 552
Joined: 12 Jun 2017, 15:09
Location: Guisborough North Yorkshire

Re: Simple PWM display

Post by RON » 16 Aug 2019, 16:00

Phil
Knocked up a quick version with a 128x64 display.
How about making a 2 channel version with 2 separate leads. They would be a perfect fit on the screen

Ron.
E102C0BD-5F82-48CF-A110-A80FAB7E4C25.jpeg
If you would like to contribute a small amount toward the upkeep of this valuable forum then please click the Donations link at the top of the page, just below the mode zero logo. All donations are kept anonymous. Thankyou

User avatar
Phil_G
Posts: 302
Joined: 15 Feb 2018, 23:32
Contact:

Re: Simple PWM display

Post by Phil_G » 16 Aug 2019, 16:17

Thats really neat Ron I dont know how you work so quickly :D
VC10 RON wrote:
16 Aug 2019, 16:00
How about making a 2 channel version with 2 separate leads.
For a two-channel version which would work with Frsky simultaneous pulses you'd need to decide whether to measure alternate pulses (because pulsein waits for a pulse) , or go to a more complicated edge-triggered interrupt version - which is perfectly feasible but this was only a quick 'tool for the job in hand' and its water under the bridge now :D
The two-channel interrupt routine from the DigiSpark GG recoder (the original 2ch version) is an example
but I think you'd have to do some smoothing, whereas pulsein() is quite stable.
Cheers
Phil

User avatar
RON
Site Admin
Posts: 552
Joined: 12 Jun 2017, 15:09
Location: Guisborough North Yorkshire

Re: Simple PWM display

Post by RON » 16 Aug 2019, 16:32

Thanks Phil,
Id prob never use the 2 channel version to be honest, I just saw the display with only half of it used and my brain was working overtime.

Its really nice and useful as it is Phil, leave as is.

Ron
If you would like to contribute a small amount toward the upkeep of this valuable forum then please click the Donations link at the top of the page, just below the mode zero logo. All donations are kept anonymous. Thankyou

Martin
Posts: 311
Joined: 16 Feb 2018, 14:11
Location: Warwickshire

Re: Simple PWM display

Post by Martin » 16 Aug 2019, 16:55

You could measure and display the voltage to use the second line of a two-line display - that would be useful information.

If you're going to try it, you'll need to use the analogReference(INTERNAL); command to use the Arduino's internal 1.1V reference - and a pair of resistors to drop the voltage down to less than 1.1V so you can measure it. You can't otherwise measure the same (roughly 5V) voltage that you're powering the Arduino with - that won't work.

User avatar
RON
Site Admin
Posts: 552
Joined: 12 Jun 2017, 15:09
Location: Guisborough North Yorkshire

Re: Simple PWM display

Post by RON » 16 Aug 2019, 17:00

Thanks Martin,
Great idea, Im on it.

Ron
If you would like to contribute a small amount toward the upkeep of this valuable forum then please click the Donations link at the top of the page, just below the mode zero logo. All donations are kept anonymous. Thankyou

User avatar
RON
Site Admin
Posts: 552
Joined: 12 Jun 2017, 15:09
Location: Guisborough North Yorkshire

Re: Simple PWM display

Post by RON » 18 Aug 2019, 10:05

Finally finished "Phil's" version except I used an Arduino Mini,(not pro mini). Unfortunately these are discontinued now but are even easier to wire than Phil's as the 5v and ground line up too, so the display just drops straight in. I used 1/8w 1k resistors for the i2c lines, really small.
Just need some clear heat shrink now!

A superb little project and so useful. Thanks Phil.

Ron
Screenshot 2019-08-18 at 10.04.47.png
If you would like to contribute a small amount toward the upkeep of this valuable forum then please click the Donations link at the top of the page, just below the mode zero logo. All donations are kept anonymous. Thankyou

Post Reply