9IEes

DIY Simple Electronic Keyboard Using 51 Microcontroller

 
Overview
The electronic keyboard
        board features 14 micro-switches at the bottom, 7 on the left and 7 on the right, along with two digital displays at the top right, which together determine the pitch of each key press. Upon power-up, the digital displays initially show "3 4," indicating that the 7 left micro-switches correspond to C3~B3 and the 7 right micro-switches to C4~B4. Pressing the buzzer produces the corresponding pitch, and the buzzer lasts for the duration of the press. The two buttons to the right of the buzzer allow switching between pitches. Pressing the right button changes the digital display to "4 5," indicating that the 7 left micro-switches correspond to C4~B4 and the 7 right micro-switches to C5~B5. Pressing it again changes the display to "2 3," thus expanding the pitch range to C2~B5. Users can also calculate the initial values ​​of timers for other pitches and add them to the code to achieve a wider range.
        All I/O ports of the microcontroller are also brought out, allowing it to be used as a simple 51 microcontroller core board.
The electronic keyboard
        works by using a 51 microcontroller's timer to generate a square wave signal of a specific frequency to drive a passive buzzer. My own board uses a crystal oscillator with a frequency of 33.1776MHz. The open-source code provides arrays of initial values ​​for timers C2 to B5 at frequencies of 11.0592MHz and 12MHz. The 14 micro-switches and two tone-range switching buttons are actually a 4*4 matrix keyboard. In the main program, the pressed key value is determined and different initial values ​​of the timer are called to drive the buzzer to sound.
参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2026-03-26 14:27:45
  • I want to copy the M8, everyone come together to give me some ideas! Hehe.
  • Implementing Low-Cost Automotive Multi-Bus Bridging Using FPGAs
  • Is this a violation?
  • Help with header file directory issues hack wince
  • G2231 multi-function electronic clock problem
  • Please solve!!!

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号