I am working on a project for knowing the position of a DC motor which has a hall sensor built into it. I am a newbie into programming using the Arduino Uno R3. After some forum search and self checks, I cannot pass this hurdle. I hope I can frame the questions properly here.
My Problem: The DC motor hall sensor sends out 2 high pulse of 11.3V - 13V with a duration of 2.8ms for each revolution. My Arduino interrupt pin doesn't read the high pulse as it gives me "0" count after motor spin (I run 50 loops and results remain the same).
On my breadboard, I use a voltage divider to reduce hall-effect ouput from max 13V to 5V so that the Arduino pin 2 can read rising voltage when it jumps to 5V (low should be 2.5V).
Couple of things I noted during the motor spin -
a) The millis()
function returns 79-81ms per sketch run
b) The same hall sensor output if connected to analog pin reads 580,590,590,1001, 1012, 580, 580.. etc. I cannot gauge position of the motor by using these values as they are inconsistent on the way up Vs. way down.
I have attached analog readings while going up and down in snap shot below: 2 questions I have:
- Why is the pin 2 not detecting a high pulse? will it not be able to read 2.8ms durations because of motor speed (9.5 rev/s or 570rpm)?
- Is it possible to gauge anything from Analog read function? Am I missing something?
Thanks in advance for all responses.. Any questions regarding the circuit, I will be more than happy to post them.
pulses
is defined. Copy/paste it into your question, don't take a screenshot of it. You can format it by selecting it and pressing Ctrl+K.