Automating the Microscope

Hey there, it’s me again!

As I have previously mentioned in another post, I am kinda new to all this coding, whatsoever.
What I am planing will probably sound simple to most of you guys, yet it’s confusing to get into if you are new to all of this.

I am pretty much trying to automate the whole process which should follow this order:
Microscope moves in x- and y- direction, does the whole autofocus stuff takes a picture after being focused and then moves again. This should loop for a few times.

I want the whole process done without any input except for starting the code via the Terminal.
As of right now I am only able to move the Motors/Microscope. I am not able to find the right commands for the autofocus and somehow the “capture image”-command I used before does not work anymore after I’ve changed the OS to the Openflexure one, while I had the standard raspberry Pi OS before.

Has anything like this been done before? Maybe with instructions? Or is there a list of commands for the Microscope which would work and which I could use for my code?
(Is my plan even the best way to automate this, or would there be an easier one?)

Appreciate all the help I can get.

What programming client or language are you using? Programming clients

The Python client readme gives the basic commands and also links to the overall OpenFlexure API commands.

For what you are doing, I would use the Blockly client. It does not have all of the commands available, but it is the one that i can always remember how to use!

Thanks for the reply!

I am using Python, yet when I tried testing the commands, it didn’t really do anything. Even tried ChatGPT to scan the page and give me a script which should work. That also did not help.

Will try some more stuff and hope this will work!

Have you tried Blockly? It is very effective.

Hey Rookie
I spend a lot of time automating the microscope like this, if you send me your code I’m happy to take a look

Hey,

thanks for reaching out!
I have managed to automate it at the current time on Python. Main issue was the connection to the microscope which I always assumed would work via “localhost”. Seems like changing it to the given name worked.

Just looking to currently manage to grab the coordinates somehow so each picture is named after each coordinate (where it was taken). Pretty close to finishing my project!

Thank you guys for your help!

3 Likes

Sounds good, sounds like you need microscope.position to get the location and then you’re set?

1 Like