Dear Sir.
I have tried many things that I search in this forum and internet, but nothing solve this problem =(
I have one very simple system to read temperature from one 100kOhms Thermistor and in this moment the arduino is provide from the USB 5V and have very stable readings.. Very good to one future PID system.
So.. When I have problem?
When I turn on one 12v PSU near the arduino (without any connection with arduino), I have very unstable readings and temperature start show a crazy variation.
Now.. What things I have tried?
- Simple 5v with thermistor, resistor and GND.
- Simple 3.3v with thermistor, resistor and GND.
- 5v using bridge to AREF and analogReference(EXTERNAL) in code, thermistor, resistor and GND
- 3.3v using bridge to AREF and analogReference(EXTERNAL) in code, thermistor, resistor and GND
- 5v and 3.3v changing the thermistor to one resistor.
- Using two AnalogRead() to rescale readings
- Changing thermistors (same problem)
- Changing PSU (same problem)
- Changing Arduino Uno, Nano or Mega (same problem)
- Using one potentiometer 1kOhms/5k/10k..... (same problem)
Using AnalogReadSerial sketch and puting direct GND to A0, I dont have variations and read a good 0 in all times. If I connect the 5V direct in A0 is the same with 1023..
But if I use one resistor: GND (resistor) A0 or 5V (resistor) A0 the problem appears.. with PSUOFF I dont have problems, and with PSUON have variations...
Note: The PSU is not connected in arduino.. I use usb to supply the arduino and arduino is near PSU (10cm)
All methods ilustraded in images, included the change the thermistor to one resistor with same 100kOhms and same problem appears.
The methods using AREF.. I change code using analogReference(EXTERNAL)
So.. The readings without PSU - Same with changing thermistor by one resistor.
RawTemp: 94 RawAvg: 92.80 Temp: 24.73
RawTemp: 92 RawAvg: 93.00 Temp: 25.00
RawTemp: 92 RawAvg: 92.80 Temp: 24.73
RawTemp: 92 RawAvg: 92.60 Temp: 24.73
RawTemp: 93 RawAvg: 92.60 Temp: 24.73
RawTemp: 92 RawAvg: 92.20 Temp: 24.73
RawTemp: 93 RawAvg: 92.40 Temp: 24.73
RawTemp: 92 RawAvg: 92.40 Temp: 24.73
RawTemp: 92 RawAvg: 92.40 Temp: 24.73
RawTemp: 90 RawAvg: 91.80 Temp: 24.46
RawTemp: 94 RawAvg: 92.20 Temp: 24.73
RawTemp: 90 RawAvg: 91.60 Temp: 24.46
RawTemp: 92 RawAvg: 91.60 Temp: 24.46
RawTemp: 92 RawAvg: 91.60 Temp: 24.46
RawTemp: 93 RawAvg: 92.20 Temp: 24.73
RawTemp: 93 RawAvg: 92.00 Temp: 24.73
RawTemp: 93 RawAvg: 92.60 Temp: 24.73
RawTemp: 94 RawAvg: 93.00 Temp: 25.00
RawTemp: 94 RawAvg: 93.40 Temp: 25.00
RawTemp: 92 RawAvg: 93.20 Temp: 25.00
RawTemp: 92 RawAvg: 93.00 Temp: 25.00
The readings with PSU ON
RawTemp: 83 RawAvg: 83.00 Temp: 22.19
RawTemp: 78 RawAvg: 82.80 Temp: 21.89
RawTemp: 91 RawAvg: 84.00 Temp: 22.48
RawTemp: 90 RawAvg: 91.00 Temp: 24.46
RawTemp: 29 RawAvg: 78.60 Temp: 20.68
RawTemp: 98 RawAvg: 81.00 Temp: 21.59
RawTemp: 59 RawAvg: 74.00 Temp: 19.42
RawTemp: 100 RawAvg: 75.20 Temp: 19.74
RawTemp: 92 RawAvg: 75.60 Temp: 19.74
RawTemp: 92 RawAvg: 88.20 Temp: 23.62
RawTemp: 123 RawAvg: 93.20 Temp: 25.00
RawTemp: 124 RawAvg: 106.20 Temp: 28.34
RawTemp: 116 RawAvg: 109.40 Temp: 29.06
RawTemp: 83 RawAvg: 107.60 Temp: 28.58
RawTemp: 93 RawAvg: 107.80 Temp: 28.58
RawTemp: 139 RawAvg: 111.00 Temp: 29.54
RawTemp: 112 RawAvg: 108.60 Temp: 28.82
RawTemp: 135 RawAvg: 112.40 Temp: 29.77
RawTemp: 104 RawAvg: 116.60 Temp: 30.70
RawTemp: 81 RawAvg: 114.20 Temp: 30.24
RawTemp: 112 RawAvg: 108.80 Temp: 28.82
RawTemp: 112 RawAvg: 108.80 Temp: 28.82
RawTemp: 55 RawAvg: 92.80 Temp: 24.73
RawTemp: 90 RawAvg: 90.00 Temp: 24.18
RawTemp: 100 RawAvg: 93.80 Temp: 25.00
RawTemp: 112 RawAvg: 93.80 Temp: 25.00
RawTemp: 95 RawAvg: 90.40 Temp: 24.18
RawTemp: 126 RawAvg: 104.60 Temp: 27.84
RawTemp: 85 RawAvg: 103.60 Temp: 27.59
RawTemp: 89 RawAvg: 101.40 Temp: 27.09
RawTemp: 61 RawAvg: 91.20 Temp: 24.46
The readings with PSU ON and thermistor changed by one resistor
RawTemp: 92 RawAvg: 97.00 Temp: 26.06
RawTemp: 91 RawAvg: 98.80 Temp: 26.32
RawTemp: 88 RawAvg: 99.80 Temp: 26.58
RawTemp: 141 RawAvg: 100.80 Temp: 26.84
RawTemp: 122 RawAvg: 106.80 Temp: 28.34
RawTemp: 42 RawAvg: 96.80 Temp: 25.80
RawTemp: 189 RawAvg: 116.40 Temp: 30.70
RawTemp: 100 RawAvg: 118.80 Temp: 31.16
RawTemp: 78 RawAvg: 106.20 Temp: 28.34
RawTemp: 78 RawAvg: 97.40 Temp: 26.06
RawTemp: 96 RawAvg: 108.20 Temp: 28.82
RawTemp: 108 RawAvg: 92.00 Temp: 24.73
RawTemp: 87 RawAvg: 89.40 Temp: 23.90
RawTemp: 57 RawAvg: 85.20 Temp: 22.77
RawTemp: 70 RawAvg: 83.60 Temp: 22.19
RawTemp: 0 RawAvg: 64.40 Temp: 16.02
RawTemp: 101 RawAvg: 63.00 Temp: 15.66
RawTemp: 92 RawAvg: 64.00 Temp: 16.02
RawTemp: 95 RawAvg: 71.60 Temp: 18.44
The code used:
#define PinThermistor A0
#define ReadTempDelay 1000
#define ReadSamples 5
int idx = 0;
int Temp[ReadSamples];
unsigned long LastReadTemp = 0;
void setup(void)
{
Serial.begin(115200);
for (int i = 0; i < ReadSamples; i++)
{
Temp[i] = analogRead(PinThermistor);
delay(100);
}
LastReadTemp = millis();
}
void loop(void)
{
unsigned long TimeNow = millis();
if (TimeNow > ReadTempDelay+LastReadTemp)
{
idx++;
if (idx >= ReadSamples) idx = 0;
int RawTemp = analogRead(PinThermistor);
Temp[idx] = RawTemp;
double RawAvg = 0.0;
for (int i = 0; i < ReadSamples; i++) RawAvg += Temp[i];
RawAvg /= ReadSamples;
double Temp = ThermistorC(RawAvg);
Serial.print("RawTemp: ");
Serial.print(RawTemp);
Serial.print(" RawAvg: ");
Serial.print(RawAvg);
Serial.print(" Temp: ");
Serial.print(Temp);
Serial.println("");
LastReadTemp = TimeNow;
}
}
double ThermistorC(int RawADC)
{
// termistor 100k e resistor 10k = 1000
// termistor 100k e resistor 100k = 10000
double Temp;
Temp = log(1000.0*((1023.0/RawADC-1)));
Temp = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * Temp * Temp ))* Temp);
Temp = Temp - 273.15;
return Temp;
}
I want make one PID Temperature control with Arduino using SSR, but with this very crazy readings I never will have success with this project =(
I tried many methods of internet to stable the readings, but nothing help, and I dont have conection between Arduino and PowerSupply.. But in future, this PowerSupply will be supply the arduino in Pin Vin and
GND.. And they need work near and together
Anyone can help me?





