This is my code so far i was happy that i get the current sensing and had some readings going but i did not know that i should be expecting sinusodial waves. Regarding the Temp i only get zero for VBus no matter if the NPC is roomtemperature or very hot…
#include <Arduino.h>
#include <SimpleFOC.h>
LowsideCurrentSense current_sense = LowsideCurrentSense(0.003f, -64.0f/7.0f, A_OP1_OUT, A_OP2_OUT, A_OP3_OUT);
float VBus = _readADCVoltageInline(A_VBUS, current_sense.params);
// hall sensor instance
HallSensor sensor = HallSensor(A_HALL1, A_HALL2,A_HALL3,8);
BLDCMotor motor = BLDCMotor(8);
BLDCDriver6PWM driver = BLDCDriver6PWM(A_PHASE_UH, A_PHASE_UL, A_PHASE_VH,A_PHASE_VL,A_PHASE_WH,A_PHASE_WL);
// Interrupt routine intialisation
// channel A, B and C callbacks
void doA(){sensor.handleA();}
void doB(){sensor.handleB();}
void doC(){sensor.handleC();
void setup() {
Serial.begin(115200);
delay(1000);
sensor.init();
sensor.enableInterrupts(doA,doB,doC);
driver.init();
motor.linkDriver(&driver);
current_sense.linkDriver(&driver);
motor.linkSensor(&sensor);
motor.controller = MotionControlType::angle;
motor.init();
current_sense.init();
current_sense.skip_align = true;
motor.linkCurrentSense(¤t_sense);
motor.initFOC();
}
void loop() {
motor.loopFOC();
motor.move();
motor.monitor();
}