Introduction: Cascade of Shift Registers 74HC595 Controlled Via Arduino and Ethernet
Today I would like to present a project that I have implemented in two versions. The project uses 12 shift registers 74HC595 and 96 LEDs, Arduino Uno board with Ethernet shield Wiznet W5100. 8 LEDs are connected to each shift register. The numbers 0-9 are represented by LEDs. Each shift register is equipped with 8 output terminals.
Each of the 4 shift registers 74HC595 forms a logical unit - a display for listing a 4-digit number. In total, there are 3 logical displays in the project consisting of 12 shift registers.
The implementations are compatible for Arduino boards Nano, Mega, Uno and for Ethernet shields and modules from the Wiznet family, specifically models W5100 and W5500 (using the Ethernet2 library).
- Arduino Uno / Nano
- Ethernet Wiznet W5100 / W5500
- 4 up to 12 shift register 74HC595
- 32 up to 96 LED diodes
Step 1: Implemented Implementations in the Project With Arduino:
- Webserver - HTTP server running directly on Arduino, allows to interpret HTML code
- WebClient - Client capable of making an HTTP request to a remote server, sending / downloading data
- Provides an HTML web page with a form that allows you to enter 3 four-digit numbers.
- After sending the form, the data are processed and stored in the EEPROM memory, the user is informed about the data processing by a separate subpage.
- After saving the data, the user is redirected back to the form.
- EEPROM memory is energy independent, data is accessible even after power recovery, but also board restart.
- All numbers are then represented on three displays consisting of 12 74HC595 shift registers.
- Communication with the web server takes place every 5 seconds after the HTTP protocol.
- The web server runs a PHP web application that allows you to enter 3 four-digit numbers via the HTML form.
- The data from the form is stored in a MySQL database.
- Arduino requests to retrieve data from this database via a query to the server.
- The processed data is parsed by Arduino, then plotted using shift registers 74HC595.
- The data are also stored in the EEPROM memory of the Arduino, they are used in case the connection to the web server fails / when the Arduino boards are restarted, they are used for the initial rendering of the data on the shift registers.
- The data is overwritten in the EEPROM only when the data changes, the EEPROM cells are saved from unnecessary overwriting.
Step 2: Wiring & Screenshot
Cascade connection for shift registers 74HC595 (can be extended by x more) - Export from TinkerCAD.
Screenshot is there from webserver interface, when it gets data via HTML form, process them, and save them to EEPROM memory.
Step 3: 74HC595 + Source Codes
It is clear from the diagram that only 3 data wires are used to control the shift registers:
- Data Outlet - (SER to 74HC595)
- Clock output - (SRCLK on 74HC595)
- Latch Outlet - (RCLK to 74HC595)
Shift registers can be combined in a cascade, while other peripherals can also be controlled by shift registers - for example, relays for switching power elements. It is also possible to control 500 separate relays (with a sufficient number of shift registers and power supply) with one data output.
When controlling the outputs of the registers, it is also possible to modify the byte order to the most significant bit - MSB FIRST, or to LSB - the least significant bit. As a result, it inverts the outputs. In one case, for example, 7 diodes are lit, in the other case 1 diode depending on the input and byte order.
Both implementations use EEPROM memory, which can store data even after a power failure or after a board restart. The second use of this memory is also the ability to represent the last known data in case it is not possible to communicate with the web server (connectivity error, server).
Memory is limited to 10,000 to 100,000 transcripts. Implementations are designed for the least possible memory load. The data will not be overwritten when they are changed. If the same data is read from the web server / client, they are not overwritten in the EEPROM memory.
Software implementation (Arduino side) for WebClient can be tried for free at: https://arduino.php5.sk/register-74hc595.php
Arduino communicates with a web interface in which it is possible to modify 3 four-digit numbers: https://arduino.php5.sk/led/
Ask for code for Arduino as webserver at: firstname.lastname@example.org
Donate for more instructables: https://paypal.me/chlebovec