I am mystified by a problem with a quadrature encoder on a DC motor. The quadrature encoder and motor are connected to an Arduino. I get reasonable speed readings when the motor runs forwards (although a few backward moves are detected. When the motor runs backwards the readings still show mostly forward motion. I have an identical motor which works perfectly, so this can't be a software issue.
On an oscilloscope the problem becomes clearer - the q1 and q2 channels are almost exact inverses of each other. As a result both channels transition at almost exactly the same time and maybe a little jitter has a big effect. Both channels show sharp, clear square waves. Since they are inverses there can be no short circuit between the channels.
It would appear that both Hall sensors are working. I turned the magnetic wheel by hand and saw that the channels do indeed switch in anti-phase.
I tried switching the Hall sensors manually by holding a neodymium magnet by each one. I found either channel could be switched independently from low to high by a magnet held behind it (so the channels are not connected via an inverter). However I found that if I used the North pole of the neodymium magnet I could switch q1 by placing the magnet behind its sensor, but q2 would not change state when the North pole was held behind its sensor. If I used the South pole of the neodymium magnet the reverse was true - I could cause q2 to switch but not q1.
So what is going wrong here ? Could the sensors be inserted the wrong way round ? Could the magnetic wheel have its poles organised incorrectly. The failure mode seems bizarre.
The sensor documentation claims 11 signals per motor rotation (I guess that means 6 poles around the magnetic wheel). It came with this motor:
Motor link
On an oscilloscope the problem becomes clearer - the q1 and q2 channels are almost exact inverses of each other. As a result both channels transition at almost exactly the same time and maybe a little jitter has a big effect. Both channels show sharp, clear square waves. Since they are inverses there can be no short circuit between the channels.
It would appear that both Hall sensors are working. I turned the magnetic wheel by hand and saw that the channels do indeed switch in anti-phase.
I tried switching the Hall sensors manually by holding a neodymium magnet by each one. I found either channel could be switched independently from low to high by a magnet held behind it (so the channels are not connected via an inverter). However I found that if I used the North pole of the neodymium magnet I could switch q1 by placing the magnet behind its sensor, but q2 would not change state when the North pole was held behind its sensor. If I used the South pole of the neodymium magnet the reverse was true - I could cause q2 to switch but not q1.
So what is going wrong here ? Could the sensors be inserted the wrong way round ? Could the magnetic wheel have its poles organised incorrectly. The failure mode seems bizarre.
The sensor documentation claims 11 signals per motor rotation (I guess that means 6 poles around the magnetic wheel). It came with this motor:
Motor link