MAX7219 LED multiplexing tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 22 พ.ค. 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

ความคิดเห็น • 109

  • @zambodiazook
    @zambodiazook ปีที่แล้ว +6

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

    • @FriendlyWire
      @FriendlyWire  ปีที่แล้ว +1

      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!

  • @thomasschellekens5084
    @thomasschellekens5084 2 ปีที่แล้ว +2

    very nice original work, insightful diagrams, very helpful.

    • @FriendlyWire
      @FriendlyWire  2 ปีที่แล้ว

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

  • @WintermuteDigital
    @WintermuteDigital ปีที่แล้ว +3

    Excellent video and clear explanations. Keep it up!

    • @FriendlyWire
      @FriendlyWire  ปีที่แล้ว +1

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

  • @techkri
    @techkri ปีที่แล้ว +4

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

    • @FriendlyWire
      @FriendlyWire  ปีที่แล้ว

      Thank you, I am happy you like it!

  • @bwack
    @bwack 2 ปีที่แล้ว +2

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

    • @FriendlyWire
      @FriendlyWire  2 ปีที่แล้ว +1

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

  • @rishusadhukhan5451
    @rishusadhukhan5451 10 หลายเดือนก่อน +2

    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  9 หลายเดือนก่อน

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

  • @mostafanfs
    @mostafanfs ปีที่แล้ว +1

    You obviously enjoy your work! and so do we!

    • @FriendlyWire
      @FriendlyWire  ปีที่แล้ว

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

  • @75slaine
    @75slaine 2 ปีที่แล้ว +1

    Fantastic details as always

    • @FriendlyWire
      @FriendlyWire  2 ปีที่แล้ว

      Thank you, Glen, so glad you liked it!

  • @makcimenuka7904
    @makcimenuka7904 7 หลายเดือนก่อน +1

    Very good tutorial. Thanks.

    • @FriendlyWire
      @FriendlyWire  7 หลายเดือนก่อน +1

      Thank you, I am glad you like it!

  • @hthharrison7764
    @hthharrison7764 2 ปีที่แล้ว +1

    Thanks for the tutorial 👍🙂

    • @FriendlyWire
      @FriendlyWire  2 ปีที่แล้ว

      Thank you, happy you like it!

  • @shwetaringe2785
    @shwetaringe2785 2 ปีที่แล้ว +5

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

    • @FriendlyWire
      @FriendlyWire  2 ปีที่แล้ว

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

  • @jumbledfox2098
    @jumbledfox2098 9 หลายเดือนก่อน +2

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

    • @FriendlyWire
      @FriendlyWire  9 หลายเดือนก่อน +1

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

    • @jumbledfox2098
      @jumbledfox2098 9 หลายเดือนก่อน +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  9 หลายเดือนก่อน +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 9 หลายเดือนก่อน +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  8 หลายเดือนก่อน +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!

  • @maxvideodrome4215
    @maxvideodrome4215 7 หลายเดือนก่อน +3

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

    • @FriendlyWire
      @FriendlyWire  7 หลายเดือนก่อน

      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 7 หลายเดือนก่อน +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  7 หลายเดือนก่อน

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

  • @eroltube100
    @eroltube100 2 ปีที่แล้ว +1

    Thanks

  • @anokhautomation4453
    @anokhautomation4453 ปีที่แล้ว +2

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

    • @FriendlyWire
      @FriendlyWire  ปีที่แล้ว +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 ปีที่แล้ว

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

  • @goesintite
    @goesintite ปีที่แล้ว +1

    Thanks for the intro to MPLab

    • @FriendlyWire
      @FriendlyWire  ปีที่แล้ว

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

  • @KasimirvonFinck
    @KasimirvonFinck ปีที่แล้ว +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  ปีที่แล้ว +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 :)

  • @dilanlakshitha2737
    @dilanlakshitha2737 ปีที่แล้ว +1

    thank you

    • @FriendlyWire
      @FriendlyWire  ปีที่แล้ว

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

  • @StrangeGarage
    @StrangeGarage ปีที่แล้ว +1

    That's a pretty good video, my dog.

    • @FriendlyWire
      @FriendlyWire  ปีที่แล้ว

      Thanks so much, glad you like it! :)

  • @flashcorp76
    @flashcorp76 ปีที่แล้ว +1

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

    • @FriendlyWire
      @FriendlyWire  ปีที่แล้ว +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

  • @ESEben10
    @ESEben10 3 หลายเดือนก่อน +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  3 หลายเดือนก่อน +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 3 หลายเดือนก่อน +1

      Thank you!

    • @FriendlyWire
      @FriendlyWire  3 หลายเดือนก่อน +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 3 หลายเดือนก่อน +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  3 หลายเดือนก่อน

      @@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.

  • @A-D-D-F_Toxic
    @A-D-D-F_Toxic ปีที่แล้ว +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  ปีที่แล้ว +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 ปีที่แล้ว +1

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

    • @FriendlyWire
      @FriendlyWire  ปีที่แล้ว +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 ปีที่แล้ว +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  ปีที่แล้ว

      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 ปีที่แล้ว +1

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

    • @FriendlyWire
      @FriendlyWire  ปีที่แล้ว

      @@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 ปีที่แล้ว +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  ปีที่แล้ว

      @@AussieTrucking Oh I see! Then this project is maybe a bit involved to get started. You can have a look at this video here (th-cam.com/video/e4Q2dYVedPY/w-d-xo.html) where I go through all the basics, and perhaps this one here (th-cam.com/video/mUhzqDD6dg4/w-d-xo.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 :)

  • @mishavillanueva7191
    @mishavillanueva7191 2 ปีที่แล้ว +1

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

    • @FriendlyWire
      @FriendlyWire  2 ปีที่แล้ว

      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 2 ปีที่แล้ว +1

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

    • @FriendlyWire
      @FriendlyWire  2 ปีที่แล้ว

      @@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: th-cam.com/video/BZjO2TuS2Vk/w-d-xo.html ) or perhaps the CD4510. Hope that helps! If you don't mind me asking, what is your project about? :)

  • @amermusinbegovic3882
    @amermusinbegovic3882 ปีที่แล้ว +1

    What simulation program do you use?

    • @amermusinbegovic3882
      @amermusinbegovic3882 ปีที่แล้ว +1

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

    • @FriendlyWire
      @FriendlyWire  ปีที่แล้ว

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

  • @bigtronicas.a.s354
    @bigtronicas.a.s354 2 ปีที่แล้ว +1

    high vibe

  • @Syeda-Hadia
    @Syeda-Hadia ปีที่แล้ว +1

    Sir can I use pic16F877 instead of pic 16f1455

    • @FriendlyWire
      @FriendlyWire  ปีที่แล้ว

      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 ปีที่แล้ว +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  ปีที่แล้ว

      What are the error messages?

    • @Syeda-Hadia
      @Syeda-Hadia ปีที่แล้ว +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  ปีที่แล้ว

      @@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 ปีที่แล้ว

      @@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

  • @07ring07
    @07ring07 2 ปีที่แล้ว +1

    👍

    • @FriendlyWire
      @FriendlyWire  2 ปีที่แล้ว

      Glad you like it, have a great day :)

  • @Syeda-Hadia
    @Syeda-Hadia ปีที่แล้ว +1

    Can I use Mikro C for software compiler

    • @FriendlyWire
      @FriendlyWire  ปีที่แล้ว

      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 ปีที่แล้ว +1

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

    • @FriendlyWire
      @FriendlyWire  ปีที่แล้ว

      @@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 ปีที่แล้ว +1

      @@FriendlyWire Alright Sir ☺️

    • @Syeda-Hadia
      @Syeda-Hadia ปีที่แล้ว

      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 ปีที่แล้ว +1

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

    • @FriendlyWire
      @FriendlyWire  ปีที่แล้ว

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

    • @Syeda-Hadia
      @Syeda-Hadia ปีที่แล้ว +1

      @@FriendlyWire got it thanks alot ✨✨

    • @FriendlyWire
      @FriendlyWire  ปีที่แล้ว

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

    • @Syeda-Hadia
      @Syeda-Hadia ปีที่แล้ว +1

      @@FriendlyWire 🤗

    • @Syeda-Hadia
      @Syeda-Hadia ปีที่แล้ว +1

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

  • @jeksontivane2455
    @jeksontivane2455 ปีที่แล้ว +1

    Como comandar matriz de led, sem programa?

    • @FriendlyWire
      @FriendlyWire  ปีที่แล้ว

      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 ปีที่แล้ว +1

      @@FriendlyWire oh thank

  • @novocanal7153
    @novocanal7153 ปีที่แล้ว +1

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

    • @FriendlyWire
      @FriendlyWire  ปีที่แล้ว +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 ปีที่แล้ว +1

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

    • @FriendlyWire
      @FriendlyWire  ปีที่แล้ว +1

      @@novocanal7153 Glad it's working now!