Is current limiting needed on reed switch freq measurment between pin + ground?

I plan to use the freqmeasure library to count how often a reed switch pulses. The circuit would be pin 13 I think it is on a Micro to the reed switch then to ground. Is a resistor required to limit the current or is it limited internally by the Arduino when used this way?

Before anyone asks why I don't use a hall effect sensor etc, this reed switch is a standard BMW part in the rear differential used to measure speed. I'm curious to find out if I have any debouncing issues with it. My hope is that there is some sort of debouncing built in to the unit or it is some sort of very high quality switch.

xr287:
I plan to use the freqmeasure library to count how often a reed switch pulses. The circuit would be pin 13 I think it is on a Micro to the reed switch then to ground. Is a resistor required to limit the current or is it limited internally by the Arduino when used this way?

Before anyone asks why I don't use a hall effect sensor etc, this reed switch is a standard BMW part in the rear differential used to measure speed. I'm curious to find out if I have any debouncing issues with it. My hope is that there is some sort of debouncing built in to the unit or it is some sort of very high quality switch.

Just define your pin this way to enable the built in pull up resistor:

pinMode(2, INPUT_PULLUP); // pin is LOW when anemometer switch is closed

This from a program of mine. If you are using pin 13, then change "2" to "13". One side of the reed switch to the pin, other side to ground. Grounds must all be connected together.

Also, it the magnet that closes the reed switch is a bar magnet and is parallel to the reed switch, it cannot bounce. The magnetic field will close it and hold it closed.

BMW probably built it correctly!

Paul

Thanks Paul. The housing is opaque so I cannot see the details of the switch or magnet inside it but it is a U shape with switch on one side and magnet on the other and a 9 bladed reluctor ring passes through the middle of the U to open the switch on each pass. I think it is likely that this switch cannot bounce then as the magnet will be parallel to it.

xr287:
Thanks Paul. The housing is opaque so I cannot see the details of the switch or magnet inside it but it is a U shape with switch on one side and magnet on the other and a 9 bladed reluctor ring passes through the middle of the U to open the switch on each pass. I think it is likely that this switch cannot bounce then as the magnet will be parallel to it.

While reed relays have a long life time, they do fatigue and wear out. That sort of surprises me that BMW would net use a fully electronic device. Are you positive it is s reed switch?

Paul

Paul_KD7HB:
While reed relays have a long life time, they do fatigue and wear out. That sort of surprises me that BMW would net use a fully electronic device. Are you positive it is s reed switch?

Paul

Pretty sure, I have the official BMW wiring diagrams for my model from the year before, year it is and year after and all show it as the same symbol and one actually calls it a reed switch. See my attachments.

reed2.PNG

Also, it the magnet that closes the reed switch is a bar magnet and is parallel to the reed switch, it cannot bounce. The magnetic field will close it and hold it closed.

Can you explain more about this? In my experience a reed switch is a mechanical device and is subject to bounce.

xr287:
Pretty sure, I have the official BMW wiring diagrams for my model from the year before, year it is and year after and all show it as the same symbol and one actually calls it a reed switch. See my attachments.

Sure looks that way. Are you intending to not use the BMW wiring to it's computer? Or are you going to piggy-back onto the current wiring?

Now, either way, your program must allow for the cases where the car/differential is stopped and the reed switch is constantly on, or is constantly off. Just programming!

Paul

cattledog:
Can you explain more about this? In my experience a reed switch is a mechanical device and is subject to bounce.

Sure. The bar magnet field is parallel to the switch "reeds". The magnetic field, N and S, flow through the reeds and the N and S being only a few thousands of an inch apart are attracted to each other with a very large force that gets stronger the closer the reeds move together.

Where people error is when they do not use a bar magnet or it is not parallel to the reeds. There the magnetic field will not follow the reeds until really too late for them to begin to move and there is not enough N-S attraction to hold them closed.

Paul

Paul_KD7HB:
Sure looks that way. Are you intending to not use the BMW wiring to it’s computer? Or are you going to piggy-back onto the current wiring?

Now, either way, your program must allow for the cases where the car/differential is stopped and the reed switch is constantly on, or is constantly off. Just programming!

Paul

I am tying in to the loom at the point it would have plugged in to the instrument cluster as the original instrument display has been removed. It’s a racing car with all sensors going to a Nextion used as a dash display.

I have read a little about dealing with receiving zero counts and switching the output to zero in software when you exceed x seconds without any new readings and have seen some examples. I’m first going to try it without to see what happens. My assumption is that as you are coming to a stop the value will get down very low probably <5mph and then freeze. As it is a racing car this isn’t really of concern to me, you won’t often even look at the mph display it is mainly for reference just not to exceed the pit lane speed limit so it will kick in to action again when moving and do the job I need it to do.

xr287:
I am tying in to the loom at the point it would have plugged in to the instrument cluster as the original instrument display has been removed. It’s a racing car with all sensors going to a Nextion used as a dash display.

I have read a little about dealing with receiving zero counts and switching the output to zero in software when you exceed x seconds without any new readings and have seen some examples. I’m first going to try it without to see what happens. My assumption is that as you are coming to a stop the value will get down very low probably <5mph and then freeze. As it is a racing car this isn’t really of concern to me, you won’t often even look at the mph display it is mainly for reference just not to exceed the pit lane speed limit so it will kick in to action again when moving and do the job I need it to do.

I think you are well on your way to success. The speed shown may be zero, but the car may still be moving rapidly if the brakes are locked up or the car is skidding sideways, but for what you are looking for, that won’t matter.
Good luck.

Paul

Just to update I got this coded and wired up today and it works perfectly. Based on the number of times the switch should pulse per revolution the maths all works out just about spot on for mph. BMW obviously have their reed switch sussed!

Response time to speed change is a little slower than I would like, have yet to play with it but I think this can just be adjusted by changing the value of the "count" variable in the freqmeasure library so it takes less samples before averaging the result.