Analog Read CubeCell

Hello I¡m trying to do an analog read from a temperature sensor TMP36, so in arduino the conversion for the analog read is 5/1024 I have observed that it not the same for the CubeCell Board, how do I have to adjust this value to get the correct conversion for make a right analog read?

Here is my program

int Sensor = ADC;

void setup() {
Serial.begin(9600);
pinMode(Sensor, INPUT);
}

void loop() {
int lecture = analogRead(Sensor);
float voltage = 5.0/1024 * lecture;
float temp = voltage * 100 - 50;
Serial.print(“Voltage --> “);
Serial.print(voltage);
Serial.println(” V”);
Serial.print("Temperature --> ");
Serial.print(temp);
Serial.println(“ºC”);
delay(2000);
Serial.print("Lecture–> ");
Serial.println(lecture);
delay(2000);

}

And this is what I’m getting:

Voltage --> 11.05 V
Temperature --> 1055.47ºC
Lecture–> 2264

And I should get (Arduino Uno using —> 5/1024):

Voltage --> 0.77 V
Temperature --> 26.66ºC
Lecture–> 157

analogRead() return the value in mV directly. The max input voltage can be read is 2399 mV.

1 Like

I believe the Cubecel is a 12 bit chip. The conversion should be 4095 , not 1023. And is the voltage may also change to 3.3 volts. so your divvider would be 3.3/4095 rather than 5/1023.
I havent researched it exactly so am just guessing but follow this path.

Has this ever been resolved? My results with analog read are rubbish so I’m wondering what’s the solution.

We have made an update and have detailed instructions. You can refer to it.