74HC595 (x14) - monopoly project

Hello all,

I've done some searching about this and I can't get it to do what I want.

Basically the end goal is to control a number of LEDs that signify houses and hotels for each property on a monopoly board - 4 green and 2 red, using 4 X bi-colour LEDs ( the middle 2 will light red to signify a hotel)

I'm using 14 off 74HC595 shift registers to give me enough outputs for all the LEDs.

I can't reach my goal of being able to control specific outputs without affecting the state of all the other outputs. I hope that makes sense...

Can anybody shed any light bon how this can be achieved?

I'm writing this from my mobile, when I get home I will update with the code I have been using and what results I'm getting.

I'd like if possible to send a simple instruction to the Arduino via Bluetooth with a property (e.g Old Kent Road) and the number of houses (0 to 5, with 5 being a hotel)

Any guidance will be greatly appreciated

Regards

Stuart

stuartpurdue:
I can't reach my goal of being able to control specific outputs without affecting the state of all the other outputs.

We'll need to see your code to really help, but I'd guess that you're writing direct to the shift registers when you get a new instruction from the phone.

A way to do this is to keep the state of each property in an array, change that when the phone tells you to and then send the information for every property to the shift registers.

I just looked at the data sheet of the 595. Change the bit You want to change in the varuable containing the data. Then shift out all the 14*8 bits, the hole lot. Then send the latch signal to the 595:s.

Railroader:
I just looked at the data sheet of the 595. Change the bit You want to change in the varuable containing the data. Then shift out all the 14*8 bits, the hole lot. Then send the latch signal to the 595:s.

That makes sense... But how would I do this. You may have already guessed that I'm ana Arduino noob!

Attach code, wiring etc.. Working a lot with similiar electronical circuits it is fairly easy. Let's see what ee can do.

Here are the 2 sketches that I have been using:

The first one sets the outputs 1 through 16 HIGH, then repeats this setting them LOW

/*
  ShiftRegister74HC595 - Library for simplified control of 74HC595 shift registers.
  Created by Timo Denk (www.timodenk.com), Nov 2014.
  Additional information is available at http://shiftregister.simsso.de/
  Released into the public domain.
*/

#include <ShiftRegister74HC595.h>

// create a global shift register object
// parameters: (number of shift registers, data pin, clock pin, latch pin)
ShiftRegister74HC595 sr (2, 11, 12, 8 ); 
 
void setup() { 
}

void loop() {

  // setting all pins at the same time to either HIGH or LOW
  //sr.setAllHigh(); // set all pins HIGH
  //delay(500);
  
  //sr.setAllLow(); // set all pins LOW
  //delay(500); 
  

  // setting single pins
  for (int i = 0; i < 16; i++) {
    
    sr.set(i, HIGH); // set single pin HIGH
    delay(20);
  }
  delay (100);
  for (int i = 0; i < 16; i++) {
    
    sr.set(i, LOW); // set single pin HIGH
    delay(20); 
  }
  delay(1000);
  
  // set all pins at once
  uint8_t pinValues[] = { B00000001, B11000000 }; 
  sr.setAll(pinValues); 
  delay(1000);

}

The second code sends all the output values for all the shift registers (I currently only have 2 setup on a breadboard)

/*
  ShiftRegister74HC595 - Library for simplified control of 74HC595 shift registers.
  Created by Timo Denk (www.timodenk.com), Nov 2014.
  Additional information is available at http://shiftregister.simsso.de/
  Released into the public domain.
*/

#include <ShiftRegister74HC595.h>

// create a global shift register object
// parameters: (number of shift registers, data pin, clock pin, latch pin)
ShiftRegister74HC595 sr (2, 11, 12, 8 ); 
 
void setup() { 
}

void loop() {
  
  // set all pins at once
  uint8_t pinValues[] = { B00000001, B11000000 }; 
  sr.setAll(pinValues); 
  delay(1000);

}

The first code will blink the outputs in a rate of a cycle 2.64 seconds. Am I right? You could drop the 20 mS delay I Think, or decrease it a lot. Those circuits are pretty fast I think.

I don't know that library at all so I hope it works well for You. Being a fossile I would probably have write the bit sending routine myself…..

Any question?

Each 595 have a serial input pin and a serial output pin. The I-pin of the first 595 is connected to an Arduino output. The output serial of the first 595 is connected to the input serial of the second 595. I Think You have figured that out ny now.

The shifting process for 14 pieces of 595s will take some little time, but not much, I think. The solution to avoid flickering at the parallell outputs of the 595 is the latch pulse issued when all 14 x 8 bits have been shifted out.