Modular HAT

This documentation includes hardware info, installation guidelines and sample code for your hardware.

Overall Info

Modular HAT is a sensor connectivity board with two modular sensor slots and six Grove System compatible ports.



  • I2C Port: Provides I2C connectivity with 'SCL', 'SDA', '3.3V' and 'GND' pins.

  • Serial Port: Provides UART connectivity with 'RX', 'TX', '3.3V' and 'GND' pins.

  • Digital Ports: Provides total 4 GPIO pins on 2 ports.

    • Left Port: 'GPIO21', 'GPIO22', '3.3V' and 'GND' pins.

    • Right Port: 'GPIO23', 'GPIO24', '3.3V' and 'GND' pins.

  • Analog Ports: Provides total 4 Analog inputs on 2 ports with single-ended and differential measurement options.

    • Left Port: 'AN1', 'AN2', '3.3V' and 'GND' pins.

    • Right Port: 'AN3', 'AN4', '3.3V' and 'GND' pins.

  • Modular Slot: This slot exposes 3.3V power, I2C, interrupt, PWM, analog input and a GPIO pin with a plug-and-play interface.

  • Stackable Raspberry Pi Connector: Connects the board to the Raspberry Pi. The connector is stackable.

I2C, Serial, Digital and Analog ports are 3.3V Grove System compatible. Pins on these ports are 3.3V tolerant.


  • Two modular sensor slots (with I2C, GPIO, PWM, Analog, Interrupt)

  • Grove System compatible ports (1xI2C, 1xUART, 2xGPIO, 2xAnalog)

  • Analog-to-Digital Converter over the SPI CS0.

  • 4Ch single-ended or 2Ch differential analog inputs are available.

  • Board temperature reading on the ADC IC.

  • Stackable Raspberry Pi header.

  • ID EEPROM for Raspberry Pi HAT specification compliance.


Modular HAT's specifications are as follows:

TI ADS1018 Analog-to-Digital Converter

Measures 4x analog inputs and internal temperature. Distributed to 2 Grove System compatible ports and the modular slots. (Modular slot 1 uses the analog input 1 and modular slot 2 uses the analog input 2.)

  • 4 Channel Single-Ended Sampling:

    • 0V to 3.3V measurement with 1/1650 resolution. (2.000mV)

    • 0V to 2.048V measurement with 1/4096 resolution. (1.000mV)

    • 0V to 1.024V measurement with 1/4096 resolution. (0.500mV)

    • 0V to 0.512V measurement with 1/4096 resolution. (0.250mV)

    • 0V to 0.256V measurement with 1/4096 resolution. (0.125mV)

  • 2 Channel Differential Sampling:

    • Same of above resolutions.

  • Internal Temperature Measurement:

    • Used for system-level temperature monitoring or cold-junction compensation for thermocouples.

    • 2C max error.

  • Programmable Continuous Sampling:

    • 128 to 3300 samples per second.

    • High speed SPI bus.

This device uses the CS0 line of the SPI bus.

I/O Ports

Modular HAT has 6 Grove System compatible ports.

  • Serial Port: Provides RX, TX, 3.3V and GND pins for UART (serial) communication.

  • I2C Port: Provides SCL, SDA, 3.3V and GND pins for I2C and SMBus communications.

  • 2x Digital Port: Provides a total of 4 GPIO and power pins distributed in 2 ports.

  • 2x Analog Port (Mentioned above): 4 Channel analog inputs connected to the Analog-to-Digital Converter.

All digital and analog pins are 3.3V tolerant. Do not sink more than 50mA from the 3.3V power pins.

GPIO Pins on I/O sockets are connected to Raspberry Pi's GPIO 21, 22, 23 and 24 pins respectively.


This memory holds manufacturer information, GPIO setup and device tree. The OS loads required drivers and configures GPIO pins according to the data on this memory. ID EEPROM is required for Raspberry Pi HAT specification compliance.

Do not try to overwrite or erase the contents of the EEPROM as it may block the device's operation.

The EEPROM is connected to the I2C1 bus and requires root privileges for user access.


To get maximum performance from your hardware, please make sure you'll meet the following requirements.


We designed Modular HAT to work with Raspberry Pi. Alternatively, you may wish to use any Raspberry Pi pin compatible device as an host.

Operating System

You can use Modular HAT with any operating system that supports I2C communication and GPIO access. We officially support Raspbian operating system.

Development Environment

Modular HAT's Raspbian library supports Python. You can write Python code in any text editor. We recommend using Visual Studio Code as an editor.


Select your operating system for set-up and programming guidelines.

pageRaspberry Pi OS

Last updated