Voltage read circuit with relay on/off

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.

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.

3) Is this programing issue?

No.

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.

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… :slight_smile:

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

Thank you very much.

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

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… :slight_smile:

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?

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.

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.

R7 = 220k, R6 = 50k

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

Should it be isolated?

No.

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.

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.

Thank you for all your comments.

But, I am not sure I understand following comment

  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?

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

Grumpy_Mike:

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?

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.

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.

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..... :)

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.

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..... :)

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

I meant change in voltage reading. At first you thought there was something wrong as you got a change. Now you know there is something wrong because you are not measuring the change in voltage correctly. However your voltage is sagging under the load of your relay.

Your terms are all muddled up. You do not take voltage your relay takes current, yes it takes a lot of current, you tell me how much because you haven't told me the type. It is the current your relay is taking that is causing the voltage to drop because of the high impedance or poor regulation of your solar cells. You are going to measure that correctly when you put the right resistors in your circuit. If your grounds are wired right.

Tom,

Solar part is pretty simple, no any drawing now. Sorry.

After more tests, I think it’s design problem. After relay is on, the load is equivalent to a resistor “on top of resistor divider”. Therefore, the code to calculate the voltage does not work anymore. You can change the code to “account” for the added resistor (it is load) to compensate it, but if it’s unknown load (such as different pump), it’s not a solution.

(See attached picture)

I tried on 5v input, and simply use a resistor added as a load (attached the relay, one end of resistor is attached to ground, another end attached to relay output). I noticed that it is off about 0.5v as well:

  1. Measure output (the relay output when it is on) is, such as 5v.

  2. But, the code read voltage is 5.5v. (Input is 5v. It can’t be 5.5v).

  3. When relay is off, the code voltage read is 5v.

So, can someone suggest a right circuit design?

relay_designissue.jpg

After relay is on, the load is equivalent to a resistor "on top of resistor divider". Therefore, the code to calculate the voltage does not work anymore.

No that is wrong. That relay is a load in parallel with your potential divider and has no effect at all on the potential divider.

I have told you what is going on before. Your relay is drawing so much current that the voltage drops. The potential divider still works the same and still measures what you have.

can someone suggest a right circuit design?

There is nothing wrong with your circuit.

If removing relay,

1) Do you agree my hand drawing of 2nd part? Relay + pump = resistor?

2) If agree 1), can the code calculates same voltage results for 2 circuits (my latest hand drawings) ? Your suggestions is that code will generate same voltage reading for 2nd part of drawing. I hope so. But, I really doubt about it, as it's obvious different circuit for calculating voltage (not simply 2 resistors divider any more).

3) If NOT agree 1), what equivalent circuit is after relay is on? What can I do to avoid it? Should I change code to calculating voltage after relay is on (2 sets of code to read voltage). I should choose "good" relay to avoid this issue.

I believe 1), so I will do a test according to 1). (very simple test.)

(Never done electrical since college. I am really confused. Sorry.)