I am trying to add wheel encoders to my rover.
I first tried hall sensors on the bell of the brushless outrunners. After a bit of trial and error, I found the correct position for the second sensor and the encoder worked perfectly with an arduino sketch I found.
Readings were consistent over multiple revolutions and back.
I then setup Ardurover to use the sensors, connected them and rebootet the pixhawk.
All I got were erratic rpm1 readings. I turned the wheel by hand and with throttle. The readings jump from positive to negative
without any obvious relation to the actual movement of the wheel.
I also tried to add pullup or pulldown resistors to the signal line. With a pullup I get no readings anymore and a pulldown does not change anything. I also tried optical sensors with a encoder track glued to the motor bell. Same result. I can upload a log if needed.
I have connected the outputs of the hall sensors and later the photo transistors to the pins mentioned in the wiki and did the ardurover setup. I also used ground and VCC from those connectors. While I can not be sure that the alignment of the hall sensors was 100% accurate, the photo transistors should be close. I printed the encoder track using geogebra. It has two rows of black and white fields, with 50% offset. The phototransistors are mounted side by side.
As I mentioned, the Arduino has no problem decoding the signals. 20 turns, 30 turns and it reports the same position each time.
Best would be checking with a scope or a digital probe making sure you have 90 degree phases overlap.
Looking at the PixHawk interface, You shoud used pull up resistors to VCC (3,3 Volts)
Ah. I put the pullup to 5V. I will test again tomorrow.
Thank you for your help @ppoirier! I totally forgot about the 3.3V signal level of the pixhawk.
Another question: Where can I get 3.3V from the Pixhawk? All VCC pins are 5V, or am I wrong? Would it work if I put the pullup to 5V and then run the signal line through a level shifter? Or by putting a resistor in the signal line, to bring the voltage down?
I am really embarrassed right now. I apologize for wasting your time @ppoirier. My conclusion is, if your not able to count properly, do not mess with electronics…
I connected one of the sensors to Main Out 1 instead of AUX6 all the time. What is even more embarrassing is, I thought it looks like it was reading only one sensor, but only now I looked at the connectors again.
Now it is working, no external pullup is needed.
Thank´s for your help and your time!
Cool , glad it works
Dont worry, it happens to all of us