Other blogs in this project

Forget Me Not Design Challenge Week 01: The Introduction

Forget Me Not Design Challenge Week 02: The EnOcean Sensor Kit, EnOcean Pi, and Raspberry Pi Model B+ Unboxing

Forget Me Not Design Challenge Posting 03: The EnOcean Sensor Kit, EnOcean Pi, and Raspberry Pi Model B+ Setup, Configuration, and FHEM Operation

Forget Me Not Design Challenge Week 04: Tektronix TBS1052B-EDU Oscilloscope

Forget Me Not Design Challenge Post 05: EnOcean EOP-350 Universal Programmer Board

Forget Me Not Challenge Design Challenge Post 06: Cadsoft Eagle Schematics

Forget Me Not Challenge Design Challenge Post 08: Soldering Iron Monitor

Forget Me Not Challenge Design Challenge Post 09: Soil Moisture Monitor

Forget Me Not Challenge Design Challenge Post 10: Cat Feed Monitor

Forget Me Not Challenge Design Challenge Post 11: Project Summary



My original proposal for a door lock monitor using the EnOcean STM 320U Magnetic Contact Transmitter Module is shown in Figure 1. In this proposal, I planed to remove the reed switch from the module and re-attach it with wires so that the reed switch could be placed in a hole drilled into the frame and sit just shy of the bolt went the lock was engaged. The bolt would have a thin magnet glued to it to provide the magnetic field to engage the reed switch.



Figure 1


Some drawbacks to the concept started to appear. The reed switch is made by Standex Meder Electronics and the EnOcean datasheet for the STM320U stated the part number as MK23-90-BV14496 [1] [2]. The reed switch can be seen in Figure 2. This datasheet is in German so I used the equivalent device MK23-90-D-1 datasheet for reference on the technical specs for the reed switch [3]. The reed switch measures 24.9 mm and has three contacts for the common connection, the normally open (NO), and normally closed (NC) switch connections. In the presence of a strong enough magnetic field, the NO contact closes and the NC contact opens. The long reed switch and its proper placement close to the engaged bolt with the wiring seemed complicated, and would require more modifications to the door frame than I would like. I also found a case where it would not be possible to place the reed switch close to the lock bolt as a wall was in the way. A new monitor method was devised and will be described below after some background on magnets and reed switches is provided.



Figure 2



The STM320U comes with a Neodymium magnet that is used the engage the reed switch. The Neodymium magnets are very cool and very powerful. The magnet is a rare-earth magnet that is composed of Nd2Fe14B and is also identified as NdFeB as a short hand. NDFeB has a tetragonal (prism shaped) crystalline structure as shown in Figure 3 [4].



Figure 3


Nd2Fe14B is brittle and prone to rust so it is usually coated with nickel-copper-nickel (Ni-Cu-Ni), nickel-copper-nickel-gold (Ni-Cu-Ni-Au), zinc, tin, copper, epoxy, silver, and gold depending on the application. Neodymium magnets come in different strength grades including N35, N38, N40, N42, N45, N48, N50, and N52. There are also temperature ratings, such as N (80°C) NM (100°C), NH (120°C), NSH (150°C), UH (180°C), and NEH (200°C) that indicate the maximum operating temperature. Even the low grade neodymium magnets are very strong and their brittleness requires care when working with them. Magnet safety should thus be always followed (eye protection, gloves) [5]. The magnet supplied with the STM-320U is a 6 mm x 19 mm cylindrical magnet (measured with a caliper) and the grade is likely N35 based on information provided by EnOcean technical support.


Electrons have a tiny magnetic field (magnetic moment). When a majority of the electrons in a material all spin in the same direction, then that material becomes magnetic. The direction that the magnetic field points is known as the magnetization direction. Figure 4 shows the direction of magnetization for a cylindrical magnet like the one supplied with the STM-320U and a button magnet. The north pole of magnet is located where the magnetic field exits or is pointing out, and the south pole of the magnet is located where the magnetic returns to the magnet (points into the magnet).



Figure 4


It is not always obvious where the north and south poles are located on a magnet as shown in Figure 5. The magnetization direction can be determined with a reference magnet that identifies its north pole with a dimple in the magnet or with a sensor. Sheets of magnetic field viewing film can be used to help identify the direction of magnetization of a magnet.



Figure 5


The field lines in Figures 4 and 5 were generated with a Mathematica demonstration program that allows the magnet size to be varied and the magnet grade (strength) to be adjusted [7]. It’s cool to explore different magnetic configuration and runs on the Mathematica on the Raspberry Pi.


Figure 6 shows the fields coming form the cylindrical magnet that came in the EnOcean kit using a magnet viewer. The poles are visible as dark areas. Magnetic particles are suspended in oil in the magnet viewing film. These particles are attracted to the poles of the magnet and darken the areas with the strongest fields. In figure 6 below, I show the field lines with the north at the top, but it may have been at the bottom so the field lines would be reversed (don’t recall which way the magnet was oriented for the photo).



Figure 6


Figure 7 shows a bar magnet with the magnetization direction through its thickness instead of through its length. In the bottom photo, the poles are visible as dark areas and the boundary between the north and south poles appears as light green line.


Figure 7


Reed Switch

A reed switch is a switch made from ferrous materials that is encapsulated in a hermetic glass envelop. The glass envelop keeps the contacts isolated from the environment like humidity, dust, and corrosion to provide high voltage isolation and good reliable electrical connections between the switch contacts. The switch contacts are coated with silver or gold to provide low contact resistance. An illustration of the reed switch used on the STM320U is shown in Figure 8 [8] [9] [10].


This reed switch is a Surface Mount Device (SMD) and has three terminals consisting of a common, Normally Open (NO), and Normally Closed (NC) leads. When the reed switch encounters a magnetic field with the proper magnetization direction and proper field strength, it will engage. The NO contact will close and the NC contact will open. This occurs because the ferrous materials in the reed switch become magnetized and act like magnets. The ends of the contacts become oppositely magnetized, which pushes the contacts together.



Figure 8


The regions where the reed switch will pull-in or close is a little more complex than shown above and is illustrated in Figure 9. This is a 2-D illustration and the pull-in and hold zones are actually 3-D. The 3-D zones can be imagined by mentally rotating the 2-D zone around the central axis of the reed switch. The hold zones are a bit larger than the pill-in zone and are regions where the reed switch will stay closed once closed but the magnetic field is not strong enough to close the reed switch at this distance initially.



Figure 9


The sensitivity of this reed switch is 20 to 25 ampere turns. The sensitivity is measured by placing the reed switch in a coil and applying a current to the coil. The number of turns is known from the coil and the current is increased until the reed switch activates. This current is measured and the Ampere Turns is calculated. This is the field strength needed to engage the reed switch. The manufacturer also specifies this field strength in mill-Teslas, which can be then converted to Gauss (10,000 Gauss =1 T). This corresponds to a field strength of 16 to 20 Gauss. Apparently, this measurement is not a standard and the details vary from vendor to vendor.



New Monitor Concept

The new concept consists of a plastic liner that is inserted into the bolt hole and a magnet spring and stabilizer assembly is inserted into the liner as shown in Figure 10. The plastic liner provides a smooth cylindrical guide for the magnet spring assembly when the bolt engages and disengages (when the lock is locked and unlocked). The foam magnet spring holds the magnets and compresses when the bolt engages, moving the magnets with in pull-in distance of the reed switch on the STM-320U. The foam magnet spring is smaller than the bolt liner so that when it is compressed by the bolt it has room to squish around. The foam stabilizer keeps the foam magnet spring centered in the liner and keeps it from rotating after repeated lock-unlock cycles. The STM-320U is placed in a small housing and stuck to the molding or wall so that the reed switch is in proximity and aligned with the magnet location and direction of magnetization in the locked position. The big improvement with this concept is that no modifications to door, lock, or door frame are required. The liner is inserted into the bolt hole along with the magnet spring, stabilizer, and magnets. The STM-320U is attached to the molding or wall and the monitor installation is complete.



Figure 10


Figure 11 shows the monitor components in the unlock position.



Figure 11


Figure 12 shows a more detailed view of the lock monitor magnet assembly and an early prototype. The foam cylinder holds the magnets vertically and acts as a spring when the bolt is engaged. The foam stabilizer keeps the magnets aligned vertically with each lock-unlock cycle. A plastic shampoo bottle modified by cutting off the top cap threads and was used to make the bolt liner. The outside diameter of the bottle/bolt liner was about 26 mm. The foam magnet spring was made from some Frost King Poly Foam Caulk Saver and it is 5/8 in diameter (~16 mm). The foam magnet spring stabilizer was made from some Frost King vinyl foam weather seal (not show below on the prototype). Scotch tape was used to hold the weather seal in place on the foam magnet spring. Double stick tape was placed in the foam magnet spring stabilizer to keep it stuck to the bolt hole liner (bottle).



Figure 12


The foam magnet spring was cut to match the depth of the bolt hole with the liner installed. The magnet was placed at about half the bolt length from the front edge of the foam magnet spring. Figure 13 shows the measurements of the first prototype with the magnet supplied with the STM-320U.



Figure 13


The supplied magnet was not strong enough to engage the reed switch for the door lock and frame I choose to work with so a second prototype was made using two sets of 8 mm by 3 mm neodymium magnets (grade N35). The position of the two sets could have been closer to the front. It was very difficult to get them in place without sticking together. Kapton tape was used to hold them in place. These magnets were not strong enough to engage the reed switch either for my door frame geometry.



Figure 14


STM-320U Housing

I could not find a small box or housing for the STM-320 so I made a temporary one by cutting some connector tubing to the length of the STM-320U Printed Circuit Board (PCB). The tubing is still a little big, so I used some ESD foam to hold it in place. The tubing is clear enough to allow the STM-320U to charge and I used double stick tape to place it on molding and walls during my tests.



Figure 15


Reed Switch Tests

The pull-in distance of the foam magnet springs was tested to see how well they worked. The STM-320U was placed in the housing so the reed switch was down near the paper and placed on the center lines of my hand drawn scale. The number on the vertical scale represent length in cm. I used the FHEM server running on the Raspberry Pi (RPi) and viewed on my phone with a browser to monitor the state of the reed switch. The magnet was aligned to be parallel to the reed switch and moved up and down my scale to determine the pull-in distance. The top part of Figure 16 shows the reed switch is still open at about 2.2 cm and the bottom part shows that it closes at round 2 cm (20 mm). The pull-in distance is the same if the magnet is oriented N-S or S-N.



Figure 16


The same test was repeated with the double magnet foam magnet spring as shown in Figure 17. The reed switch is open at around 3.5 cm and close around 3 cm.



Figure 17


Figure 18 shows a compression test of the foam magnet spring with the bolt liner before the bolt liner was inserted into the bolt hole. The length of the bolt can be seen against the molding as well as the location and alignment of the STM-320U.



Figure 18


Figure 19 shows a test of the lock detection after the bolt liner, foam magnet spring, and magnets were inserted. The STM-320U had to placed on the molding close to the magnets in the unlock position. The reed switch would close. When the bolt was engaged, the magnets moved away from the reed switch and would open. This configuration would work repeatedly, but I did not like that the idea that reed switch open meant locked. This condition seemed like it could result in a false positive indication (i.e., indicate a lock when it wasn’t locked).



Figure 19


Another foam magnet spring was made using seven 12 mm by 3 mm neodymium button magnets. To keep the foam magnet assembly from spinning around, the foam magnet spring stabilizer was added, as shown in the top part of Figure 20. The foam magnet spring was a little too stiff so I used a small screw driver to punch holes in the foam to reduce the spring force. The assembly can be seen in the bolt hole along with the new location of the STM-320U in the bottom part of the figure.



Figure 20


With this configuration, when the bolt is not engaged the reed switch reports open. When the bolt is engage, the reed switch reports locked as shown in Figure 21.



Figure 21



The bolt liner and magnet spring assembly seems to work pretty well for this prototype. It’s simple, cheap to make, and it is adaptable to many different non-metal door-frame configurations. It also requires little or no modification to the door or door frame.




[1] EnOcean Scavenger Transmitter Module user manual STM 320 / STM 320C / STM 320U June 21, 2013 V1.1

[2] Standex Meder Electronics, MK23-90-BV14496 Reed Switch Datasheet (German)

[3] Standex Meder Electronics, MK23-90-D-1 Form C Changeover Reed Switch Datasheet (English)

[4] Wikipedia, Neodymium magnets

[5] K & J Magnetics, Neodymium Magnet safety

[6] K & J Magnetics, Magnetization Direction for Neodymium Magnets

[7] Wolfram.com, Magnetic Field of a Cylindrical Bar Magnet

[8] Standex Meder Electronics, How a reed switch works

[9] Standex Meder Electronics, Reed Switch used with Permanent Magnet

[10] Standex Meder Electronics, Switching Solutions Requiring Little or No Power to Operate Using Reed Sensor/Relay Technology