

This project implements and tests a Field-Oriented Control (FOC) system for a Permanent Magnet Synchronous Motor (PMSM).
- Size
- 41.5 × 27.6 mm
- Copper layers
- 2
- Thickness
- 1.6 mm
- Parts
- 14
- Nets
- 27
- Pads
- 74
- Tracks, vias
- 0, 0
- Routed
- Not yet
- KiCad
- KiCad 9.0 (file 20241229)
- Created
- 22 Jul 2026
- Updated
- 10 Aug 2026
Overview
GP Encoder Tran is an open-source printed circuit board by Ahmedyasser572, from the Ahmedyasser572/Graduation_project_Field_Oriented_Control_For_PMSM repository on GitHub. It is a 2-layer board of 41.5 × 27.6 mm with 14 parts on 27 nets.
It is built around the AM26LS32ACDRE4, AMS1117-3.3 and TXS0108EPW. Its parts include 5 resistors, 4 capacitors, 3 ICs and 2 connectors.
Main components
3AM26LS32ACDRE4
SOIC-16SOIC-16 RS-485 / RS-422 ICs ROHSTexas InstrumentsRS-485 / RS-422 ICsAMS1117-3.3
SOT-223-40℃~+125℃ 0.003%Vout 1 1.1V@(800mA) 15V 1A 3.3V 5mA 72dB@(120Hz) Fixed Over Current Protection、Short Circuit Protection、Thermal shutdown Positive SOT-223 Voltage Regulators - Linear, Low Drop Out (LDO) Regulators ROHSAdvanced Monolithic SystemsVoltage Regulators - Linear, Low Drop Out (LDO) RegulatorsTXS0108EPW
TSSOP-20-40℃~+85℃ 1 1.4V~3.6V 1.65V~5.5V 60Mbps 8 Automatic direction detection、Output enable high-impedance、Integrated pull-up resistor Bidirectional Level translator Push-Pull、Open-drain TSSOP-20 Translators, Level Shifters ROHSTexas InstrumentsTranslators, Level Shifters
README
README.mdField-Oriented Control for a PMSM
This project implements and tests a Field-Oriented Control (FOC) system for a Permanent Magnet Synchronous Motor (PMSM). The project combines MATLAB/Simulink motor-control models with Texas Instruments C2000 embedded-controller tests and hardware experiments.
The control system includes:
- Cascaded speed and current control loops
- Clarke and Park transformations
- Inverse Park transformation
- Space Vector PWM (SVPWM)
- Rotor-position feedback from an encoder
- Phase-current and DC-link voltage sensing
- PI-controller anti-windup protection
- Simulation, inverter testing, and C2000 deployment support
Repository Structure
| Directory | Purpose |
|---|---|
FOC/ | Main FOC and PMSM Simulink models, simulation scripts, and generated model files |
Final_model_in_production/ | Production versions of the control models and generated code artifacts |
inverter Model/ | SVPWM/SPWM inverter models and inverter communication files |
Motor_Model_mathmatical/ | Mathematical motor-model development files |
C2000_tests/ | Embedded tests for the ADC, encoder, LEDs, and telemetry viewer |
Differential_Reciever_PCB/ | PCB-related files for the differential receiver and encoder interface |
presentation/ | Project presentation material |
Requirements
Simulation
- MATLAB and Simulink
- Motor Control Blockset
- A MATLAB release compatible with the included
.slxmodels
Hardware Deployment
- Texas Instruments Code Composer Studio (CCS)
- C2000Ware SDK
- A supported TI C2000 microcontroller and development board
- PMSM, inverter, encoder, current sensors, and DC-link voltage-sensing hardware
Hardware work involves dangerous voltages and rotating machinery. Use suitable protection, current limits, emergency-stop equipment, and qualified supervision.
Getting Started
- Clone or download this repository.
- Open MATLAB and set the repository root as the current folder.
- Add the relevant model directory to the MATLAB path, for example
FOC/orFinal_model_in_production/. - Open the required Simulink model.
- Run the matching initialization or tuning script before starting the simulation.
- Check the motor parameters, controller gains, sampling time, sensor scaling, and inverter limits.
- Run the simulation and inspect the scopes and generated plots.
Main Models and Scripts
The exact model depends on the experiment. Common entry points include:
FOC/FOC_physical_2.slx— FOC modelFOC/FOC_physical_2_prototybe.slx— prototype FOC modelFOC/PMSM_Model.slx— PMSM modelFOC/Communication.slx— communication modelFOC/Model_Calculations.m— model calculations and parameter preparationFOC/FOC_physical_2_Testing_mathmatical.slx— mathematical-model testinginverter Model/SVPWM_inverter.slx— SVPWM inverter model
Production models are kept in Final_model_in_production/. Use the corresponding initialization and tuning files in the same directory when working with those models.
Simulation Checks
During simulation, verify the following signals:
- Rotor speed and speed-reference tracking
- $d$-axis and $q$-axis current responses
- Phase currents and current limits
- DC-link voltage
- SVPWM duty cycles and phase voltages
- PI-controller saturation and anti-windup behavior
- Encoder angle and electrical-angle calculations
Start with a low-speed, low-voltage test case and increase the operating point gradually. Confirm that the duty cycles, currents, and controller outputs remain within safe limits.
C2000 Hardware Deployment
- Open the appropriate C2000 test project from
C2000_tests/in CCS. - Configure the target device, clock, ADC channels, PWM outputs, encoder interface, and serial/telemetry settings.
- Verify the sensor wiring and signal polarity before connecting the inverter.
- Build the project in CCS.
- Connect the debugger and flash the generated program to the C2000 controller.
- Test the ADC, encoder, PWM, and communication interfaces separately.
- Enable the motor-control loop only after the individual hardware tests pass.
- Monitor the system using the telemetry viewer and stop immediately if current, speed, or voltage exceeds the configured limits.
Safety
This project controls a motor inverter and may use hazardous DC-link voltages. Before applying power:
- Inspect all high-voltage and phase connections.
- Confirm that the emergency stop works.
- Use current limiting and appropriate fuses.
- Keep clear of the rotating motor and coupling.
- Validate PWM dead time and gate-driver behavior.
- Never connect or disconnect motor phases while power is applied.
- Test new firmware with the lowest practical voltage and speed.
Troubleshooting
| Problem | Things to check |
|---|---|
| Simulation does not start | MATLAB path, required toolboxes, initialization script, and model compatibility |
| Motor current is incorrect | Sensor offset, sensor scaling, phase order, Clarke/Park angle, and ADC configuration |
| Motor rotates in the wrong direction | Encoder direction, electrical-angle offset, phase sequence, and sign conventions |
| PWM output is unstable | DC-link measurement, controller gains, sampling time, saturation, and dead time |
| Hardware build fails | CCS project settings, C2000Ware installation, target device, and generated-code configuration |
| Telemetry data is missing | UART/IPC configuration, baud rate, signal mapping, and TelementaryViewer/ settings |
Team
- Ahmed Samy Mohamed Hagag
- Ahmed Maged Salah El-sayed
- Ahmed Yasser Mohamed Gamaleldin El Sadiq
- Mohamed Reda ELSayed Mahmoud ELSherbiny
- Mohamed Wagih El Sayed Sayed Ahmed
- Mostafa Ahmed Mohamed Amin
- Wael Mohamed Abdelhalim Moubark
- Youssef Ahmed Hassan Abdelkader
Supervisors: Dr. Mohamed Fekry, Dr. Mahmoud Gamil
Institution: Zagazig University, Faculty of Engineering
Parts
14| Qty | Value | Footprint | References |
|---|---|---|---|
| 4 | 100 | Resistor_SMD:R_0603_1608Metric_Pad0.98x0.95mm_HandSolder | R101, R102, R103, R104 |
| 2 | 100nF | Capacitor_SMD:C_0805_2012Metric_Pad1.18x1.45mm_HandSolder | C102, C103 |
| 2 | 10uF | Capacitor_SMD:C_0805_2012Metric_Pad1.18x1.45mm_HandSolder | C101, C104 |
| 1 | 10k | Resistor_SMD:R_0603_1608Metric_Pad0.98x0.95mm_HandSolder | R105 |
| 1 | AM26LS32ACDR | AM26LS32ACDR:SOIC-16_L9.9-W3.9-P1.27-LS6.0-BL | U101 |
| 1 | AMS1117-3.3 | Package_TO_SOT_SMD:SOT-223-3_TabPin2 | U102 |
| 1 | Conn_01x06_Pin | Connector_PinHeader_2.54mm:PinHeader_1x06_P2.54mm_Vertical | J102 |
| 1 | Conn_01x10_Pin | Connector_PinHeader_2.54mm:PinHeader_1x10_P2.54mm_Vertical | J101 |
| 1 | TXS0108EPW | Package_SO:TSSOP-20_4.4x6.5mm_P0.65mm | U103 |
Similar boards
- 4 layers148.8 × 100 mm

- 2 layers35.6 × 22.9 mm

- 2 layers94.5 × 74.4 mm

Ax58100-stm32-ethercat
MetalMusings/MyOwnEtherCATDevice
Documentation accompanying the "Make My Own EtherCAT device" video serie on Youtube.
184 parts93 - 2 layers72 × 45 mm

Brizer ZigBee
kvazimoda24/TionO2-ZigBee
Ядром проекта является микроконтроллер ATmega328P. Для работы по протоколу ZigBee используется модуль E18-MS1-PCB.
48 parts10 - 2 layers52 × 40 mm

Modbus rtu mirror side esp32 88x37x59mm
galopago/din-rail-circuits
Collection of electronic circuits for DIN RAIL mount
39 parts7CC-BY-4.0 - 2 layers67.3 × 74.5 mm

- 2 layers100 × 50 mm

- 2 layers190.5 × 158.4 mm

Questions
How big is the GP Encoder Tran PCB?
It measures 41.5 × 27.6 mm and has 2 copper layers, 1.6 mm thick.
What parts does the GP Encoder Tran use?
14 parts, built around the AM26LS32ACDRE4, AMS1117-3.3 and TXS0108EPW. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.
Where can I download the GP Encoder Tran KiCad files?
From the Ahmedyasser572/Graduation_project_Field_Oriented_Control_For_PMSM repository on GitHub, at the commit this page was made from: the board is Differential_Reciever_PCB/GP_Encoder/GP_Encoder_Tran/GP_Encoder_Tran.kicad_pcb and its schematic Differential_Reciever_PCB/GP_Encoder/GP_Encoder_Tran/GP_Encoder_Tran.kicad_sch. PCBKit opens the board in the browser, with nothing to install.
Can I use the GP Encoder Tran design in my own project?
Its repository states no licence, so its author keeps all rights: ask Ahmedyasser572 before reusing the design.