Home Arduino Arduino and reed switches

Arduino and reed switches

by iainhendry

The reed switch is an electrical switch operated by an applied magnetic field. It consists of a pair of contacts on ferrous metal reeds in a hermetically sealed glass envelope. The contacts may be normally open, closing when a magnetic field is present, or normally closed and opening when a magnetic field is applied. The switch may be actuated by a coil, making a reed relay,or by bringing a magnet near to the switch. Once the magnet is pulled away from the switch, the reed switch will go back to its original position.

An example of a reed switch’s application is to detect the opening of a door, when used as a proximity switch for a burglar alarm.

Reed_switch

The reed switch contains a pair (or more) of magnetizable, flexible, metal reeds whose end portions are separated by a small gap when the switch is open. The reeds are hermetically sealed in opposite ends of a tubular glass envelope.

A magnetic field (from an electromagnet or a permanent magnet) will cause the reeds to come together, thus completing an electrical circuit. The stiffness of the reeds causes them to separate, and open the circuit, when the magnetic field ceases. Another configuration contains a non-ferrous normally-closed contact that opens when the ferrous normally-open contact closes. Good electrical contact is assured by plating a thin layer of non-ferrous precious metal over the flat contact portions of the reeds; low-resistivity silver is more suitable than corrosion-resistant gold in the sealed envelope.

Since the contacts of the reed switch are sealed away from the atmosphere, they are protected against atmospheric corrosion. The hermetic sealing of a reed switch make them suitable for use in explosive atmospheres where tiny sparks from conventional switches would constitute a hazard.

One important quality of the switch is its sensitivity, the amount of magnetic field necessary to actuate it. Sensitivity is measured in units of Ampere-turns, corresponding to the current in a coil multiplied by the number of turns. Typical pull-in sensitivities for commercial devices are in the 10 to 60 AT range. The lower the AT, the more sensitive the reed switch. Also, smaller reed switches, which have smaller parts, are more sensitive to magnetic fields, so the smaller the reed switch’s glass envelope is, the more sensitive it is.

In production, a metal reed is inserted in each end of a glass tube and the end of the tube heated so that it seals around a shank portion on the reed. Infrared-absorbing glass is used, so an infrared heat source can concentrate the heat in the small sealing zone of the glass tube. The thermal coefficient of expansion of the glass material and metal parts must be similar to prevent breaking the glass-to-metal seal. The glass used must have a high electrical resistance and must not contain volatile components such as lead oxide and fluorides. The leads of the switch must be handled carefully to prevent breaking the glass envelope. The glass envelope can be damaged if the reed switch is subjected to physical shock.

 

Here is a module that is part of a sensor kit which is sold for use with the Arduino

reed switch module

In this case we have a schematic of the module, so if you wanted to build your own one, you would need the parts in the schematic below

reed switch module schematic

Connection

This is for the module above

A0  ->   Not used in this example
G    -> Arduino Gnd
+    ->  Arduino 5v
D0  -> Arduino D8 (you could use an digital pin)

Code

Very basic example, when the reed switch is open Arduino pin 8 will be low (0). Place a magnet near the reed switch and it should close which is a high and pin 8 will be high (1)

If you open the serial monitor you will see this

[codesyntax lang=”cpp”]

const int digital = 8;
 
void setup()
{
  pinMode(digital, INPUT);
  Serial.begin(9600);
}
 
void loop()
{
  Serial.println(digitalRead(digital));
  delay(1000);
}

[/codesyntax]

 

Links

Under $1 for one of these modules, so again won’t hurt the wallet too much
AliExpress.com Product – Reed switch Module for Arduino UNO

You may also like

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More