5862 views|19 replies

7

Posts

0

Resources
The OP
 

How to connect the reed switch sensor to the microcontroller [Copy link]

 
Microcontroller meter reading problem, water meter and gas meter use reed switch sensor, how to transmit the signal to the microcontroller? What type of signal? How should the meter output pulse?
This post is from 51mcu

Latest reply

For a single excitation, the closing and opening process of the reed will oscillate. On the waveform, the corresponding closing and opening edges are sawtooth-shaped.  Details Published on 2019-2-26 16:20
 

9702

Posts

24

Resources
2
 
The reed switch is equivalent to a switch or button. One end is connected to the power or ground, and the other end is connected to the gpio. External or internal pull-up and pull-down resistors
This post is from 51mcu

赞赏

1

查看全部赞赏

 
 
 

7

Posts

0

Resources
3
 
littleshrimp posted on 2019-2-23 21:41 The reed switch is equivalent to a switch or button. One end is connected to the power or ground, and the other end is connected to the gpio. External or internal pull-up and pull-down resistors
I just learned about microcontrollers. What is gpio? Can the reed switch be directly connected to the I\O port of the microcontroller? Do I need shaping and filtering?
This post is from 51mcu

Comments

Just treat it as a button.  Details Published on 2019-2-26 10:11
Just treat it as a button.  Details Published on 2019-2-23 22:08
 
 
 

9702

Posts

24

Resources
4
 
ccclllc'z'c posted on 2019-2-23 21:54 I just started to learn microcontrollers. What is gpio? Can the reed switch be directly connected to the I\O port of the microcontroller? Does it need shaping and filtering?
You can just treat it as a button.
This post is from 51mcu
 
 
 

7

Posts

0

Resources
5
 
Is shaping filtering required?
This post is from 51mcu
 
 
 

7

Posts

0

Resources
6
 
littleshrimp posted on 2019-2-23 22:08 You can just treat it as a button
How does the meter output pulses? Is there a special pulse output port?

1.gif (37.9 KB, downloads: 0)

1.gif
This post is from 51mcu

Comments

I checked online and found that reed switches are used for flow statistics. Timers are needed for meter reading and communication. You should also look at the specific meter model if you are not the designer of the meter.  Details Published on 2019-2-24 07:11
 
 
 

9702

Posts

24

Resources
7
 
ccclllc'z'c posted on 2019-2-23 22:14 How does the meter output pulses? Is there a special pulse output port?
I checked online and found that reed switches are used for flow statistics. Timers are needed for meter reading communication. You should also look at the specific meter model if you are not the designer of the meter.
This post is from 51mcu
 
 
 

2865

Posts

4

Resources
8
 
I have heard of and seen reed switches, but I don't know what this "reed switch sensor" you mentioned is. Reed switches are used in machinery to make magnetic switches. Can you give me more details?
This post is from 51mcu
 
 
 

2w

Posts

341

Resources
9
 
In 51 programming, the connection method of the reed switch is the same as that of the button. If the button program can be used, the reed switch can also be used
This post is from 51mcu
 
 
 

1w

Posts

16

Resources
10
 
The reed switch is a switch. Let's think about how to connect the switch to the microcontroller.
This post is from 51mcu
 
Personal signaturehttp://shop34182318.taobao.com/
https://shop436095304.taobao.com/?spm=a230r.7195193.1997079397.37.69fe60dfT705yr
 
 

1w

Posts

142

Resources
11
 
The reed switch contact is a pure mechanical switch, which is used exactly the same as the push button switch and can be directly connected to the IO. It is best to connect one end to the ground and the other end to the IO, and then add a pull-up resistor to the power supply. The software processing should add anti-shake delay.
This post is from 51mcu

赞赏

1

查看全部赞赏

 
Personal signature上传了一些书籍资料,也许有你想要的:http://download.eeworld.com.cn/user/chunyang
 
 

7

Posts

0

Resources
12
 
chunyang posted on 2019-2-24 15:19 The reed switch contact is a pure mechanical switch, which is used exactly the same as a push button switch and can be directly connected to IO. It is best to connect one end to the ground and one end to the IO, and then to the power supply...
What kind of pulse does the reed switch transmit?
This post is from 51mcu

Comments

You can refer to the waveform of key jitter [attachimg]403393[/attachimg]  Details Published on 2019-2-26 10:15
 
 
 

7

Posts

0

Resources
13
 
bigbat posted on 2019-2-24 08:38 I have heard of and seen reed switches, but I don't know what this "reed switch sensor" you mentioned is. Reed switches are used in machinery to make magnetic switches...
I want to use a microcontroller to read three meters, but I don't know what sensor can get the pulses of the three meters.
This post is from 51mcu
 
 
 

6366

Posts

4936

Resources
14
 
It has been made very clear before that the reed switch is equivalent to a push switch. The push switch will jitter when it is pressed and released, and the reed switch will also jitter, so it needs to be de-jittered. When used in three-meter meter reading, the reed switch and the magnet are usually used in pairs (of course, this is an early three-meter pulse detection method, and now there are more sampling methods.) Generally, a magnet is added to a certain position on the mechanical counting wheel of the three-meter, and then a reed switch is installed at the bottom of the counting wheel. When the counting wheel rotates, the reed switch is attracted by the magnet once for each rotation. One end of the reed switch is grounded, and the other end can be connected to VCC through a resistor. The end of the resistor connected to the ground is connected to the microcontroller port (that is, GPIO).
This post is from 51mcu
 
 
 

6366

Posts

4936

Resources
15
 
I forgot to mention the debouncing of the reed switch. As for the debouncing of the reed switch, a timer can be used to debouncing. If the timer is set to 1 second, then the number of seconds for which the reed switch is continuously closed can be detected to be considered as a confirmed closing, which can be used as a counting pulse. Of course, there are many details to be considered in the specific implementation.
This post is from 51mcu
 
 
 

869

Posts

0

Resources
16
 
I'm just passing by to buy soy sauce
This post is from 51mcu
 
 
 

6366

Posts

4936

Resources
17
 
ccclllc'z'c posted on 2019-2-23 21:54 I just learned about microcontrollers, and I want to ask what gpio is? Can the reed switch be directly connected to the I\O port of the microcontroller? Do I need shaping and filtering?
gpio means general purpose I/O port, which is the input and output port of the microcontroller. The reed switch can be directly connected to the I/O port of the microcontroller, and it needs to be debounced, or it can be debounced using software
This post is from 51mcu
 
 
 

6366

Posts

4936

Resources
18
 
ccclllc'z'c posted on 2019-2-25 10:07 What kind of pulse is transmitted by the reed switch?
You can refer to the waveform of key jitter
This post is from 51mcu
 
 
 

1w

Posts

142

Resources
19
 
ccclllc'z'c posted on 2019-2-25 10:07 What kind of pulse does the reed switch send out?
For a single excitation, the closing and opening process of the reed will oscillate. On the waveform, the corresponding closing and opening edges are sawtooth-shaped.
This post is from 51mcu
 
Personal signature上传了一些书籍资料,也许有你想要的:http://download.eeworld.com.cn/user/chunyang
 
 

7

Posts

0

Resources
20
 
tiankai001 posted on 2019-2-26 10:15 You can refer to the waveform of key jitter
Thanks, big guy
This post is from 51mcu
 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list