OpenFlexure Blockly

We have been working to develop OpenFlexure Blockly. OpenFlexure Blockly enables you to automate the microscope in a beginner friendly way, without writing any code! This is built with Google’s Blockly visual programming library which is commonly used in schools as an education tool.

We hope this will be useful for education as well as people using the microscope who want to quickly put together scripts.

Currently we have ‘blocks’ for the core functionality of the microscope. In the future we will expand to incoporate the functionality of user contributed extensions. If there are more ‘blocks’ you would like to see, please let us know.

Using OpenFlexure Blockly

OpenFlexure Blockly is available in a variety of ways but they are all compatible with each other (i.e. if you save a script from one method, it will work in all of them).

On the internet

The easiest way to use OpenFlexure Blockly is through the web app, no installation required! Just type in the IP address of the microscope (or microscope.local) which is connected to the same network as your computer. It works with Firefox by default, but you will need to change a flag with Chrome and Edge

As an extension

You can install OpenFlexure Blockly as an extension, meaning that it works inside the OpenFlexure GUI. By clicking App you can also launch the OpenFlexure Blockly web app which is hosted on your microscope and it will connect automatically. More information on installing the extension can be found in the repository.

Feedback

Hopefully you will find this a useful tool, either for yourself or for teaching others. If you do use it, let us know! Please provide feedback either here or by raising an issue.

Repository

The source code can be found in the repository.

4 Likes

@samuelmcdermott gave me the opportunity to play with this pre-release. It is really fun, and a great half-way house between using the built-in functions of the Openflexure web app and control directly from Python. It will do most things and I don’t need to remember any syntax :slight_smile: .

I did hit the Chrome/Edge problem. You can get around having to set the flag by copying the Blockly files to your computer and opening them locally. This also means that you don’t need to be connected to the internet. Of course using the Extension in the normal microscope interface gets round both issues.

A final note, all of the Openflexure instructions have the network name of the microscope as microsope.local as this is what is set in the server. Some networks (like mine) somehow mangle this and you find the microscope at microscope instead, without the .local

Our design decisions, user and developer guide and our suggested applications for OpenFlexure Blockly have now been published in Royal Society Open Science.

We hope that this will continue to be a useful tool to help you create scripts for your microscope, and for teaching others how to create their own microscope routines.

3 Likes

Could the scan extension be added as an openflexure block? Would be interesting to play around with as part of some routines.

Ryan

What do you want from the scan extension that cannot be done as a loop in Blockly? Blockly let’s you make functions, so a function that moves, focuses and takes pictures is straightforward as a replacement for the standard scan.

The smart stack and scan from @JohemianKnapsody does things that you cannot replicate in Blockly.

Openflexure Blockly was conceived as a simple tool for education. It is very useful also for microscope users with simple automation tasks and little familiarity with Python or MATLAB to use the full blown clients. I have been thinking about what is the best way to keep Blockly simple but also capable. One way to do that would be a set of ‘Openflexure advanced’ blocks.