PWM multiple 7-segment LEDs


+ Reply to Thread
Results 1 to 20 of 20
  1. #1
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,597

    Default PWM multiple 7-segment LEDs

    Quote Originally Posted by Ioannis View Post
    I would use what Maxim suggest for the displays and would not bother with mods to drive common anodes. ...
    Yeah, I wasn't going to keep fighting against the current.


    I'm looking at using PICs instead. Concatenating values and remembering which one is in which position is going to be a massive chore, with lots of place for error.

    Name:  4 - Console.png
Views: 128
Size:  73.8 KB


    I'm looking at using PICs instead. My 7-segment displays will range between 2 and 6 digits. I just send each PIC a USART message with the value they have to display and forget about them until the value changes.

    This is why I had gotten common anode in the first place. The power to the LEDs was going to be controlled by pot & PWM from a main PIC. I was planning on using transistors to control the 8 segments. It's cheaper to use MAX7219, but in my case I don't think it's worth it.

    Another thing consider is that this is the "basic" console; the Cessna 152 is one of the simplest planes with a single engine in MSFS 2020. I plan on making consoles for much more complex planes, most having 2 - 4 engines. That's a truckload of displays; that's why USART-and-forget is my favorite technique so far.

    I started looking at 16F PICs on JLCPCB. I forgot about those and had only looked at 18F PICs the first time. So far I'm looking at:

    - 14-pin 16F1823 @ $1.16
    - 28-pin 16F1933 @ $1.51

    And I'm just starting, I'm pretty sure I saw some 44-pins in there. I can easily control 6 digits with that and a few transistors.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  2. #2
    Join Date
    Aug 2011
    Posts
    408


    Did you find this post helpful? Yes | No

    Default Re: HW-179 8-Digit 7-Segment LED Display (MAX7219 Driver)

    This is why I had gotten common anode in the first place. The power to the LEDs was going to be controlled by pot & PWM from a main PIC
    Wouldn't it be simpler with common cathode? That way you only have a single sink transistor/fet for each set of digits, making it easy to PWM.

  3. #3
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,597


    Did you find this post helpful? Yes | No

    Default Re: HW-179 8-Digit 7-Segment LED Display (MAX7219 Driver)

    Quote Originally Posted by tumbleweed View Post
    Wouldn't it be simpler with common cathode? That way you only have a single sink transistor/fet for each set of digits, making it easy to PWM.

    Hmm, is sink more efficient than source?


    EDIT: Gotten from a quick google:

    'While this may sound strange or non-ideal, it is generally easier for the microcontroller to shunt this current to ground and absorb a little power as heat rather than try and generate the sourcing current. Sourcing current can cause large voltage swings on the input which can introduce noise.'

    Interesting, I never really put a lot of thought in this before.

    I suppose that's because the PIC didn't have to source the power consumed by the device, only the leftovers.

    Where-as if it has to source, it has to source everything. Never thought of that.
    Last edited by Demon; - 15th February 2024 at 23:27.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  4. #4
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,597


    Did you find this post helpful? Yes | No

    Default Re: HW-179 8-Digit 7-Segment LED Display (MAX7219 Driver)

    PWM is done at a higher level by a central PIC, so all LEDs across the console get the same VDD-LED.

    My largest display has 6 digits with 1 decimal point. This was my most recent gameplan. I can use smaller PICs for smaller displays:

    Name:  6 LED via TQFP-64.png
Views: 116
Size:  19.8 KB


    EDIT: Right now JLCPCB has 500 units of 16F946 in stock for $2.15, 2889 units of the 16F1947 for$2.21.

    When you consider the MAX9217 costs me $20 for each DIP for my testing, I'll need 20 to test the entire console.

    Using PICs in this case is not much more expensive and so much more affordable and convenient, especially when it comes to transmitting the values to the displays.
    Last edited by Demon; - 16th February 2024 at 03:37.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  5. #5
    Join Date
    May 2013
    Location
    australia
    Posts
    2,388


    Did you find this post helpful? Yes | No

    Default Re: HW-179 8-Digit 7-Segment LED Display (MAX7219 Driver)

    i see a lot of smoke in your future

    apart from the upside down mosfet

    pic1f946 max chip current 95mA although each pin can sink or source 25mA equally well
    @ 42 leds [or 48] if you use dp's thats 2.2mA per led 2 Full bright , the 270 ohm seg resistors are not going to do that for you

    pic1f1947 max chip current 120mA [the industrial ver can sink more] although each pin can sink or source 50mA equally well
    @ 42 leds [or 48] if you use dp's thats 2.8mA per led 2 Full bright , the 270 ohm seg resistors are not going to do that for you

    Name:  946.jpg
Views: 117
Size:  176.2 KB
    Name:  1947.jpg
Views: 91
Size:  204.8 KB
    Warning I'm not a teacher

  6. #6
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,803


    Did you find this post helpful? Yes | No

    Default Re: HW-179 8-Digit 7-Segment LED Display (MAX7219 Driver)

    The sink is always better choice than sourcing.

    Then N-channel MosFets along with NPN transistors are much better than P equivalent ones and more choices available.

    And finally, even if a PIC can source or sink 20, 30 or 50mA per pin, there is a maximum TOTAL dissipation for the whole chip, so that you cannot source at the same time on all pins a max of 50mA on each pin!

    You will melt the chip!

    So, yes. I am for the sink topology too.

    Ioannis

  7. #7
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,803


    Did you find this post helpful? Yes | No

    Default Re: HW-179 8-Digit 7-Segment LED Display (MAX7219 Driver)

    Now, if you look at datasheet, p236, for the 946 chip.

    Output Low is 0.6 Volt at only 8.5mA but,

    Output High Vdd-0.7 Volt at 3.0mA

    So, yes. It is better to sink than source.

    Ioannis

  8. #8
    Join Date
    May 2013
    Location
    australia
    Posts
    2,388


    Did you find this post helpful? Yes | No

    Default Re: HW-179 8-Digit 7-Segment LED Display (MAX7219 Driver)

    for my money i would do it the traditional way or if multiplexed display is not bright enough use a bunch of tpic6b595's

    Name:  multi.jpg
Views: 93
Size:  261.6 KB

    note schema is not complete but you get the idea, i was going to try it in proteus then i remembered how crap proteus is at simulating multiplexing
    so i gave up
    Last edited by richard; - 16th February 2024 at 11:32.
    Warning I'm not a teacher

  9. #9
    Join Date
    Aug 2011
    Posts
    408


    Did you find this post helpful? Yes | No

    Default Re: HW-179 8-Digit 7-Segment LED Display (MAX7219 Driver)

    With that many displays I assumed they would be multiplexed as in richard's post #17.
    Surely a lot less supply current, and you wouldn't need nearly as many pic's to drive them... maybe get away with one or two 44-pin packages.

  10. #10
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,597


    Did you find this post helpful? Yes | No

    Default Re: HW-179 8-Digit 7-Segment LED Display (MAX7219 Driver)

    (I'll move the PWM LED posts to an off-topic thread in a few minutes to keep this about Chuck's code example. I just want to put down some comments first.)

    Quote Originally Posted by richard View Post
    ... apart from the upside down mosfet ...
    I was hoping you wouldn't see that. It was late and I went to bed.


    Quote Originally Posted by richard View Post
    i see a lot of smoke in your future ...
    Usually I'd agree with you, and yes I'm aware of the current limitations on PICs and pins.

    But ... LEDs are special. You can get different performance out of them via PWM. This is identical LEDs:

    - left, 5V rail with 270ohm resistor.
    - right, PWM without resistor.




    I can get identical brightness with 2.5mA less. If I add a 270 ohm resistor to PWM, I get 1/2 the current.

    Name:  2 LEDs both with 270R - PWM on right.jpg
Views: 89
Size:  146.8 KB


    Yeah, I thought I could improve this even further down to 2mA but that isn't gonna happen. The LED won't be bright enough.

    And yes, I've been playing with using transistors/MOSFETs and I'll be going back that way again.

    Name:  PWM 7-segment LEDs.jpg
Views: 89
Size:  117.0 KB


    I had dropped that idea cause HPWM has lower limits on Frequencies and I didn't like not have total control (64 MHz is 3905Hz).

    But I just realized I could pulse the devices using a timer interrupt; switching between different ON-time and OFF-time.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  11. #11
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,597


    Did you find this post helpful? Yes | No

    Default Re: HW-179 8-Digit 7-Segment LED Display (MAX7219 Driver)

    Quote Originally Posted by richard View Post
    for my money i would do it the traditional way or if multiplexed display is not bright enough use a bunch of tpic6b595's...
    Thanks, I'm off to google that chip (no idea what it is). I've also seen talk about using a 74HC595 (never met that creature either).


    EDIT: Google says TPIC6B595 can sink up to 150mA at 50V. JLCPCB carries them at $1.54.

    Google says 74HC595 has a 70mA total limit, so there goes that chip. JLCPCB has them at $0.11 too.
    Last edited by Demon; - 16th February 2024 at 20:44.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  12. #12
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,803


    Did you find this post helpful? Yes | No

    Default Re: PWM multiple 7-segment LEDs

    The 74HC595 is a shift register. How can this help on 7-seg LED's ?

    Dedicated chips like Maxims or the TPIC6B595 I think is the way to go.

    Ioannis

  13. #13
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,597


    Did you find this post helpful? Yes | No

    Default Re: PWM multiple 7-segment LEDs

    Quote Originally Posted by Ioannis View Post
    The 74HC595 is a shift register. How can this help on 7-seg LED's ? ...

    Some people use them to drive 7-segment LEDs. They don't have digit control, only segment control, so you need one per digit.




    It turns out my supplier for 7-segment LEDs also print and assembles PCBs. It wouldn't be cost effective to ship my LEDs back, so I might very well do the jump to the MAX7219 if I have to buy more LEDs.

    I'm keeping all my options open for the time being, but the MAX7219 does offer one really neat feature; an intensity control. That TPIC6B595 is a close 2nd for common anode LEDs.
    Last edited by Demon; - 17th February 2024 at 01:06.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  14. #14
    Join Date
    May 2013
    Location
    australia
    Posts
    2,388


    Did you find this post helpful? Yes | No

    Default Re: PWM multiple 7-segment LEDs

    You should also look at HT16K33 , that can read in switches and buttons too
    ditto for
    tm1637 and 1638
    Warning I'm not a teacher

  15. #15
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,597


    Did you find this post helpful? Yes | No

    Default Re: PWM multiple 7-segment LEDs

    Alibaba is a game-changer for little people like me.

    I'm talking with a supplier for 15 inch displays 4K UHD 3840X2160; just the screen and the controller board (I'm using Acer 19 inch displays at only 1366x768 myself).

    I already resized all my gauges to make sure they can fit in the space. I end up with high quality graphics, low weight, lower cost, and a LOT less work.

    Name:  FS-2020 with 15inch gauges alone.png
Views: 51
Size:  685.1 KB


    That's all the gauges practically identical to the game, and this screen runs on VGA or HDMI. I just hope it's better quality than the ones I already got from AliExpress.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  16. #16
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,803


    Did you find this post helpful? Yes | No

    Default Re: PWM multiple 7-segment LEDs

    Impressive isn't it?

    Ioannis

  17. #17
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,597


    Did you find this post helpful? Yes | No

    Default Re: PWM multiple 7-segment LEDs

    This is why I went with the 7-segment display route. I had bought 2 LCDs from AliExpress and was really disappointed by the quality. The viewing angle was just too narrow, and the backlight was overly bright, even with setting turned down to zero (my decade-old Acer x183H in the background is still better).




    This pic is from the manufacturer using my image, on her PC in the back, and the display in the front.




    It's not a photoshop; she also sent me video. They sell these to laptop manufacturers.

    Using 7-segment displays brings its own challenges; more complicated, lots of parts for solder, lots of circuits to install. I didn't get a final price on the 15" display, but it's most likely going to be a justified expense. And it's going to look freaking awesome once assembled.

    There's another advantage; the next plane on my list is the Cessna 172 and it uses 2 displays side-by-side:

    https://stormbirds.blog/2022/04/30/t...carousel-48750


    I haven't done any tests yet, but I should be able to place both of those on the 15" screen.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  18. #18
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,803


    Did you find this post helpful? Yes | No

    Default Re: PWM multiple 7-segment LEDs

    Definitely the LCD is the way to go!

    I would not bother with any LEDs display. Maybe only for the buttons or pots. Or is this possible to be done with touch displays too?

    Ioannis

  19. #19
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,597


    Did you find this post helpful? Yes | No

    Default Re: PWM multiple 7-segment LEDs

    It's always possible to do touch, but I like the feel of mechanical devices. 🙂
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  20. #20
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,803


    Did you find this post helpful? Yes | No

    Default Re: PWM multiple 7-segment LEDs

    Me too!

    Ioannis

Similar Threads

  1. Re: RGB Fading Using 3 LEDs and PWM
    By Fernandoangel in forum Off Topic
    Replies: 0
    Last Post: - 8th April 2012, 05:59
  2. LEDs, current and PWM
    By Demon in forum Off Topic
    Replies: 10
    Last Post: - 2nd April 2012, 04:41
  3. Multiple LEDs and Time Coount
    By LexManos in forum General
    Replies: 4
    Last Post: - 24th July 2009, 06:36
  4. How to drive 7 segment using multiple ports?
    By guess79 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 11th December 2006, 19:43
  5. Multiple IR LEDs from 1 port using transistor
    By belpe123 in forum General
    Replies: 3
    Last Post: - 20th May 2005, 22:07

Members who have read this thread : 8

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts