molecule
AFS_Adom flight computer molecule
Public Unreviewedby ae007
Active fin stabilization flight computer for a sounding rocket, a clean-room AI redesign of the Rice Eclipse AFS board: RP2350B, ICM-45686, KX134-1211, MMC5983MA, MS5611, TMP117, INA219A, 8 servos, 2S LiPo, USB-C; 4-layer Adom molecule, designed end to end by Claude through KiCad and adom-aiflow
main
ae007
Project page: AFS_Adom rev A (Rice Eclipse AFS clean-room AI redesign): highlight reel and narrated process video with…
cbe460e
7d ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
"""Create the project symbol library AFS_Adom.kicad_sym from datasheet pin tables."""
import sys
sys.path.insert(0, '/tmp/claude-1001/-home-adom-project/8819fb5f-c2c6-4524-9528-99428cd6b88e/scratchpad/gen')
from kicad_gen import q, dump, fmt
F = ['effects', ['font', ['size', '1.27', '1.27']]]
def pin(etype, x, y, ang, name, num, length=2.54):
return ['pin', etype, 'line', ['at', fmt(x), fmt(y), str(ang)], ['length', fmt(length)],
['name', q(name), F], ['number', q(num), F]]
def symbol(name, ref, value, footprint, datasheet, desc, left, right, top, bottom, keywords=''):
"""Sides are lists of (number, name, etype); pins spaced 2.54 mm."""
n_lr = max(len(left), len(right))
n_tb = max(len(top), len(bottom))
H = max(n_lr + 1, 4) * 2.54
W = max(n_tb + 1, 5) * 2.54
W = max(W, 20.32)
hw, hh = W / 2, H / 2
pins = []
for i, (num, nm, et) in enumerate(left):
y = hh - 2.54 * (i + 1)
pins.append(pin(et, -hw - 2.54, y, 0, nm, num))
for i, (num, nm, et) in enumerate(right):
y = hh - 2.54 * (i + 1)
pins.append(pin(et, hw + 2.54, y, 180, nm, num))
for i, (num, nm, et) in enumerate(top):
x = -hw + 2.54 * (i + 1)
pins.append(pin(et, x, hh + 2.54, 270, nm, num))
for i, (num, nm, et) in enumerate(bottom):
x = -hw + 2.54 * (i + 1)
pins.append(pin(et, x, -hh - 2.54, 90, nm, num))
props = [
['property', q('Reference'), q(ref), ['at', fmt(-hw), fmt(hh + 1.27), '0'], ['effects', ['font', ['size', '1.27', '1.27']], ['justify', 'left']]],
['property', q('Value'), q(value), ['at', fmt(-hw), fmt(-hh - 1.27), '0'], ['effects', ['font', ['size', '1.27', '1.27']], ['justify', 'left']]],
['property', q('Footprint'), q(footprint), ['at', '0', '0', '0'], ['effects', ['font', ['size', '1.27', '1.27']], ['hide', 'yes']]],
['property', q('Datasheet'), q(datasheet), ['at', '0', '0', '0'], ['effects', ['font', ['size', '1.27', '1.27']], ['hide', 'yes']]],
['property', q('Description'), q(desc), ['at', '0', '0', '0'], ['effects', ['font', ['size', '1.27', '1.27']], ['hide', 'yes']]],
['property', q('ki_keywords'), q(keywords), ['at', '0', '0', '0'], ['effects', ['font', ['size', '1.27', '1.27']], ['hide', 'yes']]],
]
body = ['symbol', q(name + '_0_1'),
['rectangle', ['start', fmt(-hw), fmt(hh)], ['end', fmt(hw), fmt(-hh)],
['stroke', ['width', '0.254'], ['type', 'default']], ['fill', ['type', 'background']]]]
unit = ['symbol', q(name + '_1_1')] + pins
return ['symbol', q(name), ['pin_names', ['offset', '1.016']], ['exclude_from_sim', 'no'], ['in_bom', 'yes'],
['on_board', 'yes']] + props + [body, unit, ['embedded_fonts', 'no']]
syms = []
# ICM-45686, DS-000489 rev 1.1 §4.1 pin table, LGA-14 2.5x3 mm
syms.append(symbol('ICM-45686', 'U', 'ICM-45686', 'Package_LGA:Bosch_LGA-14_3x2.5mm_P0.5mm',
'https://invensense.tdk.com/download-pdf/icm-45686-datasheet/',
'TDK InvenSense 6-axis IMU, SPI/I2C/I3C, LGA-14 2.5x3x0.81 mm',
left=[('12', 'AP_CS', 'input'), ('13', 'AP_SCLK', 'input'), ('14', 'AP_SDI', 'input'), ('1', 'AP_SDO/AD0', 'tri_state')],
right=[('4', 'INT1', 'output'), ('9', 'INT2/FSYNC/CLKIN', 'bidirectional'), ('2', 'RESV', 'no_connect'),
('3', 'RESV', 'no_connect'), ('7', 'RESV', 'no_connect'), ('10', 'RESV', 'no_connect'), ('11', 'RESV', 'no_connect')],
top=[('8', 'VDD', 'power_in'), ('5', 'VDDIO', 'power_in')],
bottom=[('6', 'GND', 'power_in')], keywords='imu gyro accelerometer'))
# KX134-1211 spec rev 4.0 Table 4, LGA-12 2x2x0.9 mm
syms.append(symbol('KX134-1211', 'U', 'KX134-1211', 'Package_LGA:Kionix_LGA-12_2x2mm_P0.5mm_LayoutBorder2x4y',
'https://fscdn.rohm.com/kionix/en/datasheet/kx134-1211-e.pdf',
'Kionix/ROHM tri-axis accelerometer 8/16/32/64 g, SPI/I2C, LGA-12 2x2x0.9 mm',
left=[('10', 'nCS', 'input'), ('12', 'SCLK/SCL', 'input'), ('2', 'SDI/SDA', 'bidirectional'), ('1', 'SDO/ADDR', 'tri_state')],
right=[('5', 'INT1', 'output'), ('6', 'INT2', 'output'), ('4', 'TRIG', 'input'), ('11', 'NC', 'no_connect')],
top=[('7', 'VDD', 'power_in'), ('3', 'IO_VDD', 'power_in')],
bottom=[('8', 'GND', 'power_in'), ('9', 'GND', 'power_in')], keywords='accelerometer high-g'))
# MMC5983MA rev A pin table, LGA-16 3x3x1 mm
syms.append(symbol('MMC5983MA', 'U', 'MMC5983MA', 'Package_LGA:LGA-16_3x3mm_P0.5mm',
'https://www.memsic.com/Public/Uploads/uploadfile/files/20220119/MMC5983MADatasheetRevA.pdf',
'MEMSIC 3-axis AMR magnetometer, SPI/I2C, LGA-16 3x3x1 mm',
left=[('4', 'SPI_CS', 'input'), ('1', 'SCL/SPI_SCK', 'input'), ('16', 'SDA/SPI_SDI', 'bidirectional'), ('5', 'SPI_SDO', 'tri_state')],
right=[('15', 'INT', 'output'), ('3', 'NC', 'no_connect'), ('6', 'NC', 'no_connect'), ('7', 'NC', 'no_connect'),
('8', 'NC', 'no_connect'), ('12', 'NC', 'no_connect'), ('14', 'NC', 'no_connect')],
top=[('2', 'VDD', 'power_in'), ('13', 'VDDIO', 'power_in'), ('10', 'CAP', 'passive')],
bottom=[('9', 'GND', 'power_in'), ('11', 'GND', 'power_in')], keywords='magnetometer compass'))
# TMP117 SNOSD82D Table 5-1, WSON-6 (DRV) with thermal pad 7
syms.append(symbol('TMP117AIDRVR', 'U', 'TMP117AIDRVR', 'Package_SON:WSON-6-1EP_2x2mm_P0.65mm_EP1x1.6mm',
'https://www.ti.com/lit/ds/symlink/tmp117.pdf',
'TI TMP117 high-accuracy digital temperature sensor, I2C, WSON-6 2x2 mm',
left=[('1', 'SCL', 'input'), ('6', 'SDA', 'bidirectional'), ('4', 'ADD0', 'input')],
right=[('3', 'ALERT', 'open_collector')],
top=[('5', 'V+', 'power_in')],
bottom=[('2', 'GND', 'power_in'), ('7', 'EP', 'passive')], keywords='temperature sensor'))
# INA219A, SBOS448 pin table, SOT-23-8
syms.append(symbol('INA219AIDCNR', 'U', 'INA219AIDCNR', 'Package_TO_SOT_SMD:SOT-23-8',
'https://www.ti.com/lit/ds/symlink/ina219.pdf',
'TI INA219A zero-drift bidirectional current/power monitor, I2C, SOT-23-8',
left=[('1', 'IN+', 'input'), ('2', 'IN-', 'input'), ('7', 'A0', 'input'), ('8', 'A1', 'input')],
right=[('5', 'SCL', 'input'), ('6', 'SDA', 'bidirectional')],
top=[('4', 'VS', 'power_in')],
bottom=[('3', 'GND', 'power_in')], keywords='current sense monitor'))
# MS5611-01BA03: the stock Sensor_Pressure:MS5611-01BA symbol is correct (pins 4 and 5 are both CSB per the TE datasheet) and is used instead.
syms.append(symbol('TestPoint_0.5mm', 'TP', 'TP', 'AFS_Adom:TestPoint_Pad_D0.5mm', '', '0.5 mm round exposed-copper test point for the Adom probing workcell',
left=[('1', 'TP', 'passive')], right=[], top=[], bottom=[], keywords='test point probe'))
tree = ['kicad_symbol_lib', ['version', '20241209'], ['generator', q('AFS_Adom_mksym')], ['generator_version', q('9.0')]] + syms
out = '/tmp/claude-1001/-home-adom-project/8819fb5f-c2c6-4524-9528-99428cd6b88e/scratchpad/AFS_Adom/lib/AFS_Adom.kicad_sym'
open(out, 'w').write(dump(tree) + '\n')
print('wrote', out, len(syms), 'symbols')