Skip to content

Commit

Permalink
feat: rpi hat board
Browse files Browse the repository at this point in the history
  • Loading branch information
sethfischer committed Feb 25, 2024
1 parent 702374d commit 6bed8fc
Show file tree
Hide file tree
Showing 12 changed files with 936 additions and 2 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/build-pcb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: build-pcb

on: [pull_request, push]

jobs:
build-pcb:
runs-on: ubuntu-20.04

steps:
- name: Checkout
uses: actions/checkout@v4
with:
lfs: true

- name: Checkout LFS objects
run: git lfs checkout

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
poetry --version
- name: Install dependencies
run: poetry install --no-interaction

- name: Create mechanical files
run: poetry run make pcb-mech

- name: Build PCBs
# TODO docker image expects atopile project to be at root of project
uses: docker://ghcr.io/atopile/atopile-kicad

- name: Upload PCB artifacts
uses: actions/upload-artifact@v3
with:
name: pcb-build
path: pcb/build/
if-no-files-found: error
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
.mypy_cache
.pytest_cache
.venv
.vscode/
/_build
/dist
/docs/_build
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ lint-python lint-shell:
test:
pytest

.PHONY: pcb-mech
pcb-mech:
console pcb-outline --board="rpi_hat" > pcb/mech/rpi_hat.dxf


.PHONY: _build/open-graph-card/final-assembly.png
_build/open-graph-card/final-assembly.png:
Expand Down
5 changes: 4 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
sethfischer/rover
=================

|build-status| |lint-status| |test-status| |docs-status| |linkcheck-status|
|build-status| |lint-status| |test-status| |docs-status| |linkcheck-status| |build-pcb-status|


Quarter-scale Mars rover based on the NASA Mars 2020 Mission Perseverance Rover.
Expand Down Expand Up @@ -47,3 +47,6 @@ License
.. |linkcheck-status| image:: https://github.com/sethfischer/rover/actions/workflows/linkcheck.yml/badge.svg
:target: https://github.com/sethfischer/rover/actions/workflows/linkcheck.yml
:alt: Link Check Status
.. |build-pcb-status| image:: https://github.com/sethfischer/rover/actions/workflows/build-pcb.yml/badge.svg
:target: https://github.com/sethfischer/rover/actions/workflows/build-pcb.yml
:alt: PCB build status
39 changes: 39 additions & 0 deletions pcb/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# For PCBs designed using KiCad: https://www.kicad.org/
# Format documentation: https://kicad.org/help/file-formats/

# Temporary files
*.000
*.bak
*.bck
*.kicad_pcb-bak
*.kicad_sch-bak
*-backups
*.kicad_prl
*.sch-bak
*~
_autosave-*
*.tmp
*-save.pro
*-save.kicad_pcb
*.kicad_pcb.lck
fp-info-cache

# Netlist files (exported from Eeschema)
*.net

# Autorouter files (exported from Pcbnew)
*.dsn
*.ses

# Exported BOM files
*.xml
*.csv

build/

# .ato directory
.ato/

# Mechanical files built from source
mech/**
!mech/README.rst
7 changes: 7 additions & 0 deletions pcb/ato.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ato-version: ^0.2.0
builds:
default:
entry: elec/src/rpi_hat.ato:RpiHat
dependencies:
- generics
- rpi-header
14 changes: 14 additions & 0 deletions pcb/elec/src/components/CAT24C32WI-GT3.ato
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
component CAT24C32WI_GT3:
# component CAT24C32WI-GT3
footprint = "SOIC-8_L5.0-W4.0-P1.27-LS6.0-BL"
lcsc_id = "C81193"
mpn = "C81193"
# pins
signal A0 ~ pin 1
signal A1 ~ pin 2
signal A2 ~ pin 3
signal VSS ~ pin 4
signal SDA ~ pin 5
signal SCL ~ pin 6
signal WP ~ pin 7
signal VCC ~ pin 8
55 changes: 55 additions & 0 deletions pcb/elec/src/rpi_hat.ato
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
from "generics/capacitors.ato" import Capacitor
# from "generics/connectors.ato" import Header2Pin # TODO: ImportNotFoundError
from "generics/interfaces.ato" import I2C # TODO: is this needed?
from "generics/resistors.ato" import I2CPullup, Resistor

from "rpi-header/elec/src/rpi.ato" import ConnectorRaspberryPi

from "elec/src/components/CAT24C32WI-GT3.ato" import CAT24C32WI_GT3


module RpiHat:
"""
Raspberry Pi HAT

Conforming with the HAT+ specification dated 2023-12-20.

Raspberry Pi HAT EEPROM circuit diagram
https://github.com/raspberrypi/hats/blob/5f2058bf8eebf43dd19d7218f1e38d14a9835231/eeprom-circuit.png
"""
signal gnd

i2c = new I2C # TODO: is this needed?

# EEPROM write protect pull-down header
# eeprom_wp_header = new Header2Pin # TODO: import Header2Pin results in ImportNotFoundError
# eeprom_wp_header.p2 ~ gnd

# EEPROM write protect pull-up resistor
eeprom_wp_pullup = new Resistor
eeprom_wp_pullup.value = 1kohm +/- 5%
eeprom_wp_pullup.footprint = "R0402"

# EEPROM decoupling capacitor
eeprom_capacitor = new Capacitor
eeprom_capacitor.value = 100nF +/- 20%
eeprom_capacitor.footprint = "C0402"

# I2C pull-up resistors
i2c_pullup = new I2CPullup
i2c_pullup.r_sda.value = 3.9kohm +/- 20%
i2c_pullup.r_scl.value = 3.9kohm +/- 20%

# EEPROM
eeprom = new CAT24C32WI_GT3
eeprom.VSS ~ gnd
eeprom.A0 ~ gnd
eeprom.A1 ~ gnd
eeprom.A2 ~ gnd

# Raspberry Pi GPIO stacking header
rpi_header = new ConnectorRaspberryPi
rpi_header.gnd ~ gnd
rpi_header.i2c.scl ~ eeprom.SCL # TODO: should be rpi_header.GPIO1 (not available in ConnectorRaspberryPi)
rpi_header.i2c.sda ~ eeprom.SDA # TODO: should be rpi_header.GPIO0 (not available in ConnectorRaspberryPi)
rpi_header.power3v3.vcc ~ eeprom.VCC
9 changes: 9 additions & 0 deletions pcb/mech/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
============================
Atopile mechanical directory
============================

Files for this directory can be generated with:

```
make pcb-mech
```
1 change: 1 addition & 0 deletions pcb/metadata/pos-header
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Designator,Value,Package,Mid X,Mid Y,Rotation,Layer
Loading

0 comments on commit 6bed8fc

Please sign in to comment.