I am looking at creating a mail system that registers when someone has mail. My plan is to use 2 Arduinos because there is a distance between the lighting system and the mail system and to create a wireless serial communication system between the two. To make this system work I am going to use a NC switch in the Mailbox which will send a signal to the Arduino when mail is inserted causing the switch into the open position. The info will then be sent to the other arduino which will activate a light subsytem using a transistor (maybe a relay). My issue is that this mail system requires me to have around 100 mailboxes and I am having a problem finding a controller that can take 100 inputs and change them into a 8 digit binary number. The controller also needs to be able to work in reverse. Are there any parts outside of extremely expensive PLC's that can do this?
These 100 mail boxes. Are they together in a 10x10 grid like in an apartment building, or spread out down a long street?
If they are in a grid, you should wire the nc switches in a matrix configuration. That would require only 20 pins. Or as few as 11 pins of you use a charlieplex matrix, which would require a diode for every switch.
The controller also needs to be able to work in reverse.
Can you explain that please.
I hadn't thought about using a matrix system. That's actually a really good idea. Any suggestions on a matrix system?
Easiest way might be to use a Mega, but it could be done with an Uno/Nano/whatever plus some extra chips.
Say your mailboxes are in for example a 5 row x 20 column matrix. You would need 5 output pins and 20 input pins. Your sketch would activate one of the 5 output pins and then read the 20 input pins. This would read the switches in one row. Then it would activate the next output pin and so on until all 100 switches had been read. It would repeat this whole scanning process many times per second, and so be able to detect any switch being activated. If it detected that switch in column 13 of row 2 was activated, it would turn this into the number 20 * 2 + 13 = 53.
The other part of your plan concerns me. If this is an apartment building with 100 apartments, it will be difficult to send a wireless signal from the mailboxes to each apartment because of the distance and all the walls and floors blocking the wireless signal.
Its not an apartment. Its a halfway house. Yeah I looked into column-row scanning and how to implement it. The issue has been that the residents haven’t been getting their mail because my coworkers don’t look to see who has mail. This system would simplify the process by letting the residents know if they have mail and then they can ask. I basically have Direct Line of Sight (DLoS) to where the second arduino would be located. Also the matrix suggestion is way easier to implement than the Binary. Just because I would need the coder and decoder on each end. I’ll probably end up using an IR LED with a IR sensor as the switches because then i can make the boxes about 7 by 5 by 2 inches so that they can hold a decent amount of letters. However, might end up doing 7 by 8.5 by 2 do hold the larger mail. Still thinking logistics on all of that.
You can use a single light source for each pair of boxes... simply put the LED in the dividing wall - looking outward. Also allows same approach with optos paired in each wall. Less routing of wiring... or you could use IR reflective to 'see' if there are items in each box, instead of IR blocking.
Either way, slant the sensing beam through the void at an angle - to detect shorter/displaced items... (using a reflective beam could use a small mirror and traverse each box more than once!)