How to read sinusoidal signal using Arduino Due | applied electronics engineering

# How to read sinusoidal signal using Arduino Due

By Applied Electronics - Wednesday, April 5, 2017 No Comments
In this arduino tutorial you will learn how to read sinusoidal signal using Arduino Due. This tutorial is taken from Reading sinusoidal analog signal using Arduino Due.

Basically, here we create sinusoidal signal using Arduino UNO and sent that signal to Arduino Due. Matlab's Simulink software is used to plot the sinusoidal signal.

### Creating Sinusoidal signal using Arduino UNO

How to generate sinusoidal signal using Arduino UNO was already covered in the previous tutorial. See Using Arduino UNO to generate sine signal. So we will explain the generation of sinusoidal signal. However, we will have to adjust the sine signal from the filter output from the previous tutorial because the sine signal from the previous tutorial has magnitude or amplitude of 5V. This is because we have been using Arduino UNO. And since we are using ADC of the Arduino Due to read the sine signal and because Arduino Due operates with voltage range with maximum amplitude of 3.3V we have to decrease the amplitude of the sine wave coming from Arduino UNO after the filter. How to do this is explained next.

Create the hardware connection according to the following diagram.

As you may have noticed we have added a resistor parallel to the first resistor and the two resistors forms a parallel resistor network. This according to the voltage divider rule will reduce the voltage at the meeting point to 2.5V. So now the output signal from the LPF is a sinusoidal signal with amplitude of 2.5V and frequency of 0.5Hz(see previous tutorial).

The following figure shows the simulation obtained graph that shows that the amplitude is indeed upto 2.5V.

### How to read sinusoidal signal using Arduino Due

In order to read the sinusoidal signal we will connect the filter output to one of the analog pin of Arduino Due. Then in order to plot the sinusoidal signal we use the Simulink scope. So in this tutorial we will be using the Matlab simulink to read the sinusoidal analog signal obtained from Arduino Due and plot it on the time scope in simulink. If you don't know how to use simulink or just want to learn simulink see Download Introduction to Simulink with Engineering Applications PDF free.

But the simulink model is not easy to use for Arduino Due. If you want just to use the default 10-bit ADC of Arduino Due then you can use the Simulink Hardware support for Arduino block library in Simulink. See the tutorial Arduino Simulink Digital Input example for this. But if you use these blocks you can't use the 12-bit ADC feature of the Arduino Due. More resolution is better so we want to use the Arduino Due 12-bit ADC and for this reason we have to use the S-Function Builder blocks in Simulink. If you want to learn how to use S-Function builder you have to read the tutorial How to program Arduino Due using Simulink S Function.

The following is the Simulink model to read sinusoidal signal using Arduino Due using S-Function block.

Once you have setup the hardware and simulink model you are ready to read the sinusoidal signal.

First, run the program to generate the digital pulses in Arduino UNO using Arduino IDE. Then the signal will be generated and will pass into the LPF. The output of the low pass filter is sinusoidal signal with amplitude adjusted for Arduino Due ADC. Then run the simulink model. This will read the sinusoidal signal and plot in the Time Scope.

Hope you liked the tutorial. If you did not understand anything above, leave comment and we will help you try to solve your problem.