imrishabh18/nema-23-stepper-controller

A 57 mm four-layer RP2040 NEMA23 stepper-controller PCB with USB‑C/USB‑PD power input, protected motor rail, DRV8452 dual-winding driver, bidirectional current sensing, temperature/enable interlock, optional magnetic encoder, RGB LED and buzzer status indicators, and motor/test connectors.

Version
1.2.3
License
unset
Stars
0

scripts/check-feature-source.mjs

import {readFileSync} from 'node:fs'
import assert from 'node:assert/strict'
const p=JSON.parse(readFileSync('engineering/motor-profile.json','utf8'))
const source=readFileSync('passives.tsx','utf8')
assert.match(source, /\["R_REF_TOP", "2.61k"/)
assert.match(source, /\["R_REF_BOT", "10k"/)
assert.match(readFileSync('imports/WSLP1206R0100FEA.tsx','utf8'),/resistance="10mohm"/)
assert.equal(p.ratedPhaseRmsAmps,2.81)
const sensitivity=p.shuntOhms*p.senseGain
const vref=p.logicVolts*p.referenceBottomOhms/(p.referenceTopOhms+p.referenceBottomOhms)
const peak=vref/p.driverKvVoltsPerAmp,rms=peak/Math.SQRT2
assert.ok(rms<=p.ratedPhaseRmsAmps&&rms>p.ratedPhaseRmsAmps*0.99,'Nominal current target must match selected motor')
assert.ok(peak<p.driverFullScaleAmps&&rms<p.driverRmsAmps)
const worstVref=p.logicVolts*1.02*(p.referenceBottomOhms*1.01)/(p.referenceTopOhms*0.99+p.referenceBottomOhms*1.01)
const worstPeak=worstVref/0.625 // TI minimum KV; ±2% rail and ±1% divider assumptions.
const uncalibratedRms=worstPeak*(p.uncalibratedTrqDacMax+1)/256/Math.SQRT2
assert.ok(uncalibratedRms<p.ratedPhaseRmsAmps&&uncalibratedRms<p.connectorRatedRmsAmps)
const range=[p.logicVolts/2-worstPeak*sensitivity,p.logicVolts/2+worstPeak*sensitivity]
assert.ok(range[0]>0.2&&range[1]<p.logicVolts-0.2,'INA240 headroom at worst-case full-scale current')
assert.ok(worstPeak**2*p.shuntOhms<p.shuntWatts)
assert.ok(p.tvsClampVoltsAtRatedPulse<p.driverVmAbsoluteMaxVolts&&p.tvsStandoffVolts>p.maxInputVolts*1.05)
assert.ok(p.boardTemperatureResetC<p.boardTemperatureFoldbackC&&p.boardTemperatureFoldbackC<p.boardTemperatureTripC)
assert.equal(p.firmwareImplemented,false,'These are bring-up requirements, not implemented firmware')
assert.ok(readFileSync('feature-parity.tsx','utf8').includes('doNotPlace layer="bottom"'))
const uvlo=1.2*(1+51000/10000)
assert.ok(uvlo>5.5&&uvlo<8.2)
console.log(JSON.stringify({motor:p.motor,vref,nominalPeakAmps:peak,nominalRmsAmps:rms,worstCasePeakAmps:worstPeak,uncalibratedRmsCeiling:uncalibratedRms,sensitivityVoltsPerAmp:sensitivity,adcRangeAtWorstPeak:range,shuntWattsAtWorstPeak:worstPeak**2*p.shuntOhms,nominalUvRising:uvlo},null,2))