# Create sine signal from digital pulses using Arduino

## Here you will learn how to generate sine signal using Arduino UNO digital signal.

In this tutorial you will learn how to create sine signal from digital pulses using Arduino UNO. Sine wave signal is one important and fundamental signal. As such it is good to know how to generate sine wave signal for electronics application or other sciences experimentation.

One simple way to Create sine signal from digital pulses using Arduino is to use the digital pulses that can be generated using Arduino. It is likely that you already know how to generate digital pulses using Arduino. If you recall, the arduino digitalWrite function is used for this purpose. The delay between the high and low pulses is created using the delay function. The tutorial digitalRead and digitalWrite covers some basic of using digitalWrite function.

Now if this periodic digital signal is fed to a RC low pass filter then at the output of the filter you will get approximate sinusoidal signal. See the following circuit diagram.

As you can see we have connected the RC Low Pass Filter at the pin 9.The value of resistor is 318KOhm and value of capacitor is 1uF. We will explain how this values was calculated further down.

Now the following is the Arduino program code that generates the digital pulses of frequency of 0.5Hz.

This code generates digital signal having period of 2000ms, hence the frequency is 0.5Hz.

$f=\frac{1}{T_p}=\frac{1}{2000*10^{-3}}=\frac{1000}{2000}=0.5$

Then to find the value of resistor and capacitor we use the following RC filter equation,

$f=\frac{1}{2\pi&space;RC}$

Here we can choose C = 1uF and f =0.5Hz. Using these values we get R = 318KOhm.

Now we can view the filtered output using oscilloscope. This is shown below.

The output of the RC filter is shown in blue color. This sine wave is not exact because of the filter design but it illustrates the concept of converting digital pulses to sinusoidal signal.

0 points
Upvote Downvote