Sangaboard v0.5 now available

Edit: The new Sangaboard is available to order here. The form below is no longer relevant.

We have a new motor control board that is currently being tested and we aim to make this available very soon. The board is based on an RP2040 microcontroller and works as a Raspberry Pi hat. It has support for 4 motors, 2 high-current PWM channels to control LEDs (RP2040 can run PWM at up to 1MHz so there should be no flickering) and a USB-C plug instead of a micro USB. The Pi GPIO connection also connects to SWD on the chip so we can flash the board from the Pi with no user interaction. All unused/extra IO is available on an extension header so it is easy to build shields for the board (I’ve done one to control a Nema17 peristaltic pump). The current version also has a constant current driver we are experimenting with to see if it works better than simple PWM (TP61060). The design files can be found at Filip Ayazi / sangaboard-rp2040 · GitLab .

Currently, it looks like we can sustainably sell these for around 25 GBP, with the exact price depending on the scale of the order. If we scale the manufacturing order correctly and process a lot of orders at once, we can bring the cost down further. To help with this below is a form where you can express interest in buying a sangaboard. Anyone who fills in the form will be contacted directly when the boards are available and will have the option of buying the Sangaboard at a lower price.

TLDR: Sangaboard v0.5 coming soon, form above if you want some

1 Like

A batch of Sangaboard v0.5.1 has now arrived and the boards work as expected, so they will start shipping this week! They can be ordered at https://taulab.eu . Processing the orders in a large batch takes less time per order so until March 16th (when the first orders will ship in the EU) the boards are available at 22GBP/board.

Support for some of the advanced features in software is in progress, there’s a OFM software extension to control these features and to upgrade the firmware on the boards with a single click available at Filip Ayazi / Sangaboard Extension · GitLab .

To make it easy to use the illumination control features on the new Sangaboard and make building the OFM v7 easier, there’s also an illumination kit available to order with the Sangaboard. The kit contains all non-printed parts of the condenser assembly (wire, LED PCB with a very flat spectrum LED, 0.5mm thick diffuser, condenser lens) except screws so that it can be assembled with no soldering. To buy it select the Add illumination kit version when ordering a Sangaboard. It can also be ordered separately, but note it relies on the Sangaboard for current control, so if you use the LED PCB without it you need to use a series resistor.

The pricing follows the same principles as OpenFlexure Industries did, trying to keep it as cheap as possible while still sustainable longer term, so paying for my time spent processing orders, making kits, sourcing parts etc. but not for development work. My main goal is to promote the adoption of OFM so if the cost would prevent you from building one please contact me and I’ll see what I can do.

TLDR: Sangaboard v5 shipping from March 16th, lower price until then. Illumination kit for OFMv7 also available. https://taulab.eu

4 Likes

Hi. I’ve set up the board now - do I need to do anything to get the pi to talk to the Sangaboard or is this already included in the openflexure Raspbian image. Are there any instructions for this please.

Also, whilst powering through the Sangaboard’s USB C, only the RX, and two blue LEDs on the Sangaboard are lit. The TX LED is not lit - is this normal as well?

Thanks.
Zhao

This came just in time! I started buying the parts for building the v7 microscope, and the fact that the sangaboard is available just like that is a huge help.

Are there any issues I should be aware of, or does it just work out of the box with the openflexure software?

The current Openflexure raspbian build does not have the serial enabled out of the box. The version of the Sangaboard library is also not the latest one needed for communication with Sangaboard v0.5.

@filip.ayazi should be able to advise you what changes need to be made.

Follow steps under the link Using the serial port on Raspberry Pi

1 Like

I’ve done enabled serial on raspi-config but am still getting the same error that there is no stage attached.

@letshin you will also need to update the sangaboard driver in the openflexure software. @filip.ayazi should be able to let you know how to do that.

Apologies for the delay, I’m away until Wednesday and will post more info later this week. As mentioned above, to make the board visible on the current release build of the OS, the hardware serial port has to be enabled following the instructions posted by @PiR2 and as William said the sangaboard module in the OFM software needs to be updated.

To update the Sangaboard module, the commands should be:

ofm activate
#in the resulting ofm environment shell;
pip install -U sangaboard

this will upgrade the sangaboard module to the latest version which should detect the board via hardware serial (but doesn’t support the new features). Alternatively, you can follow the instructions for the Sangaboard OFM extension install from here README.md · main · Filip Ayazi / Sangaboard Extension · GitLab

No problem. Here’s where I am:

(.venv) pi@microscope:~ $ pip3 install RPi.GPIO==0.7.0 --user
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting RPi.GPIO==0.7.0
  Using cached https://www.piwheels.org/simple/rpi-gpio/RPi.GPIO-0.7.0-cp37-cp37m-linux_armv7l.whl
Installing collected packages: RPi.GPIO
Successfully installed RPi.GPIO-0.7.1

What is interesting also is that when installing RPi.GPIO and specifying version 0.7.0, the CLI returns that 0.7.1 is installed instead, even though it says the 0.7.0 tar package is being downloaded…

Ignoring that and carrying on: there is an error when running pip install -U sangaboard

(.venv) pi@microscope:~ $ pip3 install -U sangaboard --user
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting sangaboard
  Using cached https://files.pythonhosted.org/packages/be/6b/545f59f50a15284748d954416fd22754eae1eae5dbc879621e2ef372f216/sangaboard-0.3.3-py3-none-any.whl
Requirement already satisfied, skipping upgrade: pyserial in /var/openflexure/application/openflexure-microscope-server/.venv/lib/python3.7/site-packages (from sangaboard) (3.5)
Requirement already satisfied, skipping upgrade: future in /var/openflexure/application/openflexure-microscope-server/.venv/lib/python3.7/site-packages (from sangaboard) (0.18.2)
Collecting semantic-version (from sangaboard)
  Using cached https://files.pythonhosted.org/packages/6a/23/8146aad7d88f4fcb3a6218f41a60f6c2d4e3a72de72da1825dc7c8f7877c/semantic_version-2.10.0-py2.py3-none-any.whl
Requirement already satisfied, skipping upgrade: numpy in /var/openflexure/application/openflexure-microscope-server/.venv/lib/python3.7/site-packages (from sangaboard) (1.21.1)
openflexure-microscope-server 2.10.1 requires RPi.GPIO~=0.7.0, which is not installed.
Installing collected packages: semantic-version, sangaboard
Successfully installed sangaboard-0.3.3 semantic-version-2.10.0

Running without the --user tag also gives this error below.

Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/var/openflexure/application/openflexure-microscope-server/.venv/lib/python3.7/site-packages/semantic_version'
Consider using the `--user` option or check the permissions.

The end result is that the stage still isn’t connected.

It is not clear to me how this board is supposed to be powered. In the photos it appears to be powered with a USB-C cable. What is at the other end of this cable? I expect that a phone charger would suffice, but what about plugging it into the raspberry pi itself, assuming that the rpi power brick is beefy enough?

I wish to request that a bit of documentation about the Sangaboard is made available. Especially valuable would be current and voltage ratings, pinouts, schematics, and drawings.

Good point, I forgot the board changes how things are powered. The board is powered via USB-C at 5V and provides power to the Pi, so a single power supply can power the microscope. The motors are power-hungry so a 3A minimum power supply is required for reliable performance. The Pi’s and Sangaboard’s 5V lines are connected, so if the Pi is powered it will power the Sangaboard via the 5V pin which should also work if the power supply used can provide enough current, but it might go over the rated current of the micro USB connector if it’s Pi<4.

Schematics and KiCAD files are at Files · master · Filip Ayazi / sangaboard-rp2040 · GitLab

More documentation and instructions are in the works, but please do ask here if you have any questions.

Hi @letshin,

Below are all steps that I did in my installation of Sangaboard v0.5.1.

I have rPi 3B+, and after flashing Openflexure raspbian, I followed all steps from Serial Port setup in Raspberry Pi OS, including “Disabling the Serial Login Shell” and " Using the PL011 UART port" steps.
Then I followed the steps from @filip.ayazi GitLab
I got permission errors during the first step, so I had to grant group +w permission. I see that Filip already updated the README.md file :slight_smile:
After restarting and further (optional) updating the raspbian, everything works as it should.

In my case, both power lines work correctly, via the Sangaboard v0.5.1 or rPi 3B+.

1 Like

While this will work it is very much not recommended because of the effect of possible failure modes.
It is fairly likely that something connected to the Sangaboard might take a lot of current, for example motor failures or the batches of motors that some people have that take a more current than normal.

Scenario 1: The power supply is plugged into the Sangaboard.
The Sangaboard itself is likely to be able to stand that current without catastrophic damage - the power wires to the outputs are designed for current. The user might notice and correct the fault. While in the high current condition the power supply might not be able to keep at 5V, the voltage might drop a bit. This would mean that the voltage fed through Sangaboard to the Pi drops which the Pi will flag up as low voltage but often will still manage for a time until the fault is corrected.
Result: For medium over-current everything is fine. For large overcurrent the Sangaboard is damaged and/or the Pi has an unexpected shutdown (voltage much too low) which might corrupt the SD card but is unlikely to cause damage to the actual Pi board.

Scenario 2: The power supply is plugged into the Pi.
A high current flows through the Pi power circuit to the GPIO pins. This is not designed as a high current path on the board and is fairly likely to damage the Pi. The Sangaboard itself is likely to be able to stand that current without catastrophic damage. While in the high current condition the power supply might not be able to keep at 5V, the voltage might drop a bit. This would mean that the voltage fed to the Pi drops which the Pi will flag up as low voltage, this might give the user time to spot the impending fault condition and avoid damage, but probably not.
Result: For medium over-current it is likely that the Pi will be permanently damaged, which is costly. For large overcurrent the Pi will certainly be permanently damaged and Sangaboard might be permanently damaged as well.
The high probability of high cost failures mean that this is not recommended.

This is a very good point. In addition to that, Sangaboard has a polyfuse on its USB power input which should be enough to protect it from damage in an overcurrent condition.

I’ve built the required changes into an SD image so that it’s easier to use until they are merged. The image includes the required serial changes, the modified pySangaboard module version and the Sangaboard software extension for controlling illumination and upgrading firmware.

Here are the full image and lite image. With these images, the boards should work out of the box (tested on a Pi 3, I’ll test it on a Pi 4 soon but it should work the same). Please consider these a temporary fix until the changes are reviewed and merged into the official distribution version and when that happens migrate to an official version to get the best experience.

3 Likes

The full image might be corrupted. The lite image worked just fine on a Pi 4 2GB.

Hi @filip.ayazi I have been in Python dependency hell for a couple of weeks trying to release a new OpenFlexure image. Did you persuade this to build using pi-gen, and/or managing dependencies with pipenv or have you done it some other way?

If you’ve got pipenv to re-lock dependencies without breaking, I would love to know how :slight_smile: If you have used another solution, anyone using this image should be aware that it may not be compatible with updates in the future.

You shouldn’t need --user in the virtual environment - this probalby indicates the permissions are wrong. Could you try running:

cd /var/openflexure
sudo chmod -R g+w .
sudo chown -R openflexure-ws.openflexure-ws .

If you try to install sangaboard again (pip install --upgrade sangaboard) this should not encounter permissions problems.

Hi Richard,
I used the openflexure-pi-os repo and added an extra chroot step to stage2a. It took about a day of weird issues but it did build working images using the docker build method.

Extra script run on chroot (including the debug echos) was

#!/bin/bash -e

# Extras
source /var/openflexure/application/openflexure-microscope-server/.venv/bin/activate
/var/openflexure/application/openflexure-microscope-server/.venv/bin/pip3 install --upgrade pip
echo "Remove sangaboard"
/var/openflexure/application/openflexure-microscope-server/.venv/bin/pip3 uninstall -y sangaboard
echo "install dev sangaboard"
/var/openflexure/application/openflexure-microscope-server/.venv/bin/pip3 install -U git+https://gitlab.com/filipayazi/pysangaboard.git@sangaboardv5
echo "install pio"

/var/openflexure/application/openflexure-microscope-server/.venv/bin/pip3 install -U platformio
/var/openflexure/application/openflexure-microscope-server/.venv/bin/pip3 install -U semantic_version

mkdir -p /var/openflexure/extensions/microscope_extensions/
cd /var/openflexure/extensions/microscope_extensions/
echo "download extension"
git clone https://gitlab.com/filipayazi/sangaboard-extension.git
chown -R openflexure-ws:openflexure-ws /var/openflexure/extensions