Treadmill Speed Control Project - Arduino + Digital Pot + Hall Sensor

My cheap treadmill has very inaccurate speed control - it slows down significantly under load (30-40% off target speed). Unlike expensive treadmills that use closed-loop feedback to maintain precise speed regardless of load, mine just applies a fixed voltage and hopes for the best.

I would like to replace the original controller entirely with a Keya 115/230DR10AL-02 motor controller and Arduino-based feedback system:

  • Hall effect sensor (A3144) mounted on frame to detect magnet on roller for actual belt speed measurement
  • Digital potentiometer (MCP4151) to interface cleanly with the new Keya controller's potentiometer inputs
  • PID control loop in Arduino to maintain target speed under varying load

Future Additions:

  • Remote control for speed adjustment, on/off, maybe some preset buttons (specific suggestions welcome - RF probably easiest?)
  • LED display interface - I need to figure out how to communicate with existing treadmill display

The Setup:

  • New Keya controller replaces old one completely (has S1/S2/S3 potentiometer inputs)
  • Small neodymium magnet glued to roller end
  • Hall sensor mounted on frame ~5-10mm from roller (6+ inches away from motor for EMI protection)
  • Arduino reads hall sensor pulses to calculate actual speed
  • Arduino adjusts digital pot via SPI to maintain target speed
  • Mean Well isolated 5V supply powers all low-voltage components

Wiring Diagram:

I apologize for my limited schematic experience (had to use Fritzing) - I've color-coded to make it easier to follow:

  • Red: 230V Live + 5V positive power
  • Blue: 230V Neutral
  • Black: All grounds
  • Orange: Arduino SPI signals to MCP4151
  • Yellow: MCP4151 pot outputs to Keya controller
  • Purple: Hall Sensor out pin

(Note: Earth/safety ground connections to treadmill frame omitted from diagram for clarity but will be properly implemented)

Questions:

  1. Does this approach make sense for closed-loop treadmill speed control?
  2. Any concerns with the digital potentiometer interfacing to the Keya controller?
  3. Hall sensor placement - any EMI considerations being ~6 inches from the 180V DC motor?
  4. Remote control suggestions for setting target speed, on/off, other buttons?
  5. Any obvious wiring mistakes or safety issues I should address?

This is my first Arduino motor control project, so I'd greatly appreciate any feedback or suggestions for improvement. Thanks in advance for taking the time to review!


Components: Arduino Uno, MCP4151 digital pot, A3144 hall sensor, Mean Well IRM-05-5 isolated PSU, Keya 115/230DR10AL-02 motor controller, fuses

I can't give you any guidance with this project because I haven't done anything like this. I would just recommend that you consider whether it wouldn't be better to remove the potentiometer and control the speed using PWM and a suitable RC group to get an analog voltage from 0 to 5 volts.

1 Like

Ah yes, I was wondering about that. Much simpler route for sure. As long as that direct interface will not hurt the Arduino, but the other is also a direct interface so... It will probably be fine :slight_smile:

I don't know anything about treadmills.

How do you know it is 30-40% off target speed?

Is the motor a common motor found in the expensive treadmills? Is it strong enough to keep up with the load? By load do you mean speed, weight of the person on it, or all of the above? I imagine heavier folks would put more friction on the walking/running belt, thus needing more power at the motor to maintain speed.

Years ago, I did disassemble a cheap one that had a hand crank to change the speed. The motor was a single speed motor and the crank was connected to something like a CVT. It was basically a pulley that could separate each half narrower or closer, changing where the drive belt rides in the drive pulley.

But like I said, I don't know about treadmills. I am just asking.

Yes, all of the above! I have multiple treadmills, and the most expensive one (and all or most of the expensive ones) have a reed or hall sensor to adjust the speed just like I am proposing here. But with their own boards and logic of course.

The reason I know it is off is because I have filmed it and estimated the speed of the belt by using frame rate and travel distance of a marker. The expensive treadmill is dead on. One of our newer cheap ones is s bit off, but the one I am using as a "daily walker" so to speak is off by much more.

Granted, the main reason for it being off by so much has to be that it has overheated a few times and the motor magnets are probably not what they once were. I might change the motor some day too. I've already started to modify this treadmill with cooling and everything, so I just thought this would be a cool project.

I walk while I work on the computer, and I have made a tracking web app too. Just to track my sessions and send them to Garmin. But with an Arduino in place I could even control the treadmill directly from my web app.

None of this is really needed just to be active while working, but it's a really fun challenge and I want to see if I can make it happen!

My question would be whether that motor controller is mains isolated - if not the potentiometer could be at mains potential.

Have you checked the motor current to make sure it's not being overloaded and just won't go any faster?

I will check with the supplier, thanks for bringing that up!

Yes, it definitively goes faster. It's just that these boards are calibrated once for what voltage gives what belt speed with the motor during that production cycle at the factory. I would not be surprised if they do it with the belt unloaded and only for one of the motors in the entire cycle (since they use the same motor type for all of them).

But it’s not far fetched to think that motors vary and that they should either calibrate each treadmill separately under an average load, or have this type of sensor to adjust the speed constantly like the more expensive ones.

Big caveat: The above is just my assumptions.

I've updated my schematic based on some additional research.

Key Changes:

  1. Added Safety Relay Circuit - I've added an optoisolated safety relay that cuts motor power if the Arduino fails in any way (crash, hang, power loss). The relay is normally-closed on the motor controller's inhibit input, so any Arduino failure immediately stops the motor. Safety independent of software.

  2. Confirmed Controller Isolation - Supplier confirmed the Keya 115/230DR10AL-02 has proper galvanic isolation between control (S1/S2/S3) and motor power circuits. Control ground (S1) is isolated from motor negative. They also said direct PWM is not suitable for the pure positive/negative input control, and it must be an analog voltage.

  3. I chose a digital pot over PWM - While both approaches would work electrically, I went with the MCP4151 digital pot for several reasons.

I was uncertain about PWM:

  • EMI concerns in a 180V brushed motor environment - PWM lines can pick up or radiate noise, though my lines will be pretty short.

  • Arduino's default 490Hz PWM is quite low, requiring heavy filtering to get clean analog (or at least that is my understanding, i might be wrong?)

  • Even at 31kHz, getting proper ripple attenuation needs multi-stage filtering or op-amp buffering (or does it, not quite clear to me but adds complexity)

Digital pot advantages:

  • Clean, stable analog output (no PWM ripple to filter out)

  • Simpler filtering requirements - no need for multi-stage RC networks or op-amp buffers

  • Behaves exactly like the original potentiometer (resistive divider characteristics)

  • Less analog design complexity compared to getting PWM filtering right

Digital pot trade-offs:

  • SPI wiring needs care in high-EMI environment (short runs, twisted pair)

  • Slightly more complex code (SPI communication vs. simple analogWrite)

But I thought that rather than trying to design proper PWM filtering for a 180V motor environment, the digital pot gives me a known-good analog signal that matches the original potentiometer behavior. Perhaps the simpler analog output is worth the slightly more complex digital control.

The extra complexity of SPI vs PWM seemed worth it for the cleaner signal and better noise immunity. Plus having hardware safety gives me much more confidence in the whole system.

Still working on component sourcing, but the design feels much more robust now.

Let me know if I've missed anything or gotten something wrong!

Odd that they specified a 2W 10K pot. Makes me wonder if the voltage is 5V as you have indicated.

Well, they are adamant in their answers to me that it’s a 0 - 5V range between those terminals so… I guess I’ll just have to order and measure!