LM358 50Hz 5V sine wave?

Great. Thanks to everyone who helped me in this discussion. However, because I'm curious, I'm testing this project with an oscillator to see if it works.

:heart:

Exactly, phase angle has noting to do with it.
What you need is to measure the power load on each phase and adjust the load to balance out the load.

I think you need to study up a bit about 3 phase power transmission.

Tom... :smiley: :+1: :coffee: :australia:

1 Like

Well, the oscillator is really not going to be of any use, but as an exercise there's nothing wrong with building one on a breadboard to see how it works.

1 Like

No. It really doesn't make any sense.

1 Like

Suppose you have an oscillator Q. You have two AC sources A and B. You decide to measure the phase difference of A and B by comparing them with Q. Now you have Q-A and Q-B. The phase differerence between those is (Q-A)-(Q-B). That reduces to (-A)-(-B), then (-A)+B, then B-A.

Or, you could just compare B with A and get B-A.

Do you see the futility of using Q?

Also, digital sine function generators are available for about $5, complete. Those would have a crystal locked frequency which might help you a lot.

Another way, an Arduino can be programmed to produce a 50Hz square wave. Feed that to two chained op amp integrators. The first will produce a triangle wave. The second will approximate a sine wave.

1 Like

Why? You're measuring mains voltages, aren't you? This sort of mysterious statement is why people ask you what you're doing.

Well, I said it all in #21. :sunglasses:

Another way, an Arduino can be programmed to produce a 50Hz square wave. Feed that to two chained op amp integrators. The first will produce a triangle wave. The second will approximate a sine wave.

Can you help me with schematic and draw a circuit of op amp?

I wrote an Arduino program that generates a 50Hz square wave:

unsigned int freq = 50;
int sqwPin = 13;

void setup() {
  Serial.begin(9600); 
}
void loop() {

  tone(sqwPin, freq);
  freq = 50;
}

Here is the basic circuit. I can't vouch for the entire design, but I know it works because I built one a long time ago...
http://www.learningaboutelectronics.com/Articles/Function-generator-circuit.php

1 Like

thanks. Does this circuit work with 5 volt power supply ?

I don't know, but you can always make one that runs on 5V. The basic circuit doesn't depend on any particular supply voltage. Sometimes you might need a rail to rail op amp when the supply voltage is low.

It's an idea, not a recipe. In fact you might find variations on this circuit online. I just picked the first one I found...

1 Like

Ok thank you I'm trying this circuit

Why do you continuously set freq to 50? Actually, why do you call tone() repeatedly? You only need to do it once.

I wrote this code according to this post. what is the problem ?

https://www.arduino.cc/reference/en/language/functions/advanced-io/tone/

What do you mean, "according to this post"?

sorry I mean this link: https://www.arduino.cc/reference/en/language/functions/advanced-io/tone/

That's the same link. Is there something I'm supposed to hunt for there?

new code. is it ok ?

unsigned int freq = 50;
int sqwPin = 13;

void setup() {
  Serial.begin(9600); // Serial Port Baud = 9600 8,N,1
  tone(sqwPin, freq);
}
void loop() {
}

Sure, better. I would have used an int for freq and a const int for the sqwpin, though... Also I would have removed the Serial.begin().

1 Like

After all this, the OP seems to fail to grasp the voltage of each phase is not the problem or what they pay for. It is the current of each phase that their meter records. If the difference between the voltage and current phases gets too great, then they will get charged for phantom power. In this country the charge is called "demand" charge.
My late company had three 3-phase meters. The one connected to a big transformer got charged for a demand value because of the big inductance on that power .
All three meters and one other meter for another business all came from the same transformer. That transformer and many others in the neighborhood were fed from another big transformer which was fed from distribution lines from the power substation with more transformers.
My point is there is no point in trying to measure the voltage phase of your buildings. The current being used on each phase makes the difference and all the buildings get fed from identical power.

1 Like