REWORK README WIP

This commit is contained in:
jonny 2025-01-23 13:38:40 +01:00
parent e845555063
commit 820e4af1a9

296
README.md
View File

@ -1,149 +1,195 @@
A Raspberry Pi-compatible PCB that extends the GPIO header with protected I/O, relays, and various features for versatile use in prototyping and project development.
# Raspberry Pi Extension board
A custom PLC-like system based on the Raspberry Pi.
With a custom interface board a raspberry pi is extended with protected I/O, bus systems, analog inputs and Relay or PWM outputs. All components including a display are housed in a custom designed enclosure.
The project is intended for versatile use in prototyping and project development.
---
# Notes
## interface-board issues noticed when soldering
- [x] digital in TVS diode footprint: dia is larger -> rotate one/space + 1.5mm drill
- [x] make diodes pwm larger hole
- [x] make pitch buzzer larger
-
## interface-board issues at first test
- analog leds vs terminal: CH0 and CH1 swapped (first, second terminal)
-> renamed nets and added notes
- analog leds vs terminal: CH2 and CH3 swapped (third fourth terminal)
-
- CH1 and CH7 led on
### Photo of all hardware components
<p align="center">
<img src="doc/photos/all-components.jpg" alt="All Components (Disassembled)" width="75%"/>
</p>
## Power supply board
FIXME: barrel-connector wrong polarity
-> change housing (connected via wires)
-> fix layout, schematic
---
# RPI Specs (Zero, 3+)
- Available (old) Pi: Raspberry Pi 2 Model B v1.1
- GPIO
- Low: 0.9V
- High: 1.6V
- Input current: 5uA
- Input capacitance: 5pF
- Output Current +-17mA
- Pullup / Pulldown 50-65k
- EEPROM GPIO0 GPIO1, leave unused
# Repository Content
- **KiCad Projects**: 3 KiCad projects with schematics and PCB layouts for the custom pcbs created.
- **Housing**: Custom enclosure design for PCBs and Raspberry Pi created in FreeCAD.
- **Software/Firmware**: Python scripts for operating and testing the PCB features (WIP).
# Feature Ideas
- [x] Temperature control
- fan
- auto turn on
- temp sensor
- ~~turn on via gpio~~
---
## Supply
- Input protection
- [x] TVS
- [x] reverse polarity (polyfuse will trigger)
- [x] Fuse (5A polyfuse)
- [x] buffer
- [x] Pass through power supply
- [x] 3.3V, 5V, 12V, 24V Regulator
# Features Overview
This project provides:
- Protected GPIO I/O for Raspberry Pi.
- Various analog inputs
- Flexible power supply options. (3.3 V, 5 V, -5 V, 12 V, 24 V outputs)
- Relay and MOSFET control.
- Integrated LEDs for status indication.
- RS485, I2C, SPI, and UART bus communication.
- [x] power by barrel connector (24V 5A)
- ~~power by usb~~ [not allowed]
- ~~Switch between power by USB or power supply?~~
- ~~power by battery~~ [dropped]
- liion cell connector
- BMS / charge controller
- measure battery voltage
- USB charging port
Detailed features of each PCB are described in the respective sections below.
---
# Designed PCBs
## 1. **Raspberry Pi Interface Board**
This board connects to the Raspberry Pi via a 40-pin ribbon cable and provides protected GPIO extensions and versatile input/output features.
### Photo
<img src="doc/photos/rpi-interface-board.jpg" alt="Raspberry Pi Interface Board" width="60%"/>
### Features
**Inputs**:
- **8x Digital Inputs**:
- Wide continous voltage range (-1.7V to 120V), idea: compatible with 3V and 24V devices.
- TVS diodes for ESD and spike protection.
- Reverse polarity protection
- Isolated with optocouplers.
- Optional low-pass filters (toggle via DIP switches).
- **8x Analog Inputs
- Different fixed range inputs:
- 2x 0 - 3.3 V
- 2x 0 - 5 V
- 1x 0 - 12 V
- 1x 0 - 24 V
- 2x 0 - 20 mA
- Overvoltage protection with clamping diodes.
- Optional low-pass filters (toggle via DIP switches).
**Outputs**:
- 1x onboard buzzer.
- 2x 16A relays.
- 2x high-power MOSFETs (N-channel, max 55V, 33A continuous, 160A pulsed).
- 8x digital outputs (via shift register):
- Low-power (30mA push-pull) and high-power (500mA open-drain) outputs.
- Buzzer and relays connected to channels 6-8, with enable/disable switches.
- Note: Outputs are **not short-circuit proof**.
**General**:
- WAGO spring-loaded terminals for easy wiring.
- JST connectors for external LEDs for all inputs and outputs indicate the current pin state.
**Bus Communication**:
- RS485 (TVS protection, idle pullup/pulldown, 120Ω terminator).
- UART (unprotected).
- I2C (TVS diodes, 2.2k pullups).
- SPI (unprotected).
Note: Either RS485 or UART can be used at the same time (select with jumpers)
### Schematic and Layout
<p align="center">
<a href="pi-interface-board_v1.0/export/schematic_interface-board.pdf">
<img src="pi-interface-board_v1.0/export/schematic_interface-board.svg" width="49%" alt="Schematic"/>
</a>
<img src="pi-interface-board_v1.0/export/layout_interface-board.png" width="49%" alt="PCB Layout"/>
</p>
## IO
- Input
- GPIO
- [x] wide voltage range (-1.7 to 120V)
- [x] TVS
- [x] reverse polarity (-1.73V max)
- [x] Low pass filter
- [x] Optocoupler input
- [x] ADC
- external IC
- ~~multiplexer?~~
- protection
- scale input voltage
- fixed inputs: 24V 12V 5V 3.3V
- 20mA input
- ~~trim potentiometer?~~
- Output
- [x] Relay
- [x] Mosfet
- [x] Optocoupler output
- [ ] GPIO with over current protection
- [ ] GPIO level shift (24V output)
- [x] PWM pins
- [x] shift register
- [ ] DAC
- [x] LEDS indicate I/O state
- [ ] Testpoints
- [x] ESD protection (tvs diodes uart, i2c...)
---
## Bus
- [x] UART/RS485
- [ ] RS232 Connector
- [x] I2C Pullup
- [x] SPI
- [ ] CAN
- ~~Serial to usb (if Arduino)~~
- ~~OWB default GPIO4~~
## 2. **Power Supply Board**
Creates different voltages from supplied 24V. Supply for the rpi interface board as well as several terminals for variable use (connect sensors, devices etc to the housing)
### Photo
<img src="doc/photos/power-supply-board.jpg" alt="Power Supply Board" width="50%"/>
### Features
**Input**:
- 24V 5A barrel plug.
- 5A self-resetting polyfuse.
- Reverse polarity protection.
**Output**:
- 3.3V, 3A (buck converter).
- 5V, 5A (buck converter).
- -5V, 20mA (charge pump).
- 12V, 3A (buck converter).
- 24V (supply voltage filtered).
**Fan Control:**
- 2x connector for 10k NTC.
- Threshold adjustable (trim poti).
- Hysteresis adjustable (trim poti).
- select between 5V or 12V Fan.
**General**:
- Spring-loaded terminals for each voltage.
- Combined internal terminals for all voltages.
### Schematic and Layout
<p align="center">
<a href="power-supply-board_v1.0/export/schematic_power-supply.pdf">
<img src="power-supply-board_v1.0/export/schematic_power-supply.svg" width="55%" alt="Schematic"/>
</a>
<img src="power-supply-board_v1.0/export/layout_power-supply.png" width="44%" alt="PCB Layout"/>
</p>
---
## 3. **LED Boards**
Small PCBs with LEDs, resistors, and mounting holes for housing indicators.
### Photo
<img src="doc/photos/led-boards.jpg" alt="LED Boards" width="60%"/>
### Boards
1. 2x 5mm LEDs for relays.
2. 2x 5mm LEDs for PWM outputs.
3. 8x 3mm yellow LEDs for analog inputs.
4. 8x 3mm orange LEDs for digital inputs.
5. 8x 3mm red LEDs for digital outputs.
### Schematic and Layout
<p align="center">
<a href="led-boards_v0.1/export/schematic_led-boards.pdf">
<img src="led-boards_v0.1/export/schematic_led-boards.svg" width="48%" alt="Schematic"/>
</a>
<img src="led-boards_v0.1/export/layout_led-boards.png" width="51%" alt="PCB Layout"/>
</p>
## UI
- Input [dropped]
- Buttons
- DIP switches?
- Temperature sensor
- Encoder
- Potentiometer
- Output
- [ ] Display [RPI display pending]
- [x] Buzzer
- [x] LEDS
---
## Mechanical
- [x] Barrel plug (24V 3A supply)
- ~~Screw terminals~~
- [x] spring loaded?
- ~~pass through all pins?~~
## Housing
- RPI ports
- banana sockets for power out
- screw terminal exposed
- buttons, leds: need to open up?
- BNC? []
# Software/Firmware
Python code for operating the extension PCBs (e.g., GPIO pins, shift registers, ADC, and bus communication). This section is a work in progress (WIP), and example scripts will be added as development continues.
## Other
- Extension board with multiplexer
- Breadboard compatible?
- SD Card
- ~~Onboard MCU for standalone use?~~
- ~~separate bought MCU via i2c for additional GPIO, DAC, ADC in one~~
---
## Questions
- what analog input ranges (Voltage, Count)
- RS232 RS485 SPI, IIC actually necessary? examples
- CAN to second SPI?
- 8x shift register outputs, 0.5A open drain or 7mA tristate
- 2x PWM 30A enough?
- max used PWM freq? (drop opto if >80khz)
# Housing
Custom-designed enclosure includes:
- Ports for Raspberry Pi.
- Banana sockets for power outputs.
- Exposed screw terminals.
- Openings for buttons and LEDs.
- Mounts for all PCBs and wiring.
<img src="doc/images/3d-model_housing.png" width="51%" alt="3d-model"/>
---
# Dropped Features
The following ideas were considered but not implemented:
- UI Input Elements:
- Buttons, DIP switches, temperature sensors, encoders, or potentiometers.
- USB or battery-powered operation:
- Battery packs with BMS and voltage measurement.
- Li-ion cell holders.
---