Analog Read Teensy 3.5

Status
Not open for further replies.

caliope

Member
I have Teensy 3.5 set to read Analog AO to collect voltage readings from MCP 9700A Thermister. At room temperature, I expect to see 0.70 to 0.75 volts output. Once hooked up, my oscilloscope confirmed the 0.72 reading although quite noisy.

Naively, I believed that reading the A0 pin would result in a float value of the voltage. What I actually read from Pin A0 is an integer ranging in value between 220 and 230, which tells me that the ADC has converted it. Now, I need to convert this back to a voltage to interpret as a temperature. Inc dentally, the on board temperature comes back at 220
Code:
  Serial.println(myADC->analogRead(ADC_INTERNAL_SOURCE::TEMP_SENSOR));

The reading I have done on forums and datasheets suggests this is a 16 bit Pin (32768), default resolution is 10 (1024).

How do I convert a pin reading of 220 to a voltage of 0.70 volts? The math is no problem (220/1023 = 0.23) , but I am missing something??

thanks
 
Times the 3.3 volts.. equals approx. 0.71 volts.

Teensy's reference voltage is 3.3 volts.

220/1023 = x/3.3

x=3.3*220/1023
 
Thanks! works great.

Code:
      myADC->setResolution(8); // minimum is 8
      factorADC = 3.3 / (float) myADC->analogRead(ADC_INTERNAL_SOURCE::VREFH); // Teensy 3.5 reference voltage is 3.3
 
The standard way is using value*3.3/adc->getMaxValue(ADC_0); where value is int value=myADC->analogRead(ADC_INTERNAL_SOURCE::TEMP_SENSOR); but as you can see there are a few options.
 
Status
Not open for further replies.
Back
Top