Go Down

Topic: Are 64 reed switches possible to wire separately? (Read 1 time) previous topic - next topic

Restok

I need to wire 64 reed switches and a TFT LCD screen that displays the data from the switches to an arduino. I don't think a multiplexer could work since each reed switch has to manage it's own area.

And for what I'm doing, the reed switches have to be distributed proportionally on a large breadboard: 8 rows and 8 columns, each reed switch getting one square inch of space.

Is this even possible to wire given the restraint by the numbers and the need for exact proportions?

promacjoe

What Arduino are you using. An 8 x 8 matrix is the preferred method. this uses the fewest pins.  And I cannot see any difference in the application for a reed switch, versus any other type of switch. Other than it being operated with a magnet.

Restok

Op
What Arduino are you using. An 8 x 8 matrix is the preferred method. this uses the fewest pins.  And I cannot see any difference in the application for a reed switch, versus any other type of switch. Other than it being operated with a magnet.
A guy on my forum that's actually more detailed into the project suggested using the 76HC165? And having a magnet was the entire point!

INTP

Why start a new thread for your same project?

There's no reasonable limit for switches, 64 is not a problem since you don't need to know the status of all at the same time.

Restok

Why start a new thread for your same project?
There's no reasonable limit for switches, 64 is not a problem since you don't need to know the status of all at the same time.
I thought this question was more specific to the electronics of the project, instead of the idea of the project itself. If it becomes a hassle - I apologize and would gladly delete this one.

So, what do you mean when you say I don't need to know the status all the time? I planned on having the LCD screen(now leaning towards the matrix as mentioned by promacjoe) act according to the status of each and every reed switch on the board. Is this the wrong way to go about it?

INTP

First of all . . . .

Why do you need to detect all 64 squares?
Last I checked, checkers only took place on half of them . . . .


You don't need to know the instantaneous state of all your switches, meaning you are able to use a method of polling the switches sequentially. Human movement is a slow thing.


Still not sure if the Arduino is enough if it has to run a screen as well, but maybe I'm not understanding the point of your project.

Restok

OK, officially decided on the 8x8 led matrix as a screen, easier and cheaper, although more shabby looking.
First of all . . . .

Why do you need to detect all 64 squares?
Last I checked, checkers only took place on half of them . . . .


You don't need to know the instantaneous state of all your switches, meaning you are able to use a method of polling the switches sequentially. Human movement is a slow thing.


Still not sure if the Arduino is enough if it has to run a screen as well, but maybe I'm not understanding the point of your project.
I was thinking for the matrix screen, since it is 8x8, the state of each reed switch is indicated so that: If the reed switch is closed, the led indicating that square lights up, if open, it doesn't. This way, the screen gives a live feed of the checkers location all the time.

My problem was how the reed switches would be wired. Would they all connect to its own input and output? Would it be one massive closed series circuit? What input and output type would be recommended for them? Online tutorials are handy when you have one reed switch, when you have 64, well...


dougp

My problem was how the reed switches would be wired. Would they all connect to its own input and output? Would it be one massive closed series circuit?
Do you understand what the 74HC165 does?
Everything we call real is made of things that cannot be regarded as real.  If quantum mechanics hasn't profoundly shocked you, you haven't understood it yet. - Niels Bohr

No private consultations undertaken!

Restok

Do you understand what the 74HC165 does?
Thanks for the link. I read it a couple of times, and I must admit, I still am a little confused. It's a shift register, right? It adds more pins? The CLK thing bothers me though, something to do with data transfer I think.

It still is a little confusing as to how the wires are plugged, even with enough pins.

promacjoe

OK, officially decided on the 8x8 led matrix as a screen, easier and cheaper, although more shabby looking.
I was thinking for the matrix screen, since it is 8x8, the state of each reed switch is indicated so that: If the reed switch is closed, the led indicating that square lights up, if open, it doesn't. This way, the screen gives a live feed of the checkers location all the time.

My problem was how the reed switches would be wired. Would they all connect to its own input and output? Would it be one massive closed series circuit? What input and output type would be recommended for them? Online tutorials are handy when you have one reed switch, when you have 64, well...


see this document,

http://www.atmel.com/images/doc2532.pdf

Scroll down to figure 2. It shows a set of vertical and horizontal wires. Each circle represents a switch connecting these two wires together. A very simple arrangement. one reed switch for each vertical/horizontal connection.

Also Google "Arduino keyboard matrix tutorial". You will find several tutorials on how to use the keyboard matrix. It is the same as what you're doing. the only difference is, it is a 4 x 4 matrix instead of an 8 x 8. Just keep adding pins until you get the right arrangement.

also, you never did say what Arduino you're using.

promacjoe

Thanks for the link. I read it a couple of times, and I must admit, I still am a little confused. It's a shift register, right? It adds more pins? The CLK thing bothers me though, something to do with data transfer I think.

It still is a little confusing as to how the wires are plugged, even with enough pins.
A shift register is just a series of flip-flops. Each flip-flop is either on or off. The clock tells the flip-flops to shift the data over, one for each clock cycle. Basically what you're doing is setting one pin high for the data output, Turn the clock on and off. Set the data pin low, read your input pins, cycle o'clock pin one time, read your input pins. You cycle the clock a total of 8 times. Then you repeat the process. If you really want to save pins, program a Arduino nano to scan the keyboard. And report the results back to the main Arduino via a serial port. you can even program it to only send data when something has changed.

MarkT

You need a diode in series with every reed switch to be able to sense any combination of them unambiguously.

http://www.openmusiclabs.com/learning/digital/input-matrix-scanning/index.html
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

dougp

It's a shift register, right?
Yes.
It adds more pins?
Depends what you mean by 'adds more pins'. It does require at least three pins connected to the controller I/O:

  • 1. load - tells the SR to take a snapshot of its eight inputs and store them in the SR. This is the parallel in part
  • 2. clock - tells the SR to move the data one bit at a time toward its output pin
  • 3. data - The eight stored bits are presented one at a time at the output for pickup by the controller, or another SR. This is the serial out part.


So, for three I/O pins consumed you have gained the ability to sense eight real world bits. Put eight shift registers in a row (electrically - this is termed cascading) and you can sense sixty-four input bits, still with the original three I/O pins.

The tradeoff is that you now have to deal with those bits in software to make sense of them. And yes, part of that is 'manually' controlling the three items listed above. The same thing happens when you load a program to the Arduino it's just that you don't have to get your hands dirty with baud rates, handshaking, and other messiness.
Everything we call real is made of things that cannot be regarded as real.  If quantum mechanics hasn't profoundly shocked you, you haven't understood it yet. - Niels Bohr

No private consultations undertaken!

Restok

You need a diode in series with every reed switch to be able to sense any combination of them unambiguously.

http://www.openmusiclabs.com/learning/digital/input-matrix-scanning/index.html
Perfect! I'll keep researching.

Grumpy_Mike

Why do you need to detect all 64 squares?
Last I checked, checkers only took place on half of them . . . .
You seem to be forgetting this point.

Go Up