Buffer board for Raspberry Pi 400: a smart solution
If you have a Raspberry Pi 400, you know that connecting additional hardware comes with risks. The buffer board shown here is a smart solution that offers ESD protection.
Released in November 2020, the Raspberry Pi 400 is actually a Raspberry 4, but integrated into a keyboard, with the GPIO extension connector on the back of the case. There are always risks associated with connecting additional hardware, especially during prototyping. The buffer board we present here is specially designed for the Raspberry Pi 400. It allows interfacing with 3.3V and 5V external logic for all 26 GPIOs, and the level buffers / shifters used for this also provide ESD protection.
Raspberry Pi boards will hardly need to be presented here. Since the introduction of the first version in 2012, they have been the subject (or are part of) many projects in Elektor magazine. We have presented several different hardware and expansion PCB projects for these processor boards. For this project, let’s spoil the suspense right away: the circuit I’m going to travel is nothing new, since its first version was mentioned in 2015 on an Elektor Labs page. In 2018, the design was adapted to the extended 40-pin I / O connector which has been the standard for connecting additional hardware to these processor boards since the introduction of the Raspberry Pi B +. And now this latest version is suitable for one of the newer members of the Raspberry Pi product family – the Raspberry Pi 400.
Very simply, the 400 is a Raspberry 4, integrated into a keyboard. It looks like the once famous computers of the 1980s like the Commodore 64, Sinclair Spectrum, Acorn BBC and others. In terms of specs, the Raspberry Pi is of course much more powerful than its now ancient predecessors, but there is also a striking similarity – the GPIO expansion connector on the back of the case, to which the user can connect externally ( self-designed) material. There are always risks associated with connecting additional hardware, especially during prototyping, and the buffer board shown here prevents the Raspberry Pi from being damaged in the process. Additionally, the buffer board allows interfacing with external 3.3V and 5V logic, and the buffers / level shifters used for this also provide ESD protection.
The scheme of the project (Figure 1 and attached for download) is exactly the same as our post in 2018. The TXS0108E 8-bit voltage buffers / translators used in this project are bidirectional, and each pin of port A and port B has a pull-up resistor. The pull-down resistance of a Raspberry Pi GPIO is typically around 40 to 60 kÎ©. This value is too high to properly lower I / O when the buffer board is plugged in. Please note that with this input configuration, the logic level will not be low; the drop-down menu will not work as expected.
The I / O has separate power pins for the Raspberry Pi side and the outside world, VCCA and VCCB respectively. Each I / O from port A of the TXS0108E has a pull-up resistor to VCCA, connected to the + 3.3V power supply of the Raspberry Pi 400, and each I / O from port B has a pull-up resistor to VCCB. VCCB – for I / O level on K2 – can be set to +3.3 V or + 5 V logic by jumper JP3. Buffer pull-ups have a value of 40 kÎ© when the output is low and a value of 4 kÎ© when the output is high. The outputs of the buffers are therefore in fact open-drain. If, for example, an LED is connected from the output of the buffer to ground, a voltage divider is created when an additional series resistor is used. A resistive load on the output will drop the logic high level. Something to keep in mind!
There are two 0.5A PPTC resettable fuses (F1 and F2) in the power connections between K1 to K2 on the buffer board to protect the +5 V and + 3.3 V power supplies of the Raspberry Pi 400.
For the implementation of an I2C bus to communicate with external hardware, GPIO2 is SDA and GPIO3 is SCL, additional pull-up resistors R1 and R2 can be activated by jumpers JP1 and JP2.
During the startup of the Raspberry Pi GPIO0 (ID_SD) and GPIO1 (ID_SC) are used to read an EEPROM from an I2C HAT (Hardware attached on top). After startup, these GPIOs can be used like the other 26, but care should be taken if an I2C HAT is mounted, the system is not affected. To prevent GPIO0 and GPIO1 from reading during boot, add the following entry to /boot/config.txt:
force_eeprom_read = 0
For more information, see the Raspberry Pi documentation on the config.txt to file.
The printed circuit
The schematic may be old news, but the PCB (Figure 2) is specially adapted for the Raspberry Pi 400. It is a bit smaller than the original buffer board presented in 2018. The Gerber files of this new board are available for download, so you can order it from the PCB manufacturer of your choice. But it is of course much more convenient to buy the fully assembled buffer card in the Elektor Shop.
A right angle receptacle is used for the connector on the Raspberry Pi 400 side of the buffer board (K1) so that it can be inserted into the GPIO header on the back of the case (Figure 3). The connector for buffered I / O is a standard 40-pin male vertical connector (K2). The module size is 55 x 44mm including the K1 receptacle, which protrudes from the edge of the PCB. Compared to the original PCB 150719-1, the two rows of pins of K1 are swapped, because a receptacle is used here. Placing a standard 40 pin vertical male connector for K1 to connect this buffer board to a Raspberry Pi 2, 3 or 4 via a flat cable – like with the old version of the buffer – will not work here.
However, Figure 4 shows that this module can still be used with a Raspberry Pi 2, 3 or 4.
The K2 output connector can be connected to external circuits using a short 40-way ribbon cable with two 2 x 20 female connectors attached, or just a single plug with short soldered wires or single plugs with plugs. son. But be careful pushing a 40-way receptacle onto K2 or unplugging it from the board. Do not do this while the buffer board is still inserted in the Raspberry Pi 400, as a great deal of force is required and the GPIO header of the Raspberry Pi 400 could be damaged.
Buffer card test
Two very simple Python programs for testing the buffer map – borrowed from the old project – are available for download on the site Elektor Labs page of this project. The first is to test all the output GPIOs, Check_all_GPIOs_as_output.py, and the other is to test all input GPIOs, Check_all_GPIOs_as_input.py (210320-11.zip). In Raspbian, just double click on one of the files and the default IDE for Python will open, then select CLASSES to start the test.
When testing GPIOs as an output, a single low current LED connected between a pin and GND is needed to see if an output is working or not. As a series resistor for the LED, a 1.8kÎ© resistor can be used, but the value is not really critical. It will limit the current through the LED if it is directly connected to the positive supply voltage. The outputs are tested sequentially in four groups of up to eight pins each, named IOA through IOD. Due to the open drain output, the voltage across one LED (red) plus resistance is approximately 2.6V, when 5V is selected as the power supply for the outputs (JP3). Connect the resistor plus LED to one of the selected outputs and it will light up for 0.2 seconds. The repetition rate of this pulse depends on the size of the group: 1.6 seconds for groups A to C (each with eight outputs) and only 0.4 seconds for group D (two outputs). Replace “IOA” by one of the other groups in the line
for i in IOA: # leds flash 0.2 s in the IOx group
to test the other groups of outputs. Of course, GPIO0 and GPIO1 (ID_SD and ID_SC) can also be added to one of the groups.
The program for testing input GPIOs uses output I / O to indicate that the input under test is working, GPIO3 by default. Connect a 1.8 kÎ© resistor and an LED between pin 5 (IO3 ‘) of K2 and GND. Only one entry at a time is tested in the source code, to ensure that only this one works as an entry. Change the number in the following line to test another input GPIO:
IN1 = 2 #GPIO selected to test on input
The program also prints the selected GPIO and its input level. Entrances have their pull-ups activated. So, for the connected LED to light up, the current input pin must be connected to ground. Once done, the impression will change. Finally, select another GPIO for the output so that you can also check GPIO3 as the input. Of course there are plenty of ways to test GPIOs, if anyone has a more efficient and / or faster way: please share.
This buffer allows you to connect new hardware to the Raspberry Pi 400 with complete peace of mind, which significantly reduces the risk of damage during experiments. However, reducing the risk by using this buffer card does not mean that nothing can go wrong. In many cases, I won’t hurt to add some common sense too.
Questions about the buffer board?
If you have any technical questions or comments about the buffer sheet or this article, please feel free to email the Elektor Editorial Team at firstname.lastname@example.org.
List of components
R1, R2 = 10 kÎ©, 100 mW, 1%, SMD 0603
C1â¦ C8 = 100 nF, 50 V, 10%, X7R, CMS 0603
IC1â¦ IC4 = TXS0108EPWR, CMS TSSOP-20
K1 = 2 x 20 receptacle, right angle, 2.54mm pitch
K2 = 2 x 20 pin connector, vertical, 2.54mm pitch
JP1, JP2 = 2-pin header, vertical, 2.54mm pitch
JP3 = 3-pin header, vertical, 2.54mm pitch
JP1, JP2, JP3 = shunt jumper, 2.54mm pitch
F1, F2 = resettable fuse PPTC, SMD, polyfuse, 1210L050YR Littelfuse
PCB 210320-1 v1.0