0
\$\begingroup\$

I have a rather weird problem that makes it necessary to sense the four wires off of a bipolar stepper motor(A-,A+,B-,B+) and translate them back into the pins that controlled the stepper motor driver (clk,dir,step).

Block diagram describing possible implementation of solution.

First i'll outline what I've tried:

  1. mcp3008 ADC - This guy burned out right away. (I'm assuming because the stepper motor drivers for a nema17 output roughly 1.2amps per coil).
  2. Looked for higher spec ADCs but I'm somewhat lost.

Questions:

  1. Is there a better way to do this than using an ADC into a microcontroller?
  2. What sampling rate would I need to "sense" the stepper motor drivers micro stepping and translate them back/ how to calculate this?
  3. what ADC resolution would be acceptable/ how to calculate this? ex. 12bit, 16bit...
  4. What voltage would be "safe" (I know a nema17 is approx 4V, but I'm worried that another stepper will be higher).
  5. What ADCs are available that meet these spec? (above and below).
    • SPI or I2C
    • atleast 4 channels or (I can get four 1 channel ADCs).
    • through hole component package.

Thank you anyone who responds to all or either of my questions! This is my first post so I hope I was clear enough.

\$\endgroup\$
2
  • \$\begingroup\$ Do you even need an ADC? Aren't these just square waves where you want to measure the timing and phase? \$\endgroup\$ Commented Dec 22, 2020 at 14:51
  • \$\begingroup\$ Yes you are correct, they are pretty much square waves and I'm not sure if I have to use an ADC. I guess the reason I had it is cause I'm worried about steppers that microstep. What would you suggest instead though? \$\endgroup\$
    – m slez
    Commented Dec 22, 2020 at 14:55

2 Answers 2

2
\$\begingroup\$

I would use optocouplers. You will need to calculate the values of R1 and R2 to get reasonable currents.

You will need to convert the PWM signals using software.

If you can turn off the microstepping, it will be easier.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
5
  • \$\begingroup\$ This is definitely a great start for me, I'll look into optocouplers more. Unfortunately, I can't turn off the microstepping function. Would the circuit change much if I have to microstep? Thank you very much for the response! \$\endgroup\$
    – m slez
    Commented Dec 22, 2020 at 15:37
  • \$\begingroup\$ The circuit can be the same for microstepping, but the S/W will be more complicated. \$\endgroup\$
    – Mattman944
    Commented Dec 22, 2020 at 15:51
  • \$\begingroup\$ Ya, i image its gonna be terrible if its 1/256 microstepping. Thank you again, you've been incredibly helpful! \$\endgroup\$
    – m slez
    Commented Dec 22, 2020 at 16:01
  • \$\begingroup\$ When microstepping, two of the opto outputs can be active at a time. You will need to calculate the ratio of the pulse widths. When the ratio changes an amount equal to your microstep, then that is a step. \$\endgroup\$
    – Mattman944
    Commented Dec 22, 2020 at 16:54
  • \$\begingroup\$ Ah that's gonna be interesting to do, considering I probably won't know what microstepping the driver is using at any given point. \$\endgroup\$
    – m slez
    Commented Dec 22, 2020 at 18:38
1
\$\begingroup\$

Just wanted to add that the ADC burned because its a bipolar motor driver and in its negative phase it tries to source current from the load ie. your ADC, burning it. You do not need an ADC to measure this voltage, you can get by using an octocoupler circuit as Mattman944 mentioned, which puts your microcontroller in parallel to the stepper driver, thus protecting any sensing equipment you have.

\$\endgroup\$
1
  • \$\begingroup\$ hmmmm, that makes sense. I measured the output with an oscilloscope and didn't see a neg wave. But, I must have missed it. Thank you for the response! \$\endgroup\$
    – m slez
    Commented Dec 22, 2020 at 15:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.