Community project

CSV-to-XY Servo Scheduler

Photo of CSV-to-XY Servo Scheduler
Generated with AI

John Ace Viola

Published November 17, 2026

The CSV-to-XY Servo Scheduler reads time-stamped position data from a CSV file and converts it into coordinated servo movements across two axes. Built around an ESP32 microcontroller with isolated RS-422 output drivers (ISO7740FDWR and AM26C31IN), the system provides galvanic isolation between the control logic and external servo hardware, protecting sensitive equipment from ground loops and voltage transients.

This guide covers the complete wiring diagram, parts list, and assembly procedure for the isolated output stage. The included firmware handles CSV parsing, motion scheduling, and a web-based dashboard for configuration and preview. Builders will receive step-by-step assembly instructions, electrical schematics for both input and isolated output sections, and all necessary code to get the scheduler running—with safety interlocks that keep motor outputs disabled until mechanics and drive systems are fully verified.

Wiring diagram

Wiring diagram for CSV-to-XY Servo Scheduler
Loading diagram…

Gather all the parts

QtyComponent
1

TI ISO7740FDWR (16-pin SOIC)

Four forward channels; F suffix defaults LOW. Pin numbers: VCC1=1, grounds=2/8, inputs A/B/C/D=3/4/5/6, VCC2=16, grounds=9/15, EN2=10, outputs A/B/C/D=14/13/12/11. Pin 7 NC. 3.3V input side, regulated isolated 5V output side.

1

TI AM26C31IN (16-pin PDIP)

5V differential driver. VCC=16 GND=8 G=4 Gbar=12; A/Y/Z pins: channel1=1/2/3, channel2=7/6/5, channel3=9/10/11, channel4=15/14/13. Y non-inverted, Z inverted. Bench outputs only; no servo connection in this revision.

1

Resistor

10 kΩ

Through-hole resistor (current-limiting in series with an LED)

1

Resistor

10 kΩ

Through-hole resistor (current-limiting in series with an LED)

1

Resistor

10 kΩ

Through-hole resistor (current-limiting in series with an LED)

1

Resistor

10 kΩ

Through-hole resistor (current-limiting in series with an LED)

1

Ceramic Capacitor

100 nF, 25 V ceramic

Through-hole ceramic capacitor bought by value, such as 22 pF, 10 nF or 100 nF (0.1 µF). It is non-polarised, so either lead can go to either net. Its most common job is decoupling: a 100 nF capacitor between an IC's supply pin and ground, placed as close to the chip as possible.

1

Ceramic Capacitor

100 nF, 25 V ceramic

Through-hole ceramic capacitor bought by value, such as 22 pF, 10 nF or 100 nF (0.1 µF). It is non-polarised, so either lead can go to either net. Its most common job is decoupling: a 100 nF capacitor between an IC's supply pin and ground, placed as close to the chip as possible.

1

Ceramic Capacitor

100 nF, 25 V ceramic

Through-hole ceramic capacitor bought by value, such as 22 pF, 10 nF or 100 nF (0.1 µF). It is non-polarised, so either lead can go to either net. Its most common job is decoupling: a 100 nF capacitor between an IC's supply pin and ground, placed as close to the chip as possible.

Assemble it in 4 steps

1. Keep both axes disconnected

This is a USB-powered, preview-only controller. Do not connect the line-driver outputs to either MR-TB50 or servo drive. Each axis needs a separate compatible servo drive; one motor per axis does not confirm that two drives are present.

  • Industrial servo systems can cause serious injury. Unknown travel and electronic gearing prohibit motion commissioning.

2. Build the input side

Use a suitable PCB or SOIC adapter for ISO7740FDWR. GPIO25/26 are the reserved X command channels; GPIO27/33 are Y. Wire them to INA/INB/INC/IND. Fit one 10 kΩ pull-down on each input. Connect VCC1 to 3V3 and both GND1 pins to ESP32 ground. Leave isolator pin 7 unconnected.

3. Build the isolated output side

Power VCC2 and AM26C31 VCC from a separate, regulated, isolated 5 V bench supply. Connect its negative to both GND2 pins and driver ground, never to ESP32 ground. Connect OUTA/B/C/D to driver inputs 1A/2A/3A/4A. EN2 goes to isolated 5 V. Driver G goes to isolated ground and Gbar to isolated 5 V: all outputs stay disabled.

  • Do not use servo 24 V on these 5 V parts. Do not bridge the isolation gap with wires or test-equipment grounds.

4. Fit local bypass capacitors

Place each 100 nF capacitor directly across its supply pins: c1 at isolator input side, c2 at output side, c3 at the driver. Leave all eight driver Y/Z outputs disconnected. Use the datasheet pin numbers in each part description.

Review all connections

1. Connections between "iso" and "ESP32"

FunctionisoESP32
powerVCC13V3
groundGND1_2GND
groundGND1_8GND
powerVCC25V
groundGND2_9 → Isolated regulated 5V supply negativeEXT
groundGND2_15 → TI ISO7740FDWR (16-pin SOIC) GND2_9EXT
digitalEN2 → TI ISO7740FDWR (16-pin SOIC) VCC2EXT
powerVCC2 → Isolated regulated 5V supply positiveEXT
digitalINAGPIO 25
digitalOUTA → TI AM26C31IN (16-pin PDIP) 1AEXT
digitalINBGPIO 26
digitalOUTB → TI AM26C31IN (16-pin PDIP) 2AEXT
digitalINCGPIO 27
digitalOUTC → TI AM26C31IN (16-pin PDIP) 3AEXT
digitalINDGPIO 33
digitalOUTD → TI AM26C31IN (16-pin PDIP) 4AEXT

2. Connections between "driver" and "ESP32"

FunctiondriverESP32
powerVCC → TI ISO7740FDWR (16-pin SOIC) VCC2EXT
groundGND → TI ISO7740FDWR (16-pin SOIC) GND2_9EXT
digitalG → TI AM26C31IN (16-pin PDIP) GNDEXT
digitalGbar → TI AM26C31IN (16-pin PDIP) VCCEXT

3. Connections between "r1" and "ESP32"

Functionr1ESP32
digitalP1 → TI ISO7740FDWR (16-pin SOIC) INAEXT
groundP2GND

4. Connections between "r2" and "ESP32"

Functionr2ESP32
digitalP1 → TI ISO7740FDWR (16-pin SOIC) INBEXT
groundP2GND

5. Connections between "r3" and "ESP32"

Functionr3ESP32
digitalP1 → TI ISO7740FDWR (16-pin SOIC) INCEXT
groundP2GND

6. Connections between "r4" and "ESP32"

Functionr4ESP32
digitalP1 → TI ISO7740FDWR (16-pin SOIC) INDEXT
groundP2GND

7. Connections between "c1" and "ESP32"

Functionc1ESP32
digital1 → TI ISO7740FDWR (16-pin SOIC) VCC1EXT
digital2 → TI ISO7740FDWR (16-pin SOIC) GND1_2EXT

8. Connections between "c2" and "ESP32"

Functionc2ESP32
digital1 → TI ISO7740FDWR (16-pin SOIC) VCC2EXT
digital2 → TI ISO7740FDWR (16-pin SOIC) GND2_9EXT

9. Connections between "c3" and "ESP32"

Functionc3ESP32
digital1 → TI AM26C31IN (16-pin PDIP) VCCEXT
digital2 → TI AM26C31IN (16-pin PDIP) GNDEXT

Deploy the firmware

#include <Arduino.h>
#include <math.h>
#include <WiFi.h>
#include <WebServer.h>
#include "dashboard.h"
WebServer server(80);
String terminalLog;
class Console : public Print { public: size_t write(uint8_t c) override { Serial.write(c); terminalLog += char(c); if(terminalLog.length()>12000) terminalLog.remove(0,2000); return 1; } };
Console console;
// Intentionally preview-only. No command can enable motor output.
const int outputs[] = {25,26,27,33};
// CSV ENE/ENN are displacement in centimetres; TABLE remains a scaled mm preview.
struct Row { double t,e,n; };
Row rows[2000];
size_t count=0;
bool receiving=false, valid=false;
double scaleX=0,scaleY=0,ppmX=0,ppmY=0;
String line;
void command(String s) {
 s.trim();
 if(s=="BEGIN") {count=0; receiving=true;valid=false;console.println("READY");return;}
 if(s=="END") {receiving=false;valid=count>=2;console.println(valid?"LOADED":"ERROR: need at least two rows");return;}
 if(s.startsWith("CONFIG,")) {
  double a,b,c,d;char extra;
  if(sscanf(s.c_str(),"CONFIG,%lf,%lf,%lf,%lf%c",&a,&b,&c,&d,&extra)==4 && isfinite(a)&&isfinite(b)&&isfinite(c)&&isfinite(d)&&a>0&&b>0&&c>0&&d>0 && a*c<100000000 && b*d<100000000) {
   scaleX=a;scaleY=b;ppmX=c;ppmY=d;console.println("CONFIGURED: preview only");
  } else console.println("ERROR CONFIG");
  return;
 }
 if(s=="RUN") {console.println("LOCKED: outputs disabled; mechanics, drive mode and safety circuit unverified");return;}
 if(s=="TABLE") {
  if(!valid || ppmX==0){console.println("ERROR: load CSV and CONFIG first");return;}
  double ex=0,ny=0;
  for(size_t i=0;i<count;i++){ex=fmax(ex,fabs(rows[i].e-rows[0].e));ny=fmax(ny,fabs(rows[i].n-rows[0].n));}
  console.println("t_s,x_mm,y_mm,x_target_pulses,y_target_pulses,dx_pulses,dy_pulses,x_rate_pps,y_rate_pps");
  long px=0,py=0;
  for(size_t i=0;i<count;i++) {
   double x=ex?scaleX*(rows[i].e-rows[0].e)/ex:0;
   double y=ny?scaleY*(rows[i].n-rows[0].n)/ny:0;
   long nx=lround(x*ppmX),nn=lround(y*ppmY);
   double dt=i?rows[i].t-rows[i-1].t:1;
   console.printf("%.6f,%.6f,%.6f,%ld,%ld,%ld,%ld,%.3f,%.3f\n",rows[i].t,x,y,nx,nn,nx-px,nn-py,i?fabs(nx-px)/dt:0,i?fabs(nn-py)/dt:0);
   px=nx;py=nn;
  }
  console.println("TABLE_END");return;
 }
 if(receiving) {
  if(s=="t_s,ENE,ENN")return;
  double t,e,n;char extra;
  if(count>=2000 || sscanf(s.c_str(),"%lf,%lf,%lf%c",&t,&e,&n,&extra)!=3 || !isfinite(t)||!isfinite(e)||!isfinite(n)||t<0||t>3600 || (count==0 && t!=0) || (count && t<=rows[count-1].t)) {
   receiving=false;valid=false;console.println("ERROR CSV: finite ascending time starting at zero; max 2000 rows, 3600 seconds");return;
  }
  rows[count++]={t,e,n};console.println("OK");return;
 }
 console.println("Commands: BEGIN, CSV rows, END, CONFIG,x_span_mm,y_span_mm,x_pulses_per_mm,y_pulses_per_mm, TABLE. RUN is locked.");
}
void setup(){
 for(int pin:outputs){pinMode(pin,OUTPUT);digitalWrite(pin,LOW);}
 Serial.begin(115200);line.reserve(160);
 WiFi.softAP("Shake-Preview", "ShakePreview2026");
 server.on("/",HTTP_GET,[](){server.send_P(200,"text/html; charset=utf-8",dashboard);});
 server.on("/log",HTTP_GET,[](){server.send(200,"text/plain",terminalLog);});
 server.on("/command",HTTP_POST,[](){
  String text=server.arg("plain");
  if(text.length()>160){server.send(413,"text/plain","Command too long");return;}
  command(text);server.send(200,"text/plain","Command processed; see terminal");
 });
 server.on("/data",HTTP_GET,[](){
  server.setContentLength(CONTENT_LENGTH_UNKNOWN);server.send(200,"text/csv","");
  server.sendContent("t_s,ENE,ENN\n");
  if(valid) for(size_t i=0;i<count;i++){
   char buf[128];snprintf(buf,sizeof(buf),"%.9g,%.9g,%.9g\n",rows[i].t,rows[i].e,rows[i].n);server.sendContent(buf);
  }
  server.sendContent("");
 });
 server.begin();
 console.println("Phone Wi-Fi: Shake-Preview; password: ShakePreview2026; page: http://192.168.4.1");
 console.println("CSV scheduler PREVIEW ONLY; line driver hardware disabled");
}
void loop(){
 server.handleClient();
 while(Serial.available()){
  char c=Serial.read();
  if(c=='\n'){command(line);line="";}
  else if(c!='\r'){if(line.length()<159)line+=c;else{line="";receiving=false;valid=false;console.println("ERROR line too long");}}
 }
}

Remix this project

Make it yours in one click

Open a full copy of this project in your own Schematik workspace, diagram, code, parts, and assembly steps included. Swap the sensor, add features, or redesign the whole thing with AI. The author's original stays untouched.

Open in Schematik