Close
0%
0%

Versatile DIY Expansion Board for Raspberry Pi

Designed to bridge the gap between the Pi and the real world.

Public Chat
Similar projects worth following
0 followers
While the Raspberry Pi is a go-to tool for geeks and engineers, off-the-shelf hats don't always meet specific project requirements. I prefer building my own hardware tailored for the task at hand. This is the first (and simplest) of three prototyping boards I designed to bridge the gap between the Pi and the real world.

Key Features: 

  • GPIO Interface: 4 buttons for user input (active low).
  • Load Control: ULN2003 Darlington array driving two 12V relays and status LEDs.
  • Analog Sensing: 2-channel 10-bit ADC (MCP3008) via SPI with input RC filters.
  • Environment: Dedicated 1-Wire header for DS18B20 temperature sensors.
  • Timekeeping: DS1307 Real-Time Clock (RTC) with battery backup and MOSFET level shifters.
  • Industrial Comms: RS485 interface (ST485) with an automatic direction control hack.
  • Integrated Power: Onboard transformer-based PSU (5V for logic, 12V for relays).

Power Supply & Logic

The board features a dual-output transformer. One rail feeds a 5V linear regulator for the RS485 driver and RTC. The second rail provides 12V for the relay coils and the ULN2003. Logic level translation is handled by VT2/VT3 MOSFETs for the I2C bus (3.3V to 5V).

The RS485 "Auto-Direction" Hack

To save GPIO pins, I implemented a transistor-based (VT1) circuit for the ST485 driver. The chip switches to transmit mode only when the UART is actively sending data. Otherwise, it defaults to receiving. This was successfully tested using ModBus RTU at 115,200 baud.

Analog Inputs

For simplicity and academic purposes, I used an MCP3008. While it works great for basic debugging, for high-precision measurements, I recommend isolating the digital and analog grounds and using an external voltage reference.

Software & Prototyping

I used Python scripts to verify the SPI (ADC) and I2C (RTC) functionality. Even with basic coding skills, the hardware proved easy to integrate within the Raspbian environment.

Resources

The project was designed in DipTrace. You can find the schematics, PCB layouts, Bill of Materials (BOM), and Python test scripts in my repository.

  • PCB Software: DipTrace
  • Communication: SPI, I2C, UART (RS485), 1-Wire
  • Language: Python (for testing)

Schematic diagram

RaspberryPi_expansion_card.zip

All project files are included: circuit, pcb, BOM, settings, example sources

x-zip-compressed - 3.77 MB - 12/22/2025 at 20:17

Download

  • 1 × ULN2003 Semiconductors and Integrated Circuits / Misc. Semiconductors and Integrated Circuits
  • 1 × MCP3008 Data Converters / Analog to Digital Converter ICs (ADCs)
  • 1 × DS1307 real time clock
  • 1 × ST485 Interface and IO ICs / RS-232, RS-422, RS-423 and RS-485
  • 2 × 2N7002 Discrete Semiconductors / Transistors, MOSFETs, FETs, IGBTs

View all 6 components

  • Initial logs

    Osman Mazinovan hour ago 0 comments

    Raspberry Pi expansion card

    Project includes: 

    1. Schematic circuit and PCB;
    2. Two scripts written on Python for ADC MCP3008 and DS18B20 temperature sensor;

    Prototyping board project for Raspberry Pi B+, Raspberry Pi II, Raspberry Pi 3, Raspberry Pi 4

    The Prototyping board included:

    1. Real-time clock;

    2. 10-bit ADC with SPI interface;

    3. RS485 hardware bus;

    4. Two 5A, 220V Relays;

    5. Two common collector outputs;

    6. 220V, 50Hz power supply on board;

    7. 4 buttons;

    Archive contents

    * In the BOM folder you can find a bill of all materials needed to make this board.

    * In the Design folder you can find circuit design and PCB design files. To open these files, 
    * you should use the Dip Trace 3.0 CAD or other CAD viewers.

    * Test source codes located in the Source folder.

    * You should configure your Raspbian using the tutorial and commands in Settings.txt.

View project log

Enjoy this project?

Share

Discussions

Does this project spark your interest?

Become a member to follow this project and never miss any updates