0
\$\begingroup\$

I'm about to buy components for my first Arduino project: Reed contacts for my model railroad (H0 scale) to detect track usage. I don't want to use special shields, but use as few components as possible to directly connect the reed switches to the Arduino.

To make good use of the Arduino Nano, I'd like to use an input matrix. Let me summarize, how I understand the matrix (here it's 4 by 4, but with 14 digital IO pins, I could have a 7 by 7 matrix, right?):

Input matrix

To see the closed contacts, I switch on the one of the inputs at a time (I, R1, S1, T1) and read all of the outputs (N, O, P, Q). If R1 is active and I receive a high on O and P, then both of the middle contacts would be closed.

Since I'm a real newbie here, I'm unsure about the specs I should look for in the reed switches and the diodes. Also, do I miss any components (resistors?) or are switches and diodes enough?

Thank you!

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Since you're going to have a great many wires snaking over a large area, the chance of extraneous voltages impinging on the matrix is high. So a series resistor on every row & column might be a good idea for safety...perhaps 1k ohm. If you drive columns (as you've suggested), then each row requires a pull-down resistor to Arduino's gnd - perhaps 100k. \$\endgroup\$
    – glen_geek
    Oct 3 '20 at 13:48
0
\$\begingroup\$

This application is not very demanding and you're you're going to be buying a lot of parts, so just buy the cheapest ones. 1N914 or 1N4148 diodes are usually inexpensive. for the reeds shop around. you probably want glass ones as they are harder to bust than plastic ones.

Resistors are a good idea, you could use the arduino's internal pull-up but using a lower resistance (like 1K) will help noise immunity, and an electroc model railways is probably electically noisy.

backing your table-top with foil connected to the arduino ground and running the wires below the foil will probably help with the noise too,

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.