Arduino Pro Mini reading temperature wrong

Hello everyone. I built a bpard using an Arduino Pro Mini, and I'm supplying the board with 12V 2A. I have an NTC 10K sensor attached to the board, and I want the arduino to read it. I have several other stuff on the board as well but I don't think they are the problem. There is a voltage regulator on the board, which is 5V 0.5A which supplies power to the said NTC sensor. I just connected the 12V to Arduino from RAW pin, which is as far as I know in its powering limits. Here is the problem, when I connect only the 12V and power everything from the barrel jack on the board, I read wrong temperatures. But if I connect the barrel jack to the board, and also the USB connector to the Arduino, I start reading the correct temperature. I am not an electrician and can't figure out what's wrong with it, so can you help me?

Here's the list of everything the board:
ESP8266 --> 3.3V regulator on board
Ethernet Card --> 5V regulator on board
3 NTC sensors --> 5V regulator on board
Arduino Pro Mini --> 12V from barrel jack
SIM800L --> 4V from LM2596
2x16 LCD and I2C module --> 5V regulator on board

I don't think it's a low current problem, I tried to disconnect everything leaving only arduino and an NTC sensor, problem still appears. I believe it's like a reference point problem, as I'm supplying NTC sensors with 5V and Arduino with 12V, but believe me, knowing myself this opinion might be complete bull-crap. Well, thanks for the read, and possible answers!

Oh and here's the part I use to calculate the temperature in the code:

double temp(int i){                                            //NTC10K calculator
  int Vo = analogRead(i);
  logRt = log(10000.0*((1024.0/Vo-1))); 
  TempK = (1.0 / (A + B*logRt + C*logRt*logRt*logRt));  // We get the temperature value in Kelvin from this Stein-Hart equation
  TempC = TempK - 273.15;                     // Convert Kelvin to Celcius
  TempF = (TempC * 1.8) + 32.0;              // Convert Kelvin to Fahrenheit

  return TempC;
}

Temp variables are just defined previously.

Hi
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Have you included the capacitors needed around the 5V and 3.3V regulators as shown in their respective data sheets?

Do you have a DMM to measure your 5V and 3.3V pins when the fault occurs?

Thanks.. Tom... :slight_smile:

TomGeorge:
Hi
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Board

Is this good enough? Otherwise I need to hand draw it from scratch.

TomGeorge:
Have you included the capacitors needed around the 5V and 3.3V regulators as shown in their respective data sheets?

I actually didn't, but I used this exact system on a Mega and it worked well. Used to read temperatures normally. I'm just trying to cut the costs now.

TomGeorge:
Do you have a DMM to measure your 5V and 3.3V pins when the fault occurs?

Thanks.. Tom... :slight_smile:

Fault occurs when I'm supplying the board with the barrel jack. Do you mean Arduino's 5V and 3.3V pins or the voltage across NTC sensor? If it's the voltage across NTC, I don't power NTC sensors from the Arduino in either cases, they get powered by the exact same way, from the voltage regulator. Here is the datasheet as well.
RECOM R-78E Datasheet

Hi,
Thanks for the diagram;

But it does not really show much, please draw a diagram that includes your components and interconnections, not just terminals.
The diagram you have provided is not any good for troubleshooting as there is no indication of interconnections, except a search a word puzzle, and no sensor or controller symbols.

Thanks.. Tom.. :slight_smile:

Alright, that's gonna take some time. Thanks for the help, I'll be right back in like half an hour or so.

Please please please don't mock me about this, hopefully it works.

Hi,
Have you included the capacitors needed around the 5V and 3.3V regulators as shown in their respective data sheets?

Can you post a diagram of how you have wired your regulators and what their part numbers are?

A photograph of a hand drawn picture would be better, including ALL your wiring.

I hope you really haven't got the NTC connected directly across the 5V supply?

Thanks.. Tom.. :slight_smile:

TomGeorge:
Hi,
Have you included the capacitors needed around the 5V and 3.3V regulators as shown in their respective data sheets?

No I didn't. I tried them before without the caps and they worked normally so I thought it was for filtering and didn't think it was neccessary. Was I mistaken?

TomGeorge:
Can you post a diagram of how you have wired your regulators and what their part numbers are?

They take 12V and ground, put out 5V and 3V. Nothing else happens, no other component there. Can't find the part numbers but here are the links to the product pages of the components on the manufacturer's site.
3.3V Regulator
5V Regulator

TomGeorge:
A photograph of a hand drawn picture would be better, including ALL your wiring.

The whole circuit would take really long I will try to draw it at some point and post it here.

TomGeorge:
I hope you really haven't got the NTC connected directly across the 5V supply?

No I haven't. Sorry about the diagram above. It's a simple voltage divider circuit, 5V goes across NTC, divides between the Arduino and ground over 10K res.

TomGeorge:
Thanks.. Tom.. :slight_smile:

No I thank you dude. You are trying to help me :slight_smile:

Seems to me that you HAVE connected NTC to GND and +5V. That is wrong.

-How have you connected that to ADC port on arduino?
-What is the range of the NTC resistance in different temperatures?

Your picture could be clearer, take some time and draw in on paper if fritzing is not familiar.
As said before, ALL connections you actually use.

Cheers,
Kari

Hi,
The reason for the capacitors for the regulators, is to help with noise and stability of the regulator.

Our apprentice at my workplace has been designing and setting up a portable remote controlled flashing light using Arduino ProMini and a Lora module.
He was having problems with the receiver not always initializing properly and indicating a failure to connect to the Lora module.
He was using a 3.3V reg to separately supply the Lora and he hadn't placed any caps around the reg.
When the PorMini was trying to initialize the Lora, the 3.3V supply rail was taking to long to reach 3.3V, so it was not fully powered up.
Two 0.1uF and a 47uF Tantalum around the 3.3V reg fixed the problem and it initializes everytime now.

Basically at the moment draw the NTC circuit and how you have connected them to the Arduino, and include your two regulators.

Tom... :slight_smile:
PS. The unit is out for trials at the moment, but when it comes back in I might get him to remove the caps and hook a scope up to the 3.3V output and see how different no caps and fitted caps is.

RabbitTheDevil:
No I didn't. I tried them before without the caps and they worked normally so I thought it was for filtering and didn't think it was neccessary. Was I mistaken?

You were lucky the first time. They need the capacitors for stability, especially the output side but usually also needed on the input side - see data sheet for minimum value and recommended type of capacitor. Place them as close as possible to the actual regulator.

wvmarle:
You were lucky the first time. They need the capacitors for stability, especially the output side but usually also needed on the input side - see data sheet for minimum value and recommended type of capacitor. Place them as close as possible to the actual regulator.

Thank you for the suggestion.

GaryP:
Seems to me that you HAVE connected NTC to GND and +5V. That is wrong.

-How have you connected that to ADC port on arduino?
-What is the range of the NTC resistance in different temperatures?

Your picture could be clearer, take some time and draw in on paper if fritzing is not familiar.
As said before, ALL connections you actually use.

Cheers,
Kari

NTCs are correctly wired, the thing that thinks it is a schematic above is wrong. Sorry about that.

TomGeorge:
Hi,
The reason for the capacitors for the regulators, is to help with noise and stability of the regulator.

Our apprentice at my workplace has been designing and setting up a portable remote controlled flashing light using Arduino ProMini and a Lora module.
He was having problems with the receiver not always initializing properly and indicating a failure to connect to the Lora module.
He was using a 3.3V reg to separately supply the Lora and he hadn't placed any caps around the reg.
When the PorMini was trying to initialize the Lora, the 3.3V supply rail was taking to long to reach 3.3V, so it was not fully powered up.
Two 0.1uF and a 47uF Tantalum around the 3.3V reg fixed the problem and it initializes everytime now.

Basically at the moment draw the NTC circuit and how you have connected them to the Arduino, and include your two regulators.

Tom... :slight_smile:
PS. The unit is out for trials at the moment, but when it comes back in I might get him to remove the caps and hook a scope up to the 3.3V output and see how different no caps and fitted caps is.

I'll fix the issue about regulators when I order another board.

Thank you all for your answers, but the problem is not about the regulator or how the NTCs are wired.

All 3 NTCs get the current from the regulator in every case. The only difference between me reading the correct value of temperature is how I power the Arduino. If I power it through the barrel jack on board, I read something around 15 degrees celcius. If I power the board through the barrel jack, and then power the arduino through the USB converter while bridging the grounds together, I read 25 degrees which is the correct value. This makes me believe that the problem is some sort of reference point getting mistaken on Arduino as when I power it through the barrel jack, I use 12 Volts on RAW pin. In both cases, NTCs get the current flow from 5V regulators, not from the Arduino itself. That is why I believe it's like a reference point problem. If there was something wrong with the regulators, I wouldn't be able to read correctly when I power the Arduino from the USB converter, if I am correct.

I really appriciate your inputs on this, I'll fix them all as soon as possible starting with the regulator caps. But right now I need to figure out the problem with this, so I can order another board that is fixed.

TL;DR: I power the Arduino from RAW pin with 12V, I get wrong readings. I power the Arduino from USB converter, I get correct readings. Every other part of the project remains the same. I'll get the caps for regulators on the next board.

When you power from USB, Vcc is about 4.5V. When you power from 12V, Vcc is about 5V.

Vcc is used as ADC reference.

That's your problem.

Simple solution: power the NTCs from your Arduino's 5V pin, and regardless of the actual value of Vcc the thermocouples will read the same.

wvmarle:
When you power from USB, Vcc is about 4.5V. When you power from 12V, Vcc is about 5V.

Vcc is used as ADC reference.

That's your problem.

Simple solution: power the NTCs from your Arduino's 5V pin, and regardless of the actual value of Vcc the thermocouples will read the same.

Thank you, I'll try that.

Thanks everyone for suggestions once more.

wvmarle:
When you power from USB, Vcc is about 4.5V. When you power from 12V, Vcc is about 5V.

Vcc is used as ADC reference.

That's your problem.

Simple solution: power the NTCs from your Arduino's 5V pin, and regardless of the actual value of Vcc the thermocouples will read the same.

This solved my problem for future references.