Hi! I'm using the connections from the arduino shiftout example, but I've got a problem sometimes when the arduino starts all outputs go high.
I'm controlling 10 tip122 with a solenoid 12v based lock so this is a big problem as it could open all the locks, I can't seem to find any way to start all the outputs low before they are triggered.
I've managed to change the state to low controlling the OE of the 595 but it takes almost a second.
Maybe the error is in your code (which you didn't post), or in your hardware (that we can't see).
Read the "how to post" sticky that's on top of every main page.
Leo..
Sorry! i've attached the breadboard i'm using to test, and the board i've designed where i use the TIP112 with the solenoids.
the only differences from the breadboard and the PCB are the pull downs(10k) on pin 8, 11 & 12, and pin 4 to OE with also a pull down.
Here's the code i'm testing with, the one that takes almost a second to reset al the outputs of the 595:
#include <MultiShiftRegister.h>
/*
Shift Register Example
for 74HC595 shift register
This sketch turns reads serial input and uses it to set the pins
of a 74HC595 shift register.
Hardware:
* 74HC595 shift register attached to pins 8, 12, and 11 of the Arduino,
as detailed below.
* LEDs attached to each of the outputs of the shift register.
Created 22 May 2009
Created 23 Mar 2010
by Tom Igoe
*/
//Pin connected to latch pin (ST_CP) of 74HC595
const int latchPin = 8;
//Pin connected to clock pin (SH_CP) of 74HC595
const int clockPin = 12;
////Pin connected to Data in (DS) of 74HC595
const int dataPin = 11;
MultiShiftRegister msr (2 , latchPin, clockPin, dataPin);
void setup() {
Serial.begin(9600);
Serial.println("start");
//set pins to output because they are addressed in the main loop
pinMode(latchPin, OUTPUT);
pinMode(dataPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(4, OUTPUT);
for(int a = 0;a<9;a++){
msr.clear(a);
msr.shift();
}
digitalWrite(4,LOW);
}
void loop() {
if (Serial.available() > 0) {
String input = Serial.readString();
input.trim();
int bitToSet = 99;
if(input.equals("_0")){
bitToSet = 0;
}else if(input.equals("_1")){
bitToSet = 0;
}else if(input.equals("_2")){
bitToSet = 2;
}else if(input.equals("_3")){
bitToSet = 3;
}else if(input.equals("_4")){
bitToSet = 4;
}else if(input.equals("_5")){
bitToSet = 5;
}else if(input.equals("_6")){
bitToSet = 6;
}else if(input.equals("_7")){
bitToSet = 7;
}else if(input.equals("_8")){
bitToSet = 8;
}else if(input.equals("_9")){
bitToSet = 9;
}
if(bitToSet != 99){
msr.set(bitToSet);
msr.shift();
delay(2000);
msr.clear(bitToSet);
msr.shift();
}
}
}
Tie the OE pin to the inactive level, using a resistor (1-10k). Then apply the active level from an Arduino output pin, once everything is set up properly.
DrDiettrich:
Tie the OE pin to the inactive level, using a resistor (1-10k). Then apply the active level from an Arduino output pin, once everything is set up properly.
i think i'm already doing that on the breadboard, i have 10k between OE and D4, and setting that high at the end of the sketch