Support Forum

Share your projects and post your questions

Register   or   Sign In
The Forum

Multiple expansion board power requireemnts

816 Views - Created 01/05/2021

01/05/2021

Posted by:
SteveC

SteveC Avatar

Hi

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)?

01/05/2021

Posted by:
andrew

andrew Avatar

Location:
United Kingdom

andrew Twitter  andrew Website  

Hi

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.

02/05/2021

Posted by:
SteveC

SteveC Avatar

OK Andrew, many thanks for the quick and comprehensive response. There is one more query though - both IO Pi's currently fitted are input only so no problem according to the above but I may add another IO Pi as outputs to drive a relay board, in which case I think it safer to use the external PS to this IO board.

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?

02/05/2021

Posted by:
andrew

andrew Avatar

Location:
United Kingdom

andrew Twitter  andrew Website  

There shouldn't be any issue with having two IO Pis powered from the Raspberry Pi and the third powered externally.

03/05/2021

Posted by:
SteveC

SteveC Avatar

Thanks for that. Have to say the quality and speed of your response is excellent.

18/06/2022

Posted by:
Railway Pi

Railway Pi Avatar

Hi there, I also have a question about external power to ADC Pi v3. I have 1 X IO Plus and 2 X ADC Pi connected to a Pi3B, the IO Plus using an external power supply, the ADC Pi's drawing power from the RPi. I can read all 16 ADC channels. When I add a 3rd ADC Pi, I consistently get read timeout errors from that board but the other two read fine. I suspected a power issue. Is power likely to be the cause? If so, can the ADC Pi be powered externally? If not, what other likely causes are there? Thanks in advance

18/06/2022

Posted by:
Railway Pi

Railway Pi Avatar

I should also mention that all four boards show correctly from i2cdetect -y 1

18/06/2022

Posted by:
andrew

andrew Avatar

Location:
United Kingdom

andrew Twitter  andrew Website  

Hi

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.

18/06/2022

Posted by:
Railway Pi

Railway Pi Avatar

Thank you! I'll try the 3rd board on its own when I get a minute and report back. All of the boards are being used in the same python application, they're being used for block detection on a model railway - there's every chance I'll need a 4th board later too. Assuming the 3rd board works alone, I'll give the extented timeout a go. Out of interest, would there be any benefit to switching to a RPi 4 with its faster performance? I was considering switching to C or C++ code too, would that be any benefit? Thanks again.

18/06/2022

Posted by:
andrew

andrew Avatar

Location:
United Kingdom

andrew Twitter  andrew Website  

The performance gains from switching to an RPi 4 or C/C++ depends mainly on your application.

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.

19/06/2022

Posted by:
Railway Pi

Railway Pi Avatar

Ok, I got there in the end. Firstly I changed my code so that I was only initialising the 3rd board - same read timeout. Next I changed my code so that I was only using the 2nd board and I connected the sensors to that board and it works - so the issue isn't with the sensors. Next I built up and configured a 4th board and swap tested for the 3rd board - same error. This eliminates the board as the source of the issue. Finally I went back to the 3rd board and swapped all 5 jump leads connecting to the RPi and everything is working as it should now. Thanks for your help and the tips on RPi4 and C or C++.

Sign in to post your reply

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.