hello, I have some problems regarding the motor, I have uploaded the sangaboard v3 firmawre according to github on the arduino nano, when I want to test the ofm there are some problems such as stage not connected. is there anything I can do to fix this?
In the past I have debugged the sangaboard by trying to talk to it directly.
Do you have experience with Python? It should be installed on the Pi. If you press Ctrl+Alt+T to bring up a terminal. and run (type and press enter):
pip install sangaboard
Then run
python3
This should start Python and you can type Python commands in now. Try typing in the following lines, pressing enter after each. If you get an error message then can you screenshot it?
from sangaboard import Sangaboard
with Sangaboard() as sb:
sb.move_rel([1000,0,0])
print(sb.position)
sb.move_rel([-1000,0,0])
Once done press enter one more time (this will run the indented block).
Make sure you add the same number of spaces before each line that is indented. What should happen is nothing appears under what you have typed until the final enter. At that point the x motor should run-forward, return its position to the terminal, and then run back again.
Let us know if this works. If it doesn’t work please capture the error message.
I have done it from installing the sangaboard to coding according to what you sent, but an error occurs like this and the stepper motor does not move.
That looks like a Python error with importing the library, rather than a Sangaboard hardware error.
yah, when importing sangaboard library an errors appears
Were you able to pip install sangaboard
without errors?
yah, any sugestion?
Can you run pip3 install sangaboard
again and screenshot the output
yah its working, but stepper motor moves very slowly, then on ofm software the stage still not connected
Just to check, are you using the openflexure operating system? Or did you install raspian separately?
I used Openflexure operating system, do I need to rewrite the os on the sd card, at the first time using the stage it can be connected but now it can’t be connected. or there are other problems for my raspi because i use raspi 4b 8gb?
So we know that the sangaboard acknowledges that it is a sangaboard, and that you have the openflexure OS on here. We are now getting into the technicalities of the software where we could really do with @r.w.bowman chiming in.
If the code snipped that Julian shared works, that suggests everything is OK with the Sangaboard. However, the microscope only tries to initialise the sangaboard once, when it starts up. It may be that restarting the microscope fixes the problem (i.e. turn the Raspberry Pi off and on again).
There are ways to do it without rebooting, but there are more things that can go wrong there (e.g. your Python process will stop it working if it’s still got the port open) so I’d recommend shutting down, unplugging the power, and starting it up again.
The OpenFlexure image is 32-bit (for now) so your 8Gb Pi will effectively function as a 4Gb Pi - but I don’t believe that should cause any problems other than not having all your RAM available.
thanks for the advice, well before that I already did it, turned off the ofm and raspiberry software, even removed the power cable and turned it on again, but thats still not working, the stage is still not connected, next I will rewrite the raspibian os ofm, and later I will tell you
That’s very strange. The OFM’s initialisation procedure should be identical to what happens with the Python code you’ve just run auto-scans the ports. That said, Julian’s instructions will have installed the latest sangaboard software rather than the version shipped with your server.
It may be worth trying in the microscope’s Python environment. If you run:
ofm activate
in a terminal, you’ll get the exact version of the packages used by the server. You can print them out by running:
pip freeze
it will print out the version of everything installed. Could you paste the output of that here? There should be a line for sangaboard
that tells us the version.
After that, we can try loading the board. run:
python
If you re-try Julian’s script at this point, we should see the error the server gets:
from sangaboard import Sangaboard
sb = Sangaboard()
print(sb.position)
Most likely you will get an error on the second line.
If that fails, you may need to upgrade the sangaboard
package. Exit python with exit()
then, in the same terminal, try:
pip install --upgrade sangaboard
After that, re-run python
and try the three lines above again. If it finds a port and prints out 3 numbers, we have fixed the problem. You can reboot and it ought to work properly.
I am slightly perplexed why this would happen - but it’s worth a try.
hi, now it’s working thanks, but there’s a problem when I want to change the stage position the command can be done but there is a feedback warning the motor is not moving or not saw motion, and I don’t see my motor moving just making a sound the motors vibrate but don’t spin, is it caused by the part I installed too tight or because the part of the main body I printed with 70% infiil so it’s too strong to be moved by the motor? and I want to add extensions or new features to my ofm software is that something I can do?