mohan-bee/modern-controller
A two-board 2.4 GHz wireless control system using CH32X035 MCUs, SX1280 radios, USB‑C transmitter with RFX2401C PA/filter, and a battery-powered receiver with U.FL antennas, RGB status LEDs, regulators, and PWM output headers.
- Version
- 0.0.6
- License
- unset
- Stars
- 0
Use with the tscircuit CLI
tsci is the tscircuit CLI. Install it with npm install -g tscircuit.
tsci clone mohan-bee/modern-controller # download the package files into ./modern-controller
tsci add mohan-bee/modern-controller # add it to your project as @tsci/mohan-bee.modern-controllerIn a cloned or new (tsci init) project: tsci dev starts a local preview, tsci build outputs Circuit JSON, and tsci push publishes to tscircuit.com.
design/connectorDrawing.ts
interface Element {
type: string
name?: string
source_component_id?: string
center?: { x: number; y: number }
}
export function connectorDrawing(panel: Element[]) {
const page = "drawing_page_connectors"
const view = "drawing_part_view_top"
// Paper coordinates are in mm from the centre of the landscape sheet.
const labels: [string, string, number, number][] = [
["J203", "RX programming · J203", -124, 70],
["J202", "RX antenna · J202", -124, 44],
["J204", "RX battery · J204", -124, 20],
["D201", "D201 · RX status", 69, 68],
["J205", "J205 · O1 / O2", 69, 38],
["J102", "TX antenna · J102", -124, -13],
["J101", "USB-C · J101", -124, -54],
["J103", "J103 · TX programming", 69, -23],
["D101", "D101 · TX status", 69, -52],
]
return [
{ type: "drawing_page", drawing_page_id: page, name: "connector-guide",
display_name: "Panel connector guide", width: 297, height: 210 },
{ type: "drawing_part_view", drawing_part_view_id: view, drawing_page_id: page,
name: "component-side", direction: "z_positive", center: { x: 0, y: 3 }, width: 124, height: 124 },
...labels.map(([ref, text, x, y]) => {
const source = panel.find(e => e.type === "source_component" && e.name === ref)
const part = panel.find(e => e.type === "pcb_component" && e.source_component_id === source?.source_component_id)
if (!source || !part?.center) throw new Error(`Missing placement for ${ref}`)
return { type: "drawing_part_label", drawing_part_label_id: `drawing_part_label_${ref}`,
drawing_part_view_id: view, source_component_ids: [source.source_component_id],
anchor: { ...part.center, z: 0.5 }, label_position: { x, y }, text }
}),
...[
["Panel connector guide", 89, 5],
["Component side / 70 × 70 mm / Receiver above transmitter", 80, 3],
["J204 Pin 1 B+ · Pin 2 B− | J205 Pin 1 O1 · Pin 2 O2", -76, 3.3],
["J205 pin 3 GND · pin 4 VIN. Use only one receiver supply.", -85, 3],
].map(([text, y, size], i) => ({ type: "drawing_page_note", drawing_page_note_id: `drawing_page_note_${i}`,
drawing_page_id: page, text, font_size: size, position: { x: -128, y } })),
]
}