Expansion Shield for RaspberryPi compatible with Arduino. Part 1 - Schematic

RaspberryPi

Boris Landoni

Let’s expand RaspberryPi functionalities with a shield that is compatible with the Arduino pinout and with an onboard analog to digital converter with 16-bit resolution. Further expansions that we will present in the future will allow you to add a DAC, a number of additional digital I/Os and the ability to connect also with non GPIO enabled boards.

Today we present an ADC shield that allows you to add to the possibility for a RaspberryPi to read from analog sensors. As we will see later in the article, this shield can be powered both 12 V and 5 V: it converts the voltage levels from 3.3 V to 5 V for the GPIO digital pins and the for the communication bus of I2C and SPI. In addition, this shield has both a GPIO compliant connector for RaspberryPi and the strips matching the typical Arduino microcontrollers and related shields (Figure 1).

Essentially, with this shield you can use RaspberryPi along with many of the already available Arduino shields or just share some pins to put a RaspberryPi and an Arduino microcontroller in communication.

Expansion Shield for RaspberryPi compatible with Arduino
Figure 1. Expansion Shield for RaspberryPi (GPIO Shield).

DIAGRAM

The GPIO shield has been designed to offer the following options (Figure 2):

  • Extend the functionality of the GPIO with a four-channel differential or single ADC converter, directly on the board and, with an additional shield, with an boost to 16 additional digital I/O plus a 4096 steps DAC.,
  • using 5 V RaspberryPi power supply or external 5 V to 12 V power supplies for compatibility with the Arduino shield;
  • Converting 3.3 V with 5 V, and vice versa, from the I2C and SPI digital I/O buses to meet the electrical requirements of both RaspberryPi and the external sensors and devices
  • having the possibility to use the ADC converter with inputs both in differential and linear mode
  • having a 26-pin connector to connect GPIO to RaspberryPi
  • having connectors for directly connecting an Arduino board and the future shield we are going to release;
  • having connectors for additional external USB/I2C and USB / SPI converters.
Плата расширения для Raspberry Pi, совместимая с Arduino
Figure 2. GPIO Shield Schematic Diagram.

Let’s analyze the wiring diagram to see how the requirements have been put to work in practice. We can start from the power supply, consisting a classical configuration based on the 7805 regulator. The capacitors filter and stabilize the output voltage. The EXT and INT jumpers allow you to choose whether to receive the 5V supply from pin 2 of the GPIO connector or from an external controller through the 7805 regulator. In this way it is possible to avoid an external power supply, when it not necessary. Pin 2 of the RaspberryPi is capable of delivering 500 mA in the A version and and 300 mA in version B. For shields and sensors with greater absorption or with shields requiring higher voltages as, for example, the relay shield, you must use an external power supply.

Now let’s check the level conversion circuits, which are manufactured using two different approaches.

Th conversion of the levels of the digital I/O pins is done using the TBX0108 integrated, an 8-bit level shifter with two power lines.

On the A side, you’find the lines coming from the GPIO RaspberryPi connector dubbed RPI in the diagram, on the B side you see the lines connected IOL and IOH connectores, mapping Arduino I/Os. GND is connected to ground, VCCA and VCCB are the voltage references for the conversion of levels and are connected to 3 V and 5 V lines; OE (Enable) enables the operation of the integrated when placed at high level then is connected to VCCA (Voltage 3.3 V)..

The tableshows the correspondence between the RaspberryPi’s GPIO pins and Arduino pin connectors, the two sections of the table give the correspondences for both the configuration of the rev. 1 both and of the rev. 2.

Arduino
Raspberry Pi rev.1
Raspberry Pi rev.2
D2
GPIO18
GPIO18
D3
GPIO23
GPIO23
D4
GPIO24
GPIO24
D5
GPIO25
GPIO25
D6
GPIO4
GPIO4
D7
GPIO17
GPIO17
D8
GPIO21
GPIO27
D9
GPIO22
GPIO22

In the TBX0108, voltage level conversion works in both directions automatically as the TBX0108 is able to determine the direction of data flows for each I / O pin (autosensing).

For what regards the I2C bus, SPI bus and serial port lines we choose a solution based on the BSS138 MOS- FET, N-channel field effect transistor in enhancement mode with a VGS threshold of 1.3 V.

The level conversion circuit is identical for each signal line. As an example we refer to the SDA line of the I2C bus. The gate (g) of the BSS138 MOS-FET (T7) is connected to the to 3.3 V power supply line, the source (s) is connected to the lower level signal line (3,3 V) and the drain (d) is connected to the higher level line (5 V).

Let’s check now the ADC conversion for which we have chosen the Microchip MCP3428 .

In the ADC conversion we had to accept a little compromise in mapping the pins on the Arduino shield connectors. Arduino has six ADC inputs but two of these, pins A4 and A5 are shared with I2C inputs. In the Arduino environment, the different locations of the pins are programmatically configurable, according to the application. This possibility is not reproducible with the RaspberryPi, which is not natively equipped with ADC converter. In our case, we have adopted the external integrated circuit that communicates with the microcontroller via I2C, engaging related pins and leaving only four pins free for the ADC inputs. On the other hand MCP3428 allows conversions up to 16 bits of precision of both linear and differential signals.

Terminals ranging from CH1+ to CH4+ are respectively connected to pins ranging from A0 to A3 on the AD connector on the Arduino. The terminals ranging from CH1- CH4- are mounted on the A- strip, and can be grounded individually thanks to the J0, J1, J2 and J3 jumpers. In this way it is possible to configure each pin to capture both linear and differential analog signals. SDA and SCL pins are connected on one side to the corresponding Arduino connector pins and on the other side to the xxx of the Txx transistor. The Adr0 and Adr1 pin allow to assign different addresses to the integrated circuit depending on the combination of low and high levels assigned to the pin themselves. In our case we keep both pins at a low level by connecting them to ground so as to set the 0x68 address. Obviously the VCC pin is connected to 5 V and VSS pin is grounded.

The serial bus lines coming from pin 8 and 10 of the GPIO connector also go to the corresponding conversion levels circuits and then to the TXD and RXD pins of the Arduino connector.

Finally, Jxx connector brings the i2C bus lines to connect an external USB/i2C converter. The same applies to the Jxx connector that brings the SPI bus to be able to connect with an external USB/SPI converter.

PCB top view and component placement see on Figure 3.

  Expansion Shield for RaspberryPi compatible with Arduino
Figure 3. GPIO Shield PCB top view and
component placement.

Bill of Materials

R1 – R17
10 к
SMD 0805
R18
470 Ohm
SMD 0805
С1, С3
100 nF
SMD 0805
C2, C4
100 uF 25 V
 
U1
TXB0108PWR
 
U2
MCP3428-E/SL
 
U3
MC7805ABD2T
D2PAK
LED
Led
SMD 0805
T1 – T8
BSS138W-7-F
 
D1
GF1M-E3/67A
 
RST
Microswitch
 

Part 2 - Use the Shield on RaspberryPi

You may have to register before you can post comments and get full access to forum.
EMS supplier