A Python Based mostly GUI For AM Modulation

efy testAmplitude modulation (AM) is a sign modulation approach that’s extensively utilized by radio stations for transmitting their packages.

This undertaking proposes a Python GUI-based simulator to review AM. A person can differ numerous parameters—comparable to modulation index, amplitude and frequency of the modulating sign, and service sign—and observe the output. The undertaking can be utilized to simulate the sign modulation by radio engineers for designing totally different service indicators and their modulation and demodulation.

This GUI is developed in Python 3.10.1 by utilizing Jupyter Pocket book. As solely two elements are used for the undertaking, as proven within the invoice of fabric, there isn’t a want for any circuit diagram. Simply join the LCD to Raspberry Pi through an HDMI cable connector.

Invoice of Materials
Parts Amount Description
Raspberry Pi 1 Raspberry Pi board to attach LCD
LCD 1 For show
5V, 2A energy adaptor 1 For energy provide


For amplitude modulation, the service waveform is modulated in response to the instantaneous amplitude of the message (baseband) sign. To grasp, allow us to think about a sinusoidal wave because the message sign that must be transmitted. Allow us to say, the amplitude of the message sign is Am and its frequency is fm. The mathematical time-domain illustration of the message sign could be:

m(t) = Am.cos (2πƒmt) ........Eq 1

The service sign is a high-frequency radio wave with amplitude Ac and frequency fc, which is represented by:

c(t) = Ac.cos (2πƒct) ........Eq 2

The equation of modulated waveform is:

equation 1



The modulation index defines modulation stage, which will be outlined as:

A Python Based mostly GUI For AM Modulation

Software program Set up

The software program required for the undertaking are Python 3.10.1, Tkinter, Matplotlib, and NumPy.

First, set up the Anaconda Distribution or Python 3 atmosphere in Raspberry Pi. Then set up Tkinter, Matplotlib, and NumPy.

Subsequent, import these libraries into the code and put together the code for the sign modulator simulator.

Jupyter Pocket book from Anaconda creates an interactive web-based Python computing atmosphere in any browser that’s chosen whereas set up.

Anaconda Navigator
Fig. 1: Anaconda

Create a brand new pocket book from the file menu of Jupyter IDE by deciding on Python 3 as ipykernal. Rename the brand new pocket book as Analog Communication Simulator.

Jupyter library
Fig. 2: Jupyter library

This undertaking makes use of features from Tkinter, Matplotlib, and NumPy libraries, therefore import their libraries. You should utilize pip set up and conda set up to put in the libraries. For instance, pip set up matplot

Jupyter Notebook GUI
Fig. 3: Jupyter Pocket book GUI

Subsequent, create the graphical person interface (GUI) for the simulator. The GUI features a window with canvas to plot graphs and entry bins to get person information for amplitude, frequency of message sign and service indicators, and for modulation index. It consists of three buttons to plot the message sign, profession sign, and modulated sign, and for clearing the canvas (see Fig. 4).

AM Simulator
Fig. 5: Excellent modulation


Within the code, first import numerous packages of Python for easy operation of varied features, as follows:

from tkinter import *
from matplotlib.determine import Determine
from matplotlib.backends.backend_tkagg
import (FigureCanvasTkAgg, Navigation
from tkinter import ttk
import numpy as np

To show root window and handle different elements on this window, use Tk() perform for first displaying the basis window. The occasion loop of this window is created by mainloop() perform. The title of root window will be offered right here. The next coding snippet exhibits this process:

root = Tk()
root.title(‘Amplitude Modulation’)
fig1 = Determine(figsize=(2, 2), dpi=100)

An interface between the Determine and Tkinter Canvas is offered by the FigureCanvasTkAgg class. Right here, chances are you’ll design a canvas of width=1050 and top=650 by positioning it at x=230, y=50, as follows:

canvas = FigureCanvasTkAgg(fig1,
canvas.get_tk_widget().place(x=230, y=50,
width=1050, top=650)

Subsequent, create the widgets for plotting the message, profession, and modulated indicators. For user-defined values of amplitude and frequency of the sign, use the entry widget from the Tkinter bundle. These values are saved in variables for additional calculation. All widgets are grouped by utilizing the body perform.

AM Simulator
Fig. 5: Excellent modulation

Two button widgets are used for plotting the message and service indicators. The instructions for these buttons are outlined by taking inputs from entry widget variables (Amplitude and Frequency) and utilizing the sin perform from the NumPy bundle of Python.

Fig. 6: Under modulation
Fig. 6: Underneath modulation

The mathematical equation for the modulated sign is outlined in Eq 3. That is plotted by utilizing the NumPy bundle. The user-defined modulation index is used for calculating and plotting the modulated sign.

A button for clearing the plotting in canvas must be designed. This may be achieved by the .clear() perform.

To check, run the simulator code and put the values for sign modulation. Take a look at good modulation below Modulation and over modulation of indicators utilizing the simulation. The testing instances are proven as follows.

Fig. 7: Over modulation
Fig. 7: Over-modulation

When the modulation index is maintained at worth 1, as proven in Fig. 5, you get good modulation. When the modulation index is under 1, as proven in Fig. 6, it’s referred to as below modulation. When the modulation index is above 1, as in Fig. 7, you get over-modulation.

Obtain supply code

Akhtar Nadaf is an electronics fanatic working at N.Ok. Orchid Faculty of Engineering and Know-how, Solapur

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button

Adblock Detected

Please consider supporting us by disabling your ad blocker