Hi, I am new, I have built a Microscope. I have searched and been unable to find how to wire up my stepper motors to an arduino. Any pictures I see are so small I cant make anything out. Where can I get the arduino code once I have connected my stepper motor to my Arduino.
This is a part of the instructions that needs more detail I am afraid. Have you found the part of the instructions for the Sangaboard compatible motor controller using an Arduino Nano? This includes a wiring diagram and a link to the repository with the Sangaboard firmware for Arduino. The repository instructions contain steps that you do not need if you have a Nano. Find the download button at the top of the page
, next to the blue Clone
button. Click on it and click the zip button under download this directory.
Then unzip the file and open sangaboard.ino
in your Arduino IDE. If you have not used Arduino before see the Arduino web site on how to get and use the IDE and load programs to your Nano.
There is a useful picture on a recent thread of how the Nano and motor controller boards fit on the nano_converter_plate.stl
, First build - High Resolution OFM.
I hope this helps. There is are plans to simplify this process but we are not quite there yet.
Hi Doug! Iām working on this right now, I just found these instructions to be more complete than those on the main OFM website - OpenFlexure Documentation
You need to connect the following, as per the schematic and the arduino pin numbers:
D2,D3,D4,D5: Z motor
D6,D7,D8,D9: Y motor
D10,D11,D12,D13: X motor
Then connect the ground of the arduino to the ground of the motors power supply. Thatās it! The communications with the Raspberry Pi happen over the USB cable, so you need a USB to micro USB or usb C (depends on your nano).
Hope that helps!
You can also see a couple of pictures of a wired up nano in my build report.
One thing thatās not mentioned anywhere is that you need to put the pins of the nano upside-down, with the long part sticking out from the bottom, so that the USB port will fit in the gap.
Thank you so much for the feedback. I should also have asked, is it possible to use a standard Arduino (Uno) in place of the Arduino Nano.
Regards
Doug Ferrier
Thanks so much for the clearer and bigger sized schematic diagram. Iām not sure what the comment means regarding ā,need to put the pins of the nano upside-down, with the long part sticking out from the bottom, so that the USB port will fit in the gapā. Surely the USB port is already in place and the pins (if used) can face either way? Or have I misunderstood?
Regards
Doug Ferrier
To place the nano on the printed motor controller board you need to place it āupside downā, with the reset button pointing towards the bottom. See the image here - https://global.discourse-cdn.com/free1/uploads/openflexure/original/2X/c/c1d367b8ffce7861eb3ef2db0d9c2f907ef9e056.jpeg - I think if you put it with the reset button facing up the USB port wont fit in the gap and wont be accesible.
I think in principle you should be able to use an UNO as well, though it might be a tight fit inside the enclosure.
Hi again, I managed to get something working using a Arduino Uno with the recommended 3 stepper motors. I got some pseudo stage mapping once. The next time it failed completely
Unfortunately I have absolutely no idea what is happening when the Microscope is switched on. There is no way of knowing what is happening during calibaration or stage-mapping. It would be useful to be able to exercise separate parts of the System - so as to be able to check what is working and what isnt.
Every time I boot the system up I get a Network error. Only way of getting it to start functioning again is to type OFM Serve in a terminal window. I have no idea what this does or why I have to do it. Anyway, it causes the Microscope to lose any calibration status and I have to recalibrate.
Another major problem is the Video picture operation. The Camera view is either sitting there blocking everything on my Monitor screen or , if I deselect Preview , I get nothing at all. I just cant get to grips with this and will probably give up on the stepper motor drive. I wish I knew how to get the Microscope to āboot upā without errors. I also get other strange errors appearing but cant remember the titles - very odd text is all I can remember. I will probably give up soon as I do not have enough descriptive information to know what is happening and how to troubleshoot. I am using a Pi 2 (with the latest Raspian for Openflexure) and a V3 Camera - not bought a Microscope Objective yet - and wont until I can work out what is going on.
ā¦mistake, its a V2 camera. Oops
Hi @dougf I had a bit of a break, Iāll try to go through all of your questions. I hope I have not missed any.
Arduino Nano/Uno: Both boards are based on the ATmega328P so as you have found there should be no problem with installing the Sangaboard firmware on a Uno instead of a Nano. The Nano is just smaller which can be more convenient. Re the comment from @mzedp on the pin direction, the Nano pins should be in the usual direction for a Nano, as for the soldered header versions that are available. The Nano then goes upside down with the pins in the air.
Video display: There are two ways of putting the video feed to the display on a Raspberry Pi. The fastest is to directly feed the video from the camera to a region of the screen. This is GPU preview
in the Openflexure interface, under settings > display
. As you have found, it places the video over anything else, which can be annoying if you are using the Raspberry Pi desktop, and particularly when you are doing the initial setup. The other way to display the video is to send it to a web stream
which can then be viewed on another device over the local network (or on the Pi itself as the Openflexure interface is actually a web app running with a virtual network connection). The web stream goes through processing and sending over the network (or virtual network) so is slow to update, but it is under the control of the interface so is kept in the window nicely.
That is all a long explanation, what you need to do is uncheck Enable GPU preview
and uncheck Disable web stream
in settings > display
All being well this will help with the other issues as you will be able to see what you are doing better. the other errors might all be related, but it is a little hard to tell. As you say it can be hard to tell exactly where the issue is, the log file
might help which you can get from the Openflexure interface under logging
. However, in practice these types of issue usually stem from a corrupted installation somewhere in the Raspberry Pi operating system or the Openflexure Server. This is a weak link in the Raspberry Pi, partly because SD flash cards are actually not very reliable. My first thing to try is always a fresh installation of the SD card, or even a fresh SD card. Then ofm update
and ofm upgrade
to make sure that you are on version 2.11.0 or higher (I think that is the latest version). See whether that solves the problems.
Note: ofm serve
should not be required, it is for development only. I am not exactly sure what it does, but you may have ended up with more than one instance of the microscope trying to run at the same time.
Camera stage mapping: The camera stage mapping is actually not really needed for operation of the microscope. It just lets the software find out the relationship between the size of a motor step and the movement across the screen image. This is used for āclick to moveā, where you can click on a part of the image and the microscope will move that to the centre of the image.
Pi version: Is it a Pi 2B that you are using? This should work, but I have not recently tried a Pi 2 on the microscope software. A Pi 3B is significantly more capable.
Still having problems. I created a fresh installation on SD card and am getting constantly Network Error so cant get the system to do anything now. Dont know what to do. BTW I disconnected the arduino with stepper motors as it was too confusing
That is a pity. network error
is difficult to diagnose as it could be several different things. The software devs might know more there.
I am slightly wondering if it is the Pi that you are using. The website does say that a Pi2 is sufficient, but I am not sure that anyone has actually checked that recently. I routinely use Pi3B+, I donāt think I have a Pi2 anywhere to test. You are running the full Pi desktop by the sound of it, which can be demanding on the Pi.