Questions about encoders and stepper motors


We try to assemble their own farmbot, the choice of encoder and stepper motor model information is as follows:

IC model 26C31
The resolution is 200 lines

Stepper motor
42BYG miniature stepper motor, 48mm body, NEMA17 type, double shaft
Rated Voltage: 2.8V
Current / Puase: 1.68A

Once assembled, once the encoder is added, the stepper motor always fails to take enough of the specified length to stop.
For example, the command is to require it to go 100mm, then it will go 20mm ~ 30mm will stop.

We choose the encoder and stepper motor model is not ok?

thank you very much!

It’s possible that the encoder moves the opposite direction. Try to set the ‘encoder invert’ parameter, otherwise

For more detail, connect to the arduino directly to the PC. You can use the serial monitor in the arduino IDE to see if the encoder measures the movement, and what sign it has.

Hi Tim,

Could you explain how to see the encoders signal with arduino IDE serial monitor?

Thank you!

You can view messages the firmware is sending by opening the Serial Monitor (in the Tools menu) after plugging the Arduino into your computer. Lines starting with R84 and R85 include the encoder positions. See the response section of the readme for more information.

I have done the following,

1-Disconnect the USB from the arduino and the Rasberry
2-Connect the Arduino with my PC
3-Open the Arduino IDE and Serial Monitor
4- Switch to 115200 Bauds
5-Just read these codes

How can I read code R84 and R85?

I know my questions are very basic, but this is all new to me.

Thank you very much

Change the line setting (to the left of the baud rate setting) to Both NL & CR.

Then send some GCODE (input box in the top): G00 X200 (move X axis motor 200 steps, which is one rotation). The R84 and R85 responses should be given. You can move any axis motor, or even several at a time: G00 X200 Y100 Z-300. These are absolute movements, so return to zero with G00 X0 Y0 Z0 before trying again.

I enter the G codes and responds well.

With the encoders disabled in the web app, the engines move well.

I connect to the web app, I connect the Y axis encoder, reconnect to the serial monitor and send the command G00 Y2000

The motor moves very little and with noise and I see the following on the serial monitor.

In the web app does not let me reverse the encoders
I have version OS 3.1.6 and firmware 3.0.8. The encoder model is the US Digital E4T-200-197-D-D-M-B

I have reviewed the wiring and connections and apparently everything is fine.

Thank you very much!!

Firmware 3.0.8 is very old. The latest Arduino firmware now comes bundled with (and is installed by) FarmBot OS during configuration. I would recommend configuring FarmBot OS again after a factory reset or a reflash of the SD card to get the latest firmware.

I can already see codes R84 and R85 :slight_smile: and the Y-axis works correctly with the encoder activated.

When correctly configuring the OS, many problems of the web app have disappeared, thank you very much for your help !!!

1 Like