I am trying to design a setup that can determine to position of a rotating shaft.
I initially went with using a fixed disc with 8 reed switches and a magnet attached another disc that rotates with the shaft. Well the principle is there but I keep getting erroneous things happening like multiple reed switches being triggered at the same time due to the magnetic field, some time just 1 reed switch, or 2 or 4 or 4 or sometime not at all or 2 reeds switches being trigger but on different sides of the disc. It's all intermittent therefore not reliable.
I thought I could use a continuous potentiometer but they are quite expensive and some rotate 360 degrees but only measure over 340 degrees of the 360 degrees.
I tried an encoder which works great and measuring rotation but on startup there is no way to set the initial "top" position unless I use an absolute encoder but again quite expensive for my simple needs.
I wondered if there is a way to rotate the shaft on start up and use a optical sensor to measure when the shaft is in the "top" position but attaching a motor to the shaft would be a bit difficult.
Does anyone have any ideas that will work to make the reed switches be more reliable (I have tried several different strength magnets which don't work any better) or another way to measure to position of a rotating shaft?
Along with the encoder put 1 reed switch (or better yet a Hall effect or opto sensor ) at the starting position. A 1 bit absolute encoder, so to speak. Like a limit switch. Many encoders are made with the 2 quadrature outputs and 1 other output that shows "zero".
How did you have your switches wired, did you have pullup or pulldown resistors to take care of the open circuit condition of the switch?
How many positions in one revolution you want to measure?
You can set initial position with a single extra channel, that only signals on a separate magnet on the disc, trying to keep that magnet away from influencing the other Hall Effect and vice versa may be a challenge.
Hi the shaft is attached to what will be a larger weather vane.
The shaft "top" position will be North.
I have followed previously several threads on creating the magnetic reed switch setup.
My first setup was with the reed switches like spokes off the centre but virtually every reed switch trigger when ever a magnetic appeared nearby.
I then tried my current version with the reed switches around the circumference. (See photo)
The current wiring is just each reed switch connected to 5v and to a LED bargraph so I can see which reed switches are being trigged when a magnetic moves by. As you can see in the current picture
When my smallest magnetic is in proximity the NE and E led is lit. However sometimes I can have 4 led lit which is causing me the trouble. I have tried the magnetic in various positions and orientations none really seem ideal.
Nothing is actually connected to an Arduino yet as I am still trying to get this bit working.
I did try the weather vane tutorials which connect different resistors to each reed switch then read off the value from the ADC to work out direction but with the extra reed switches all triggering it gave the wrong info, hence my need to try and work out the positioning better.
The actual orientation of the reed switches I found to be best was when looking from above you can see the gap between the 2 strips with the top strip facing out towards the circumference.
I tried using a ADC and various resistors to determine the voltage to determine shaft orientation but that was too problematic so I decided to use a digital pin for each reed switch on a Mega.
Visualize the magnetic field of your magnet. It has two poles. The magnetic field is North and South. You can easily determine the pole orientation of your magnet. The reed switches and the magnetic field must be parallel for best operation of the reed switches. The magnetic field will temporarily magnetize the reeds and make them snap together.
If your reed switches have ONLY a single reed. Toss them and get switches with TWO reeds.
I have a weather vane which has 8 reed switches arranged like the spokes of a wheel, so each one 45 degrees from its neighbour. When the magnet is over one then just the one closes, when it is between 2 then both close, giving 16 positions. There are different value resistors in series with each switch so each closed switch or combination of 2 closed switches gives a different resistance.