Steer by wire - FOC Shield configuration

Hi everyone,

I am new in FOC matters and especially interested in Steer by wire. I have used exactly the schema and sketch from the official Simple FOC. The problem is, it is not working at all. Both motors move a little just at the beginning, when I plug the system. But nothing more happens.

I have 2 Simple FOC Shields V. 2.0.4. and right here are my pinouts:

FOC Shield No. 1: Solderpoints: 5V, A0, A2, A5, 11,13, 3, 7, 10, 6

FOC Shield No. 2: Solderpoints: 5V, A1, A3, 12, 2, 4, 5, 8, 9, 11

Well, that is the best I could do…I have respected all the rules of configuration, I hope… I really did not know if or how to incorporate eventually pins for the AS5600 - I2C – sensor. Is this configuration wrong? Or what else is to be done, so that the system works like in your video?

The schema and the sketch are exactly like on



Hi Martin, and welcome to SimpleFOC!

Do you think you could provide a picture of your solder-points, and maybe the code or link to the exact example you’re using?

You seem to be using 11 twice?

Hey @mar_kec,

Are you using the sketch from

You are abolutely right, I have not included the configuration of the shields, I should have.
I’ll try to upload them soon.

Could you also let us know what microcontroller and sensor are you using, that will help to debug.

Some of those configuration pins are only necessary if you are using 2 encoders.

Sorry, my configuration is:

FOC Shield No. 1: Solderpoints: 5V, A0, A2, A5, A4,13, 3, 7, 10, 6

FOC Shield No. 2: Solderpoints: 5V, A1, A3, 12, 2, 4, 5, 8, 9, 11.

The rest is below:

Steer by wire
using Simple**FOC Shield and Arduino UNO

#include <SimpleFOC.h>

// software interrupt library

#include <PciManager.h>

#include <PciListenerImp.h>

BLDCMotor motor1 = BLDCMotor(11);

BLDCDriver3PWM driver1 = BLDCDriver3PWM(3, 10, 6, 7);

Encoder encoder1 = Encoder(A2, 2, 500, A0);

void doA1(){encoder1.handleA();}

void doB1(){encoder1.handleB();}

void doI1(){encoder1.handleIndex();}

// encoder interrupt init

PciListenerImp listenerA(encoder1.pinA, doA1);

PciListenerImp listenerB(encoder1.pinB, doB1);

PciListenerImp listenerI(encoder1.index_pin, doI1);

BLDCMotor motor2 = BLDCMotor( 11);

BLDCDriver3PWM driver2 = BLDCDriver3PWM(9, 11, 5, 8);

MagneticSensorI2C sensor2 = MagneticSensorI2C(0x36, 12, 0x0E, 4);

void setup() {

// initialise encoder hardware


// interrupt initialization




// link the motor to the sensor


// init driver


// link driver


// set control loop type to be used

motor1.controller = MotionControlType ::torque ;

// initialise motor


// align encoder and start FOC


// initialise magnetic sensor hardware


// link the motor to the sensor


// init driver


// link driver


// set control loop type to be used

motor2.controller = MotionControlType ::torque ;

// initialise motor


// align encoder and start FOC


Serial.println(“Steer by wire ready!”);



void loop() {

// iterative setting FOC phase voltage



// virtual link code

motor1.move( 5*(motor2.shaft_angle - motor1.shaft_angle));

motor2.move( 5*(motor1.shaft_angle - motor2.shaft_angle));



Hi runger,

Sorry, Here is my right configuration:

FOC Shield No. 1: Solderpoints: 5V, A0, A2, A5, A4,13, 3, 7, 10, 6
FOC Shield No. 2: Solderpoints: 5V, A1, A3, 12, 2, 4, 5, 8, 9, 11

You find it as attached files too…

and the sketch:

Thank you!!!



I am using Arduino UNO, AS5600, AMT103, 2 x GM4108 and 2 x Simple FOC v. 2.0.4

The solder points are on the pictures.

The sketch - link is here: Haptics - Steer by wire | Arduino-FOC

Is my configuration wrong or maybe the shields are broken?



Hey Martin,

I hope we can get this working! Normally, the SimpleFOC shield is quite robust, so let’s hope it is not broken!

You mention AS5600 and AMT103:

  • the AMT103 can be connected to the encoder pins, there are examples in our docs
  • the AS5600 has to be connected to the Arduino’s I2C pins, SDA and SCL

Am I to understand you are using one of each kind of sensor, the encoder with one shield and the magnetic sensor on the other?

Did you connect the magnetic sensor to SDA and SCL?

Have you tried the boards separately, e.g. does each setup work by itself, with only one driver/sensor/motor attached to the Arduino?

You should test each setup individually first, making sure each of them is working well with open-loop, torque-voltage and then velocity mode, in that order.
I think if you try to debug everything all at once there are too many “moving parts” and it will be more difficult.