esp32_motor-pcb-x1_final.py (6381B)
1 from skidl import * 2 3 # Set the default tool to KiCad 7 for footprint management. 4 set_default_tool(KICAD7) 5 6 # Create ESP32 and TMC5160 headers with updated part names 7 esp32_header1 = Part("Connector_Generic", "Conn_01x15", footprint="PinSocket_1x15_P2.54mm_Vertical", ref="ESP32_HEADER1") 8 esp32_header2 = Part("Connector_Generic", "Conn_01x15", footprint="PinSocket_1x15_P2.54mm_Vertical", ref="ESP32_HEADER2") 9 tmc5160_header1 = Part("Connector_Generic", "Conn_01x08", footprint="PinSocket_1x08_P2.54mm_Vertical", ref="TMC5160_HEADER1") 10 tmc5160_header2 = Part("Connector_Generic", "Conn_01x08", footprint="PinSocket_1x08_P2.54mm_Vertical", ref="TMC5160_HEADER2") 11 12 # Create 1x4 connector for stepper motor connections 13 stepper_motor_header = Part("Connector_Generic", "Conn_01x04", footprint="PinHeader_1x04_P2.54mm_Vertical", ref="STEPPER_HEADER") 14 15 # Create 1x4 connector for CAN Bus connections 16 can_bus_header = Part("Connector_Generic", "Conn_01x04", footprint="PinHeader_1x04_P2.54mm_Vertical", ref="CAN_BUS_HEADER") 17 18 # Create 100uF 63V capacitor with correct footprint 19 capacitor = Part("Device", "C", value="100uF", voltage="63V", footprint="Capacitor_THT:CP_Radial_D10.0mm_P5.00mm") 20 21 # Define resistor 22 resistor1 = Part("Device", "R", value="220", footprint="R_0603_1608Metric") 23 24 # Create 1x2 horizontal header for limit switch connections 25 limit_switch_header = Part("Connector_Generic", "Conn_01x02", footprint="PinHeader_1x02_P2.54mm_Horizontal", ref="LIMIT_SWITCH_HEADER") 26 27 # Create a 3-pin terminal block for 36V connections 28 terminal_block = Part("Connector_Generic", "Conn_01x03", footprint="TerminalBlock_Phoenix_PT-1,5-2-5.0-H_1x02_P5.00mm_Horizontal", ref="TERMINAL_BLOCK",) 29 30 # Create through-hole solder pads for 36V+ and 36V_GND connections with 2.54mm spacing 31 terminal_block_2 = Part("Connector_Generic", "Conn_01x02", footprint="TerminalBlock_Phoenix_MPT-0,5-2-2.54_1x02_P2.54mm_Horizontal", ref="TERMINAL_BLOCK_2") 32 33 # Create 36V_V+ and 36V_GND nets. 34 V_plus_36V = Net("36V_V+") 35 GND_36V = Net("36V_GND") 36 37 # Create VIN and GND nets. 38 vin = Net("VIN") 39 gnd = Net("GND") 40 41 # Create 3.3v gnd net. 42 vcc_gnd = Net("VCC_GND") 43 44 # Connect 36V_V+ and 36V_GND to TMC5160 header 1. 45 V_plus_36V += tmc5160_header1[1] # Connect 36V_V+ to pin 1 of TMC5160 header 1 46 GND_36V += tmc5160_header1[2] # Connect 36V_GND to pin 2 of TMC5160 header 1 47 48 # Connect 36V_V+ and 36V_GND to the terminal block 49 V_plus_36V += terminal_block[1] # Connect 36V_V+ to the first pin of the PT terminal block slot 1 50 GND_36V += terminal_block[2] # Connect 36V_GND to the third pin of the PT terminal block slot 2 51 52 # Connect VIN and GND to ESP32 header 2. 53 vin += terminal_block_2[1] # Connect VIN to the MPT TerminalBlock slot 1 54 gnd += terminal_block_2[2] # Connect GND to the MPT TerminalBlock slot 2 55 56 # Connect capacitor between 36V_V+ and 36V_GND nets 57 capacitor[1, 2] += V_plus_36V, GND_36V 58 59 # Connect one pin of the limit switch header to the resistor and the other pin to ESP32 3.3v (Pull-down Resistor!) 60 limit_switch_header[1] += resistor1[2], esp32_header1[5] # Connect pin 1 of limit switch header to one pin of the resistor, and pin 5 on esp32 header 1 61 limit_switch_header[2] += esp32_header2[1] # Connect pin 2 of limit switch header to ESP32 3.3v pin 62 63 # Connect VIN and GND to ESP32 and TMC5160 pins. 64 vin += esp32_header1[1] # VIN connected to pin 1 of ESP32 header 1 65 gnd += esp32_header1[2] # GND connected to pin 2 of ESP32 header 1 66 vcc_gnd += tmc5160_header1[8] # GND connected to pin 8 of TMC5160 header 1 67 vcc_gnd += resistor1[1] # GND connected to Resistor pin 1 68 69 # Connect all the CAN Bus headers to the ESP32 Header 2 70 can_bus_header[1] += esp32_header2[1] 71 can_bus_header[2] += esp32_header2[2] 72 can_bus_header[3] += esp32_header2[3] 73 can_bus_header[4] += esp32_header2[4] 74 75 # Connect ESP32 header 2 pins 1 and 2 to TMC5160 header 2 pins 7 and 8 respectively 76 esp32_header2[1] += tmc5160_header1[7] # Connect pin 1 of ESP32 header 2 to pin 7 of TMC5160 header 2 77 esp32_header2[2] += tmc5160_header1[8] # Connect pin 2 of ESP32 header 2 to pin 8 of TMC5160 header 2 78 79 # Connect the closest ESP32 header 1 and TMC5160 header 2 pins. 80 esp32_header1[10] += tmc5160_header2[8] # Connect ESP32 header 1 pin 10 to TMC5160 header 2 pin 8 81 esp32_header1[9] += tmc5160_header2[7] # Connect ESP32 header 1 pin 9 to TMC5160 header 2 pin 7 82 esp32_header1[3] += tmc5160_header2[1] # Connext ESP32 header 1 pin 3 to TMC5160 header 2 pin 1 83 84 # Additional connections for ESP32 header 2 and TMC5160 header 2 85 esp32_header2[15] += tmc5160_header2[2] # Connect pin 15 of ESP32 header 2 to pin 2 of TMC5160 header 2 86 esp32_header2[10] += tmc5160_header2[5] # Connect pin 10 of ESP32 header 2 to pin 5 of TMC5160 header 2 87 esp32_header2[9] += tmc5160_header2[3] # Connect pin 9 of ESP32 header 2 to pin 3 of TMC5160 header 2 88 esp32_header2[8] += tmc5160_header2[4] # Connect pin 8 of ESP32 header 2 to pin 4 of TMC5160 header 2 89 90 # Connect ESP32 header 2 to TMC5160 header 2 91 esp32_header2[15] += tmc5160_header2[2] # Connect pin 15 of ESP32 header 2 to pin 2 of TMC5160 header 2 92 esp32_header2[10] += tmc5160_header2[5] # Connect pin 10 of ESP32 header 2 to pin 5 of TMC5160 header 2 93 esp32_header2[9] += tmc5160_header2[3] # Connect pin 9 of ESP32 header 2 to pin 3 of TMC5160 header 2 94 esp32_header2[8] += tmc5160_header2[4] # Connect pin 8 of ESP32 header 2 to pin 4 of TMC5160 header 2 95 96 # Connect ESP32 header 2 to TMC5160 header 2 97 esp32_header2[15] += tmc5160_header2[2] # Connect pin 15 of ESP32 header 2 to pin 2 of TMC5160 header 2 98 esp32_header2[10] += tmc5160_header2[5] # Connect pin 10 of ESP32 header 2 to pin 5 of TMC5160 header 2 99 esp32_header2[9] += tmc5160_header2[3] # Connect pin 9 of ESP32 header 2 to pin 3 of TMC5160 header 2 100 esp32_header2[8] += tmc5160_header2[4] # Connect pin 8 of ESP32 header 2 to pin 4 of TMC5160 header 2 101 102 # Connect stepper motor header pins to TMC5160 header 1 103 stepper_motor_header[1] += tmc5160_header1[3] # Connect pin 1 of stepper motor header to pin 3 of TMC5160 header 1 104 stepper_motor_header[2] += tmc5160_header1[4] # Connect pin 2 of stepper motor header to pin 4 of TMC5160 header 1 105 stepper_motor_header[3] += tmc5160_header1[5] # Connect pin 3 of stepper motor header to pin 5 of TMC5160 header 1 106 stepper_motor_header[4] += tmc5160_header1[6] # Connect pin 4 of stepper motor header to pin 6 of TMC5160 header 1 107 108 generate_netlist() 109