X axis motor won't stop

Hi!
Just finished building the microscope and it works really great. However, there is one issue with controlling the stepper motors: The X axis motor often won’t stop turning (and continues even after the RaspberryPi is shut down, only unplugging the power helps). This problem occurs randomly when moving the stage via entering x coordinate numbers, but it always happens when I am using the keyboard arrows, only with the left arrow though. Is this a Sangaboard hardware issue or could it be something software related?

That is a very strange behaviour! If it is moving, then the Sangaboard is continuing to send the sequence of motor coil activations. As shutting down the Pi does not make it stop this must be because the sangaboard thinks that it has been sent a command to move a very large number of steps. The Pi might have send repeated moves, I don’t remember if they stack up.

It is an intermittent problem, which can be hard to pin down because you cannot always replicate it. I would take the x-motor off the microscope and try to make this issue happen again. When it does, let it run and time how long it takes for the motor to stop. There are 1000 steps per second. Is it different if you stop the Pi or unplug the keyboard?

Thinking about the start of this post again, I think that moves do stack up. So this is most likely to be a sticky keyboard key issue - the Pi gets repeated key presses and sends them to the Sangaboard, which then takes a long time to get through all those commands even when the Pi has stopped sending more.

With a keyboard command I can always replicate it. However, I doubt it is a sticky key issue as it also happens randomly sometimes when entering x coordinates and it also happened a few times in calibration mode. Just tested it, the motor keeps running for 9 minutes. No time difference if I disconnect my laptop form the microscope, 4.5 minutes if I power off the Raspberry Pi.

Is there also an alternative for controlling the stepper motors using the Rpi Pico? Think I read the instructions somewhere but can’t find them anymore. As I have a Pico and the motor controllers at home, I could try that and check if the problem persists.

There is not currently a firmware easily available for a Pico. The Sangaboard v0.5 is based on the same microcontroller as the Pico so it is in principle possible. One of the auxiliary pins on the Sangaboard I think is a reserved pin on the Pico, so the firmware is not a direct swap.

Have you got a screen and keyboard to controll from the Pi directly? Just to see if there is s difference. Otherwise it is worth reinstalling the Pi operating system from scratch. The SD cards are a weak point in the Pi system, and often strange behavoir is solved by a reinstall.

A clean reinstall of the whole operating system indeed solved my problem. Thanks for your quick and helpful answers.

3 Likes