Uploading Sangaboard firmware to v.05 board

Hi Folks, I’d appreciate some help please.

I am working on Windows 11.
I am following instructions at: arduino_code · master · Bath Open Instrumentation Group / Sangaboard · GitLab

I installed arduino-cli, then did this:

arduino-cli lib install “Adafruit TSL2591 Library” “Adafruit Unified Sensor” “Adafruit ADS1X15” - worked OK

arduino-cli core update-index && arduino-cli core install arduino:avr - hung so I cancelled it.

Later, I realised Windows was displaying an authorisation window which I didn’t see, and this is why the install “hung” - so this may never have completed.
[Ghis is really annoying - it does not pop these windows over others - the only way to notice is a “throbbing” icon in the task bar]

So I re-ran that step, but it says it’s already installed and the subsequent step:

arduino-cli board list
arduino-cli board attach {YOUR COM PORT}

  • fails with “Can’t open sketch: no such file or directory:C:\Users\chris\Documents\Arduino\COM16”

  • this path is where I put the arduino-cli.exe file

Two things:

  1. How do I compleltey re-run the step which I stopped?
  2. Why is it looking in that path for a sketch whose name is the COM port, and how do I fix that?

Many thanks
Chris

The instructions and code that you link to are for Sangaboard v0.3, or a system based on an Arduino Nano (ATmega328p).

Sangaboard v0.5 uses a different internal microcontroller to deliver the Sangaboard functions that are presented externally. This is an RP2040, as on the Raspberry Pi Pico microcontroller board. The firmware for that is different to account for the different architecture and is in a different repository. If you have purchased the board it is likely to already have the firmware installed. If you had the board made yourself then the loader linked in Sangaboard v0.5 now available - #2 by filip.ayazi might be appropriate, or other posts about the firmware in that thread might help. It is not something that I am totally familiar with.

As @WilliamW says, the v0.5.x board uses a different microcontroller, and importantly does not upload firmware in the same way as an Arduino board.

If you bought the Sangaboard from Taulab, it may well already have the firmware installed on it - so you may not need to do anything. If you need to update/replace the firmware, the first thing to say is that you’ll need the newer, PlatformIO based firmware at:

The second thing to say is that, once that’s built, you can upload it fairly simply without any additional software. The build does happen automatically on gitlab, but I will avoid (for now) posting a link to the CI build, as that will not keep working. Perhaps @filip.ayazi could comment on the best place to obtain the built firmware?

William thanks for your reply.

1, I notivced that the instructions referred to version 02 and 0.3 but I did not see any mention of what to do with version 0.5. Did I miss it? if so - please say where it is.

  1. As I’ve pointed out to Filip, nothing I got with the Sangaboard said anything about how to prepare it or that it was alfready ready. I’m some guy off the street and all I know is twhat you tell me in your instructions.

Filip has now told me that it had all the correct firmware on it. But since I got some way through a flasking process befire that failed, I don’t know if I’ve destroyed that formware or not. Have I? ANd if so - now what?

I appreciate your help and that you are unpaid. It’s friustrating but this is a significant obstacle - friction - to getting this microscope out there and it’s entirely avoidable.

In other news, I’ve assembled all thephysical parts. It’s a very impressive masterpiece. Amazing. And I’m sure it represents a huge amount of work. Unpaid work. Even if I never get it working, I’m impressed.

But with a little better documentation Joes like me would have such a better time.

I hope thatg’s more ehlpful than it iss annoying.

Best Wishes,
Chris

r.w.bowman, thanks. Filip did reply by email and I’ve replied to that.The essense of my reply is - respectfully - that his reply isn’t helpful because he assumes a vastly greater level of expertise than I have. I’ve spent my adult life in software develoipment, and hobby time with Arduino - but I know bugger all about OFM or the SWD conneciton. And I didn’t know and wasn’t told that the board was flashed - all I had was your documentation

So I have a Sangaboard which I may or may not have screwed, and I have a Raspberry Pi which I’m hoping the documentation will tell me what to do with in terms which someone like me can deal with. I wanted to sort out the Sangaboard first.

I appreciate your unpaid time and the vast accompllishment this project represents.

Best Wishes
Chris

That’s a little frustrating - there’s a bit of a blurred line between where Sangaboard stops and OpenFlexure starts, and it’s not helped by the fact that the OFM instructions are not yet updated to cover Sangaboard 5, and the Sangaboard 5 instructions are not yet 100% complete. I’ve outlined a plan to fix this in an OFEP but it’s not yet done, I hoped to sort it all out before the recent beta, but it will have to wait for the next one in a month or two.

I am reluctant to give my own advice in case it is out of date, and/or conflicts with Filip’s. However, it should not be necessary to mess about with SWD pins to get your board working and I’m a little surprised that’s what he suggested.

The first thing I’d do is plug everything in and check if it works. If you put the latest OpenFlexure SD card in a Pi, plug in the camera, put the Sangaboard on top, and boot it up, does it report that there’s no Sangaboard? It’s unlikely that running the upload commands for a Nano will have done anything at all to your board, especially if the error you got was that the serial port didn’t exist.

If your board doesn’t show up, you should be able to upload the firmware with any computer by plugging it in on USB while holding the “reset” button. That should make it show up as a storage drive, and you simply drag and drop the firmware file into it, at which point it disappears and should be ready to use.

A Sangaboard with working firmware should show up as a serial port (on whatever computer it’s plugged into over USB). We should probably come up with a simple procedure to test it, but perhaps I’ll leave that for a future post if you are stuck and it would be useful,

If you are in touch with Filip you may want to ask him for the firmware, but I can probably supply what I believe to be the latest version if you can’t get it from him for whatever reason.

All the best,

Richard

Thanks again r.w.bowman.

In email, Filip has pointed out that the Sangaboard sales page clearly says that the board is programmed, and he is of course, correct.

I didn’t notice that. Anyway the elapsed time between me seeing that page and me working with the board (only a few days) exceeded the working memory limit of this old goldfish.

Also, in my experience. boards often arrive flashed but the latest firmware is flashed over it as a metter of course, and I was in that mode of thinking.

But the sales page clearly DOES tell me I don’t need to flash it.

I will do as you said - write an SD card, plug it and the Sangaboard into the Pi, stand back and power on.
If it works, well then - GOD I’m good (joke). If not, then I’m screwed. I daren’t ask Filip for the firmware - I’ve upset him, which, no doubt, I have a genetic predisposition to do.

Thanks for your patience.

Onward, ever onward!

It’s that man again…

Well, I got it working with an old Pi and an old camera. I have not got past calibratio yet, but I can already see that it’s amazing. I have two questions:

  1. I am using an LED and resistor and I’ve followed the guidance in the LED workaround section.
    But that section does not say where to connect it, so I connected it where the illumination board would plug into the Sangaboard. It does not light. I can light it with an external power source wwithout problems. Can anyone tell me how to get ti poweered from the Sangaboard please? I was also careful to check on the Sanagboard sales page, but can’t see any reference to it.

  2. I can’t see any way the microscope can know where it’s stage is. There is no homing process, no end-stop sensors and no persistent memory between boots (as far as I know). As I’ve successively failed to calibrate automatically using the camera, the X axis has been driving itself in one direction each time and never returning the the middle. I worry the flexing mechanism will destroy itself. How is that avoided? I’ve been removing the motors and hand-winding the stage back to the middle.

I suppose the reason it won’t calibrate is that I have no condenser lens and no diffuser so the image quality is poor, so I’ll work on that next, but this question of “homing” is a concern I’d appreciate your clarification on.

Many thaanks,
Chris

  1. For the current release (7.0.0-Beta-2) we are assuming that the LED has its own current limiting, so the wiring instructions step 5 says " For Sangaboard v0.5, plug the 2-pin female connector onto the 2 way male header labelled 5V GND." This is the same for the 5mm LED workaround.

  2. The stage has no limit switches, but the position in steps is recorded in non-volatile memory and should persist after reboot. You do need to set the stage to the centre (with the holes that the actuator nuts insert through aligned in the actuator casings) at the beginning, and then in the software set that position as zero.
    If you are scanning a flat specimen, then the focal position actually tells you about the stage centre position because the x-y levers are parallelograms so the stage moves slightly down as it moves away from centre in any direction. You don’t need to hand-wind the stage, just put in where you want to go to in the ‘navigate’ tab. If you have set the zero position that will be 0,0,0.

Which part of calibration fails, the camera flat field and colour correction or the camera-stage mapping? The flat field correction needs to have no sample in place and the illumination needs to be sufficiently even that there are no areas without light. The camera-stage mapping needs a specimen that is well focused. You can exit the calibration into the main program and adjust the positions and focus, then you can run the calibrations from the ‘settings’ tab (I think that is where they are).

Hey William thanks again. Jeez, you mean I missed something else. I’m very sorry. I’ve plugged the LED-plus-resistor onto the Sangaboard 5v supply and ground and it works now.

I’m struggliong to make sense of your item 2.

I understand that the stage actually moves up and down as it moves from side to side as a necessary consequence of the compliant mechanism, sand so focus will change.

So I can focus it manually on something in the middle and it will go out of focus as I move away from it in any direction. But that doesn’t mean that the place it is in focus is where the mechanism is relaxed, nor in the middle, as far as I can see.

Can I think out loud so you might be able to correct my thinking?

The stage mechanism is relaxed when it’s printed. I suppose this would be the ideal HOME condition. However, the camera’s horizontal position is set during assembly by making its height just below that of the stage, and it’s not in the middle at that point.

If I move the stage to put the camera in the middle and call that (0,0), won’t that mean that HOME is placing the mechanism under permanent strain? Maybe that’s not an issue?

The calibration fails saying that it has moved the stage to ([large x], 0,0) and has not found the object - or something similar. If I try again, it continues to move the stage even further in the X and it will do that time and time again. If I power cycle it, it will not return to home, it will carry on moving in that same X direction. I’m concerned that that will destroy the stage mechanism.

Thanks, Chris

A bit of permanent strain is fine. The z-axis focus is unlikely to be at the relaxed position, but is also not likely to move to the end of travel.

If you have (0,0,0) set as the central position for the stage in x,y and then when you have done some viewing, or the calibration has failed you have ended up at ([large x], 0,0) or ([large x],[large y],0). after cycling the power the stage position should still read ([large x],[large y],0). It does not automatically refresh, so you may need to do a step move using the arrow keys to make it update. Then you can type in (0,0,0) and click move and it will go back to that set starting point.

OK WIlliam, I think I;ve got it now. Thanks so much.

I’ve seen this machine at work this afternoon, and it’s very impressive indeed.

I’d have to say the images themselves are not super sharp, but I’m using an old V1.2 camera and an old Pi. Tomorrow I’ll upgrade them both. I suppose the image quality with single plastic lens element optics cannot ever be top notch. When I have this fully functional I’ll probably built the one with microscope objectives.

No reply needed - and thanks again for all your help with this.

3 Likes