Magnetic Contact Sensor + Boron

Not sure if this is the right place to ask this question but just thought I would start here.

How many magnetic contact sensors potentially I can have connected to a single digitalPin on the Boron?
I’m not looking to monitor the individual sensors I just need to know if when any of them are triggered.

I have one end connected to GND and the other to PIN4. Aside from cable lengths, what are the other variables that may affect the number of sensors on a single pin?

Hi,
What do you mean by “magnetic contact sensor” ? , reed switch ?
you can have ∞ value of reed switches connected to 1 digital pin, all of them will be connected in parallel to each other and you can get status of just one of them. Make sure that if you connect one end of them to GND you will use pull-up in setup eg:

int reed_sw = D4;                         // reed switch is connected to D4

void setup()
{
  pinMode(reed_sw, INPUT_PULLUP);    // sets pin as input with internal pull-up resistor
}

ref

Hope this help,
Best regards

1 Like

Thanks @dreamER. Is cable length something I have to worry about in this case?

Hi,
Yup you are absolutely right wire length and fact that is just 3.3V (Boron GPIO are not 5V tolerant !!!) can be a little headache.
I’ll use optocoupler in this circuit and try ( personalty I’m not sure if this boosters work but is worth to try for $8 :slight_smile: ) DC/DC booster
to pull up a little (eg: to 12V) the voltage for reed switches. I’know this is Boron project and probably you would like to save energy
consumption as much as possible, but you will use booster just to power up the LED inside the optocoupler which shouldn’t consume too much energy (just couple mA). Thanks to the higher voltage, even if you gonna get some voltage droop, on long wires the circuit should be still stable and work fine. Also the optocoupler will provide you safe separation between your boron and reed switches.
here is some theory about optocouplers:

https://www.electronics-tutorials.ws/blog/optocoupler.html

and here is the DC/DC booster which can do the job:

Also if you don’t want to over complicate the things and you have direct 12V DC available regarding to this post you can power the Boron on VUSB pin directly from 12V and then use the same power supply for reed switches and optocoupler circuit.

Here is some drawing :

Hope this help.
Best regards

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.