MAX7219 LED multiplexing tutorial

Sdílet
Vložit
  • čas přidán 24. 07. 2024
  • The MAX7219 LED multiplexing chip can drive up to 64 individual LEDs. And in this tutorial we will learn how the MAX7219 works, what multiplexing is, and how you can use popular MAX7219-based modules to drive 7-segment displays and LED dot matrix displays with a PIC microcontroller. Let's go!
    Thanks for watching, and let me know in the comments if you have any questions!
    Companion article: www.friendlywire.com/tutorials...
    Email list: www.friendlywire.com/email
    Website: www.friendlywire.com
    Twitter: / friendlywire
    Reddit: / friendlywire
    Facebook: / friendlywire
    Instagram: / friendlywire
    Timestamps:
    00:00 Introduction
    00:33 Components needed for this tutorial
    01:07 What is multiplexing?
    02:07 How does the MAX7219 work?
    04:10 How to control the MAX7219
    06:00 Test circuit with a PIC microcontroller
    06:36 Building the circuit
    08:30 MAX7219-based 7-segment module
    10:22 MAX7219-based dot matrix module
    11:57 Conclusion

Komentáře • 113

  • @zambodiazook
    @zambodiazook Před rokem +7

    Thank you for posting, I dreamed of these displays in 1988 - it is wonderful seeing this in reality

    • @FriendlyWire
      @FriendlyWire  Před rokem +2

      I am so glad that this video brought you happy thoughts! Was there any particular application you had in mind? A clock, or some scientific instrument? I would love to use these in a future project (and not just in a tutorial), and I am always looking for inspirations. Have a wonderful weekend!

  • @rishusadhukhan5451
    @rishusadhukhan5451 Před rokem +3

    I can't see any video like this. This is much more interesting and fill with information. I can't see any youtuber who make a video about the hardware and software together with full information. I appreciate it and I say that "keep going". Never give up.

    • @FriendlyWire
      @FriendlyWire  Před rokem

      Thank you so much, this is very kind of you, and I am glad you found my video useful. Have a great day!

  • @75slaine
    @75slaine Před 2 lety +1

    Fantastic details as always

  • @thomasschellekens5084
    @thomasschellekens5084 Před 2 lety +2

    very nice original work, insightful diagrams, very helpful.

    • @FriendlyWire
      @FriendlyWire  Před 2 lety

      Thank you, Thomas, glad you like it! But I have to admit, there are a many other tutorials for the MAX7219 out there :)

  • @mostafanfs
    @mostafanfs Před rokem +1

    You obviously enjoy your work! and so do we!

    • @FriendlyWire
      @FriendlyWire  Před rokem

      Thanks so much, Mostafa! :) And yes, I do!

  • @shwetaringe2785
    @shwetaringe2785 Před 2 lety +5

    Thank you for such detailed explanation. It helped a lot. Your are doing fabulous job. Please keep doing.

    • @FriendlyWire
      @FriendlyWire  Před 2 lety

      Wow, thank you so much, will do! :) Have a great day!

  • @bwack
    @bwack Před 2 lety +2

    Thanks. I like the MAX7219. The 7-segment modules are very handy :)

    • @FriendlyWire
      @FriendlyWire  Před 2 lety +1

      Glad you liked the video! Yes, they are so useful for debugging, too.

  • @techkri
    @techkri Před rokem +4

    Thanks so much for this video :) I was looking for this exact video.

  • @WintermuteDigital
    @WintermuteDigital Před rokem +3

    Excellent video and clear explanations. Keep it up!

    • @FriendlyWire
      @FriendlyWire  Před rokem +1

      Thank you so much, it means a lot. Glad you liked the video! :)

  • @makcimenuka7904
    @makcimenuka7904 Před 9 měsíci +1

    Very good tutorial. Thanks.

  • @maxvideodrome4215
    @maxvideodrome4215 Před 9 měsíci +4

    I really dig how a YT content creator is using something other than Arduino.

    • @FriendlyWire
      @FriendlyWire  Před 9 měsíci +1

      Ha, thanks, I am glad you like my videos :) Honestly, I believe everyone should use what they want. For me, I get more joy out of using PIC microcontrollers, because I like to work at the level of registers, and I do not really like to use a lot of libraries or pre-built stuff. And in my videos I try to share this excitement. But of course it is also a bit hypocritical from my side, because I still use C to write the code, and not pure assembly. Arduinos are fantastic for some, so: to each their own 🙂

    • @maxvideodrome4215
      @maxvideodrome4215 Před 9 měsíci +1

      @@FriendlyWire I am the same way. I’ve been programming PICs since 2004. I am not a fan of libraries because I like to know how to drive things myself. (Aside from using I2C and SPI libraries for consistency). I find Arduino sharpens my skills because certain parts/modules documentation is only in the form of Arduino libraries. I need to pull those apart to write my own for PIC (like eink displays/etc)

    • @FriendlyWire
      @FriendlyWire  Před 9 měsíci

      @@maxvideodrome4215Oh yeah, definitely, there is lots to learn from libraries :)

  • @hthharrison7764
    @hthharrison7764 Před 2 lety +1

    Thanks for the tutorial 👍🙂

  • @jumbledfox2098
    @jumbledfox2098 Před 11 měsíci +2

    Thank you so much for this. I'm super excited to make more electronics :3

    • @FriendlyWire
      @FriendlyWire  Před 11 měsíci +1

      That's great, and thank you for your nice comment! Best of luck! :)

    • @jumbledfox2098
      @jumbledfox2098 Před 11 měsíci +1

      @@FriendlyWire thank you! The only thing I'm a bit scared of at the moment is powering my projects. Do you have any videos about such things? Thanks!

    • @FriendlyWire
      @FriendlyWire  Před 11 měsíci +1

      @@jumbledfox2098 Oh, I feel you, this can be a bit scary indeed. I don't have a dedicated video on this, sorry. What kind of project do you want to power? Does it have a lot of LEDs? If you want to stay in electronics, I would recommend to get a proper bench power supply, either a switched one (cheaper) or a linear one (more expensive). Let me know, I am happy to guide you :)

    • @jumbledfox2098
      @jumbledfox2098 Před 11 měsíci +1

      @@FriendlyWire thank you! My project includes 51 seven segment displays controlled via 7 max7219 chips, since each chip only powers one display at a time I'd need enough amps for 7*8 leds, however I don't know how many each segment uses. When I figure that out would I just need to use a power supply that can deliver that many amps (plus a bit more for the esp32 microcontroller as well as just in case)? I'd like to power it via USB c from a wall outlet if possible, I've used a barrel jack on a previous project but I didn't really know what I was doing haha (and usb c looks infinitely nicer than a barrel jack)

    • @FriendlyWire
      @FriendlyWire  Před 11 měsíci +1

      @@jumbledfox2098Okay, that's a lot of LEDs, but totally doable! Each LED, conservatively speaking, takes 20mA at full brightness. Call that 1.2A. Let's add another 300mA for anything else, just in case, so 1.5A is what you need. Makes less than 10W at 5V, so: totally doable for USB type C. But: it is too much for a regular computer USB port, which is capped at 5W, so keep that in mind. I would recommend getting a standard USB type C charger/wall adapter [like this 20W version here: www.amazon.com/dp/B0B9X2SFMH/], and a USB type C chassis adapter that is rated for that current [ like this one here: www.amazon.com/dp/B0BY7VHWRR/ ]. In your circuit, make sure to add a large-ish capacitor (100uF) close to each MAX7219, as well as a 100nF bypass capacitor. Add a very small resistor (100 Ohms or so) in series with each of the 100uF capacitors, this prevents a current surge when you first plug in the power.
      Let me know if you have any questions, and I hope it helps!

  • @KasimirvonFinck
    @KasimirvonFinck Před rokem +2

    Hey! Really cool explanation. I am doing an Art-Installation and have to light up 21 IBC containers (the large 1000l water tanks that you may use without water and rather put a light inside ;) ) For years i stayed away from two major electronic subjects... Transistors and multiplexing ;D just the gap was too braod and too easy to overcome and bypass. But not anymore. I am digging in and your video and the ones from great scott help alot. Your's though does speak to me much more as i want to understand what is happening on signal level to understand what im doing and why on the micro controller side.
    The project is to be wireless ... of course ;) (has to do with the visitors and safety blah) so I was going to use three ESP32 controllers and one master ESP32 controller for controlling the LEDs.
    To be power efficient and stay in my tiny artist budget, I want to use either 3 single 3W High power LEDs or three 1W RGB LEDs in parralle per container times 21 container in three groups.
    So that each group has 7 Containers with 3 LEDs each.
    I thought it would be ok to use the MAX7219CNG IC and MOSFETS to drive the LED. On the ESP32 side I am planning to use WLED for easy control, though am not 100% sure how the rollout will work.
    BUT now im considering the length of the cables etc. and worry about WHERE to ideally place the controller and how as the cable length might interfere.
    In any case: Thank you very much for the video!

    • @FriendlyWire
      @FriendlyWire  Před rokem +1

      Thank you for your kind words, Kasimir! I am so happy to hear that this video speaks to you, it really means a lot.
      For your project I am thinking the best solution depends a lot on the requirements of the images/patterns to be displayed. What is your target refresh rate? What kind of color depth do you need? I have never used ESP32's because of their complexity, and I like to set every bit in every register myself, but they sure sound like fantastic devices to play around with.
      Driving the MAX7219 outputs with MOSFETs may work, but you have to make sure you do some sort of manual current limiting in this case, because the MAX7219's do that automatically with that one external resistor. But of course in this case it would only regulate the gate current, and the drain-source current is independent of the gate current for mosfets.
      Good luck with your project! I am happy to help out with as much as I can, and thank you again for your interest and your nice words :)

  • @goesintite
    @goesintite Před 2 lety +1

    Thanks for the intro to MPLab

    • @FriendlyWire
      @FriendlyWire  Před 2 lety

      Thank you, Miguel, I am glad you like it! :)

  • @anokhautomation4453
    @anokhautomation4453 Před 2 lety +2

    Nice useful tutorial 👍
    Please post another tutorial for digital clock with PIC microcontroller using dot matrix display.

    • @FriendlyWire
      @FriendlyWire  Před 2 lety +1

      Thank you for your comment! :) You are actually the first one to ask for it! I have the source code ready to go, but I need to add more comments to make it easier to understand/modify for anybody interested in this. I will try to get a video out on this at some point :)

    • @Syeda-Hadia
      @Syeda-Hadia Před rokem

      @@FriendlyWire I'll be waiting for it too.

  • @eroltube100
    @eroltube100 Před 2 lety +1

    Thanks

  • @StrangeGarage
    @StrangeGarage Před rokem +1

    That's a pretty good video, my dog.

  • @dilanlakshitha2737
    @dilanlakshitha2737 Před 2 lety +1

    thank you

    • @FriendlyWire
      @FriendlyWire  Před 2 lety

      Thank you, Dilan, glad you like the video! :)

  • @flashcorp76
    @flashcorp76 Před rokem +1

    😊Nice, where is the Clock tuto ? That would be cool 👍🏻

    • @FriendlyWire
      @FriendlyWire  Před rokem +1

      Thanks! You're the first one to ask, if you contact me via email I can send you the .c-file :) My email is at the bottom of my website www.friendlywire.com

  • @A-D-D-F_Toxic
    @A-D-D-F_Toxic Před 2 lety +1

    What would you do for R-SET (2:32) if you had a few different LEDs in your matrix that have a different voltage than the rest?

    • @FriendlyWire
      @FriendlyWire  Před 2 lety +1

      Different voltages is no problem :) R-set sets the current, and most LEDs work well at the same current. A red LED needs around 1.9V and a blue LED needs 2.5V, but at 20mA they have the same brightness. So I think you can use any LED you like, as long as they have the same current. (If they have different current requirements some of the LEDs may look dim.) Hope that helps!

    • @A-D-D-F_Toxic
      @A-D-D-F_Toxic Před 2 lety +1

      @@FriendlyWire ah, thank you! I’m slowly remembering my electronics class stuff

    • @FriendlyWire
      @FriendlyWire  Před 2 lety +1

      @@A-D-D-F_Toxic No worries, happy to help! Thank you so much for your interest, Ryan, and have fun with the MAX7219 :)

  • @AussieTrucking
    @AussieTrucking Před rokem +1

    thank you for making this it helped a lot. How do you use the button to change what is displayed on the dot matrix?

    • @FriendlyWire
      @FriendlyWire  Před rokem

      Hey there, I am glad you liked the video! Inside the code you will have to react to the button press, and basically you can send out anything you want to the display. What kind of information do you want to display?

    • @AussieTrucking
      @AussieTrucking Před rokem +1

      @@FriendlyWire im wanting to be able to have 4 different icons loaded but only change when the button is pressed.

    • @FriendlyWire
      @FriendlyWire  Před rokem

      @@AussieTrucking What's your experience in programming in C? It's not so difficult, especially if you only want to display static images. Did you check out the companion article? friendlywire.com/tutorials/max7219/

    • @AussieTrucking
      @AussieTrucking Před rokem +1

      @@FriendlyWire i have no experience in programming lol. Its peaked my interest with the LED's. I've had a look at that link I understand a little but it in a way makes sense.

    • @FriendlyWire
      @FriendlyWire  Před rokem

      @@AussieTrucking Oh I see! Then this project is maybe a bit involved to get started. You can have a look at this video here (czcams.com/video/e4Q2dYVedPY/video.html) where I go through all the basics, and perhaps this one here (czcams.com/video/mUhzqDD6dg4/video.html) about more details with getting all setup.
      What kind of symbols are you looking to display? You can reach me on social media (@FriendlyWire, Twitter preferred) or via email (at the bottom of my website www.friendlywire.com). If it's only simple symbols I will be happy to send you the code that generates/creates them with button presses :)

  • @ESEben10
    @ESEben10 Před 5 měsíci +1

    Thank you for the clear tutorial! I get a FYM-23881C dot display , what is RGB unlike yours, what is one colour. It has 32 pins and with a MAX7219 I'll be able to drive only one colour. So, is that that I need three MAX7219 for each display to make light R,G or B ? Or there is a single driver that can handle this kind of display?

    • @FriendlyWire
      @FriendlyWire  Před 5 měsíci +1

      Thank you, glad you liked it :) That's a good question! I would have just went along with using three MAX7219's for this, since this chip is readily available and not so expensive. There are probably RGB drivers for this purpose, but it would most likely be more expensive. And at this point you could also make an 8x8 matrix from the comparatively cheap WS2812 LEDs (which are RGB to begin with).

    • @ESEben10
      @ESEben10 Před 5 měsíci +1

      Thank you!

    • @FriendlyWire
      @FriendlyWire  Před 5 měsíci +1

      @@ESEben10 Hope it helps. Let me know what you decided to do in the end, I would love to see the build. Have a great day! :)

    • @ESEben10
      @ESEben10 Před 5 měsíci +1

      @FriendlyWire what I have in mind right now is to place a switching device with at least 3 switching positions between the drivers and displays and tie together their switch position select pins. This way I can commute between R,G and B using only one driver per display. I was thinking on demuxes but I would need a bunch of them per display . The easiest way I found to implement a switch is using microcontrollers (like stm32f405 or f407) with enough gpio's pins to use one of it per display. But it is nevertheless a tricky solution.

    • @FriendlyWire
      @FriendlyWire  Před 5 měsíci

      @@ESEben10 One switched driver per display will be very difficult I think, since you have to write the new color data to the MAX7219 every single time when you switch to a different color, and that may mess up the multiplexing stability and will lead to flickering, unless you are super fast.

  • @mishavillanueva7191
    @mishavillanueva7191 Před 2 lety +1

    Whats the difference with cd4026 with simple counter using 7 segement display?

    • @FriendlyWire
      @FriendlyWire  Před 2 lety

      The CD4026 can only display 0,1,2,3,4,5,6,7,8,9, and that's it. Also, it can only change from 0 to 1, from 1 to 2, from 2 to 3, and so on. The MAX7219 allows you to display anything you want on a 7-segment display. It's not a counter, it is a display driver, so it is more flexible while not so specialized.

    • @mishavillanueva7191
      @mishavillanueva7191 Před 2 lety +1

      @@FriendlyWire got it. But can i use it as a counter as cd4026 i mean can i substitute to it?

    • @FriendlyWire
      @FriendlyWire  Před 2 lety

      @@mishavillanueva7191 It's not a direct substitution, you have to use it with a microcontroller. If you need a counter alternative to the CD4026 I would recommend the CD4017 (on which I also have a video: czcams.com/video/BZjO2TuS2Vk/video.html ) or perhaps the CD4510. Hope that helps! If you don't mind me asking, what is your project about? :)

  • @Syeda-Hadia
    @Syeda-Hadia Před rokem +1

    Sir can I use pic16F877 instead of pic 16f1455

    • @FriendlyWire
      @FriendlyWire  Před rokem

      Yes, of course, this is possible. You need to change to code slightly to accommodate for that. This tutorial is about the MAX7219 driver, and when you follow the steps it will be easy to adjust the code.

  • @Syeda-Hadia
    @Syeda-Hadia Před rokem +1

    Sir will u please guide me through the problem I'm getting errors in line 69-70 and 82-83.. please sir. I'm doing project for dot matrix module

    • @FriendlyWire
      @FriendlyWire  Před rokem

      What are the error messages?

    • @Syeda-Hadia
      @Syeda-Hadia Před rokem +1

      @@FriendlyWire sir I'm doing it with pic18f452 may be that's why I'm getting the errors, how I would resolve them.. just in 69-70 and 82-83 lines..please sir guide me about it

    • @FriendlyWire
      @FriendlyWire  Před rokem

      @@Syeda-Hadia Yes, this code is for the PIC16F1455, so the code needs to be changed to work with the PIC18F452. Lines 69-70 are for the pullup resistors of the PIC16F1455, the PIC18F452 may not have these registers. And lines 82-83 turn off the analog features on the pins RC2 and RC3 of the PIC16F1455.
      Which pins of the PIC18F452 are you planning to use? And did you create a new project inside the MPLAB IDE specifically for the PIC18F452?

    • @Syeda-Hadia
      @Syeda-Hadia Před rokem

      @@FriendlyWire yes sir as according to the code I have use the pins for pic18 as you have used for pic16..
      But the problem I'm receiving is how to disable the features of the pins of pic18 to match it with pic16..
      As you have disable the feature of analog in ur pic microcontroller..
      What would be the command syntax for my pic18 microcontroller

  • @amermusinbegovic3882
    @amermusinbegovic3882 Před rokem +1

    What simulation program do you use?

    • @amermusinbegovic3882
      @amermusinbegovic3882 Před rokem +1

      I'm trying with proteus , can't make it work

    • @FriendlyWire
      @FriendlyWire  Před rokem

      @@amermusinbegovic3882 Actually I don't use a simulation program. Is something not working? Are there error messages?

  • @bigtronicas.a.s354
    @bigtronicas.a.s354 Před 2 lety +1

    high vibe

  • @jeksontivane2455
    @jeksontivane2455 Před rokem +1

    Como comandar matriz de led, sem programa?

    • @FriendlyWire
      @FriendlyWire  Před rokem

      Without a program this is probably more difficult with the MAX7219 (since it is designed to work with microcontrollers). In that case I would recommend to build your own discrete driver out of transistors.

    • @jeksontivane2455
      @jeksontivane2455 Před rokem +1

      @@FriendlyWire oh thank

  • @Syeda-Hadia
    @Syeda-Hadia Před rokem +1

    Can I use Mikro C for software compiler

    • @FriendlyWire
      @FriendlyWire  Před rokem

      Yes, I think Mikro C supports PIC controllers. But the XC8 version I am using in my videos is completely free, and then you can follow the videos more directly. Both ways work :)

    • @Syeda-Hadia
      @Syeda-Hadia Před rokem +1

      @@FriendlyWire Thank youuuuu thank you for such a generous reply. All the best wishes for you....😊🤞🤞

    • @FriendlyWire
      @FriendlyWire  Před rokem

      @@Syeda-Hadia Thank you, and don't hesitate to get in touch if anything doesn't work, we will figure this out :)

    • @Syeda-Hadia
      @Syeda-Hadia Před rokem +1

      @@FriendlyWire Alright Sir ☺️

    • @Syeda-Hadia
      @Syeda-Hadia Před rokem

      Hi, once again here to bother you, actually just wanna ask that can we change the code for dot matrix module

  • @Syeda-Hadia
    @Syeda-Hadia Před rokem +1

    Hi, sir the great calm explanation. Thank you 💕.
    Sir I hope u don't mind, can u share the code.
    Regards

    • @FriendlyWire
      @FriendlyWire  Před rokem

      Thank you for your kind words! The entire source code is on my website: friendlywire.com/tutorials/max7219/

    • @Syeda-Hadia
      @Syeda-Hadia Před rokem +1

      @@FriendlyWire got it thanks alot ✨✨

    • @FriendlyWire
      @FriendlyWire  Před rokem

      @@Syeda-Hadia Happy to help, and best of luck!

    • @Syeda-Hadia
      @Syeda-Hadia Před rokem +1

      @@FriendlyWire 🤗

    • @Syeda-Hadia
      @Syeda-Hadia Před rokem +1

      Hi 👋.
      Sir I'm having an error in code for dot matrix module with max7219 in Mikro C

  • @07ring07
    @07ring07 Před 2 lety +1

    👍

  • @novocanal7153
    @novocanal7153 Před 2 lety +1

    Please, https for your homepage. http not runing :-( Firewall here

    • @FriendlyWire
      @FriendlyWire  Před 2 lety +1

      I coded this website in static HTML, the only javascript is from the image gallery, so you should be safe. I have heard several people mention they cannot view my website, may I ask from where you are watching, and what your browser is?
      //edit: I turned on SSL, it should work now as soon as it is activated by the provider.

    • @novocanal7153
      @novocanal7153 Před 2 lety +1

      @@FriendlyWire from Brazil. I use Chrome. https is ok now. Thank you so much!!

    • @FriendlyWire
      @FriendlyWire  Před 2 lety +1

      @@novocanal7153 Glad it's working now!

  • @rrssmooth6643
    @rrssmooth6643 Před měsícem +1

    I thought I could figure out arduino, driving me nuts

    • @FriendlyWire
      @FriendlyWire  Před měsícem

      Sorry for your frustration! Sometimes these things can drive us nuts indeed... Can I help with anything?

    • @rrssmooth6643
      @rrssmooth6643 Před 28 dny +1

      @@FriendlyWire I will just keep working at it, cannot believe school children know how to do it. I figure little things out more and more.

    • @FriendlyWire
      @FriendlyWire  Před 27 dny

      @@rrssmooth6643 That's awesome, good luck, and don't give up, you can do it!