Rather than switching to a different wiring, I’d recommend using the wiring that you already
have working from that instructable since fm’s library can pretty much handle
any wiring. (that is what it was designed to do)
It is just a matter of creating the proper constructor to match the wiring.
So, time to get familiar with reading datasheets and schematics.
First go get a 595 datasheet.
Google for “74hc595 datasheet”
Different datasheets call the pins different things but all 595s work the same way
and have the same pinouts.
Grab the NXP datasheet as that one uses the same names as the instructable.
First, if you look closely at the schematic in the instructable you will notice
an error.
The LCD LED + pin is not connected to anything.
The stripboard and the Fritzing diagram properly show it connected to VCC.
So this is an error in the schematic.
One other thing not in the schematic is a current limiting resistor.
If one is needed it will go between the LED- and the transistor collector.
Since there are 3 wires going to Arduino and E is driven by
the 595 you will need to use LiquidCrystal_SR3W
Now go back and look at the schematic for the instructable.
Look at the output bits on the Shift register (Q0 to Q7)
Where do they go?
Q0 LCD E
Q1 LCD D7
Q2 LCD D6
Q3 LCD D5
Q4 LCD D4
Q5 (Not connected)
Q6 Backlight Transistor
And now what about the Clock, Data and Latch pins on the 595?
Refer to the 595 datasheet.
Go to table 6.2 “Pin Description”
The rows you want are:
SHCP pin 11
STCP pin 12
DS pin 14
The table will tell you what the pins do
(note: storage register clock is the “strobe” or “latch”, it latches the 595 outputs)
So using the 595 datsheet and the schematic, see how the SHCP, STCP, and DS pins
are connected to the Arduino pins.
Those are Arduino pins are the pins that will be used in the constructor
for data, clock, and strobe/latch.
(I’m leaving the lookup of those arduino pins to you)
So now you have almost all the information you need for the LiquidCrystal_SR3W
constructor.
The one perhaps not so obvious thing will be the backlight polarity.
The circuit uses an NPN transistor. That will turn on when the base is connected to
positive voltage. So you guessed it, the polarity will be POSITIVE.
Another not obvious thing is that the SR3W code is written to drive the RW
line on the LCD with the 595. If you look at the schematic you will notice
that the LCD RW pin is directly connected to ground vs the 595.
This is actually a good thing since the LCD will only every be written to and
ensures that incorrect wiring or constructor will not ever damage the LCD.
However, the SR3W code wants an output bit number for RW since it wants to drive
RW from a shift register output pin.
Because of this, you must assign RW an output bit number even if it is not needed.
The key is you MUST select a bit that is not used by anything else.
If you look at the wiring you will notice that bit 5 not used, so that will be what
you use for the RW bit in the constructor.
So now just create and fill in the information into the SR3W constructor:
(The values are blank and left as an exercise for you)
#include <LiquidCrystal_SR3W.h>
// d,clk,strb, en,rw,rs,d4,d5,d6,d7,bl,blpol
//LiquidCrystal_SR3W lcd (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);
So that’s it.
Fill in the values and it should work with your existing wiring.
— bill