Go Down

Topic: Voltage read circuit with relay on/off (Read 5054 times) previous topic - next topic

hlai_arduino

Hi,

I have a simple voltage read circuit:

1) 2 resistors divide input of 15v (solar source), the middle of connected resistors connect o arduino uno analog input (just like tutorial).
2) Same input source connect to a relay, which is disconnected by default. Relay load is a pump. When arduino uno detect input voltage above a threshold, relay will be on.

My problem:

1) Relay off. Program is able to read input voltage correctly.
2) Relay on. Program is not able to read input voltage accurately. It is +0.5 v that real voltage.

My question:

1) When relay on, the 2 resistor circuit to read voltage may not be "accurate" anymore. It's equivalent of another "resistor"(pump) is connected from input of source to ground. Is this the source of the problem?

2) What's is the circuit to solve this problem?

3) Is this programing issue? I should use different parameter to adjust the reading when relay on/off?

Thanks.






Grumpy_Mike

Quote

1) When relay on, the 2 resistor circuit to read voltage may not be "accurate" anymore. It's equivalent of another "resistor"(pump) is connected from input of source to ground. Is this the source of the problem?

No.

Quote
3) Is this programing issue?

No.

Quote
2) What's is the circuit to solve this problem?

A proper circuit. But you have not given the circuit you have. We need a schematic and a photograph of what you have.

TomGeorge

Hi,
Can you please post a copy of your sketch, using code tags.

Can you please post a  copy of your circuit, in  CAD or picture of hand drawn circuit in jpg, png or pdf format.

Thanks ..Tom.... :)
Everything runs on smoke, let the smoke out, it stops running....

hlai_arduino

I am attaching the circuit drawing.  (you can ignore the value of resistors)

Thank you very much.


cjdelphi

I love the 0 ohms resistor divider :)  give the arduino power!

TomGeorge

Hi, are you testing the circuit with the solar panel? if so what are its specs.
Have you tried using a variable power supply in place of the panel anrduino?

Tom..... :)
Everything runs on smoke, let the smoke out, it stops running....

Grumpy_Mike

I did say "and a photo".
We need to see how this is laid out. One problem you can get is if the path from the ground of your divider is carrying current from your relay. This is called ground bounce and can affect measurements in exactly the way you say.

Also have you actually measured the voltage on the analogue input pin with a meter, does this change?

Quote
you can ignore the value of resistors

No, the absolute values of the resistors are important for the settling time of the A/D, if there are above 10K or so it could be your problem.

hlai_arduino

R7 = 220k, R6 = 50k

Based on response so far, my circuit is ok.  BUT,  I am thinking my design has problem due to reading voltage and output are connected. They are not "isolated". Should it be isolated? I am software guy. Anyone see problem?

This is experiment I've done, For example:

1) Relay off, program read 12.6v. Voltage meter read is 12.6v.
2) Relay on, program read 11.6v. Voltage meter read is 10.7v.  (Why???)

My solar panel connect to a solar controller/battery. Input 15v source (this post) is output of a solar controller.

I did not use variable power supply. Does it make difference for my test above?

I did not attach phone due to not on breadboard. I already wired in up and it's too "ugly" to see details.

Grumpy_Mike

Quote
R7 = 220k, R6 = 50k

That is your problem way too high. try dividing them by 10.

Quote
Should it be isolated?

No.

Quote

1) Relay off, program read 12.6v. Voltage meter read is 12.6v.
2) Relay on, program read 11.6v. Voltage meter read is 10.7v.


That looks like another problem. Your power supply can not provide enough current for your relay causing it's voltage to sag. This in turn will affect the voltage reference and affect the reading.

Quote
I already wired in up and it's too "ugly" to see details.

Does that mean you are not going to rewire it if that is the problem. Often "ugly" wiring is a contributing factor to problems like this. You are dealing with analogue measurement, these things are easily got wrong.

hlai_arduino

Thank you for all your comments.

But, I am not sure I understand following comment

Quote

1) Relay off, program read 12.6v. Voltage meter read is 12.6v.
2) Relay on, program read 11.6v. Voltage meter read is 10.7v.


----You comment---
That looks like another problem. Your power supply can not provide enough current for your relay causing it's voltage to sag. This in turn will affect the voltage reference and affect the reading.
----



If my power supply can not provide enough current for relay, meter reading will also be affected, and program reading = meter reading. Right? Not just program reading get affected. Right?



hlai_arduino

Quote
R7 = 220k, R6 = 50k
That is your problem way too high. try dividing them by 10.

Quote
R7 = 220k, R6 = 50k

That is your problem way too high. try dividing them by 10.


---Question on your comment.

You said R7 = 22k, R6 = 5k? Is this going to waist  too much of power source? How to do you determine the value of the resistor used, so that you know voltage reading circuit is not wasting power source?

Grumpy_Mike

Quote
If my power supply can not provide enough current for relay, meter reading will also be affected, and program reading = meter reading. Right? Not just program reading get affected. Right?

That is right. First this is an indication that you should get a change, so now your problem is this change is not being measured correctly. Remember you first thought the change was a problem.

Quote
Is this going to waist  too much of power source? How to do you determine the value of the resistor used, so that you know voltage reading circuit is not wasting power source?

You need at the most 10K on the analogue input port.
If you are worried about wasting power, consider how much that divider takes and contrast that with how much your relay takes. It is like worrying about water loss from a bucket, and covering the bucket with a lid to prevent evaporation, instead of mending the leak in the bucket.

TomGeorge

Hi.
Please what is the specification of your solar panel, open circuit voltage and short circuit current.
A picture of it please and its dimensions, where did you get it?

Tom..... :)
Everything runs on smoke, let the smoke out, it stops running....

hlai_arduino


Hi Grumpy_Mike:

You said "change". You mean "new wiring after relay is on"? Can you explain? Voltage reading program should consider the "change"?

I can only think of relay is a resistor that takes some voltage out from pump, which is the reason the measure (measure from pump input, not counting the relay, if it is an equivelant resistor, not really a "clean wire"). My hand meter measure is the pump. I can measure from the relay, which might review where voltage is lost.



Hi Tom:

I build the solar panel of 120 watts. I just know it works ok. I can turn on my 30 watts pump all day with sun, and for few hours after sun set.

I bought a marine battery from costco about $70. Solar controller. $20 bought at ebay.




TomGeorge

Hi, have you got your arduino project AND solar controller in circuit as well.

Can you please post a  copy of your circuit, in  CAD or picture of hand drawn circuit in jpg, png or pdf format.

Tom..... :)
Everything runs on smoke, let the smoke out, it stops running....

Go Up