loading

LED Matrix?

I tried making a LED Matrix but encountered a problem while writing the code. I thought that I would be able to light them up by applying power to rows and columns but found out that we can only light up a few LEDs at a time due to the current limit of Arduino. I now have no idea as to how I'd write the code, so I would appreciate it if someone could help me. My matrix is 5x5. I attached a picture describing how my LED's are connected. I have so far not connected the resistors and I was wondering if I could connect them on the cathodes rather than anode. So, I would like it if anyone could help me regarding the resistors and the code. Thanks.

Picture of LED Matrix?
sort by: active | newest | oldest

Apart from several well documented Instructables to the right of the scrren the Arduino Playground has some very nice info on different types of LED matrix systems as well - including all code and wiring diagrams.
I give you some hints:
You need transistors to drive the LED's and you need a seperate power supply for the matrix.
Meaning you only drive the transistors through the Arduino.

For the numbers and characters you can use so called arrays - they are like a seperate piece of code that you can call like a pin or variable.
Instal of activating all commands for the LEDS you want to light up you call the corresponding array.

Again all this and much more is free for your taking in the Arduino Playground.

shahryar.adil.3 (author)  Downunder35m1 month ago

If this is put in a loop, will it work without causing flickers or anything? (I know I accidentally switched pin 2 to LOW twice)

shahryar.adil.3 (author)  Downunder35m1 month ago

Can we do it like

digitalWrite(2, HIGH);

digitalWrite(7, HIGH);

digitalWrite(8, HIGH);

digitalWrite(9, HIGH);

digitalWrite(10, HIGH);

digitalWrite(11, HIGH);

delay(1);

digitalWrite(2, LOW);

digitalWrite(6, HIGH);

delay(1);

digitalWrite(2, LOW);

digitalWrite(7, LOW);

digitalWrite(8, LOW);

digitalWrite(10, LOW);

digitalWrite(11, LOW);

digitalWrite(3, HIGH);

digitalWrite(4, HIGH);

digitalWrite(5, HIGH);

for the letter "H"?

shahryar.adil.3 (author)  Downunder35m1 month ago

I get the basic idea, we connect transistors to 5 columns and 5 rows which are then connected to the Arduino power supply directly (not through Arduino). Like the diagram attached (sorry for my bad or even non existent schematic skills :D). Then we make different (voids) with the commands for each letter and number. After that we somehow take a serial input and use it to call the different voids. I just don't know how to code it, like I don't know what commands to use and such so I would like it if you could assist me a bit there.

rickharris1 month ago

Your best option is charlieplexing.

You could add transistor drivers to provide the necessary current.

As always look at how others have done the task to get ideas no need to reinvent the wheel, well not at first. get it working and the develop.

Although not specifically for the arduino and using different code there is a wealth of applicable theory and practical infgormation that can be used by the arduino operator here

http://www.picaxe.com/Getting-Started/PICAXE-Manua...

shahryar.adil.3 (author)  rickharris1 month ago

Can't I do it this way with some advanced code? Saw this instructable

https://www.instructables.com/id/5X5-dot-matrix-on...

it would be awesome if i could use this code but i cant cause he wired his leds differently in batches of two :/

Mmm it strikes me your real problem is you don't understand the arduino code well enough to know what each part is doing.

Although NOt for ther arduino have a look through this it may well give you a better understanding of what your trying to do and how to go about it.
1. You only need a very few commands to achieve most of what you want to do.
2. You need to know how to get those commands into the arduino and make them run
3. You need to be able to fault find your code bugs because there will be some.!
4. A lot of this is starting simple and building up. Start by turning one LEd on and off. Charliplexing relies on the fact that most modern microcontrollers have 3 state outputs, ON - OFF - high impedance. effectively off.

So you can connect the LEDs between 2 inputs opposite way around. 1 on 1 off will light 1 LED turn them round and light the other LED

https://www.instructables.com/id/Lets-Program-a-PIC-Microprocessor/


shahryar.adil.3 (author)  rickharris1 month ago

Yep, that was the problem lol Can you help me write the code? I want to set the values for all the letters and numbers and then have a serial monitor input in which i write stuff and it displays on the matrix. The whole word, moving through the matrix would also be pretty cool

Help, Only in a very general way as your effort in getting it right will teach you much more then someone else providing answers.

painful but true.

1. Write out a full flow diagram of your process.

https://www.instructables.com/id/Starting-programm...

NO ONE does this and yet is is the single most useful start you can make to programming. If your flow chart is correct turning it into code is easy.

2. Start with a very simple task, light a SINGLE led turn it on and off slow, quickly.

3. Scale up to 2 the 3 LEDS, test out the charlyplexing principle, you will need 3 LEDs to do this.

4. Once you can turn on and off 3 or 4 LEDs you can go back to your matrix.

5. Start again by turning on single LEDs. Understand that in general a matrix will not light all LEDs at once but will flash them sequentially so to the eye it looks like they are on all at the same time.

6. Lear how to operate the following commands in you chosen language:

Set ports to input or output

Turn output on

Turn output off

Read the state of an input

perform a goto operation

Set a timer command

Setup and operate a subroutine.

How loops work

These are essentially all the commands you need to operate your matrix. (depending what you want to do with it.)

7. Learn how to use a transistor as a switch so you can sink larger currents.

8. Find out how to use a darlington ic. (e.g. ULN2003)

Most of this you can find in the manuals I linked to before, in the interfacing manual.

Good luck, have fun learning.

shahryar.adil.3 (author)  rickharris1 month ago

Can you just write me the code? I'll then try to understand it. If you want payment, I can provide you some pro memberships. The LEDs are connected in the arrangement shown here

Ah, no. I am a teacher and it would be against my principles to just do it for you.

My experience tells me "students" do not learn from having the answers given to them. They learn by going through the struggle to collect knowledge and skill which takes time.

I am not all that sure you have expressed what you want the system to do in good enough terms any way.

I have been a pro member since it started, as you can see I have a large number of instructables to my name and payment isn't an issue I don't need the money. HOWEVER YOU do need to gain experience and skills. Start small and build up.

iceng1 month ago

The RGB Brick has three LEDs in each of the 35 dots..

The BSX Stamp can sink 15 LED lines about 14ma each for a row across..

The HC4017 advances through the rows and can be reset to Sync with the 5 moving images stored in memory.

See the pre-phone ible to get more idea how it works.

https://www.instructables.com/id/LED-RGB-UFO-COM-M...

RGBrick.jpg