This document describes a project using a microcontroller to generate a sine wave. It discusses using an Arduino Uno and Nano microcontrollers, connecting components like a capacitor, LED, and jumper wires. A program is written and uploaded to the Arduino to generate PWM signals approximating a sine wave. The output wave is displayed on the Arduino IDE plotter and using the Nano to read the signal. The project demonstrates how a microcontroller can be used to generate different waveforms.
2. Background
Microcontroller is basically a device which is used as an interface between the physical system and
computer software
A microcontroller is a small and low-cost computer built for the purpose of dealing with specific tasks,
such as displaying information in a microwave LED or receiving information from a television’s remote
control. Microcontrollers are mainly used in products that require a degree of control to be exerted by
the user.
Invention of Microcontrollers. It was during 1970 and 1971 when Intel was working on inventing the
world's first microprocessor, that Gary Boone of Texas Instruments was working on quite a similar
concept and invented the microcontroller
2
3. Arduino : microcontroller
We have use 8 bit Arduino uno microcontroller its specifications are given below
Arduino is an open-source electronics platform based on easy-to-use hardware and
software. Arduino board are able to read inputs - light on a sensor, a finger on a button, or a
Twitter message - and turn it into an output - activating a motor, turning on an LED, publishing
something online. we can tell our board what to do by sending a set of instructions to the
microcontroller on the board. To do so we use the Arduino programming language(based
on Wiring) and the Arduino Software (IDE) based on processing.
3
5. Circuitry
Arduino uno microcontroller
Nano arduino microcontroller
Connecting cable
Bread board
USB cable
470 microF Capicitor
Jumper wires
LED
5
6. PWM (pulse with modulation)
Pulse Width Modulation, or PWM, is a technique for getting analog
results with digital means. Digital control is used to create a square wave,
a signal switched between on and off. This on-off pattern can simulate
voltages in between full on (5 Volts) and off (0 Volts) by changing the
portion of the time the signal spends on versus the time that the signal
spends off. The duration of "on time" is called the pulse width.
6
8. Program for sine wave in Arduino Uno
int op=5;
float ip=A0;
float x;
float z;
void setup() {
pinMode (op,OUTPUT);
pinMode (ip,INPUT);
Serial.begin(9600);
}
8
9. Program for sine wave
void loop()
{ for ( x = 0; x <360; x++)
{
z=sin(x*PI/45);
z=(z+1)/2*255;
analogWrite(op,z);
z=analogRead(ip);
z=((z-1024)/512)+1;
Serial.println(z);
delay (20);
} }
9
10. Program for displaying sine wave in nano
arduino
int sen=A2;
void setup()
{
Serial.begin(9600);
pinMode(sen,INPUT);
}
void loop()
{
int j=analogRead(sen);
Serial.println(j);
}
10
11. Description of work
First we arrange an arduino kit containing Arduino microcontroller ,Nano
microcontroller , breadboard ,capacitor ,LED and jumper wire.
We install the program in microcontrollers with the help of arduino software.
With the help of capacitor we generate a sine wave and display its characterstics
on the arduino software plotter
We use nano micro controller for displaying output wave
11