Connect a reed switch to DS2413 breakout board? Help please

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
akke123
 
Posts: 2
Joined: Sun Jul 25, 2021 5:05 am

Connect a reed switch to DS2413 breakout board? Help please

Post by akke123 »

I have multiple DS2413 breakout boards and I need to read the state of multiple reed switches.

Can I just connect the reed switches betsween the GPIO pin and the IO pin (which is positive power?)
I read in the datasheet that the IO pins have a week pulldown transistor so I though I need to put the reed switches between IO and GPIO?

Or do I connect between GPIO and GND + pullup resistor between GPIO and IO ?

Can anyone please explain to me how to do it correctly before I fry them :-)

User avatar
dastels
 
Posts: 15662
Joined: Tue Oct 20, 2015 3:22 pm

Re: Connect a reed switch to DS2413 breakout board? Help ple

Post by dastels »

IOA and IOB are open-drain, the same idea as open-collector if you have a bipolar transistor instead of a FET. All that means is that it is connect to ground if you output a 0/false and not connected to anything if you output a 1/true. It's a far more flexible way to do output, especially when you want to switch power to something (like a LED) on and off. It does mean that you need an external pullup resistor if you want to output a voltage (when the output is unconnected the pullup has it default to 1/high. For a switch you will also need a pullup and connect the other side of the switch to ground. When the switch is closed, the input will be 0/false; when it's open the pullup will make sure the input is 1/high.

IO is not positive power, it's the data signal from the controller board (e.g. an Arduino UNO). Please see https://learn.adafruit.com/adafruit-1-w ... drain-gpio for how to connect the switch to the DS2413 and it to the controller.

What you use for "Local Power" will depend on how you are using the board. If you run a power line from the controller (5v or 3.3v depending on what it is) then your input pullups will connect to that (not that the pullup on the IO signal can be on the controller board). If you are using a battery or some other external power source the input pullups will connect to that. One big advantage of the one-wire interface is that you don't need to run power to it; it can have its local power for the pullups (or whatever you are controlling if you use it for output).

Dave

User avatar
akke123
 
Posts: 2
Joined: Sun Jul 25, 2021 5:05 am

Re: Connect a reed switch to DS2413 breakout board? Help ple

Post by akke123 »

But I have only 2 wires to the ds2413 (located 2m further away in the garden). So I have no ‘local power’ to connect the pullup resistor to?
Do i need an additional wire to bring power to the location? Or is it possible to connect the reed switches without additional power?

User avatar
dastels
 
Posts: 15662
Joined: Tue Oct 20, 2015 3:22 pm

Re: Connect a reed switch to DS2413 breakout board? Help ple

Post by dastels »

No, you need a pullup on the inputs which means you need a power source. That could be a battery or a power wire from the controller. Either approach as advantages/disadvantages. Connecting the switches without a pullup would give a solid 0/false input value but the input would be unconnected/floating when the switch is open and subject to EMF noise and give an unreliable value including false positives.

Dave

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”