PWM multiple 7-segment LEDs


Closed Thread
Results 1 to 20 of 20

Hybrid View

  1. #1
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,154

    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: 1344
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
    453


    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
    3,154


    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
    3,154


    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: 1299
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,631


    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: 1262
Size:  176.2 KB
    Name:  1947.jpg
Views: 1233
Size:  204.8 KB
    Warning I'm not a teacher

  6. #6
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,115


    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
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,154


    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: 1226
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: 1238
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!

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 : 0

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