Relay board and Temp sensor voltage issues ?

I have a basic setup, with a Ardunino Uno Connected to a 3 pin Temperature sensor and a 4 relay board. I simply have the Ardunio reading the Temp in a loop and I am using the 4 relays on TimeAlarm.h turning things on and off.

The relays turn on and off fine.

The Temp sensor reads corectally (21c in my office), unless a relay come on and it goes up to 25c and more as more as more relays come on.

The relays and temp sensor (+ an LED to show power ) are powered off the Arduino +5 pin. My multimeter shows 5v with the LEd and Temp sesor on, but it does drop to about 4.5v witht the relays on.

I'm assuming the 4 Relay board is sucking to much electricity and making the Temp Sensor read wrong ? I should powwer it via its own supply ?

What temperature sensor? What relay board? What code?

Temp sensor is a Texus Instruments LM35 DZ

Reads Bang on with the following code :

for(tempi = 0;tempi<=7;tempi++){ // gets 8 samples of temperature

samples[tempi] = ( 5.0 * analogRead(pin) * 100.0) / 1024.0;
tempc = tempc + samples[tempi];
delay(1000);
}
tempc = tempc/8.0; // better precision

Serial.print(tempc, DEC); // Test Print to serial port
Serial.print(' '); // Test Print to serial port
Serial.print('\n');

if (tempc > 40) // Check and drop temp if its over the max of 40
{
tempc = 20;
}

analogWrite(dialone, (tempc - 15) * 10); // Calculate and display on Analogue one temp

tempc = 0;

Relay board was an eBay job, no markings except for "4 Relay Module"

void Relay1ON(){
Serial.println("Relay 1 On - White Light");
digitalWrite(RELAY1,LOW); // Turns ON Relays 1 (White Lights)
}

void Relay1OFF(){
Serial.println("Relay 1 Off - White Light");
digitalWrite(RELAY1,HIGH); // Turns OFF Relays 1 (White Lights)
}

Using the above code to turn on and off the relays. They turn on and off fine with this code, but just make the Temp read higher, and higher the more you turn on. The volts from the 5v Pin Also drops a little each time.

The relays and temp sensor (+ an LED to show power ) are powered off the Arduino +5 pin. My multimeter shows 5v with the LEd and Temp sesor on, but it does drop to about 4.5v witht the relays on.

There is your problem, the load of the relay coils is lowering the arduino's +5vdc supply. The LM35 output voltage will be effected by a change in the +5vdc voltage. What relays are you using, how much current does each relay coil require? You may have to use an external regulated +5vdc power source for the relays.

Lefty

retrolefty:
The LM35 output voltage will be effected by a change in the +5vdc voltage.

I think what is actually happening is that the LM35 output is staying the same, but the Arduino ADC is using the default 5V reference. So, when the 5V supply drops, the apparent input voltage increases.

A simple solution would be to use the 3.3V pin as the analog reference. See the documentation for the analogReference function.

Having said that, if the 5V supply is dropping to 4.5V with all the relays on, then either the relays are taking too much current, or the power supply that is powering the Arduino is not up to the job.

Thats what I am thinking. Ill need to give the Relay board its own supply. It does seem to have the option for this via a JD-VCC jumper.

dc42:

retrolefty:
The LM35 output voltage will be effected by a change in the +5vdc voltage.

I think what is actually happening is that the LM35 output is staying the same, but the Arduino ADC is using the default 5V reference. So, when the 5V supply drops, the apparent input voltage increases.

A simple solution would be to use the 3.3V pin as the analog reference. See the documentation for the analogReference function.

Having said that, if the 5V supply is dropping to 4.5V with all the relays on, then either the relays are taking too much current, or the power supply that is powering the Arduino is not up to the job.

Well the LM35 shows that the output resistor is sized based on the chips supplied voltage (Vs) so if it changes it's output will indeed change.

Choose R1 = ?VS/50 µA

BigMrTong:
Thats what I am thinking. Ill need to give the Relay board its own supply. It does seem to have the option for this via a JD-VCC jumper.

That may well be the best solution. How are you powering your arduino board presently?

Lefty

retrolefty:
Well the LM35 shows that the output resistor is sized based on the chips supplied voltage (Vs) so if it changes it's output will indeed change.

Choose R1 = ?VS/50 µA

http://www.ti.com/lit/ds/symlink/lm35.pdf

R1 (resistor from the output to a negative supply) is only used if negative output voltages are required (i.e. to read temperatures below 0degC), and I doubt that the OP is using it. The figure that matters on the datasheet is the line regulation, which is given as 0.05mV/V tested limit. So when the supply voltage drops by 0.5V, the output for a given temperature may change by up to 25 microvolts, which is hardly significant.

Ill Check out the analogReference function.

dc42:

retrolefty:
The LM35 output voltage will be effected by a change in the +5vdc voltage.

I think what is actually happening is that the LM35 output is staying the same, but the Arduino ADC is using the default 5V reference. So, when the 5V supply drops, the apparent input voltage increases.

A simple solution would be to use the 3.3V pin as the analog reference. See the documentation for the analogReference function.

Having said that, if the 5V supply is dropping to 4.5V with all the relays on, then either the relays are taking too much current, or the power supply that is powering the Arduino is not up to the job.

USB at present. Have tried an external plug and that does make things slightly better but not fully.

retrolefty:

BigMrTong:
Thats what I am thinking. Ill need to give the Relay board its own supply. It does seem to have the option for this via a JD-VCC jumper.

That may well be the best solution. How are you powering your arduino board presently?

Lefty

With three Relays on, the voltage has dropped from 5v to 4.3v

My Log of temop is as below (19c is correct)

19
19
19
19
19
19
19
19
19
19
19
Relay 2 On
21
22
22
21
21
21
Relay 1 On
24
24
24
24
24
24
24
Relay 3 On
27
27
27
27
27
27
27
27
26
27
27
26
27

dc42:

retrolefty:
Well the LM35 shows that the output resistor is sized based on the chips supplied voltage (Vs) so if it changes it's output will indeed change.

Choose R1 = ?VS/50 µA

http://www.ti.com/lit/ds/symlink/lm35.pdf

R1 (resistor from the output to a negative supply) is only used if negative output voltages are required (i.e. to read temperatures below 0degC), and I doubt that the OP is using it. The figure that matters on the datasheet is the line regulation, which is given as 0.05mV/V tested limit. So when the supply voltage drops by 0.5V, the output for a given temperature may change by up to 25 microvolts, which is hardly significant.

So Could I use :

analogReference(External)

and connect the 3.3v pin to the AREFF pin ?

[/quote]

I think what is actually happening is that the LM35 output is staying the same, but the Arduino ADC is using the default 5V reference. So, when the 5V supply drops, the apparent input voltage increases.

A simple solution would be to use the 3.3V pin as the analog reference. See the documentation for the analogReference function.

Having said that, if the 5V supply is dropping to 4.5V with all the relays on, then either the relays are taking too much current, or the power supply that is powering the Arduino is not up to the job.
[/quote]

BigMrTong:
So Could I use :

analogReference(External)

and connect the 3.3v pin to the AREFF pin ?

Yes. Be sure to make the analogReference call before your first analogRead call. And change the figure 5.0 in your calculation to 3.3.

But, as I said, something is not quite right if the 5V supply is dropping to 4.5V. What are you using to power the Arduino and relay board?

[/quote]

Yes. be sure to make the analogReference call before your first analogRead call.

But, as I said, something is not quite right if the 5V supply is dropping to 4.5V. What are you using to power the Arduino and relay board?
[/quote]

I am powering the Arduino just from the USB port. The relay board is just powered from the 5v pin on the Arduino (which I think is the issue ?)

I have connected the 3.3v to AREF and called the function in Setup.

My log now looks like this. Seems this throws the temp sonsour out, but also still goes up as the relays go in.

30
30
30
30
30
30
Relay 2 On - Blue Light
34
34
34
34
34
34
34
Relay 1 On - White Light
37
37
37

Well, I have just tried powering the Relay board via its own 5v supply on the JD-VCC pin, and thats works fine. So looks like the relay board does just suck so much jiuce it effects the 5v supply to the Temp sensor.

Log now steady.

20
21
21
21
21
21
21
21
21
Relay 3 On - Dosing Pump
21
21
21
21
21
21
20
21
21
21
20
21
20
21