Hi all,
I am currently trying to use a Maxon motor with a built-in hall sensor to output its current RPM to my Arduino system.
Unfortunately, when I attempt to output the sensor data, it does not appear to be working.
I have the sensor output wire connected to a PWM pin, and I am using analogRead to try and real the values and print to a serial monitor.
this hasn't worked. The serial monitor reads values but its something like 3500 and doesn't change, even when the motor speed changes or the motor turns off. Even when the motor is off the monitor is still outputting the same value (as refreshed values, the values change with +-50 rpm even though the motor dropped something like 2000 rpm or was turned off).
This is a 5-wire maxon ec45 flat motor for reference.
I agree with @Railroader, that makes no sense. PWM and analogRead are completely different. PWM is an output. AnalogRead does not work on PWM (digital) pins.
Post a data sheet or link to a data sheet for the motor.
It may be that the sensor output is open collector (drain) so needs a pullup resistor to work. You can use an external pullup (10K or so) or enable the internal pullup. You can use internal pullup on an analog input if it is indeed analog output.
In setup() put:
pinMode(Ax, INPUT_PULLUP);
to enable the internal pullup on pin x.
But the Hall effect sensor on a motor is more likely to be a Hall effect switch so reading with a digital input pin (digitalRead) that is set to enable the internal pullup is more appropriate.