Generate Single Phase Or Three Phase Sine wave by Arduino

You can generate single phase or three phase 50 Hz Sine Wave through simple coding of Arduino.  The code link is given  here click to download on the link   or    to see the code in details.


// Formule  y(t) = A sin(wt +p)

// Where; A = Amplitude, w =Angluar Frequency. t = Time , p =Phase Difference

// Frequenvy = 50Hz, 3 Phase R Y B, Phase Angle Difference = 120 degree

// R(t) = A sin ((Angular Frequency * time)+ Phase Angle Difference)

// Y(t) = A sin ((Angular Frequency * time)+ Phase Angle Difference)                                     //  B(t) = A sin ((Angular Frequency * time)+ Phase Angle Difference)

// Programmed By Mr. Adeeb Raza

int R= 9     //R Phase at pin no.9

int Y=10;   //Y Phase at pin no.10

int B=11;  //B Phase at pin no.11

void setup() {

Serial.begin (9600);

pinMode(R, OUTPUT);

pinMode(Y, OUTPUT);

pinMode(B, OUTPUT); }

void loop() {

for (int t=0; t<20; t++){ // one cycle 360 degree movement in 20 mili seconds

float R = 2.5* sin ((50*t)+0);    // R Phase Zero Degree

float Y = 2.5* sin ((50*t)+120);  // Y Phase 120 Degree

float B = 2.5* sin ((50*t)+240);  // B Phase 240 Degree

digitalWrite(9, OUTPUT);          // R phase Output on pin No. 9

digitalWrite(10, OUTPUT);        // Y phase Output on pin No. 10

digitalWrite(11, OUTPUT);        // B phase Output on pin No. 11

Serial.print(R); Serial.print(” “);

Serial.print(Y); Serial.print(” “);

Serial.print(B); Serial.println(” “);




// End code


Adeeb Raza

About adeebraza1236

I am an electronic instrumentation engineer by profession but I am working as a design engineer. I can design electronic hardware interface circuits for computer based security system, Computer based industrial control system for automation and process control Etc. My Interests: Electronics Circuit designing with PCB Designing, Computer software development using VB & C , PC based security system, Designing LED Lights, UPS, Inverter Etc
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s