Back

#robotics

2 APIs with this tag

RC Servo & PWM API

RC servo and PWM maths as an API, computed locally and deterministically — the pulse-width, angle and duty-cycle numbers a robotics, RC or embedded developer drives a servo with. The angle endpoint turns a pulse width into the servo angle: a hobby servo reads the width of the pulse (not a duty cycle), so the standard 1000–2000 µs maps linearly across the travel with 1500 µs at centre — angle = (pulse − min) ÷ the min-to-max span × the travel — and it flags when a pulse asks for more than the configured range so you do not drive the servo into its mechanical stops. The pulse endpoint runs it the other way, giving the pulse width a microcontroller should write for a target angle (90° is 1500 µs on a 1000–2000 µs / 180° servo), exactly what an Arduino-style servo library computes under the hood. The duty endpoint converts a pulse and a refresh frequency into the PWM period and duty cycle: a 50 Hz servo frame is 20 ms, so a 1500 µs pulse is just 7.5 % duty — the value a timer peripheral needs — and faster frames for digital servos or multirotor ESCs (e.g. 333 Hz) change it. Everything is computed locally and deterministically, so it is instant and private. Ideal for robotics and RC firmware, microcontroller and embedded tools, drone and animatronics projects, and maker calculators. Pure local computation — no key, no third-party service, instant. 3 compute endpoints. For stepper steps-per-mm use a stepper-motor API.

api.oanor.com/servo-api

Stepper Motor API

Stepper-motor motion maths as an API, computed locally and deterministically — the steps-per-millimetre and speed numbers a 3D-printer, CNC or robotics builder configures a machine with. The leadscrew endpoint gives the steps per mm for a lead-screw or ball-screw axis: (motor steps per revolution × microstepping) ÷ the screw lead, so a 1.8° motor (200 steps) at 16 microsteps on an 8 mm-lead screw is 400 steps/mm with 2.5 µm of resolution — the value that goes straight into the firmware. The belt endpoint does the same for a belt-and-pulley axis, where the travel per motor turn is the pulley teeth × the belt pitch (GT2 belt = 2 mm), so a 20-tooth GT2 pulley gives the classic 80 steps/mm of a 3D-printer X/Y axis, and shows the speed-versus-precision trade of a bigger pulley. The speed endpoint turns a steps-per-mm and a step pulse rate into the axis speed in mm/s and mm/min — at 80 steps/mm a 40 kHz step rate is 500 mm/s, though the real limit is the motor stalling at high step rates and the controller pulse ceiling. It also notes that microstepping adds smoothness, not true accuracy, since torque per microstep falls. Everything is computed locally and deterministically, so it is instant and private. Ideal for 3D-printer and CNC firmware setup, motion-control and robotics tools, and maker calculators. Pure local computation — no key, no third-party service, instant. Ideal-geometry estimates — leave a margin below the theoretical top speed. 3 compute endpoints. For CNC surface finish use a CNC-finish API; for gear ratios a gear-ratio API.

api.oanor.com/steppermotor-api