Block Stage Motor Control

Hello, I’ve just printed the block stage and am attempting to control it with motors and the openflexure connect software, however when I upload the arduino sketch and then attempt to control it, nothing happens. Do I need to have the pi camera connected to be able to control the motors? If so, is there another way I can use the software to just manipulate the block stage? Thanks for any help in advance.

I should also mention that I’m using an arduino nano hooked up to the three motors using their stock driver boards, just like the example motor circuit diagram that is on the site.

The Openflexure server on the Raspberry Pi, the Connect software and the Web App are all primarily useful for the microscope using the Raspberry Pi camera. The motor control Arduino / Sangaboard is in some ways a separate system. The Openflexure server communicates with it using serial commands to get the moves needed for things like tiled scans.

If you are not using a Raspberry Pi camera then the Openflexure server is rather overkill just to send the move commands, although the onscreen buttons and keyboard shortcuts would still be a useful interface.

A couple of things to try. Are you able to get responses to serial commands sent directly to the Arduino - for example using the serial monitor in the Arduino IDE? If you have got a Pi Camera (version 2) to hand, then does it all work if you have a camera connected?

Sorry my internet has been cutting in and out today. I ended up just writing a little code by myself because like you said the server was overkill. I did have three questions though if you don’t mind. Firstly, in reference to the block stage, which gears control x, y, and z? Also, and this may be a bit of a tangent from the original question, but what would be the easiest way to create a GUI to control the motors with? Finally, what is the range of motion of the stage, and will it break if the gears are turned too far in one direction? Sorry that was a lot at once, I’ve had some time to think since my internet went down, and thank you for the help!

To find x-y-z it is probably easiest to take the motors off and turn the knobs by hand, you will see what moves. If I remember correctly, the middle one is vertical, the outer ones are sideways. Which you think of as the z axis depends on your use…
Then connect the motors to the appropriate ports on the Arduino to get the x-y-z in the right order in the software.

The range of motion is nominally 2mm on each axis. If you drive the motors too far, something has to give, either the mechanism, the internal motor gears or the mounting.

I can’t help on a GUI, it depends what you are comfortable with, and how you want to use it. The microscope uses a Web App for universality, but JavaScript is not much fun to program. Most languages will be able to manage something as a GUI.

1 Like

I suspect the simplest way to get started programming is the pysangaboard Python module, which is what the OFM server uses internally. For a GUI, you’re then free to use any of the (many) Python GUI toolkits; I mostly use the Vue.js web app these days, but have previously used Qt’s Python bindings.

I’d follow William’s advice to figure out which axis is which - and don’t worry about crashing into the end of travel. My experience is the motors don’t usually have enough torque to cause any damage to the plastic parts, though of course it’s not a great idea to keep running them once they stop moving for too long. You may find the axes jam, but it should just be a matter of taking the motor off and unscrewing them a bit. If you turn too far the other way, usually you notice the stage stops moving because there isn’t enough tension to keep the screw in place any more - that’s harmless.

If you use screws that are too long, it is possible to damage the stage by screwing them all the way in - but if you’ve got ones the right size that should not be a problem.