Hello;
My current and temperatures are reading incorrectly.
Not sure what to do at this point.
Any help would make by bot feel much better:smiley:
Randy
// ??????????????????????? WRONG AMPS, 190ma is reported as 28ma ????????????????????????????????
void reportMotorCurrent() {
// write motor current (in MilliAmps) to the serial monitor
uint16_t motorCurrent = getVariable(CURRENT);
Serial.print(" Motor Current = ");
Serial.print(motorCurrent);
Serial.println(" mA");
} // end reportMotorCurrent
// ??????????????????????? WRONG TEMPS, 80Ā°F is reported as 543Ā°F ??????????????????
void reportControllerTemperature() {
uint16_t ControllerTemperature_A = getVariable(TEMPERATURE_A);
// write Board Temperature (in C) to the serial monitor
Serial.print(" Controller Temperature A = ");
Serial.print(ControllerTemperature_A);
Serial.println(" Ā°C");
// write Board Temperature (in F) to the serial monitor
uint16_t degF = (((ControllerTemperature_A) * 9 / 5) + 32);
Serial.print(" Controller Temperature A = ");
Serial.print(degF);
Serial.println(" Ā°F");
uint16_t ControllerTemperature_B = getVariable(TEMPERATURE_B);
Serial.print(" Controller Temperature B = ");
Serial.print(ControllerTemperature_B);
Serial.println(" Ā°C");
degF = (((ControllerTemperature_B) * 9 / 5) + 32);
Serial.print(" Controller Temperature B = ");
Serial.print(degF);
Serial.println(" Ā°F");
} // end reportControllerTemperature
Hello, Randy.
I am sorry you are having problems reading the current and temperature from your G2 SMC. From your formula to convert to Fahrenheit it looks like you are not taking into account that the temperature variables are reported in units of 0.1 Ā°C. Also, it looks like you are expecting the controllerās temperature to be 80Ā°F; I am not sure where you are getting this reference, but I recommend looking at the temperatures and current values reported in the Simple Motor Control Center G2 software and comparing them to the raw values you are reading from the device. If those suggestions do not help you find the problem, you might try checking that your getVariable()
function is correctly combining the two bytes received back from the controller into one 16-bit value.
If you try those things and still cannot get the readings you expect, can you post more information about what you tried and what the results were? For example, it would be helpful to see a screenshot of your Serial Monitor output as well as the āStatusā tab of your Simple Motor Control Center G2 software with your controller connected. Additionally, could you post the simplest complete program that demonstrates the problem?
Brandon
Thanks Brandon,
My error was using āuint16_tā instead of āunsigned intā.
All data from SMC now agrees with the Motor Control Center and my external bench test equipment.
Love these Controllers!
void reportMotorCurrent() {
// motor current (in MilliAmps) converted to (Amps) to the serial monitor
unsigned int motorCurrent = getVariable(CURRENT);
Serial.print(" Motor Current = ");
Serial.print(motorCurrent * .001, 3);
Serial.println(" A");
} // end reportMotorCurrent
void reportControllerTemperature() {
unsigned int ControllerTemperature_A = getVariable(TEMPERATURE_A);
// Temperature A (in 0.1Ā°C) to the serial monitor
Serial.print(" Controller Temperature A = ");
Serial.print(ControllerTemperature_A * 0.1, 1);
Serial.println(" Ā°C");
// Temperature A (in 0.1Ā°C) converted to (in Ā°F) to the serial monitor
float degF = (((ControllerTemperature_A * 0.1) * 9 / 5) + 32);
Serial.print(" Controller Temperature A = ");
Serial.print(degF, 1);
Serial.println(" Ā°F");
} // end reportControllerTemperature
1 Like