Hello everyone!
I have been trying to develop a 32 LED array in which every LED can be individually addressed using shift registers. The closest I have been able to find to this was the 74HC595 & 74HC165 Shift Registers with Arduino tutorial on YouTube. Nevertheless, this tutorial only addresses how to control 8 LEDs with one shift register, while I have 32 LEDs and four shift registers.
I saw other examples online, but while they show the incorporation of four shift registers, none of them control the LEDs individually.
I am completely lost on this topic and any input is well appreciated. I will list the alternative resources I have found as well as a general schematic of my connections down bellow.
Resources:
4 shift register (32 bit) cascade schematic and code -
2 shift register (16 bit) cascade schematic and code -
1 shift register (8-bit) schematic and code -
https://dronebotworkshop.com/shift-registers/
Same connections schematic I have:
Thank you!
Mario
Hi,
I came across your post, re cascading 74HC595 shift registers (SIPOs), and your need to explicitly address each of your 4 x SIPO cascade output port individually.
At the time you posted this article I was in the process of finalising an Arduino library to deal with the general control and management of these shift registers. The library is called ez_SIPO8_lib and is posted on the Arduino Project Hub.
The library provides many methods and functions to deal with your requirements. It is able to deal with single SIPOs, SIPOs in a cascade, multiple SIPOs (single or cascaded), etc. It has a theoretical upper limit of 255 SIPO ICs, a total of 2040 output ports, which can be divided up into cascades of any size.
Moreover, it provides easy to use functions that allows you to address any output port in a SIPO cascade explicitly, all together or in 8-bit units. It will do exactly what you were seeking.
Have a look at the Project Hub articles:
1. ez_SIPO8_lib - provides the library files, comprehensive User Guide, Crib Sheet and examples
2. ez_SIPO8_lib Tutorials, especially Tutorial 1 (Absolute Addressing - your requirement) and Tutorial 4 (Cascading SIPOs)
This library makes dealing with these ICs very straight forward and provides a comprehensive set of tools for the developer.
Hope you still have this interest and I would be pleased to know if this proves helpful to you.
Gook luck
Ron
Ron Bentley
Creativity is an input to innovation and change is the output from innovation. Braden Kelley
A computer is a machine for constructing mappings from input to output. Michael Kirby
Through great input you get great output. RZA
Gauss is great but Euler rocks!!
Hi again,
since my last post I thought I would provide a simple demonstration of how you could use the ez_SIPO8_lib to accomplish what it is you were trying to achieve.
See the sketch below - it creates a cascade of 4 x 74HC595 ICs and then randomly sets/clears each of its output ports (0-31). To verify the status of each output ports, and therefore the status of the attached LEDs, the cascade SIPO bit/output port data is printed to the serial monitor.
Note that this sketch only scratches the surface of the tools that the library can provide a developer.
// // Example of use of ez_SIPO8_lib's function to allow output ports // of a cascaded set of 74HC595 ICs to be addressed individually. // In this example the SIPO array comprises a single cascaded bank // of 4 x 74HC595 ICs. // #include #define num_SIPO_ICs 4 // 32 outputs on 4 x 8-bit cascaded 74HC595s #define max_pin num_SIPO_ICs * pins_per_SIPO #define data_pin 8 #define latch_pin 9 #define clock_pin 10 // create a SIPO environment for required number of SIPO ICs, no timers for this sketch SIPO8 my_SIPOs(num_SIPO_ICs, 0); uint16_t bank_id; // holds the arrays's bank id once it is created void setup() { // Create the SIPO cascade - allocate all 74HC595 ICs to one bank // absolute address range of the array/bank will be 0-(max_pin-1) bank_id = my_SIPOs.create_bank(data_pin, clock_pin, latch_pin, num_SIPO_ICs); // We will use theserial monitor to verify the output pin statuses to LEDs Serial.begin(9600); // Set up random function with a pseudo random seed randomSeed(analogRead(A0) + analogRead(A1) * 1023); } void loop() { do { // Start with all of the IC's output pins LOW (LEDs off). my_SIPOs.set_all_array_pins(LOW); my_SIPOs.xfer_array(MSBFIRST); // Now randomly set/clear each SIPO pin in the cascade: for (uint16_t pin_no = 0; pin_no < max_pin; pin_no++) { bool status = random(2); // return value will bt 0(LOW) or 1(HIGH) my_SIPOs.set_array_pin(pin_no, status); } // SIPO array/bank now processed so send to the physical SIPO ICs my_SIPOs.xfer_array(MSBFIRST); // Print the bit by bit statuses of the array/bank pins to the serial monitor // to confirm the pin bit/output LED status values: my_SIPOs.print_pin_statuses(); delay(5000); // wait a little while before recycling and restarting } while (true); }
If you have any queries then please do let me know.
Ron Bentley
Ron Bentley
Creativity is an input to innovation and change is the output from innovation. Braden Kelley
A computer is a machine for constructing mappings from input to output. Michael Kirby
Through great input you get great output. RZA
Gauss is great but Euler rocks!!