Embedded Piano Interfaced with LCD

Similar documents
Keywords Digital IC tester, Microcontroller AT89S52

1. Pin diagram of 8051 and ports

SANKALCHAND PATEL COLLEGE OF ENGINEERING, VISNAGAR. ELECTRONICS & COMMUNICATION DEPARTMENT Question Bank- 1

Microcontrollers. Fig. 1 gives a comparison of a microprocessor system and a microcontroller system.

e-pg Pathshala Subject : Computer Science Paper: Embedded System Module: Interrupt Handling Module No: CS/ES/13 Quadrant 1 e-text

Environmental Data Acquisition Using (ENC28J60)

Effective Utilization of a Microcontroller Port for Optimisation of Hardware

Microcontroller and Embedded Systems:

e-pg Pathshala Subject: Computer Science Paper: Embedded System Module: Interfacing External Devices using Embedded C Module No: CS/ES/22

The 8051 microcontroller has two 16-bit timers/counters called T0 and T1.

Interrupts, timers and counters

8051 Peripherals. On-Chip Memory Timers Serial Port Interrupts. Computer Engineering Timers

GSM Based Electronics Notice Board

Microcontroller & Interfacing

Chapter 09. Programming in Assembly

ANDROID MOBILE BASED HOME AUTOMATION USING BLUETOOTH

SECURE DIGITAL ACCESS SYSTEM USING IBUTTON

Review of Ultra Fast Acting Electronic Circuit Breaker at Overloading

e-pg Pathshala Subject : Computer Science Paper: Embedded System Module: 8051 Architecture Module No: CS/ES/5 Quadrant 1 e-text

8051 Microcontroller

ericssonz LBI-38616B MAINTENANCE MANUAL FOR MTD TM SERIES AND DATA RADIO LOGIC BOARD 19D902151G3 DESCRIPTION CIRCUIT ANALYSIS TABLE OF CONTENTS

AC : DESIGN OF DATA ACQUISITION SYSTEM FOR COMPUTER ENGINEERING EDUCATION

Embedded Systems Lab Lab 1 Introduction to Microcontrollers Eng. Dalia A. Awad

Rewa Engineering College, Rewa. Rewa Department OF Electrical Engineering

CHAPTER TIMER PROGRAMMING

e-pg Pathshala Subject: Computer Science Paper: Embedded System Module: Interrupt Programming in Embedded C Module No: CS/ES/20 Quadrant 1 e-text

Goal: We want to build an autonomous vehicle (robot)

GUJARAT TECHNOLOGICAL UNIVERSITY

Professional Development Board (#28138)

Alcohol Detection using Pic Microcontroller

3 PHASE FAULT ANALYSIS WITH AUTO RESET FOR TEMPORARY FAULT AND TRIP FOR PREMANENT

Display Real Time Clock (RTC) On LCD. Version 1.2. Aug Cytron Technologies Sdn. Bhd.

Accelerometer-Based Musical Instrument

e-pg Pathshala Subject : Computer Science Paper: Embedded System Module: Serial Port Communication Module No: CS/ES/11 Quadrant 1 e-text

Design & Interface of Voice Module for Deaf and Dumb

2. (2 pts) If an external clock is used, which pin of the 8051 should it be connected to?

A PIC-based LCD Display for Stand-Alone Instrumentation

UNIT V MICRO CONTROLLER PROGRAMMING & APPLICATIONS TWO MARKS. 3.Give any two differences between microprocessor and micro controller.

PIC Microcontroller Introduction

ELEG3923 Microprocessor Ch.9 Timer Programming

GSM MODULE BASED SMART NOTICE BOARD

C H A P T E R 1 INTRODUCTION

The Atmel ATmega328P Microcontroller

Timer programming

8051 Microcontroller memory Organization and its Applications

1. LCD (Liquid Crystal Display)interface

Solar Based E Uniform For Soldiers-Used For Temperature Control And Tracking

8051 Training Kit Lab Book

A TECHNICAL REVIEW ON DTMF BASED ELECTRONIC VOTING MACHINE

8051 Intermidiate Development Board. Product Manual. Contents. 1) Overview 2) Features 3) Using the board 4) Troubleshooting and getting help

Department of EIE / Pondicherry Engineering College. Timer/Counters. Department of EIE / Pondicherry Engineering College 1

DTMF BASED INDUSTRIAL AUTOMATION

The Atmel ATmega168A Microcontroller

PROGRAMMABLE POWER SUPPLY

CEIBO FE-5111 Development System

1. Attempt any three of the following: 15

Bolero Nexus Emulation Adapter 208BGA 100TQ

DS-251 In-Circuit Emulator

EMBEDDED SYSTEMS COURSE CURRICULUM

The Freescale MC908JL16 Microcontroller

Prepaid Energy Meter for Billing System Using Microcontroller and Dongle

Password Based Circuit Breaker

Exclusive 2.5 GHz Frequency Counter

GSM BASED HOME AUTOMATION SYSTEM

Unit 2. Computer Control. PIC stands for PROGRAMMABLE INTERFACE CONTROLLER. A PIC chip takes in input signals and then controls output transducers

EEE3410 Microcontroller Applications Department of Electrical Engineering Lecture 4 The 8051 Architecture

Bolero3M Nexus Emulation Adapter 256BGA 176TQ

Waveform and Timing Generator Description

Lecture (02) PIC16F84 (I)

Microcontroller Based Code Locking System with Alarm

FACULTY OF ENGINEERING LAB SHEET

Transcendent Frequency Counter

TEVATRON TECHNOLOGIES PVT. LTD Embedded! Robotics! IoT! VLSI Design! Projects! Technical Consultancy! Education! STEM! Software!

CORRIGENDUM ISSUED FOR NATIONAL COMPETITIVE BIDDING UNDER TEQIP PHASE-II

Bolt 18F2550 System Hardware Manual


RFID: Read and Display V2010. Version 1.1. Sept Cytron Technologies Sdn. Bhd.

8051 Microcontroller Interrupts

Introduction 1. Liquid crystal display (16 characters by 2 rows) Contrast dial: turn the dial to adjust the contrast of the display (see page 5)

Figure 1.1: Some embedded device. In this course we shall learn microcontroller and FPGA based embedded system.

RTC Interface 89C51 DS M. Krishna Kumar MAM/M7/LU17/V1/ Vcc VCC 5 SDA P1.0 6 SCL P KHz 3 BAT 3.

LED Matrix Scrolling using ATmega32 microcontroller

Lab 1 Introduction to Microcontroller

POWER SAVER METER USING MICROCONTROLLER TO SAVE ELECTRICITY UPTO 30-40%

MICROCONTROLLER BASED SMART FAN SYSTEM

User Manual For CP-JR ARM7 USB-LPC2148 / EXP

CheckSum. FUNC-2B Functional Test Module. The FUNC-2B features:

Lab 3 LCD Mar

EB-51 Low-Cost Emulator

Using the HT16K33 in DVD Player Panel Applications

PIC DESIGN (version 1) 2/11/2009

Lesson-3: Counters and Timers

Introduction to Microcontroller Apps for Amateur Radio Projects Using the HamStack Platform.

Mechatronics and Measurement. Lecturer:Dung-An Wang Lecture 6

CEIBO FE-5131A Development System

HARDWARE OPERATIONS MANUAL

Design and construction of ENP for Car : a novel Embedded System

Embedded World Television, Radio, CD player, Washing Machine Microwave Oven Card readers, Palm devices

MLR INSTITUTE OF TECHNOLOGY DUNDIGAL , HYDERABAD

PAD ANALOG / DIGITAL TRAINER OPERATOR S MANUAL

Transcription:

Embedded Piano Interfaced with LCD Akshita Vinod Nichani U.G. Student, Electronics and Telecommunication Department, DJSCE Shruti Tushar Pistolwala U.G. Student, Electronics and Telecommunication Department, DJSCE ABSTRACT In Indian classical music, there are seven fundamental musical notes known as Swaras. They are namely, Sa, Re, Ga, Ma, Pa, Dha, Ni. In this paper, a digital piano has been designed using a microcontroller. It comprises of eight keys for the above notes, along with an eighth note, the upper Sa. It is a minimalistic and easy to use piano interfaced with an LCD to provide the user with a visual indication of the Swara being played. Its simplicity and ease of operation, along with a low-cost factor makes it an ideal instrument for beginners. The waveforms can be observed on an oscilloscope and varied for better understanding for the learner. This instrument can also be developed further to form a robust system with more notes and waveforms. General Terms Embedded Systems Keywords Microcontroller, Proteus, Keil, Musical notes, LCD 1. INTRODUCTION In this project, a basic instrument aimed at emulating a piano has been designed, using microcontroller SST89E516RD (of the 8051 family). The controller has 8 buttons connected to one port, and an LCD connected to another. When a button is pressed, the frequency of the musical note that the button corresponds to is converted into an appropriate time delay. This delay is changed to its corresponding hexadecimal value and loaded into the timer of the controller to produce a waveform at the output, which is given to a speaker and amplifier circuit to make the note audible. Simultaneously, on the display of the LCD the note being played appears. 2. LITERATURE SURVEY The instruments that have been made previously, that are analogous to this, include a piano using timer IC 555 [9] and a piano with LED indicators using PIC microcontroller. In the case of IC 555, sounds of varying frequencies are produced by varying the value of the resistance connected to it in the astable multivibrator mode. The limitation of this implementation is that the exact value of frequencies in an octave cannot be obtained due to restrictions on the practical values of resistors available. Moreover, the waveform of sound produced at the output will always be a square or rectangular wave. For a piano that has previously been implemented using PIC microcontroller, the program to generate the necessary delay is loaded into the controller, however, the note being played is indicated simply by the glowing of an LED placed near each button. Hence this instrument overcomes the drawbacks of both. It not only produces the exact frequency required by loading the corresponding delay into the controller, but also provides a display to enable interaction of the system with the user by indicating which note is being played. The quality of sound produced is the same, as would be for more expensive controllers, thus it serves as an effective alternative to those. Additionally, it is also capable of producing varying sound due to different waveforms such as saw tooth, sine, triangular. Since we have interfaced the LCD in 4-bit mode, one port of the microcontroller is available for the addition of more buttons, i.e. more musical notes, which is another feature which enhances the potential for development of this instrument. 3. SYSTEM ARCHITECTURE 3.1 Proposed System Block Diagram Figure 1: Proposed System Block Diagram 3.2 SST89E516RD This microcontroller belongs to the 8051 family. It is a 40 pin PDIP. It has several applications in embedded system projects in fields like electronics, medicine, communication, making of musical instruments to name a few. The features of this controller that are utilized in this project include its dual block super flash memory of 72 Kbytes (64 Kbytes of a primary block + 8 Kbytes of a secondary block) along with 1k byte internal RAM. It has four I/O ports of 8-bits each. There are three 16-bit Timers/Counters, in this instrument timer 0 is used in mode 1. It has standard 12 clocks per cycle and can be operated at any frequency between 0 to 40 MHz, at a power supply of 5 volts. Figure 2: SST89E516RD IC [6] 15

Pin of 8051 Communications on Applied Electronics (CAE) ISSN : 2394-4714 Table 1. Pin connections [6] Connected to P1.0 P1.7 Buttons P2.0- P2.2 P2.4-P2.7 RS, RW, EN of LCD Data pins D4-D7 of LCD P3.0 Audio amplifier circuit 3.3 Liquid Crystal Display The LCD used is JHD162A [7], to give information to the user. It is a 16X2 LCD, with 2 rows and 16 characters per row. Each character is displayed within a 5X7-pixel matrix. This is a 16-pin device, constituting 8 data pins and 3 command pins. It has two registers, namely the command register and data register, used to store commands and data respectively. They can be selected using the command pin RS. When RS = 0 the command register is selected and when RS = 1 the data register is selected. With respect to the data pins, when the LCD is used in 8-bit mode, all 8 data inputs are used. It can also be operated in 4-bit mode, which has been done in this project, where only 4 data pins are used. Figure 3: LCD 162A [7] 3.4 Amplifier and Speaker A speaker and amplifier circuit is required to make the musical note being played audible to the user. Both are connected at P3.0 of the microcontroller. The output current obtained at the pins of the microcontroller is not sufficient to drive the speaker. The specification of the speaker used is 8Ω, 0.5 Watt, thus its current requirement is 250mA whereas the current provided by the controller is 16mA. For this reason, an amplifier is needed. The amplifier circuit used consists of IC TBA810 [8]. It is a 12 pin IC that can be given a supply voltage of up to 16V. It functions as a class B amplifier and provides an output power of 7 Watt. It gives high output current of 3A, high efficiency (75%) and very low harmonic and crossover distortion. The input signal that is to be amplified is given at pin 8 of the IC, and the amplified output is obtained at pin 12. Thus, the speaker is connected between pin 12 and ground. Figure 4 : Audio amplifier and speaker [8] 4. SYSTEM IMPLEMENTATION 4.1 Calculations and working Buttons are connected to Port 1 of the controller, LCD at Port 2 and speaker at the first pin of Port 3. Each of the eight buttons correspond to the eight musical notes. When any button is pressed, that pin of Port 1 gets connected to ground. Simultaneously, the note is played through the speaker and displayed on the LCD. This process is implemented using the calculations explained below. A crystal oscillator of frequency 11.0592 MHz is connected between pin 18 and 19 of the microcontroller. To load the frequency of the notes into the timer of the controller, as an appropriate hexadecimal value, the following steps are followed [2]. Crystal oscillator frequency = 11.0592 MHz Frequency of one machine cycle = F = 11.0592MHz/12 = 921.6 KHz. Time period of one machine cycle= 1/F= 1.085 µs. Considering the first musical note, Sa, required frequency= 230Hz. Hence required period T= 1/230 = 4166.66 µs. The delay required in the waveform = T/2 = 2083.33 µs. Now, a period of 1.085 µs corresponds to 1 count thus the delay of 2083.33 µs will correspond to the desired count. Thus, the desired count = 2083.33/1.085 = 1920.122 1920. Count to be loaded into timer = max. count desired count +1 = 65535 1920 + 1= 63616. The hexadecimal value of this number is F880. The SST89E516RD has three Timers/Counters [1]. Each of these can be used in four different modes of operation. Based on which mode is to be used, the mode bits M1 and M0 are loaded in the TMOD register, for mode 1 the. This project uses Timer 0 in mode 1. For this, the bits loaded in the TMOD register are 0 0 0 0 1 0 0 1. In mode 0 the timer is used in the 16-bit mode. The lower and higher bits of the count to be loaded are placed into the TL0 and TH0 registers respectively, which are 8 bit each. In the example above, 80 is loaded into TF0 and F8 into TH0. TMOD Register [1] TIMER 1 TIMER 0 GATE C/T# M1 M0 GATE C/T# M1 M0 16

Once the operation of the timer is complete, the timer overflow flag (TF0), present in the timer control register (TCON), is set to 1 and an interrupt occurs to stop the operation of the timer. In this manner, the sound wave is generated at the first pin of port 3 where the speaker is placed. The table shows the values that are loaded into the Timer 0 register and have been calculated using the procedure explained above. TCON Register [1] TF1 TR1 TF0 TR0 IE1 IT1 IE0 IT0 Table 2. Musical notes and their corresponding hexadecimal values loaded into Timer 0 Musical Note Frequency (Hz) TL0 TH0 SA 240 80 F8 RE 270 55 F9 GA 300 00 FA 2X16 LCD module. Step 10: Check if any button is pressed i.e. any port 1 pin is grounded. Step 11: If button is pressed go to step 12, else go to step 10. Step 12: Display note that is being played on second line of LCD. Step 13: Change state of speaker at P3.0 and call Delay routine for loading that frequency into Timer 0 Step 14: Go to step 10. 4.2.1.2 Flowchart Start Initialize speaker at P3.0 Initialize delay function for each note MA 320 60 FA PA 360 00 FB Initialize LCD module DHA 400 80 FB NI 450 00 FC Display Piano by Akshr on first line of LCD SA 480 40 FC 4.2 Software Implementation 4.2.1 Keil 4.2.1.1 Algorithm Step 1: Start. Is any button pressed? No Step 2: Load header files for register 51 in Keil. Step 3: Load header files for LCD module in 4-bit mode. Step 4: Initialize buzzer at port 3 of microcontroller. Step 5: Initialize the delay logic for each note, to load frequencies of the piano in Timer 0 of the microcontroller Step 6: Initialize the LCD module. Yes Display note played on second line of LCD Call delay function for corresponding note Step 7: Clear LCD module. Step 8: Give LCD module a delay. Step 9: Display string Piano by Akshr in the first row of Sound obtained on speaker by loading frequency value in Timer0 17

4.2.2 Proteus The code was executed in Keil and then a schematic of the circuit was created on Proteus and the Hex. File of the code Figure 5: Execution of code on Keil generated by Keil was loaded into the microcontroller and the circuit was then simulated to produce the desired output. Figure 6: Output on Proteus Figure 7: Output Waveform of SA Figure 8:Output Waveform of RE 18

Figure 9:Output Waveform of GA Figure 13:Output Waveform of NI Figure 10:Output Waveform of MA Figure 11:Output Waveform of PA Figure 14:Output Waveform of SA (Upper) 4.3 Hardware Implementation The circuit has been implemented on a perforated circuit board. All the individual components which include the SST89E516RD, with all connections have been soldered on to the board as per the circuit. A voltage regulator 7805 has also been used to give a 5V output to the 8051 since we a 12V adapter is used for the input voltage. This circuit is placed into a metal box on to which the LCD, speaker and buttons- of the press to short type, are fixed and connected to the 8051-circuit underneath. Hence this is made into a portable and simplistic instrument with all the connections concealed underneath so that only the speaker, LCD and buttons are accessible to the user. Figure 12:Output Waveform of DHA Figure 15: Implementation of piano on PCB 19

Figure 16: Testing of piano and LCD on development board 5. CONCLUSIONS Hence, the design and implementation of a simple but effective instrument for learning and recreational purposes has been carried out. Previously a similar instrument has been implemented using analog devices such as IC 555 [9], and now an improved version has been created using a microcontroller. This product also has the scope for expansion in the future. Since there is an empty port remaining on the controller, additional musical notes can be added. As of now we only have eight Swaras, further, more number of Swaras along with soft and sharp notes can be included. Moreover, the sound being generated is due to a square wave. The microcontroller can be programmed to produce sound due to varying waveforms such as sine, sawtooth, triangular to make it a more advanced and complex instrument. Thus, there is a scope for this product to be developed into a well-equipped commercial instrument. 6. ACKNOWLEDGMENTS The authors would like to thank the project guide, Dr Amit. Deshmukh, Professor and Head of Department, EXTC DJSCE for his invaluable guidance and support throughout the course of this project. Figure 17: Final product 7. REFERENCES [1] The 8051 Microcontroller and Embedded Systems Using Assembly and C. Second Edition by Muhammad Ali Mazidi, Janice Gillispie Mazidi and Rolin D. McKinlay. [2] The 8051 Microcontroller Third Edition by Kenneth Ayala. [3] Microcontrollers Features and Applications by D.S. Yadav and Arun Kumar Singh. [4] The 8051 Microcontroller based Embedded Systems by Manish K Patel. [5] C and the 8051 by Thomas W. Schultz. [6] http://www.microchip.com/wwwproducts/en/sst89e516 [7] http://www.datasheetspdf.com/datasheet/jhd162a [8] http://html.alldatasheet.com/htmllpdf/25016/stmicroelectronics/tba810/1620/1/ TBA810.html [9] Akshita Nichani, Shruti Pistolwala, Piano using IC 555, Technofocus a journal for budding engineers, pp. 8-10, 2016, (ISSN 2321-0532). 20