Just for a sanity check I tested the current sense separately with the following code:
void loop() {
//Shunt is 0.01R and gain is 50. 1A=0.01V=>0.5V/A
//3.3V/50=0.066=6.6A=> +-3.3A
//0A average is 1910, offset=137
Serial.print(map(analogRead(34)+137,0,4095,-3300,3300));
Serial.print("\t");
Serial.print(map(analogRead(35)+137,0,4095,-3300,3300));
Serial.print("\t");
Serial.print(map(analogRead(36)+137,0,4095,-3300,3300));
Serial.print("\t");
Serial.println(map(analogRead(39)+137,0,4095,-3300,3300));
delay(250);
}
Perfect measurements on all 4 channels.
I’ve also taken note of suggestions 2 and 3 from Runger’s comment;
Everything works separately, driver, encoder, current sense…
