main
John Lauer
Complete exact catalog links for all purchased PCB references and screen library pin sets
e3249a7
from pathlib import Path
import json,sys,copy,shutil,hashlib
root=Path(__file__).resolve().parents[2];sys.path.insert(0,str(root/'tools'));import sexp
specs=[('ERA-2AEB333X','Panasonic','33k','P33KDCCT-ND','https://industrial.panasonic.com/cdbs/www-data/pdf/RDM0000/AOA0000C307.pdf','era-a.pdf',.475,.5,.5125),('TNPW04025K60BEED','Vishay','5.6k','541-9844-1-ND','https://www.vishay.com/docs/28758/tnpw_e3.pdf','tnpw-e3.pdf',.55,.6,.475),('TNPW04021K00BEED','Vishay','1k','TNP1.00KDACT-ND','https://www.vishay.com/docs/28758/tnpw_e3.pdf','tnpw-e3.pdf',.55,.6,.475)]
for mpn,man,value,dk,ds,pdf,dx,dy,center in specs:
slug=mpn.lower();p=root/'components'/slug;p.mkdir(exist_ok=True);(p/'review').mkdir(exist_ok=True);pan=man=='Panasonic'
sch=sexp.parse((root/'kicad/digital.kicad_sch').read_text());s=copy.deepcopy(next(x for x in sexp.find(sexp.first(sch,'lib_symbols'),'symbol') if x[1]=='Device:R'));s[1]=mpn
for x in sexp.find(s,'symbol'):x[1]=x[1].replace('R_',mpn+'_')
for pr in sexp.find(s,'property'):
if pr[1]=='Value':pr[2]=value
if pr[1]=='Footprint':pr[2]=mpn+':'+mpn+'_Manufacturer_Example'
if pr[1]=='Datasheet':pr[2]=ds
for k,v in [('MPN',mpn),('Manufacturer',man),('DigiKey',dk),('Tolerance','0.1%'),('TCR','25ppm/K'),('Adom Wiki','https://wiki.adom.inc/adom/'+slug)]:s.append(sexp.parse(f'(property "{k}" "{v}" (at 0 0 0) (hide yes) (effects (font (size 1.27 1.27))))'))
(p/(slug+'.kicad_sym')).write_text('(kicad_symbol_lib (version 20231120) (generator "adom-component-audit")\n'+sexp.dump(s)+'\n)\n')
fp={'footprintName':mpn+'_Manufacturer_Example','description':'Manufacturer reflow example; process qualification pending','pads':[dict(number=str(i+1),x=x,y=0,dx=dx,dy=dy,type='smd',shape='rect') for i,x in enumerate([-center,center])],'body':dict(x1=-.5,y1=-.25,x2=.5,y2=.25),'courtyard':dict(x1=-1.05,y1=-.55,x2=1.05,y2=.55)};(p/'footprint-input.json').write_text(json.dumps(fp,indent=2)+'\n')
for src,dst in [('kicad/3d/R_0402_1005Metric.step',slug+'.step'),('components/stm32g0b1kct6/LICENSE-KICAD.md','LICENSE-KICAD.md'),('components/m20-9990246/LICENSE','LICENSE'),('datasheets/'+pdf,'datasheet.pdf')]:shutil.copyfile(root/src,p/dst)
d=json.loads((root/'components/amplh5030s-100mt/page.json').read_text());d.update(slug=slug,title=mpn+' precision resistor',description=value+' ohm, 0.1%, 25 ppm/K thin-film 0402 resistor with exact order code and provisional assets.',brief='Precision resistor; preserve value, tolerance and TCR when sourcing.',tags=['resistor','precision','0402'],source={'name':man,'url':ds});c=d['component'];c.update(mpn=mpn,manufacturer=man,package='0402 / 1005 metric',category='Resistors',datasheet=ds,wiki_url='https://wiki.adom.inc/adom/'+slug,distributor_links={'digikey':dk});c['parts']={k:v.replace('amplh5030s-100mt',slug) for k,v in c['parts'].items()};c['qualification']={'status':'provisional','model':'Attributed generic KiCad 0402 body, not exact manufacturer CAD','assembly':'Native variant and process review pending'}
(p/'page.json').write_text(json.dumps(d,indent=2)+'\n');d.update(name='@adom/'+slug,files=['README.md','LICENSE','LICENSE-KICAD.md','THIRD_PARTY.md','page.json','package.json','provenance.json','footprint-input.json',slug+'*','symbol.html','footprint.html','hero.png','datasheet.pdf','skills/**'],dependencies={});(p/'package.json').write_text(json.dumps(d,indent=2)+'\n')
detail=('E denotes 25 ppm/K and B 0.1%; 333 is 33 kΩ; X specifies 2 mm pitch punched carrier tape. Rated power is 0.063 W at 85 °C, subject to derating and voltage limits. The body drawing is 1.00 ±0.10 ×0.50 +0.10/−0.05 ×0.35 ±0.05 mm. Top and bottom termination lengths differ; the generic model does not reproduce that detail.' if pan else 'B denotes 0.1%, E denotes 25 ppm/K, and ED specifies 10,000-piece paper tape packaging. This is the lead-free TNPW e3 family, not the separate lead-bearing TNPW family. The current manufacturer document distinguishes general, power and advanced operating modes; 0.13 W is the advanced-mode P70 value, not a universal rating under all stability conditions. General-mode P70 is 0.070 W. Body dimensions are 1.00 ±0.05 ×0.50 ±0.05 ×0.35 ±0.05 mm, with nominal 0.20 mm end terminations.')
land=('Panasonic’s 2025-12-24 land guide gives gap 0.5–0.6 mm, outer span 1.4–1.6 mm and width 0.4–0.6 mm. This candidate selects gap 0.55 mm, outer span 1.50 mm and width 0.50 mm, yielding pad length 0.475 mm and centers ±0.5125 mm. The existing board’s 0.54 ×0.64 mm pads are a separate variant.' if pan else 'Vishay document 28950 offers separate IPC and IEC reflow examples. This candidate uses its IPC example: 0.55 ×0.60 mm pads, centers ±0.475 mm, gap 0.40 mm and outer span 1.50 mm. The IEC example is different. Existing board 0.54 ×0.64 mm pads and centers ±0.51 mm are a separate variant. Do not silently substitute patterns.')
(p/'README.md').write_text(f'''# {mpn}
{man} {value}Ω, ±0.1%, ±25 ppm/K thin-film resistor in 0402 (1005 metric). Terminals 1 and 2 are nonpolar. Exact value, tolerance, TCR and packaging suffix belong to the identity, even when the body looks identical to another resistor.
{detail}
{land} Solder-mask, paste, assembly and fabrication qualification remain open; the physical PCB has not been changed.
The included generic KiCad model measures 1.00 ×0.50 ×0.35 mm. Its envelope fits the nominal package; it is not exact manufacturer CAD, terminal metallization, film structure or a tolerance envelope. It carries no value marking, so do not infer resistance from its appearance. STEP uses mm; GLB meters; Z up and seating at zero. The annotated hero is reference artwork, not assembly geometry.
[Manufacturer datasheet]({ds}) · [Land-pattern guide]({'https://industrial.panasonic.com/cdbs/www-data/pdf/RDM0000/DMM0000COL17.pdf' if pan else 'https://www.vishay.com/doc?28950'})
The component remains provisional. Precision resistor selection does not alone establish system accuracy: include ratio tolerance, differential temperature drift, self-heating, amplifier/reference errors and calibration in the circuit budget.
''')
(p/'THIRD_PARTY.md').write_text('KiCad Device:R symbol and R_0402_1005Metric STEP (Copyright2018 KiCad StepUp), plus derived GLB, are CC-BY-SA4.0 with KiCad design exception. Original documentation and land-pattern transcription are MIT. Manufacturer PDF remains manufacturer copyright. See LICENSE-KICAD.md.\n')
(p/'provenance.json').write_text(json.dumps({'part':mpn,'reviewDate':'2026-10-11','datasheet':{'url':ds,'sha256':hashlib.sha256((p/'datasheet.pdf').read_bytes()).hexdigest()},'model':{'source':'kicad/3d/R_0402_1005Metric.step','license':'CC-BY-SA-4.0 with KiCad exception','classification':'Generic nominal model','bboxMm':[1,.5,.35]},'symbol':{'source':'KiCad Device:R','license':'CC-BY-SA-4.0 with KiCad exception'},'qualification':'provisional','visualReview':{'local':'pending','wiki':'pending; browser closed'},'assetSha256':{}},indent=2)+'\n')
q=p/'skills'/slug;q.mkdir(parents=True,exist_ok=True);(q/'SKILL.md').write_text(f'''---
name: {slug}
description: Import {mpn} and preserve precision resistor identity and process constraints.
---
# {mpn}
Parent skill: wiki-component.
Read README.md and provenance.json. Preserve {value} ohm, 0.1% tolerance and 25 ppm/K TCR. The generic unmarked 0402 CAD cannot identify electrical value. Pins are nonpolar.
Compare the manufacturer-pattern candidate with the native PCB variant and actual solder process. Do not change copper automatically. Use clean geometry in assemblies and retain KiCad attribution.
Review voltage, power, temperature and stability conditions in the manufacturer datasheet. Include resistor ratio, thermal gradients and calibration in the system error budget. Catalog validity does not qualify hardware.
''')