Working with sangaboard hardware/library

hey guys, hope you’re all doing well.

I’ve been tasked with making the project compatible with a raspberry 5 and so far it has been rough due to my lack of understanding of the inner workings of the sangaboard.

I’ve recently got my hands on the sangaboard.py lib and reading through it rendered me able to move the motors, do emergency stop etc etc, but I can’t for the life of me understand how to send inputs thru the 5V/GND used for the light.
I’m sure this is due to my lack of knowledge regarding raspberries and electronics, and trying to read through the git repository in order to get a better understanding hasn’t helped me too much as I can’t find where the lights are controlled.

Thank you for your help and sorry for the horrendous english
Good day to y’all

I’m not an expert, I’m just another user of the software, but I think I can answer your question.

In terms of the software, I think it would be relatively straightforward. The primary means of communication between the Raspberry Pi and the sangaboard is through a serial port (two pins, tx and rx). You probably don’t need to write any code to get things working on the pi 5, you’ll just need to make sure the serial port is enabled.

Can you post a link to the Python library you’re talking about? I haven’t used Python library to control the sangaboard, but I have written them before. It mostly involves sending a string to the sangaboard which contains a command and then reading the response (which is usually a single line of text). For example, to change the amount of current being supplied to the LED (assuming you’ve got it connected to the constant current pins) you send “led_cc 0.5\n” (or “led_cc 0.0\n”, “led_cc 1.0\n”, etc) to the serial port. For reference, here’s the implementation for the LED driver: src/modules/illumination/illumination.cpp · master · Filip Ayazi / sangaboard-firmware · GitLab

You’d want to check that the pins between the rpi4 and the rpi5 are compatible. I think they are, but you should probably double check. You don’t want to fry your rpi 5 by connecting it to the sangaboard! Assuming that they are compatible, the next thing I’d look at is power consumption. I’m not sure that the sangaboard will be able supply enough power to the rpi 5 as well as to the motor drivers it has. The rpi 5 uses more electrical current than the rpi 4, so you may run into trouble there.

2 Likes

Hello, thank you for your anwser it made me able to understand how it works and why I needed to use the AMA0 serial port.
I’ll try to explain to the best of my capacity.

The library I’ve been using till now is the sangaboard lib from myPi (pip) link to the lib rereading it after your message I see where the query are done and the message are sent ty.

As for power consumption I had no issues with the sangaboard + rasp5 since the power supply is first connected to the sangaboard, but now I’m testing with the AI Module (as I need to analyse the images) and I think it will but I’ll find a solution.

I’m repeating myself but really thank you for your help it has been clear and very helpful,
have a wonderful day

Sure thing. Actually, I’ve been wondering this myself since I also have an rpi 5. I have the Hailo AI accelerator, is that the same one you have? If you figure out how to get them all working, feel free to post how you did it. I haven’t tried but I’m assuming, like you said, that power consumption might become an issue.

For power, I have seen people powering both the Pi and the Sangaboard USBC power connectors at the same time, which would give plenty of power capacity. However I don’t think that there is any protection in that case if the two power supplies are at slightly different voltages and start to fight eachother. It would be better to isolate the 5V connection between the Sangaboard and the Pi in the 40-pin GPIO connector if you need separate power.

Yup I’m currently working with the Hailo-8L AI accelerator with the M.2 HAT+.Personally I’ve had some roadblocks such as needing some gpio extenders as the rasp5 pins aren’t long enough to connect the AI module and the sangaboard, reworking the openscad files to fit everything together and a 300mm camera cable. I’ll keep you updated if any further issues are met.

1 Like

I’m self taught in electronics so my understanding is fragile, I’m sorry if that’s a dumb question.
How would you go about isolating the connection ? like not connecting the rasp 5V pin to the sangaboard’s ?

Yes. I am not recommending it as a great option.

There is not a neat way to do it built into the Sangaboard. It would mean finding and cutting the 5v trace to the connector on the Sangaboard (if there is a nice place to do that), or removing the internal connector parts for the two 5v connections in the 40-pin connector on the Sangaboard. The simplest, but most destructive would be to clip off the two 5v pins from the connector on your nice new Pi5 :open_mouth:

If you are using a 40-pin riser, cutting pins out of that is least destructive.

It may be necessary to isolate the two 3.3v supplies as well. I don’t know whether Sangaboard connects them, I think not.

Always make sure that 0v gnd is still connected

Sangaboard talks to the Pi over serial, it will also listen over USB serial if you want to play with it that way. To control illumination I recommend using the version of the pysangaboard module from Files · sangaboardv5 · Filip Ayazi / pySangaboard · GitLab , the changes are not yet merged but it contains support for the illumination module giving you a python API for changing illumination states.

As for completely separating the power, this is not easy to do on the Sangaboard. One option is to separate motor power, leaving only the LEDs and logic on the same connection (CC led is up to 100mA, PWM leds could be run also be run from a different supply if needed). There is cuttable trace on the bottom of the board which isolates motors from the main 5V rail and can be powered via the Vmot pin on the expansion board header on the right.

However, I think you should be able to provide enough power through the Sangaboard, the USB-C is rated to 5A, I tested a Sangaboard and 2 high power LEDs with a raspberry pi and it worked (I didn’t run it for long due to heating on the LEDs but it didn’t give undervoltage warnings).

3 Likes