MAX7219 LED multiplexing tutorial

  Переглядів 34,445

FriendlyWire

FriendlyWire

День тому

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 Рік тому
Thank you for posting, I dreamed of these displays in 1988 - it is wonderful seeing this in reality
@FriendlyWire
@FriendlyWire Рік тому
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 9 місяців тому
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!
@maxvideodrome4215
@maxvideodrome4215 7 місяців тому
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 місяців тому
@@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 :)
@75slaine
@75slaine 2 роки тому
Fantastic details as always
@FriendlyWire
@FriendlyWire 2 роки тому
Thank you, Glen, so glad you liked it!
@bwack
@bwack 2 роки тому
Thanks. I like the MAX7219. The 7-segment modules are very handy :)
@FriendlyWire
@FriendlyWire 2 роки тому
Glad you liked the video! Yes, they are so useful for debugging, too.
@WintermuteDigital
@WintermuteDigital Рік тому
Excellent video and clear explanations. Keep it up!
@FriendlyWire
@FriendlyWire Рік тому
Thank you so much, it means a lot. Glad you liked the video! :)
@mostafanfs
@mostafanfs Рік тому
You obviously enjoy your work! and so do we!
@FriendlyWire
@FriendlyWire Рік тому
Thanks so much, Mostafa! :) And yes, I do!
@techkri
@techkri Рік тому
Thanks so much for this video :) I was looking for this exact video.
@FriendlyWire
@FriendlyWire Рік тому
Thank you, I am happy you like it!
@thomasschellekens5084
@thomasschellekens5084 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 :)
@shwetaringe2785
@shwetaringe2785 2 роки тому
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!
@hthharrison7764
@hthharrison7764 2 роки тому
Thanks for the tutorial 👍🙂
@FriendlyWire
@FriendlyWire 2 роки тому
Thank you, happy you like it!
@jumbledfox2098
@jumbledfox2098 8 місяців тому
Thank you so much for this. I'm super excited to make more electronics :3
@FriendlyWire
@FriendlyWire 8 місяців тому
That's great, and thank you for your nice comment! Best of luck! :)
@jumbledfox2098
@jumbledfox2098 8 місяців тому
@@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 8 місяців тому
@@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 8 місяців тому
@@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 місяців тому
@@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!
@makcimenuka7904
@makcimenuka7904 7 місяців тому
Very good tutorial. Thanks.
@FriendlyWire
@FriendlyWire 7 місяців тому
Thank you, I am glad you like it!
@anokhautomation4453
@anokhautomation4453 Рік тому
Nice useful tutorial 👍 Please post another tutorial for digital clock with PIC microcontroller using dot matrix display.
@FriendlyWire
@FriendlyWire Рік тому
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.
@KasimirvonFinck
@KasimirvonFinck Рік тому
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 Рік тому
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 Рік тому
Thanks for the intro to MPLab
@FriendlyWire
@FriendlyWire Рік тому
Thank you, Miguel, I am glad you like it! :)
@eroltube100
@eroltube100 2 роки тому
Thanks
@StrangeGarage
@StrangeGarage Рік тому
That's a pretty good video, my dog.
@FriendlyWire
@FriendlyWire Рік тому
Thanks so much, glad you like it! :)
@dilanlakshitha2737
@dilanlakshitha2737 Рік тому
thank you
@FriendlyWire
@FriendlyWire Рік тому
Thank you, Dilan, glad you like the video! :)
@flashcorp76
@flashcorp76 Рік тому
😊Nice, where is the Clock tuto ? That would be cool 👍🏻
@FriendlyWire
@FriendlyWire Рік тому
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
@AussieTrucking
@AussieTrucking Рік тому
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 Рік тому
@@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 Рік тому
@@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 (ukposts.info/have/v-deo/nWSCZpqQjZuVsY0.html) where I go through all the basics, and perhaps this one here (ukposts.info/have/v-deo/pYWZrqd7e2yVyGg.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 :)
@A-D-D-F_Toxic
@A-D-D-F_Toxic Рік тому
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 Рік тому
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 Рік тому
@@FriendlyWire ah, thank you! I’m slowly remembering my electronics class stuff
@FriendlyWire
@FriendlyWire Рік тому
@@A-D-D-F_Toxic No worries, happy to help! Thank you so much for your interest, Ryan, and have fun with the MAX7219 :)
@ESEben10
@ESEben10 3 місяці тому
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 місяці тому
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 місяці тому
Thank you!
@FriendlyWire
@FriendlyWire 3 місяці тому
@@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 місяці тому
@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.
@mishavillanueva7191
@mishavillanueva7191 2 роки тому
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 роки тому
@@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: ukposts.info/have/v-deo/eoqbg2iLrIljt58.html ) or perhaps the CD4510. Hope that helps! If you don't mind me asking, what is your project about? :)
@Syeda-Hadia
@Syeda-Hadia Рік тому
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 Рік тому
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 Рік тому
@@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
@amermusinbegovic3882
@amermusinbegovic3882 Рік тому
What simulation program do you use?
@amermusinbegovic3882
@amermusinbegovic3882 Рік тому
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 роки тому
high vibe
@FriendlyWire
@FriendlyWire 2 роки тому
Hahaha what? :D
@Syeda-Hadia
@Syeda-Hadia Рік тому
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 Рік тому
@@FriendlyWire got it thanks alot ✨✨
@FriendlyWire
@FriendlyWire Рік тому
@@Syeda-Hadia Happy to help, and best of luck!
@Syeda-Hadia
@Syeda-Hadia Рік тому
@@FriendlyWire 🤗
@Syeda-Hadia
@Syeda-Hadia Рік тому
Hi 👋. Sir I'm having an error in code for dot matrix module with max7219 in Mikro C
@Syeda-Hadia
@Syeda-Hadia Рік тому
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 Рік тому
@@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 Рік тому
@@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
@07ring07
@07ring07 2 роки тому
👍
@FriendlyWire
@FriendlyWire 2 роки тому
Glad you like it, have a great day :)
@jeksontivane2455
@jeksontivane2455 Рік тому
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 Рік тому
@@FriendlyWire oh thank
@novocanal7153
@novocanal7153 Рік тому
Please, https for your homepage. http not runing :-( Firewall here
@FriendlyWire
@FriendlyWire Рік тому
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 Рік тому
@@FriendlyWire from Brazil. I use Chrome. https is ok now. Thank you so much!!
@FriendlyWire
@FriendlyWire Рік тому
@@novocanal7153 Glad it's working now!
DS1302 real-time clock tutorial: the clock that doesn't forget the time!
16:40
Make Your Own LED Matrix !
7:06
NematicsLab
Переглядів 631 тис.
Lesson 15 MAX7219 LED Dot Matrix Module
21:53
Ricardo Moreno
Переглядів 31 тис.
Is Adam Savage Still an Atheist?
8:16
Adam Savage’s Tested
Переглядів 255 тис.
How to make your own LED Display 🚥 [WS2812B Neopixel]
8:39
Dombi3D
Переглядів 43 тис.
Easy LED Matrix Control: Arduino and 8x8 1088AS Matrix Multiplexing
10:59
Control LEDs with your computer using RS232!
16:09
FriendlyWire
Переглядів 56 тис.
inventor aw - This Device is very helpful ,, you can make at home
6:47
Building the Ultimate LED Matrix Dashboard
12:29
allen's lab
Переглядів 137 тис.
DIY FYI: Using a MAX7219 with an LED Matrix
10:09
Blitz City DIY
Переглядів 12 тис.
ATtiny85 - MAX7219 Dot Matrix
9:55
Anas Kuzechie
Переглядів 5 тис.