Multiple expansion board power requireemnts
816 Views - Created 01/05/2021
I have 2 x ADC Pi and 2 x IO Pi boards stacked on a Pi 3B+.
Plus there are 4 x 8-channel optoisolators to step down the 24V sensor inputs to the IO Pi's
16 x 20k series resistor inputs to step down the 0-10V analogue sensors for the ADC channels.
All seem to be working well and I have tested each pin (48!) individually and a few hooked up a the same time.
Now I want to package the whole assembly but am concerned about power.
I intend to have a single 5V supply powering the pi, both IO Pi's and the Optoisolator boards.
As I understand it the IO Pi can be externlly powered if the 5V solder link is removed
Question is for the ADC Pi's. There are 5V and GND pins on each board but as far as I can see these are taken directly from the Pi.
Can these be used for an external power suppply as well or would that somehow affect the 5V on the Pi GPIO.
Plus, what would be a suitable power supply if each board had all pins active (ie max current draw)?
The ADC Pi will draw less than 10mA when sampling the inputs.
For the IO Pi, the maximum current draw for each MCP23017 IO chip is 25mA per channel or 125mA in total so the overall maximum for both chips would be 250mA plus 5mA for the level shifter and pull-up resistors so 255mA max. This would only be when the IO channels are set as outputs and you are drawing the full 250mA from external devices. If you are using the IO Pi for inputs the current should be less than 20mA with the internal pull-up resistors enabled.
Overall the two ADC Pi and two IO Pi boards will be drawing less than 100mA so there shouldn't be any issue with running them from the Raspberry Pi 5V on the GPIO header. You shouldn't need to use external power for the IO Pi unless you are trying to use all of the pins as outputs and using the full 250mA capacity.
If you use a single power supply for the whole project I would recommend splitting the output with one pair of 5V and ground wires connected to the Raspberry Pi which will in turn power the ADC Pi and IO Pi boards through the GPIO header and separate wires powering your optoisolators and sensors.
The Raspberry Pi website has a list of the different Pi models with the current draw and recommended power supply current capacity for each one. The Pi 3+ has a recommended power supply current of 2.5A for the bare Pi before you start adding expansion boards.
You will need to measure how much current your optoisolators and analogue sensors use but as an example if the total current draw for the isolators, sensors, ADC Pis and IO Pis was 500mA I would recommend doubling that to 1A to give you plenty of safety margin and add it to the Raspberry Pi current draw of 2.5A to give you a 3.5A power supply rating. If you think that you might expand your project later on you can always get a power supply with a higher current rating.
I normally use RS Components for my power supplies. They are a bit more expensive than Amazon or eBay but their products tend to be of higher quality and they do next-day delivery.
Is there an issue with say 2 IO Pi's (inputs) being powered by the Pi GPIO and the other (output) board being externally powered if they are all on the same stack?
Three ADC Pis should draw less than 30mA from the Raspberry Pi 5V rail so power should not be the cause of your problems.
If you connect the third ADC Pi to the Raspberry Pi on its own do you still get the timeout error or is it only when four boards are connected?
Are you accessing all of the boards from a single application or using different applications for each device?
You could try increasing the timeout time for the ADC reads and see if that helps fix the issue. If you are using the python library you would need to change the following code on line 316 of the ADCPi.py file.
timeout_time = time.time() + (100 * seconds_per_sample)
Try changing 100 to a higher value such as 500 or 1000 and see if that helps.
With the ADC Pi the sample rate is limited by the ADC chip so switching to a faster Raspberry Pi or using C/C++ will give you only a small performance gain in the time it takes to process the ADC sample after it has been read from the ADC Pi.
With the IO Pi, you will get a slightly better response time reading and writing to the IO pins using C/C++. Changing the I2C bus speed from the default 100KHz to 400KHz will give a bigger performance gain as you will be reducing the time it takes to transfer the data on the I2C bus.
You can test the speed difference on the ADC Pi by using the speed test demos that are in the ADCPi demo folders for C, C++ and Python libraries in our GitHub repositories.
The main performance gains when switching to an RPi 4 or C/C++ will be in other parts of the application, for example drawing a GUI to the display. C and C++ will be faster than Python as they are compiled languages so they will have lower overheads in terms of CPU cycles and memory. You just have to be more careful with your memory management as C and C++ make it far easier to create memory leaks and buffer overruns.
Note: documents in Portable Document Format (PDF) require Adobe Acrobat Reader 5.0 or higher to view, download Adobe Acrobat Reader or other PDF reading software for your computer or mobile device.