Go Down

Topic: 2pcs 74HC595 with 16ch led + potentiometer. (Read 1 time) previous topic - next topic

Wawa

It is possible to fix it?
Not if I know why it's doing that.
Are you sure the LDR can't "see" the light of the LEDs.
Does the room have natural or artificial light.
Are the values on the serial monitor also "pumping"
(you might have to put that delay in, to slow down printing).
Leo..

gavron04

Yes, I'm sure.

With led bulb or with natural light the same.

On serial monitor:

Code: [Select]

LDR value is: 98
PWM value is: 109
LDR value is: 99
PWM value is: 111
LDR value is: 100
PWM value is: 113
LDR value is: 101
PWM value is: 115
LDR value is: 101
PWM value is: 115
LDR value is: 101
PWM value is: 115
LDR value is: 99
PWM value is: 111
LDR value is: 96
PWM value is: 104
LDR value is: 99
PWM value is: 111
LDR value is: 99
PWM value is: 111
LDR value is: 99
PWM value is: 111
LDR value is: 101
PWM value is: 115
LDR value is: 100
PWM value is: 113
LDR value is: 99
PWM value is: 111
LDR value is: 98
PWM value is: 109
LDR value is: 98
PWM value is: 109
LDR value is: 99
PWM value is: 111
LDR value is: 100
PWM value is: 113
LDR value is: 105
PWM value is: 125
LDR value is: 100
PWM value is: 113
LDR value is: 96
PWM value is: 104
LDR value is: 99
PWM value is: 111
LDR value is: 98
PWM value is: 109
LDR value is: 97
PWM value is: 106
LDR value is: 99
PWM value is: 111
LDR value is: 100
PWM value is: 113
LDR value is: 100
PWM value is: 113
LDR value is: 100
PWM value is: 113
LDR value is: 99
PWM value is: 111
LDR value is: 98
PWM value is: 109
LDR value is: 97
PWM value is: 106
LDR value is: 107
PWM value is: 129
LDR value is: 100
PWM value is: 113
LDR value is: 96
PWM value is: 104
LDR value is: 101
PWM value is: 115
LDR value is: 99
PWM value is: 111
LDR value is: 98
PWM value is: 109
LDR value is: 98
PWM value is: 109
LDR value is: 98
PWM value is: 109
LDR value is: 98
PWM value is: 109
LDR value is: 100
PWM value is: 113
LDR value is: 100
PWM value is: 113
LDR value is: 100
PWM value is: 113
LDR value is: 99
PWM value is: 111
LDR value is: 99
PWM value is: 111
LDR value is: 97
PWM value is: 106
LDR value is: 96
PWM value is: 104
LDR value is: 100
PWM value is: 113
LDR value is: 100
PWM value is: 113
LDR value is: 99
PWM value is: 111
LDR value is: 100
PWM value is: 113
LDR value is: 98
PWM value is: 109
LDR value is: 98
PWM value is: 109
LDR value is: 98
PWM value is: 109
LDR value is: 98
PWM value is: 109
LDR value is: 100
PWM value is: 113
LDR value is: 100
PWM value is: 113
LDR value is: 101
PWM value is: 115
LDR value is: 99
PWM value is: 111
LDR value is: 88
PWM value is: 86
LDR value is: 99
PWM value is: 111
LDR value is: 98
PWM value is: 109
LDR value is: 97
PWM value is: 106
LDR value is: 100
PWM value is: 113
LDR value is: 100
PWM value is: 113
LDR value is: 99
PWM value is: 111
LDR value is: 99
PWM value is: 111
LDR value is: 98
PWM value is: 109
LDR value is: 97
PWM value is: 106
LDR value is: 98
PWM value is: 109
LDR value is: 99
PWM value is: 111
LDR value is: 100
PWM value is: 113
LDR value is: 100
PWM value is: 113
LDR value is: 100
PWM value is: 113
LDR value is: 98
PWM value is: 109
LDR value is: 96
PWM value is: 104
LDR value is: 98
PWM value is: 109
LDR value is: 98
PWM value is: 109
LDR value is: 98
PWM value is: 109
LDR value is: 100
PWM value is: 113
LDR value is: 100
PWM value is: 113
LDR value is: 99
PWM value is: 111
LDR value is: 98
PWM value is: 109
LDR value is: 97
PWM value is: 106
LDR value is: 98
PWM value is: 109
LDR value is: 99
PWM value is: 111
LDR value is: 100
PWM value is: 113
LDR value is: 100
PWM value is: 113
LDR value is: 99
PWM value is: 111
LDR value is: 99
PWM value is: 111
LDR value is: 98
PWM value is: 109
LDR value is: 96
PWM value is: 104
LDR value is: 99
PWM value is: 111
LDR value is: 99
PWM value is: 111
LDR value is: 98
PWM value is: 109
LDR value is: 100
PWM value is: 113
LDR value is: 99
PWM value is: 111
LDR value is: 97
PWM value is: 106
LDR value is: 97
PWM value is: 106
LDR value is: 97
PWM value is: 106
LDR value is: 98
PWM value is: 109
LDR value is: 100
PWM value is: 113
LDR value is: 100
PWM value is: 113
LDR value is: 100
PWM value is: 113
LDR value is: 99
PWM value is: 111
LDR value is: 99
PWM value is: 111
LDR value is: 97
PWM value is: 106
LDR value is: 98
PWM value is: 109
LDR value is: 100
PWM value is: 113
LDR value is: 100
PWM value is: 113
LDR value is: 98
PWM value is: 109
LDR value is: 99
PWM value is: 111
LDR value is: 98
PWM value is: 109
LDR value is: 97
PWM value is: 106
LDR value is: 97
PWM value is: 106
LDR value is: 98
PWM value is: 109
LDR value is: 99
PWM value is: 111
LDR value is: 100
PWM value is: 113
LDR value is: 100
PWM value is: 113
LDR value is: 99
PWM value is: 111
LDR value is: 98
PWM value is: 109
LDR value is: 107
PWM value is: 129
LDR value is: 97
PWM value is: 106
LDR value is: 96
PWM value is: 104
LDR value is: 100
PWM value is: 113
LDR value is: 100
PWM value is: 113
LDR value is: 98
PWM value is: 109
LDR value is: 98
PWM value is: 109



Code: [Select]
LDR value is: 140
PWM value is: 204
LDR value is: 140
PWM value is: 204
LDR value is: 141
PWM value is: 206
LDR value is: 132
PWM value is: 186
LDR value is: 139
PWM value is: 202
LDR value is: 137
PWM value is: 197
LDR value is: 137
PWM value is: 197
LDR value is: 137
PWM value is: 197
LDR value is: 139
PWM value is: 202
LDR value is: 141
PWM value is: 206
LDR value is: 140
PWM value is: 204
LDR value is: 140
PWM value is: 204
LDR value is: 139
PWM value is: 202
LDR value is: 137
PWM value is: 197
LDR value is: 137
PWM value is: 197
LDR value is: 137
PWM value is: 197
LDR value is: 146
PWM value is: 218





Second question. I have 2x 74HC595. It has max. 70mA, per channel max. 20mA. I have found TPIC6C595. It has max. 250mA. Per channel max. 100mA. Now I must adjust about 8mA per LED. When I would have TPIC6SC595 I will have without problem 20mA per LED. Software is the same as for 74HC595 or not?


Wawa

It seems you have to use smoothing code to stabilise those PWM writes.

A TPIC can only switch to ground.
The LEDs need to go between outputs and 5volt (all anodes to 5volt).

Code stays the same.
Leo..

gavron04

It is possible to create compartments / within range like: when LDR value 140-145 then PWM is still 204?



TPIC pin G is the same as OE in 74HC595?



Grumpy_Mike

Quote
It is possible to create compartments / within range like: when LDR value 140-145 then PWM is still 204?
Yes use a compound if like this:-

Code: [Select]

if(value >=140 && value <=145) { // do stuff

gavron04

Thanks. Tomorrow I will test.

So if LDR works without additionally resistor can I make PCB with directly connected LDR to analog input pin and gnd?




This LDR will be ok? http://www.tme.eu/gb/details/gm3526/photoresistors/wodeyijia/ (I don't know which LDR I have now)

Grumpy_Mike

Well according to the data sheet at 10 Lux using the internal resistor you will get a reading between 128 and 256.

gavron04

#37
Sep 12, 2017, 11:47 am Last Edit: Sep 12, 2017, 12:26 pm by gavron04
I will buy 5 different types of LDR and I will test which is the best.


I have question about my code. It is possible to add second 74HC595 which will drive ULN2003 (on other pins on atmega)


Code: [Select]
if (irrecv.decode(&results))
   {
       switch (results.value)
       {
         case 0x801:  // kod klawisza 1
            digitalWrite(Out1Pin, LOW);
            break;
            
         case 0x1:  // kod klawisza 1
            digitalWrite(Out1Pin, HIGH);
            break;
            
         case 0x802:  // kod klawisza 2
            digitalWrite(Out2Pin, LOW);
            break;
            
         case 0x2:  // kod klawisza 2
            digitalWrite(Out2Pin, HIGH);
            break;
            
         case 0x803:  // kod klawisza 3
            digitalWrite(Out3Pin, LOW);
            break;
            
         case 0x3:  // kod klawisza 3
            digitalWrite(Out3Pin, HIGH);
            break;
            
         case 0x80D:  // kod klawisza 4
            digitalWrite(MutePin, LOW);
            break;
            
         case 0xD:  // kod klawisza 4
            digitalWrite(MutePin, HIGH);
            break;

         case 0x807:  // kod klawisza 7 CH1
            digitalWrite(CH2Pin, LOW);
            digitalWrite(CH3Pin, LOW);
            digitalWrite(CH1Pin, HIGH);
            break;
            
         case 0x7:  // kod klawisza 7 CH1
            digitalWrite(CH2Pin, LOW);
            digitalWrite(CH3Pin, LOW);
            digitalWrite(CH1Pin, HIGH);
            break;      
                  
          case 0x808:  // kod klawisza 8 CH2
            digitalWrite(CH1Pin, LOW);
            digitalWrite(CH3Pin, LOW);
            digitalWrite(CH2Pin, HIGH);
            break;
            
         case 0x8:  // kod klawisza 8 CH2
            digitalWrite(CH1Pin, LOW);
            digitalWrite(CH3Pin, LOW);
            digitalWrite(CH2Pin, HIGH);
            break;  
                    
          case 0x809:  // kod klawisza 9 CH3
            digitalWrite(CH1Pin, LOW);
            digitalWrite(CH2Pin, LOW);
            digitalWrite(CH3Pin, HIGH);
            break;
            
         case 0x9:  // kod klawisza 9 CH3
            digitalWrite(CH1Pin, LOW);
            digitalWrite(CH2Pin, LOW);
            digitalWrite(CH3Pin, HIGH);
            break;  


I need more free pins and it is only way to disconnected directly wiring atmega<>uln2003 and add between atmega and uln one 74HC595.


I have problem. How can I leave alone some pins without change status (low,high)?

I have 3 outputs on/off on relay.

If I pressed 1
shiftValue = 0b0111111111111111;

If I pressed 2
shiftValue = 0b1011111111111111;

If I pressed 3
shiftValue = 0b1101111111111111;

So after pressed 1 - I turn on 1, but others pin are off.

gavron04

#38
Sep 12, 2017, 01:16 pm Last Edit: Sep 12, 2017, 04:55 pm by gavron04
About LDR and within range.


Code: [Select]


const byte LDRpin = A2; // LDR connected to pin A1 and ground (A0 is used for the pot)
const byte PWMpin = 10; // connected to the two OE pins
int lightValue = 50; // change/experiment with this value
int darkValue = 160; // change/experiment with this value
int LDRvalue;
byte PWMvalue;


void setup()

{

  Serial.begin(9600); // only needed for debugging
  pinMode(LDRpin, INPUT_PULLUP); // enables the internal pull up resistor
  pinMode(PWMpin, OUTPUT); // make the pin an output

}


void loop()

{
  LDRvalue = analogRead(LDRpin);
  Serial.print("LDR value is: ");
  Serial.println(LDRvalue);
  LDRvalue = constrain(LDRvalue, lightValue , darkValue);
  PWMvalue = map(LDRvalue, lightValue, darkValue, 0, 250);
  Serial.print("PWM value is: ");
  Serial.println(PWMvalue);
  analogWrite(PWMpin, PWMvalue); // write to the OE pins
}


I have searched in reference, but I can't find how to do this. constrain/min/max it isn't it.

I need to do this:

Code: [Select]


if(LDRvalue >=140 && value <=145)
{
PWMvalue = map(LDRvalue, lightValue, darkValue, 0,250);
analogWrite(PWMpin, PWMvalue);
}

if(LDRvalue >=120 && value <=125)
{
PWMvalue = map(LDRvalue, lightValue, darkValue, 0,250);
analogWrite(PWMpin, PWMvalue);
}


It is ok or not?



gavron04

Code: [Select]
const byte LDRpin = A2; // LDR connected to pin A1 and ground (A0 is used for the pot)
const byte PWMpin = 10; // connected to the two OE pins
int lightValue = 50; // change/experiment with this value
int darkValue = 160; // change/experiment with this value
int LDRvalue;
byte PWMvalue;

int latchPin = 4;
int clockPin = 5;
int dataPin = 3;
int potPin = 0;
int potValue = 0;

int shiftValue = 0;
int shift1Value = 0;
int latch1Pin = A4;
int clock1Pin = A5;
int data1Pin =  A3;

//#define Out1Pin 1  //out1 230vac
//#define Out2Pin 2 //out2 230vac
//#define Out3Pin 0 //out3 5vdc
//#define MutePin A2 //mute
#define VolUpPin 10 //up
#define VolDownPin A1 //down
//#define CH1Pin A3 //ch1
//#define CH2Pin A4 //ch2
//#define CH3Pin A5 //ch3
#include <IRremote.h>
#define irPin 8  // pin dla TSOP
IRrecv irrecv(irPin);
decode_results results;





void setup() {
  Serial.begin(9600); // only needed for debugging

  
     irrecv.enableIRIn();
    
   //pinMode(Out1Pin, OUTPUT);
   //pinMode(Out2Pin, OUTPUT);
   //pinMode(Out3Pin, OUTPUT);
   //pinMode(MutePin, OUTPUT);
   pinMode(VolUpPin, OUTPUT);
   pinMode(VolDownPin, OUTPUT);
   //pinMode(CH1Pin, OUTPUT);
   //pinMode(CH2Pin, OUTPUT);
   //pinMode(CH3Pin, OUTPUT);
   pinMode(LDRpin, INPUT_PULLUP); // enables the internal pull up resistor
   pinMode(PWMpin, OUTPUT); // make the pin an output




   //digitalWrite(0, LOW);
   //digitalWrite(1, LOW);
   //digitalWrite(2, LOW);
   //digitalWrite(A2, HIGH);
   //digitalWrite(10, LOW);
   //igitalWrite(A1, LOW);
   //digitalWrite(A3, HIGH);
   //digitalWrite(A4, LOW);
   //digitalWrite(A5, LOW);

   pinMode(latchPin, OUTPUT);
   pinMode(dataPin, OUTPUT);  
   pinMode(clockPin, OUTPUT);
   pinMode(latch1Pin, OUTPUT);
   pinMode(data1Pin, OUTPUT);  
   pinMode(clock1Pin, OUTPUT);

}

void loop() {
  LDRvalue = analogRead(LDRpin);
  Serial.print("LDR value is: ");
  Serial.println(LDRvalue);
  LDRvalue = constrain(LDRvalue, lightValue , darkValue);
  PWMvalue = map(LDRvalue, lightValue, darkValue, 0, 250);
  Serial.print("PWM value is: ");
  Serial.println(PWMvalue);
  analogWrite(PWMpin, PWMvalue); // write to the OE pins

if (irrecv.decode(&results))
   {
       switch (results.value)
       {
         case 0x801:  // kod klawisza 1
            //digitalWrite(Out1Pin, LOW);
            shift1Value = 0b0000000000000001;
            break;
            
         case 0x1:  // kod klawisza 1
            //digitalWrite(Out1Pin, HIGH);
            shift1Value = 0b0000000000000001;
            break;
            
         case 0x802:  // kod klawisza 2
            //digitalWrite(Out2Pin, LOW);
            shift1Value = 0b0000000000000010;
            break;
            
         case 0x2:  // kod klawisza 2
            //digitalWrite(Out2Pin, HIGH);
            shift1Value = 0b0000000000000010;
            break;
            
         case 0x803:  // kod klawisza 3
            //digitalWrite(Out3Pin, LOW);
            shift1Value = 0b0000000000000100;
            break;
            
         case 0x3:  // kod klawisza 3
            //digitalWrite(Out3Pin, HIGH);
            shift1Value = 0b0000000000000100;
            break;
            
         case 0x80D:  // kod klawisza 4
            //digitalWrite(MutePin, LOW);
            shift1Value = 0b0000000000001000;
            break;
            
         case 0xD:  // kod klawisza 4
            //digitalWrite(MutePin, HIGH);
            shift1Value = 0b0000000000001000;
            break;

         case 0x807:  // kod klawisza 7 CH1
            //digitalWrite(CH2Pin, LOW);
            //digitalWrite(CH3Pin, LOW);
            //digitalWrite(CH1Pin, HIGH);
             shift1Value = 0b0000000000010000;
            break;
            
         case 0x7:  // kod klawisza 7 CH1
            //digitalWrite(CH2Pin, LOW);
            //digitalWrite(CH3Pin, LOW);
            //digitalWrite(CH1Pin, HIGH);
            shift1Value = 0b0000000000010000;
            break;      
                  
          case 0x808:  // kod klawisza 8 CH2
            //digitalWrite(CH1Pin, LOW);
            //digitalWrite(CH3Pin, LOW);
            //digitalWrite(CH2Pin, HIGH);
            shift1Value = 0b0000000000100000;
            break;
            
         case 0x8:  // kod klawisza 8 CH2
            //digitalWrite(CH1Pin, LOW);
            //digitalWrite(CH3Pin, LOW);
            //digitalWrite(CH2Pin, HIGH);
            shift1Value = 0b0000000000100000;
            break;  
                    
          case 0x809:  // kod klawisza 9 CH3
            //digitalWrite(CH1Pin, LOW);
            //digitalWrite(CH2Pin, LOW);
            //digitalWrite(CH3Pin, HIGH);
            shift1Value = 0b0000000001000000;
            break;
            
         case 0x9:  // kod klawisza 9 CH3
            //digitalWrite(CH1Pin, LOW);
            //digitalWrite(CH2Pin, LOW);
            //digitalWrite(CH3Pin, HIGH);
            shift1Value = 0b0000000001000000;
            break;  

            
         case 0x11:  // kod klawisza 5
            digitalWrite(VolUpPin, LOW);
            delay(250);
            digitalWrite(VolDownPin, LOW);
            break;
            
         case 0x811:  // kod klawisza 5
            digitalWrite(VolUpPin, HIGH);
            delay(250);
            digitalWrite(VolUpPin, LOW);
            break;
            
         case 0x10:  // kod klawisza 6
            digitalWrite(VolDownPin, LOW);
            delay(250);
            digitalWrite(VolUpPin, LOW);
            break;
            
         case 0x810:  // kod klawisza 6
            digitalWrite(VolDownPin, HIGH);
            delay(250);
            digitalWrite(VolDownPin, LOW);
            break;
            
         case 0x80C:  // kod klawisza OFF
            //digitalWrite(Out1Pin, HIGH);
            //digitalWrite(Out2Pin, HIGH);
            //digitalWrite(Out3Pin, HIGH);
            shift1Value = 0b0000000000000000;
            break;
            
         case 0xC:  // kod klawisza OFF
            //digitalWrite(Out1Pin, LOW);
            //digitalWrite(Out2Pin, LOW);
            //digitalWrite(Out3Pin, LOW);
            shift1Value = 0b1111111111111111;
            break;
digitalWrite (latch1Pin, LOW);
shiftOut (data1Pin, clock1Pin, MSBFIRST, highByte (shift1Value)); // upper 8 bits
shiftOut (data1Pin, clock1Pin, MSBFIRST, lowByte (shift1Value)); // lower 8  bits
digitalWrite (latch1Pin, HIGH);
  delay(100); // remove this line after testing

         }
   irrecv.resume();
   }


// read pot &  update outputs to 2 daisy chained shift registers
potValue = analogRead(A0);

if ( potValue >=0 && potValue <=20)
{
shiftValue = 0b1111111111111111;
}

if ( potValue >=20 && potValue <=63)
{
shiftValue = 0b0111111111111111;
}

if ( potValue >=63 && potValue <=126)
{
shiftValue = 0b0011111111111111;
}

if ( potValue >=126 && potValue <=189)
{
shiftValue = 0b0001111111111111;
}

if ( potValue >=189 && potValue <=252)
{
shiftValue = 0b0000111111111111;
}

if ( potValue >=252 && potValue <=315)
{
shiftValue = 0b0000011111111111;
}

if ( potValue >=315 && potValue <=378)
{
shiftValue = 0b0000001111111111;
}

if ( potValue >=378 && potValue <=441)
{
shiftValue = 0b0000000111111111;
}

if ( potValue >=441 && potValue <=504)
{
shiftValue = 0b0000000111111111;
}

if ( potValue >=504 && potValue <=567)
{
shiftValue = 0b0000000011111111;
}

if ( potValue >=567 && potValue <=630)
{
shiftValue = 0b0000000001111111;
}

if ( potValue >=630 && potValue <=693)
{
shiftValue = 0b0000000000111111;
}

if ( potValue >=693 && potValue <=756)
{
shiftValue = 0b0000000000011111;
}

if ( potValue >=756 && potValue <=819)
{
shiftValue = 0b0000000000001111;
}

if ( potValue >=819 && potValue <=882)
{
shiftValue = 0b0000000000000111;
}

if ( potValue >=882 && potValue <=945)
{
shiftValue = 0b0000000000000011;
}

if ( potValue >=945 && potValue <=1010)
{
shiftValue = 0b0000000000000001;
}

if ( potValue >=1010 && potValue <=1023)
{
shiftValue = 0b0000000000000000;
}



digitalWrite (latchPin, LOW);
shiftOut (dataPin, clockPin, MSBFIRST, highByte (shiftValue)); // upper 8 bits
shiftOut (dataPin, clockPin, MSBFIRST, lowByte (shiftValue)); // lower 8  bits
digitalWrite (latchPin, HIGH);
  delay(100); // remove this line after testing

}


I have now this code. But second 74HC595 with ULN isn't work properly. When I press 1,2,3,OFF nothing happen.

Grumpy_Mike

Quote
I have searched in reference, but I can't find how to do this. constrain/min/max it isn't it.
odd searching for "Arduino constrain" gives this as a first hit:-
Please read:-
https://www.arduino.cc/en/Reference/Constrain

and also read:-
https://www.arduino.cc/en/Reference/Map
I don't think you are using it correctly.

Quote
But second 74HC595 with ULN isn't work properly.
Why are you using latch1Pin & latchPin and clock1Pin & clockPin

The latch and clock pin should be the same for both shift registers otherwise it can not possibly work. How is it wired up?

gavron04

The latch and clock pin should be the same for both shift registers otherwise it can not possibly work. How is it wired up?
I have 2x 74hc595 to drive 16ch led and 1x 74hc595 with ULN2003. I need to drive them separately (2x74hc595 and 1x 74hc595 with uln2003).

I have testing this on universal board, but here You can see my connection:




2x 74HC595 I have on second pcb. On first pcb I have only connector.

It is possible to drive 1x 74hc595 with uln2003 each pin separately?

Wawa

You can chain as many shift register chips from the same three pins as needed.
It's not restricted to one or two.

A TPIC6B595 (ebay) could replace the "74HC595+ULN2003".
Leo..

gavron04

Sound better. But again the same question:

1) I function like this:
a) when I press "1" on remote control First relay go ON
b) when I press "2" on remote control Second relay go ON
c) when I press "3" on remote control Third relay go ON
d) when I press again "1" on remote control First relay go OFF (only First relay, Second and Third is still ON)
e) when I press again "2" on remote control Second relay go OFF (only Second relay, First and Third is still ON)
f) when I press again "3" on remote control Third relay go OFF (only Third relay, Second and First is still ON)

How can I do this? I don't think, that it is:


Code: [Select]
if (irrecv.decode(&results))
   {
       switch (results.value)
       {
         case 0x801:  // kod klawisza 1
            //digitalWrite(Out1Pin, LOW);
            shift1Value = 0b0000000000000001;
            break;
digitalWrite (latchPin, LOW);
shiftOut (dataPin, clockPin, MSBFIRST, highByte (shiftValue)); // upper 8 bits
shiftOut (dataPin, clockPin, MSBFIRST, lowByte (shiftValue)); // lower 8  bits
digitalWrite (latchPin, HIGH);
  delay(100); // remove this line after testing

         }
   irrecv.resume();
   }


And next question. If I have use the same three pin as I have on 2x 74HC595 to drive 16ch led how can I define in code for remote control with 74HC595 (when I press "1" on remote control, switch ON first relay by third chip 74HC595) that is third chip 74HC595?


About TPIC6B595. I use ULN2003 to drive 5 relays. TPIC6B595 is still good for this?

Grumpy_Mike

Quote
I need to drive them separately (2x74hc595 and 1x 74hc595 with uln2003).
No you don't.
Their is no reason to drive them separately.

Quote
About TPIC6B595. I use ULN2003 to drive 5 relays. TPIC6B595 is still good for this?
Yes each output of the TPIC6B595 can sink 150mA. Have you got diodes across those relay coils?

Quote
How can I do this?
By assigning a state boolean variable for each relay and having the code that detects the key number toggle that state variable. Then write that state variable to the relay.

Go Up