How to strategically place Magnetic Contact Switch side by side

hi all, i am currently trying to place 7 Magnetic contact switch side by side in a medication box (The ones that has monday to sunday) so as i have no knowledge of magnets and how it affect the project.. So i tried to do digitalread when i try to lift up individual case but for some, it cannot detect the magnetic being removed (Might be due to the magnet beside it) Quite confident it might not be due to the range.. But more of the Polarity which causes the Reed Switch to close if they detect N and S together?? (Not quite sure here.. just giving my guess)

So anyone could maybe give me some help? ( I also found out that some magnet's polarity is different.. might be the manufacturer cased it wrongly.. using Adafruit's magnetic contact switch.) Thanks

Where would you like to start? Magnets? Reed switches? The switch example program that comes with the Arduino IDE?

Paul

Reed switches do not play well when they are close together. This is because the magnetic field "conducts" along the metal strips inside the switches and interferes with the other switches. You would be better off using hall effect switches and smaller magnets.
This is a project where I used this arrangement to detect a dice. Dice Game

Grumpy_Mike:
Reed switches do not play well when they are close together. This is because the magnetic field "conducts" along the metal strips inside the switches and interferes with the other switches. You would be better off using hall effect switches and smaller magnets.

Note that the orientation of your reed switches could make a lot of difference
Diagram:
reed_switches.png
Yours,
TonyWilk

reed_switches.png

It sounds like you have the magnets in the lid and the reed switches in the bottom. That means there is always going to be a magnet a certain distance from the reed switch. You can try mounting the reed switches in the lid and the magnets in the bottom, which will double the distance a particular reed switch will be from a magnet when that lid is opened

Hi all, thanks for the speedy replies and recommendations.

i guess @tinman13kup has the nearest idea of how my placement is by.. but if i were to follow the recommendation given by tinman, i think that the wires from the reed will be all over the place since it will move when i lift it up and such.. if i were to place different polarity (like NS | SN) etc, will it work??

Here is a scenario that i found out when experimenting
if i were to place the magnet:

SN NS SN

and i were to remove the 'NS' Magnet, the middle reed will still detect it as closed since the left SN and the right SN somehow made the middle reed detect that there is a legit magnet there..

any other recommendation on how i can do if my main intention is to place the reed below instead of putting it at the lid?

much thanks

i think that the wires from the reed will be all over the place since it will move when i lift it up and such

Only if your construction skills are not up to wiring properly.

Why not post a photo of what you have then we don’t have to guess?

You could try adding magnetic shielding between the reed switches using something like: 99.995% Pure Iron Foil Fe Thin Sheet 0.05mm x 100mm x 1000mm | eBay.

Paul

I have never tried using pure iron as a shield. When ever I want a shield I use mu metal foil, mind you it is quite expensive but works great.

@Paul_KD7HD

That's a great idea! didnt really realise thati need to know magnetism until now.. hahaha will try it out :slight_smile:

Sorry, but can aluminium foil serve the same purpose?

Sorry, but can aluminium foil do the same purpose ?

No.

@Grumpy_Mike

Thanks for the info! :slight_smile:

Qin:
Sorry, but can aluminium foil serve the same purpose?

No, but a cut-up tin can could.

Yours,
TonyWilk

No, but a cut-up tin can could.

No. Try putting a magnet either side of a tin can, you don't see any effect. Put a magnet either side of some uMetal foil and they don't stick together.

I think you are barking up the wrong tree with this shielding idea uMetal is horrendously expensive.

Qin:
, i think that the wires from the reed will be all over the place since it will move when i lift it up and such..

Swap the switches position for the magnets, put the magnets on the moving part and the switches in the fixed part.

How part apart are the magnet/switch pairs?

Have you tried to make a small mock-up of a couple of magnets and switches to see how they interact.

We do not know the strength of your magnets or the sensitivity of the reed switches.

Tom... :slight_smile: