Skip to content

Commit

Permalink
chore: rpi hat electronic design
Browse files Browse the repository at this point in the history
  • Loading branch information
sethfischer committed Jul 17, 2024
1 parent 7d0a1ae commit 416877f
Show file tree
Hide file tree
Showing 25 changed files with 1,313 additions and 2 deletions.
9 changes: 8 additions & 1 deletion docs/build-release.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ Prerequisites
* `Python`_ >=3.11, and python-venv.
* `Poetry`_ for Python dependency management.
* `Mayo 3D CAD viewer and converter`_ for exporting PNG images.
* `KiCad EDA`_ v8 (a dependency of `atopile`_) for building PCB manufacturing files.
- ``KICAD8_3D_MODEL_DIR`` should point to version 8.0.3 of `KiCad Packages3D`_.
- ``KICAD8_FOOTPRINT_DIR`` should point to version 8.0.3 of `KiCad Footprints`_.
* Optional:
- `ImageMagick`_ for manipulating images.
- `exiftool`_ for manipulating EXIF headers.
Expand All @@ -54,7 +57,7 @@ Install prerequisites
sudo apt-get install git python3.11 python3.11-venv imagemagick optipng exiftool
Poetry, Mayo, and git-lfs should be installed according to their respective documentation,
Poetry, Mayo, git-lfs, and KiCad should be installed according to their respective documentation,
and be available in your path.


Expand Down Expand Up @@ -114,6 +117,10 @@ Run linters and tests:
.. _`Git`: https://git-scm.com/
.. _`Poetry`: https://python-poetry.org/
.. _`Mayo 3D CAD viewer and converter`: https://github.com/fougue/mayo
.. _`KiCad EDA`: https://www.kicad.org/
.. _`atopile`: https://atopile.io/
.. _`KiCad Packages3D`: https://gitlab.com/kicad/libraries/kicad-packages3D
.. _`KiCad Footprints`: https://gitlab.com/kicad/libraries/kicad-footprints
.. _`ImageMagick`: https://imagemagick.org/
.. _`exiftool`: https://exiftool.org/
.. _`git-lfs`: https://git-lfs.com/
Expand Down
35 changes: 35 additions & 0 deletions src/osr_elec/ato.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,38 @@ ato-version: ^0.2.57
builds:
rpi-hat:
entry: elec/src/rpi-hat.ato:RpiHat
dependencies:
- name: generics
version_spec: '@4e056dec822566592798abb059fd7aad1f970885'
link_broken: false
path: .ato/modules/generics

- name: rpi-header
version_spec: '@d41fc0044336bcf77a9387521e90547570c0bd52'
link_broken: false
path: .ato/modules/rpi-header

- name: ams1117-33
version_spec: '@29f49d7b6b6db24be0282f6c3524f49b71e71b48'
link_broken: false
path: .ato/modules/ams1117-33

- name: https://github.com/sethfischer/headers
version_spec: '@07544e27c71ef3d528268b7dc78d38ce871a4b64'
link_broken: false
path: .ato/modules/headers

- name: https://github.com/sethfischer/ck-js-series
version_spec: '@7966abbac3d54090fe57a52b69af8855d0d54f31'
link_broken: false
path: .ato/modules/ck-js-series

- name: https://github.com/sethfischer/koa-speer-rc-series
version_spec: '@3e76c2d7896923adff9df4924fa15924dd08a057'
link_broken: false
path: .ato/modules/koa-speer-rc-series

- name: https://github.com/sethfischer/combo-power-connectors
version_spec: '@36ce69930fbd2186f9581fc63e33e4254fc89fd4'
link_broken: false
path: .ato/modules/combo-power-connectors
18 changes: 18 additions & 0 deletions src/osr_elec/elec/src/lib/bourns/tvs-diodes.ato
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"""Bourns TVS diodes."""


component Cdsot23Sm712:
"""
CDSOT23-SM712 - Surface Mount TVS Diode.

# Reference

* [CDSOT23-SM712 Surface Mount TVS Diode](https://www.bourns.com/pdfs/CDSOT23-SM712.pdf)
"""
footprint = "Package_TO_SOT_SMD:SOT-23-3"
lcsc_id = "C404012"
mpn = "C404012" # CDSOT23-SM712

signal p1 ~ pin 1
signal p2 ~ pin 2
signal common ~ pin 3
78 changes: 78 additions & 0 deletions src/osr_elec/elec/src/lib/can-controller-trx.ato
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
"""CAN controller and transceiver."""

from "generics/interfaces.ato" import Power, SPI

from "ck-js-series/smd.ato" import CkJs102011jcqn

from "lib/capacitors.ato" import PowerDecouplingCap100nf
from "lib/connectors.ato" import JstGhHorizontalCan
from "lib/leds.ato" import LedIndicatorsCanTtl, LEDIndicatorUser
from "lib/microchip/MCP2517FDT.ato" import MCP2517FDT
from "lib/microchip/MCP2562FD.ato" import MCP2562FD
from "lib/oscillators.ato" import ABM8_20MHzOscillator
from "lib/resistors.ato" import Resistor1608


module CanControllerTrx:
"""CAN controller and transceiver."""
# power
power = new Power
power.voltage = 3.1V to 3.3V
signal gnd ~ power.gnd

spi = new SPI

controller = new MCP2517FDT
controller.power ~ power
controller.spi ~ spi

# controller power decoupling capacitor
controller_power_cap = new PowerDecouplingCap100nf
controller_power_cap.power ~ power

# controller oscillator
oscillator = new ABM8_20MHzOscillator
oscillator.gnd ~ gnd
oscillator.xin.io ~ controller.xin
oscillator.xout.io ~ controller.xout

# user LED on controller GPIO 0
user_led_indicator = new LEDIndicatorUser
user_led_indicator.v_in = power.voltage
user_led_indicator.input ~ controller.gpio0.io
user_led_indicator.gnd ~ gnd

# transceiver
transceiver = new MCP2562FD
transceiver.power ~ power
controller.can_ttl ~ transceiver.can_ttl

# indicator LEDs
can_leds = new LedIndicatorsCanTtl
can_leds.voltage = power.voltage
can_leds.power ~ power
can_leds.can_ttl ~ controller.can_ttl

# transceiver power decoupling capacitor
transceiver_power_cap = new PowerDecouplingCap100nf
transceiver_power_cap.power ~ power

# CAN termination switch
switch = new CkJs102011jcqn
switch.common ~ transceiver.can.CANH

# CAN termination resistor
termination_resistor = new Resistor1608
termination_resistor.value = 120 ohm +/- 5%
termination_resistor.p1 ~ switch.p1
termination_resistor.p2 ~ transceiver.can.CANL

# CAN in connector
can_in = new JstGhHorizontalCan
can_in.can ~ transceiver.can
can_in.power ~ power

# CAN out connector
can_out = new JstGhHorizontalCan
can_out.can ~ transceiver.can
can_out.power ~ power
9 changes: 9 additions & 0 deletions src/osr_elec/elec/src/lib/capacitors.ato
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"""Capacitors."""

from "generics/capacitors.ato" import Capacitor


component PowerDecouplingCap100nf from Capacitor:
"""100nF power decoupling capacitor."""
value = 100nF +/- 20%
package = "0603" # equivalent to 1608
76 changes: 76 additions & 0 deletions src/osr_elec/elec/src/lib/connectors.ato
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
"""Connectors."""

from "generics/interfaces.ato" import CAN, Power

from "lib/interfaces.ato" import RS485


component _Connector:
"""Connector base."""
designator_prefix = "J"


component JstB2bPhKS from _Connector:
"""
JST B2B-PH-K-S top entry 2-pin PH header.

2.0 mm pitch disconnectable crimp style connector.

# Reference

* [PH connectors](https://www.jst.com/wp-content/uploads/2021/09/ePH.pdf)
"""
footprint = "Connector_JST:JST_PH_B2B-PH-K_1x02_P2.00mm_Vertical"
lcsc_id = "C5251182"
mpn = "C5251182" # B2B-PH-K-S

signal p1 ~ pin 1
signal p2 ~ pin 2


component PhoenixPt1x3P3mm5Horizontal from _Connector:
"""Phoenix Contact terminal block 3-way side entry 3.5mm PCB

Phoenix Contact PT 1,5 Series 3.5mm 3-way terminal block.
"""
footprint = "TerminalBlock_Phoenix:TerminalBlock_Phoenix_PT-1,5-3-3.5-H_1x03_P3.50mm_Horizontal"
lcsc_id = ""
mpn = "" # 1984620

signal p1 ~ pin 1
signal p2 ~ pin 2
signal p3 ~ pin 3


component JstGhHorizontalCan from _Connector:
"""
UAVCAN/CAN Micro connector.

JST GH connector Header Surface Mount, Right Angle 4 position 1.25mm.

# Reference

* [GH connectors](https://www.jst-mfg.com/product/pdf/eng/eGH.pdf)
"""
footprint = "Connector_JST:JST_GH_SM04B-GHS-TB_1x04-1MP_P1.25mm_Horizontal"
lcsc_id = "C189895"
mpn = "C189895" # SM04B-GHS-TB(LF)(SN)

can = new CAN
power = new Power
signal gnd ~ power.gnd

power.vcc ~ pin 1
can.CANH ~ pin 2
can.CANL ~ pin 3
gnd ~ pin 4
gnd ~ pin MP


component Rs485Connector from PhoenixPt1x3P3mm5Horizontal:
"""RS-485 board to wire connector."""
signal gnd ~ pin 3

rs485 = new RS485
rs485.a ~ pin 1
rs485.b ~ pin 2
8 changes: 8 additions & 0 deletions src/osr_elec/elec/src/lib/fiducials.ato
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"""Fiducial markers."""


component Fiducial0mm75Mask1mm5:
"""Circular Fiducial, 0.75mm bare copper, 1.5mm solder mask opening (Level B)."""
designator_prefix = "FD"
footprint = "Fiducial:Fiducial_0.75mm_Mask1.5mm"
exclude_from_bom = True
74 changes: 74 additions & 0 deletions src/osr_elec/elec/src/lib/headers.ato
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
"""Headers."""

from "generics/interfaces.ato" import GPIO, I2C, Power, UART


component _Header:
"""Header base."""
designator_prefix = "J"


component PinHeader1x02P2mm54Vertical from _Header:
"""1x2 2.5mm pitch vertical pin header."""
footprint="Connector_PinHeader_2.54mm:PinHeader_1x02_P2.54mm_Vertical"
lcsc_id = "C5360898"
mpn = "C5360898" # PZ2.54-1*2

signal p1 ~ pin 1
signal p2 ~ pin 2


component PinHeader1x03P2mm54Vertical from _Header:
"""1x3 2.5mm pitch vertical pin header."""
footprint="Connector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_Vertical"
lcsc_id = "C2894926"
mpn = "C2894926" # PZ254-1-03-Z-8.5

signal p1 ~ pin 1
signal p2 ~ pin 2
signal p3 ~ pin 3


component PinHeader1x05P2mm54Vertical from _Header:
"""1x5 2.5mm pitch vertical pin header."""
footprint="Connector_PinHeader_2.54mm:PinHeader_1x05_P2.54mm_Vertical"
lcsc_id = "C3328227"
mpn = "C3328227" # M20-9990546

signal p1 ~ pin 1
signal p2 ~ pin 2
signal p3 ~ pin 3
signal p4 ~ pin 4
signal p5 ~ pin 5



component PinHeaderUartTHT from PinHeader1x03P2mm54Vertical:
"""UART pin header."""
uart = new UART

uart.gnd ~ pin 1
uart.tx ~ pin 2
uart.rx ~ pin 3


component PinHeaderI2cTHT from PinHeader1x05P2mm54Vertical:
"""I2C pin header.

Follows Pimoroni Breakout Garden specification.
"""
i2c = new I2C
power = new Power
int = new GPIO

signal gnd ~ pin 1

int.io ~ pin 2
int.gnd ~ gnd

power.vcc ~ pin 5
power.gnd ~ gnd

i2c.sda ~ pin 4
i2c.scl ~ pin 3
i2c.gnd ~ gnd
6 changes: 6 additions & 0 deletions src/osr_elec/elec/src/lib/interfaces.ato
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"""Interfaces."""


interface RS485:
signal a
signal b
Loading

0 comments on commit 416877f

Please sign in to comment.