Inspired by a friend of mine, I have developed a circuit to light a matrix of LEDs. Is it possible that the pastor has requested to repair a votive candle, already provided with the incandescent lights. We made to put the white LEDs in small power. A pass key or sensor of the coins turn on an LED at a time.
The project presented here is unassuming to be fully functional, is solofor educational purposes. In fact there could be some problems to be solved in the final construction of the project.
The bench test demonstrates the feasibility. Then finally in the installation there will be precautions that the length of the connections is not excessive, or that’ power is filtered by any disturbances.
The development comprises an Arduino UNO V3, a LED matrix by 6 lines to 4 column. These LEDs are driven directly dall'Arduino multiplexed.
The program to’ act of activating a button or detection of passage of a coin, begins to flash the LED next to the sequence. When there is none no active, clear that from the first part.
In the video, that you can see the address below described, a simple wire mo 'button has been used.
The arrangement of the LEDs of the matrix, part from a square that reflects in a certain way the Cartesian axes. Then the ignition sequence starts from the bottom left and follows with the’ increased Y, up to the maximum of the number of a column. Below, moves to the next column. See table below, showing what the ignition sequence. Starting from number one.
LEDs for orientation
To simplify development, I organized a single-sided, which provides for the connection of each anode and cathode. The card already provides for a matrix expansion by 6×6. The figure below shows the arrangement of the card. I left the space between anode and cathode of each LED, to allow more tracks. Unfortunately there are some bridges to pass, given that the routing was not possible to reduce them.
One should note that the cathodes are directed towards the resistances ranging all’ Arduino, while the anodes are connected to the collectors of the transistors. So we see the wiring diagram.
Note that the’ Arduino can be placed on connectors. I recommend this way, in order to extract it in the event of reprogramming.
In all cases You can see the details downloading package which also contains sketches[*] be loaded on’ Arduino.
[*] A sketch has the period that the LEDs are only switched on and starts to reaching the maximum number of LEDs. This is called matrix_single_time.ino. The second one, matrix_multiple_time.ino, It works that each LED has a separate period and ends with the assigned time (TIMEOUT). Furthermore, if all the lights saranno burning, andRRA reset the duration of the LED thatVRA the longest period. A note matrix_multiple_time.ino, starts counting from position 24 all’ back.
There is also a version that uses a MAX7219 with its library, which can handle up to 64 lights. But it is not present in the package.
The program allows some customization, which are listed in its first lines. Aside from that to which it is currently designated it may take the’ Arduino and implement a matrix 8 lines to 6 column, with only two correction lines. We see in detail.
The line 5 #define DEBUGdefines whether to compile with the serial connected for debugging (Once you try the circuit, better comment out the line). Below, in the sketch, the lines 23 e 24 you can define which feet assign for use with the serial. It takes a USB-RS232 TTL interface as shown. So you can connect to the legs still available depending on how you want to assign.
The line 12 #define INBTN A0, allows us to assign the’ input you want to use to activate the count. At least for this project is expected in the printed circuit a block with screw fastening, to connect the button. But for other use is the ability to assign a new position. Except those on’ Arduino are numbered 0 a 13, which they are those that are used to drive the LEDs matrix.
The line 13 #define TMPRESS 20, serves to define the period that’ input must remain low in order to be validated. You may need the’ adjustment to define the sensitivity. The value is in 2,5 milliseconds. That corresponds to the update period of the LEDs.
The line 14 #define TIMEOUT 7200, It establishes how long they remain all LEDs lit, once who has reached the maximum number of starts. The measure is in seconds, for so hath it has been considered a two-hour period. In the function countdown the delay is 998 milliseconds, that you may need to be adjusted to have the correct period.
The lines 15 e 16 define how many columns NUMCOLS and how many rows NUMROWS that for the project are 4 e 6 respectively.
at the following 3 lines is calculated by the program settings, depending on the values defined for the rows and columns, above. (There are also changing to a different use of the program).
To the line 20 #define NUMBLINKS 8, It can vary the number of times blinking before to remain the LED lit.. Take care that can only be an even number, sentence that ends the count with its LED off.
The line 21 #define COMMON_ANODE, allows us d 'set whether to use high or low levels for the outputs of the rows. For which case you wanted to interpose the buffer transistor orppure circuits integrated as ULN2804, this allows you to vary the compilation and reverse outputs.
If one wanted the active high outputs, just comment out the line, putting //.
The same also applies for the line 22 #define COL_ACTIVE_LOW, It allows us to invert the outputs of the logic for the columns. I set to pilot the 2N2907A, so they needed active low.
The line 25 #define TIMELAPSE 2500, It is the one that determines the refresh rate of the matrix and the scanning of the columns. The period in microseconds. In fact here the function is called refresh every 2,5 milliseconds. You could adjust, increasing the value, to slightly reduce the brightness of the LEDs, but it risks d 'run into an annoying flicker. I tried with 5 milliseconds and has no flicker. Reducing could further undermine the performance of the other tasks of’ Arduino.
For the rest, you can also adapt the program to drive a numeric display 7 segments, with up to 6 figures. Or a matrix 8×6 column. This is why the program is a commitment to teaching, to learn some programming tricks. One detail to note is to use an interrupt routine to be able to have the’ Updating bright LEDs.
Like when I took the e-journals, almost I never was copying the entire project, I was interested in getting ideas for my ideas.
https://www.elettroamici.org/wp-content/uploads/2019/12/candelabrum.jpg7201280Picmicro675https://www.elettroamici.org/wp-content/uploads/2017/08/FAVICON-1-300x271.pngPicmicro6752019-12-14 03:47:172019-12-14 07:35:43lights Game with Arduino