This is the correct layout of the connections on the board:
Beware: on the pcb the top left ABCABC if incorrectly printed as CBACBA. The above picture is the correct one !!
Here is the part list:
- 1x 595 multiplex pcb
- 4x 74HC595
- 3x 2pin jumper headers
- 3x jumpers
- 16x 3 screw connector
- optional: 4x 100n capacitor - only needed in case of interference
Usage:
Connect the Ground to the Arduino Ground and place a 5 volt supply with enough power to feed all of your connected devices.
Connect the 3 pins from the Arduino to the desired 595 In1-4. If the 595's are placed in a row, place the jumpers in the needed positions and connect only the A+B wires from the first used port to the second, do not connect the C together, the jumper takes care of that. Make sure that the Arduino software knows that there are more then one 595 connected, otherwise you get strange results.
The 595 can drive up to 20-30mA per output, not more. If you want to drive more power you need some kind of driver or relay.
Here is some sample code for the Arduino to test the working of your pcb:
// 74HC595 multiplex board test sketch
// (C) 2012 PigelMagic
// Pins used to connect to the 595 board - change this if needed
int CLK_Pin = 8; // Connactor A - pin 11 on the 75HC595
int LATCH_Pin = 9; // Connector B - pin 12 on the 75HC595
int DATA_Pin = 10; // Connector C - pin 14 on the 75HC595
// How many of the shift registers - change this if needed
#define number_of_74hc595s 1
// Nothing to change under this line for demo program
// definitions
#define numOfRegisterPins number_of_74hc595s * 8
#define totalLoop number_of_74hc595s * 8
boolean registers[numOfRegisterPins];
void loop(){
for (int i=0; i<totalLoop; i++) {
setRegisterPin(i, HIGH);
writeRegisters();
delay(250);
setRegisterPin(i, LOW);
writeRegisters();
}
writeRegisters();
}
void setup(){
pinMode(CLK_Pin, OUTPUT);
pinMode(LATCH_Pin, OUTPUT);
pinMode(DATA_Pin, OUTPUT);
Serial.begin(9600);
Serial.print("Totaal aantal output pins");
Serial.println(totalLoop);
//reset all register pins
clearRegisters();
writeRegisters();
}
//set an individual pin HIGH or LOW
void setRegisterPin(int index, int value){
registers[index] = value;
}
//Only call AFTER all values are set how you would like (slow otherwise)
void writeRegisters(){
digitalWrite(LATCH_Pin, LOW);
for(int i = numOfRegisterPins - 1; i >= 0; i--){
digitalWrite(CLK_Pin, LOW);
int val = registers[i];
digitalWrite(DATA_Pin, val);
digitalWrite(CLK_Pin, HIGH);
}
digitalWrite(LATCH_Pin, HIGH);
}
//set all register pins to LOW
void clearRegisters(){
for(int i = numOfRegisterPins - 1; i >= 0; i--){
registers[i] = LOW;
}
}
No comments:
Post a Comment