ASSIGNMENT NO.5 TITLE: Construct a Square wave of programmable frequency and draw voltage (y-axis) and time (x-axis) graph. PROBLEM STATEMENT: Write a Python program to capture signal using ARM Cortex A5/A9/M4 ADC and signal generator, generate/construct a Square/Sine wave of programmable frequency and voltage Draw Voltage (y-axis) and Time (x-axis) graph. OBJECTIVE: 1. To learn the concept of signal generation. 2. To learn the basic concept of ADC 3. To learn the basic about BBB/ ARM Cortex A5/A9/M4. PRIREQUISITES: Software: Fedora/ Ubantu. Hardware: Signal generator, resisters, BBB etc. THEORY: Square waves: Like sine waves, square waves are described in terms of period, frequency and amplitude Peak amplitude, Vp , and peak-to-peak amplitude, Vpp , are measured as you might expect. However, the rms amplitude, Vrms , is greater than that of a sine wave. Remember that the rms amplitude is the DC voltage which will deliver the same power as the signal. If a square wave supply is connected across a lamp, the current flows first one way and then the other. The current switches direction but its magnitude remains the same. In other words, the square wave delivers its maximum power throughout the cycle so that Vrms is equal to Vp . (If this is confusing, don't worry, the rms amplitude of a square wave is not something you need to think about very often.) Although a square wave may change very rapidly from its minimum to maximum voltage, this change cannot be instaneous. The rise time of the signal is defined as the time taken for the voltage to change from 10% to 90% of its maximum value. Rise times are usually very short, with durations measured in nanoseconds (1 ns = 10-9 s), or microseconds (1 µs = 10-6 s), as indicated in the graph. Signal generators, also known variously as function generators, RF and microwave signal generators, pitch generators, arbitrary waveform generators, digital pattern generators or frequency generators are electronic devices that generate repeating or non-repeating electronic signals (in either the analog or digital domains). They are generally used in designing, testing, troubleshooting, and repairing electronic or electro acoustic devices; though they often have artistic uses as well. There are many different types of signal generators, with different purposes and applications (and at varying levels of expense); in general, no device is suitable for all possible applications. Traditionally, signal generators have been embedded hardware units, but since the age of multimedia-PCs, flexible, programmable software tone generators have also been available. A function generator is a device which produces simple repetitive waveforms. Such devices contain an electronic oscillator, a circuit that is capable of creating a repetitive waveform. (Modern devices may use digital signal processing to synthesize waveforms, followed by a digital to analog converter, or DAC, to produce an analog output). The most common waveform is a sine wave, but sawtooth, step (pulse), square, and triangular waveform oscillators are commonly available as are arbitrary waveform generators (AWGs). If the oscillator operates above the audio frequency range (>20 kHz), the generator will often include some sort of modulation function such as amplitude modulation (AM), frequency modulation (FM), or phase modulation (PM) as well as a second oscillator that provides an audio frequency modulation waveform. Steps: 1. Make the connections as shown in figure. 2. Give input as square wave from signal Generator. Also give input frequency. 3. Give the output of signal generator to P9 pin no 40 of BBB. 4. Access BBB through Minicom. 5. Run the python code in operating system of BBB. 6. Observe the value of voltage. 7. Draw time Vs voltage graph Conclusion: - In this way we perform the construction of a Square wave of programmable frequency using signal generator and drawn voltage (y-axis) and time (x-axis) graph. Program: import Adafruit_BBIO.ADC as ADC import time ADC.setup() while True: value = ADC.read("P9_40") voltage = value * 1.8 print(voltage) time.sleep(0.001) Output:- Voltage vs time wave form:1.2 1 0.8 0.6 0.4 0.2 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 1.1 1.2 1.3 1.4 1.5 1.6