Maker Pro
Maker Pro

Using a REED SWITCH with uC Question

JimL86

Nov 13, 2017
13
Joined
Nov 13, 2017
Messages
13
Hey,

I am using a REED SWITCH with on one side that is connected to a battery and on the other side to a GPIO on micro-controller (ATTINY814)

Does the circuit consume current when the reed switch is on or off? Even when the microcontroller is in idle state (Sleep Mode)? If so, how much current you assume?

Is it possible to make a configuration in which the microcontroller is in sleep mode and no current is being drawn unless the microcontroller awakes? (even when the reed switch is on)..

* FYI provided a drawing of the circuit.
 

Attachments

  • Magnetic Switch Connection.png
    Magnetic Switch Connection.png
    9 KB · Views: 118

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
Before worrying about the current drawn, you need a circuit that works. With the circuit you show, the input is floating when the the switch is open. If the micro has pulldown you can enable, and you enable them, the circuit would work, otherwise, it needs a pulldown resistor (from the GPIO to ground) in order to work correctly.

Anyway, there is obviously no current in your circuit when the switch is open. When it is closed, it would be the leakage current of the input, which should be in the datasheets. With pullups, there is a current through the pullup as well when the switch is closed.

Bob
 

kellys_eye

Jun 25, 2010
4,864
Joined
Jun 25, 2010
Messages
4,864
Pull up resistors are the most commonly used method and some μcontrollers have them built into their I/O ports - check the datasheet to see if your particular port offers this.
 

hevans1944

Hop - AC8NS
Jun 21, 2012
4,739
Joined
Jun 21, 2012
Messages
4,739
Have you read, and do you understand, all 598 pages of the Atmel datasheet for your ATtiny814?

What is the purpose of the reed switch? How do you awaken the processor from "sleep mode"? Which sleep mode will you be using?

Is it possible to make a configuration in which the microcontroller is in sleep mode and no current is being drawn unless the microcontroller awakes? (even when the reed switch is on)..
No. If the reed switch is closed, connecting the CR2032 coin-cell to a GPIO input, some current will flow regardless of whether the microcontroller is awake or asleep.

Please tell us what you are trying to DO, instead of proposing and asking questions about how you think it should or could be done.
 
Top