Self-Playing Xylophone

Similar documents
Module 4: Traffic Signal Design Lesson 1: Traffic Signal (Arduino) Control System Laboratory Exercise Grade 6-8

Fig. 1 Analog pins of Arduino Mega

MASTR II BASE STATION 12/24V POWER SUPPLY 19A149979P1-120 VOLT/60 Hz 19A149979P2-230 VOLT/50 Hz

Bill of Materials: 7-Segment LED Die with Arduino PART NO

Sentinel I24 Digital Input and Output Configuration

4, 8, 16 Port VGA and Audio Extender / Splitter with Audio over Single CAT5

Vorne Industries. 87/719 Analog Input Module User's Manual Industrial Drive Itasca, IL (630) Telefax (630)

Senior Design Project: Blind Transmitter

Lesson Sequence: S4A (Scratch for Arduino)

VGA & Audio Receiver SET over Single CAT5 with RGB Delay Control

Axle Assembly Poke-Yoke

This document is intended to provide information to allow the researcher to build their own device.

USER S GUIDE. 1 Description PROGRAMMABLE 3-RELAY LOGIC MODULE

Provides an activation of Relay 1 triggered by Input 1. The function also provides an option for reverse-logic on the activation of Input 1.

Measure the value of water flow using water flow sensor and DC water pump 12 V interfacing with Arduino uno

Color Programmable Control Board

Electric Motorized Projection Screen PowerMax Tension Series

VGA, Audio & RS232 Extender SET over Single CAT5 with RGB Delay Control & IR Pass Through

VGA & RS232 Extender SET over Single CAT5 with RGB Delay Control

The Infinity Portal Craig A. Lindley 03/16/2011

16-BIT LOAD CELL/DUAL STATUS INPUT

Published in A R DIGITECH

4, 8, 16 Port VGA/ Audio Extender / Splitter With Local Output with SPDIF Model #: VGA-C5SP-8

The Haply Development Kit

Bill of Materials: Magic Color PART NO

1x4, 1x8, 1x12, 1x16 VGA Extender / Splitter over Single CAT5

Kramer Electronics, Ltd. USER MANUAL. Model: VS x 1 Sequential Video Audio Switcher

Arduino LED Matrix Control. Controlling lots of LEDs

In-Ceiling Electric Motorized Front Projection Screen Evanesce Series. User s Guide

Computer Architecture and Organization. Electronic Keyboard

Christmas LED Snowflake Project

VGA / Audio Extender Single CAT5 / CAT6 with RGB Delay Control & EQ

AES-402 Automatic Digital Audio Switcher/DA/Digital to Analog Converter

Homework 6: Printed Circuit Board Layout Design Narrative

VGA / Audio Extender Single CAT5 / CAT6 with RGB Delay Control & EQ

Triple RTD. On-board Digital Signal Processor. Linearization RTDs 20 Hz averaged outputs 16-bit precision comparator function.

Mal-2 assembly guide v1.0

XTAL Bank DDS Version 0.02 Sept Preliminary, highly likely to contain numerous errors

AD9884A Evaluation Kit Documentation

TV Character Generator

A 400MHz Direct Digital Synthesizer with the AD9912

The NorCal SMT Dummy Load Assembly and Operating Manual Rev. 1.0 January 4, 2005

Solid-State Digital Timer

Electrical connection

PSM-003. Micro Polarization Controller/Scrambler. User Guide

Combo Board.

VMA444 SI4703 FM TUNER EVALUATION BOARD USER MANUAL

LED Backlight for Technics amplifiers

2.0 Wall Mount TV Soundbar Instruction Manual

Winmate Communication INC.

SPECIAL SPECIFICATION :1 Video (De) Mux with Data Channel

Kramer Electronics, Ltd. USER MANUAL VM-20HD. Dual 1:10 HD/SD SDI Distribution Amplifier

D-ATV.com s IQ modulator switch. 30 October 2004

Kramer Electronics, Ltd. USER MANUAL. Model: VM Video Component Distributor

Reaction Game Kit MitchElectronics 2019

HDMI 1.3 Receiver over Signal. CAT5/CAT6 Cable. Model #: HDMI-C5-R-M. 1

Check our knowledge base at

LEVEL ADJUST POWER Shiloh Road Alpharetta, Georgia (770) FAX (770) Toll Free

Power Injector 1520 Series

Digital Effects Pedal Description Ross Jongeward 10 December 2014

It will cause malfunction if the monitor is operating with unspecified power supply

UNIT V 8051 Microcontroller based Systems Design

AES-404 Digital Audio Switcher/DA/Digital to Analog Converter

Laboratory 8. Digital Circuits - Counter and LED Display

N3ZI Digital Dial Manual For kit with Serial LCD Rev 3.04 Aug 2012

35058-TE. PLJ-6LED-A LED Frequency Display Module Manual

Andrew G. Bell June 28, 2016

Obtained from Omarshauntedtrail.com

INSTALLATION INSTRUCTIONS FOR

3G/HD/SD-SDI to HDMI Converter

In total 2 project plans are submitted. Deadline for Plan 1 is on at 23:59. The plan must contain the following information:

AES Channel Digital/Analog Audio Switcher/DA/Digital to Analog Converter

Instruction Manual Model BlockUpconverter

Model Camera System (CCTV) User Manual

Trusted 40 Channel Analogue Input FTA

SWITCH: Microcontroller Touch-switch Design & Test (Part 2)

16 Stage Bi-Directional LED Sequencer

FlexiScan. Impro FlexiScan 4-Channel Controller INSTALLATION MANUAL

SwiftMix Automation Safety

PATTERN GENERATOR PG-3D1X USER MANUAL V.2012PG-3D1X101.00

User Manual MODEL: KKF1500-PCAP. True FLAT P-CAP LCD Monitor. Installation Guide. 15 True FLAT P-CAP Touch LCD Monitor

ENGR 40M Project 3b: Programming the LED cube

ECE 372 Microcontroller Design

Good afternoon! My name is Swetha Mettala Gilla you can call me Swetha.

TBC & Matrix Switcher TBC-5000 Instruction Manual

Advantys STB DATA SHEET. Advantys STB Output Module. Description. Features

BASCOM-TV. TV Code Features: ICs supported: BASCOM versions:

Model /29S RF Splitter

ED3. Digital Encoder Display Page 1 of 13. Description. Mechanical Drawing. Features

DLP200M 2 Relay Module for Heating and Cooling Plants

Electric Wall/Ceiling Projection Screen Saker Plus Series User s Guide

Introduction 1. Green status LED, controlled by output signal ST. Sounder, controlled by output signal Q6. Push switch on input D6

Applications & Features of the SB- SDQM- 2130

Introduction. The Clock Hardware. A Unique LED Clock Article by Craig A. Lindley

Integrated Circuit for Musical Instrument Tuners

6170 Shiloh Road Alpharetta, Georgia (770) FAX (770) Toll Free

ISSN: ISO 9001:2008 Certified International Journal of Engineering Science and Innovative Technology (IJESIT) Volume 2, Issue 4, July 2013

MOD028 GLOCKENSPIEL TECHNO-MUSIC-OLOGY

Multi-Key v2.4 Multi-Function Amplifier Keying Interface

DATA SHEET. The Advantys model STBDAI5260 Digital Input Module provides 2 isolated discrete input points that operate on a 115 VAC power source.

Transcription:

Self-Playing Xylophone Matt McKinney, Electrical Engineering Project Advisor: Dr. Tony Richardson April 1, 2018 Evansville, Indiana

Acknowledgements I would like to thank Jeff Cron, Dr. Howe, and Dr. Richardson for helping me through the senior project process.

Table of Contents I. Introduction II. Background and Problem Definition A. Background B. Problem Statement III. Design Approach A. Design process B. Software Design C. Hardware Design D. Mechanical Design E. Parts List F. Standards and Constraints G. Costs IV. Results V. Conclusions and Recommendations A. Recommendations B. Conclusions Appendix A Appendix B Appendix C References List of Figures 1. Picture of Xylophone

2. Software Flowchart 3. SD Card Circuit 4. Key Striking Circuit 5. Solenoid Mechanical Layout 6. Final Project List of Tables 1. Table of Costs

I. Introduction Many engineers struggle with the concept of music and many musicians struggle with the concepts of engineering. Music and engineering are simply two very different subjects. This project, a self-playing xylophone, blends these two unlike subjects. This is done by using engineering principles to create music. To do this first a microcontroller reads in a song. Next the microcontroller uses pin manipulation as an input to supporting circuitry. Finally this circuitry controls solenoids which strike xylophone keys to play a song. The final result plays a song. This project is useful for STEM education purposes. It could be taken into a school and used as a demonstration piece to excite kids about the possibilities of engineering. II. Background and Problem Statement A. Background Before addressing how to play a xylophone with solenoids, it is important to explain how humans play xylophones. The musician holds two mallets. The instrument is a collection of keys that each play a specific note when struck by a mallet [1]. Striking these keys in the right order plays a song. A xylophone is pictured in Figure 1. Figure 1: Picture of Xylophone [2]

B. Problem Definition The minimum specification of the project was to play a simple song. This was done by using the microcontroller to control 4 solenoids that strike the keys of the xylophone. The microcontroller had a song preloaded on it. It will directly control 4 pins that were each linked to a solenoid. The microcontroller used its programming of the song to play the xylophone. After this was done the project was expanded upon. After a simple machine capable of playing music was created, the next step was to improve the system. This was done by adding features and expanding on what was already completed. The project currently plays 15 keys. A demultiplexing system allows for controlling more solenoids. A power circuit powers the solenoids. The software also plays more keys and reads in musical files. The final product is also user accessible both in price and function. This means that a normal person should be able to use this product and also afford it. III. Design Approach A. Design Process The first task is to read in the song and interpret it. To read in the song it was chosen to use an SD card. The challenge with this was to access the contents of the SD card with the microcontroller. This was further complicated when one of the pins for this was already in use as an output. The problem had to be worked around by rewriting the output code to use different pins. The first musical file format it was planned to use was MIDI, but MIDI was overly complicated for this project. So instead, ABC file notation was used. It is not overly complicated,

but still holds all the song information that this project needs. ABC is also easily interpreted as characters by the microcontroller. For the output to control the solenoids, the project uses pin manipulation. The challenge was to pick the correct pins because the microcontroller has a limited number of pins. This problem became further complicated by the use of an SD card and using serial communication for debugging. The solenoid activation pins had to be reassigned. The circuitry must be capable of controlling and powering the solenoids. It is necessary for the logic circuit to be able to control all of the solenoids given a limited number of microcontroller pins. This problem was further complicated by the fact that it is not easy to locate the correct parts. Many of the ideal parts are no longer in production. When powering the solenoids, it was important to find the right components that could provide the necessary amount of power, not burn out while providing that power, and also be cost effective. The solenoids must be able to play the song while also not drawing too much power. They must also be cost effective. The mechanical had to be made so that the project could be supported. First a small prototype was built only using a couple of keys. After that a full design was created and constructed considering aesthetics, durability, functionality, and cost. B. Software Design At the highest level the software reads in a musical file from an SD card. Then it uses the file information to control I/O pins that play the xylophone keys The microcontroller establishes communications with the SD card. Next, it opens up the musical song file. Once the ABC (file overview of ABC file notation in Appendix A) is being read off the SD card, the next step is to create an output based on the ABC file input. Stepping

through the file line by line, each character is evaluated. First, the header section of the ABC file is ignored. Next, each note is read in. The code checks where the note is on the scale and how long it is played. This is done determining if the note is an upper or lower case letter. Then subtracting based on whether it is upper or lower case. Then it is checked if the note has a character a certain character after it. If there is, another subtraction is made. Through these two subtractions, the note in the song is converted into a number which correlates to a position in an array. The position in the array correlates to the physical key on the xylophone which is to be played. After determining the note, the next character is checked to see how long the note is to be played and a delay is set that correlates to how long the note should be played. Finally, to play the note the physical key to be played is loaded into the I/O pins. The output is quickly enabled and disabled to strike the key and then there is a delay corresponding to how long the note is to be played. If the note is within range, the note is played for the desired time. Then the next note in the song is checked and the process is repeated until the song is over. A flow chart of the code is given below in Figure 2.

Figure 2: Software Flow Chart C. Hardware Design At a high level, the hardware provides power to the project, allows for the SD card to communicate with the microcontroller, controls and powers solenoids, and provides power to the project. The SD card circuit is straightforward with wires running directly between the microcontroller and SD card reader. The circuit shown below in Figure 3. Figure 3: SD card circuit

After the music file is interpreted by the microcontroller the next step is to demultiplex the 5 pins from the microcontroller into a single output. This was done by making a 5 to 32 demultiplexer. This was done by cascading five 3 to 8 demultiplexers. The demultiplexers are active high because the solenoid retracts when they are turned on. This circuit runs on 5 volts. After the demultiplexer there is a power circuit which powers the solenoids. This circuit consists of an NPN transistor which is being used as a switch and a diode snubber. This circuit is triggered by the 5 volt logic circuit, but provides 12 volts to the solenoid. The circuit is shown below in Figure 4. Figure 4: Key striking circuit The solenoid is used to strike the xylophone key. The solenoid has an electromagnet which retracts the cylinder when it is turned on and releases the cylinder when it is turned off. To strike the key the solenoid is quickly turned off and then back on. This is shown below in Figure 5.

Figure 5: Solenoid mechanical layout. D. Mechanical Design The goal of the mechanical design is to support the rest of the project. The mechanical design consists of two parts: the xylophone and the support apparatus. The xylophone was first altered by cutting off the extra plastic with a Dermal tool. After doing this there was only the xylophone. Next, polycarbonate was cut and drilled and mounted above the xylophone with a hole above each key. A solenoid was mounted in each hole so that it can strike its corresponding key. A polycarbonate sheet was mounted above the unused sharps and flats keys to support all of the hardware and software electronics. The mechanical design is shown in Figure 6. E. Parts List SD Card Module: Used to interface SD card with microcontroller. [3] UNO R3 Board ATmega328P: Microcontroller used in project. Picked because this Atmel chipset is well developed, cost effective and the engineer had experience with it. [4][5] MM74HCT138N: 3:8 demultiplexer used to link micro output to solenoid power circuit. Also active high which is required for project. [6] N2222: NPN transistor used to power solenoids. Cost effective transistor that fits within the power specifications.

1N4001: Diode used for snubber circuit. Cost effective diode that fits within the power specifications [7] 3V-12V DC 80mA-350mA Micro solenoid: This solenoid provides enough power to strike the solenoids with good sound quality and also does not draw too much current. [8] NOTE: These solenoids did not end up being used because the supplier sent the wrong solenoids. The solenoids that where shipped are lower power and do not work as well. #10-24 Screws/nuts: A good size machine screw that is robust enough to support the project Polycarbonate: Used for mounting solenoids. Strong enough to support mechanical stress. Also clear so that project can be viewed. 25 Note Xylophone: Children s xylophone that can handle the mechanical apparatus attached to it and also produce reasonable sound quality. [9] PS-5231-5DF1-LF power supply: The power supply was chosen because provides necessary voltages.[10] F. Standards and Constraints When designing this project it is important to take several factors into account. Economically/Manufacturability, the design will is able to be produced so that it if it ever becomes a consumer product it can be manufactured economically. This is done by choosing parts that are easily mass produced. This means that the parts are manufactured or produced cheaply. Environmental impacts must also be considered. Solenoids draw a lot of current and thus power. This power is reduced to decrease the environmental impact. Also, if this product were mass produced the manufacturing techniques would need to be analyzed for environmental impact. Social/political/ethical, most people think of music as simple entertainment, but some people use it for harm. Many songs have been shown to be racist, offensive, and political. This product will have the capability to play these songs. To do this may be wrong, but since I am not personally playing the song I will leave that choice up to the individual. Two factors come into health and safety. If water is spilled on the project it could short out and become a shock hazard. The final project has taken steps to reduce this risk. Also, the solenoids contain cylinders which

have the potential to come free. These cylinders could then be choked on. The project has tried to eliminate this threat by making it so the solenoids are unable to come free. For this project ISO/ICE/IEEE standard 24748-5-2017 [11] was considered. This standard relates to the life cycle of software. The project has software so the life cycle of said software is important. G. Costs The table of costs is given below in Table 1. Product: Quantity: Cost: Part Total: Microcontroller $1.00 $30.00 $30.00 Solenoids 15 $7.99 $119.85 Demultiplexer 4 $0.59 $2.36 Transistors 15 $0.02 $0.30 Diodes 15 $0.05 $0.75 SD Card Adapter 1 $5.99 $5.99 Polycarbonate Sheet 1 $10.99 $10.99 Hardware 1 $4.99 $4.99 Xylophone 1 $32.55 $32.55 Power Supply 1 $14.99 $14.99 Total $222.77 IV. Results Table 1: Costs The overall result is a working prototype of a self-playing xylophone. This prototype could be adapted to go into full scale production. The entire working project has several working sub parts. Working hardware includes an SD card reader, logic circuit, and key striking mechanism. The working code sections that read in an ABC file form an SD card, interpret ABC

file notation, and create an output based on the ABC file notation. The project also has a solid mechanical design. Which could also be adapted to if the project went into production. A picture of the project is below in Figure 6. Figure 6: Final project V. Conclusions and Recommendations A. Recommendations If this project were to be remade or put into production, there are several things to be considered. The solenoids right now are active high instead of active low. This means that to retract they need to be turned on. The power consumption of this project could be optimized if they were active low. Before going into production it would be important to get a reliable solenoid supplier. For this project the solenoids were purchased from an unreliable supplier and the wrong solenoids were delivered. B. Conclusions

As stated in the results, this is a working project. It can be used to get kids interested in STEM. The project could be expanded on to include controlling more keys, playing cords, or adding a touch screen. There are many different directions that this project could be taken into. Also, the way that the project is now, it could be taken into production. So to summarize this project is working as is and can be expanded on or taken into production. Appendix A This appendix discusses ABC file notation. The first thing in an ABC file is the header. It contains information about the song. The header is denoted in Figure 5. The next part of the file is the notes. The notes correlate to the notes in the song. This is also denoted in Figure 5 below. [12] Figure 6: ABC file example [12] Appendix B

This appendix includes the code used on the Self-Playing Xylophone project. const int enablepin = 9;// Control pins const int controlpin0 = 2; const int controlpin1 = 3; const int controlpin2 = 5; const int controlpin3 = 6; const int controlpin4 = 7; const int button = 8; char song[] = "C, D, E, F, G, A, B, C D E F G A B c d e f g a b c' d' e' f' g' a' b'"; byte notecontrol[] = {0x01,0x02,0xFE,0xFE,0xFE,0xFE,0x00,0x08,0x09,0x03,0x04,0x05,0x06,0x07,0x0FF,0xFF,0x0A,0x 0B,0x0C,0x0D,0x0E,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF; void setup() { // put your setup code here, to run once: Serial.begin(9600); pinmode(enablepin, OUTPUT); pinmode(controlpin0, OUTPUT); pinmode(controlpin1, OUTPUT); pinmode(controlpin2, OUTPUT); pinmode(controlpin3, OUTPUT); pinmode(controlpin4, OUTPUT); pinmode(button, INPUT); digitalwrite(enablepin, LOW); void loop() { // put your main code here, to run repeatedly: for (int i=0; i < sizeof(song) ; i++){ int note = song[i]; if ((song[i] >= 'A' && song[i] <= 'G')){ note = note - 58; if (song[i+1] == ',') { note = note - 7; Serial.println(notecontrol[note]); Playnote(notecontrol[note]); if ((song[i] >= 'a' && song[i] <= 'g')){ note = note - 83; if (song[i+1] == 39) { note = note + 7;

Serial.println(notecontrol[note]); Playnote(notecontrol[note]); delay(250); void Playnote(byte n){ Serial.println("Playing note"); Serial.println(n); if( (n & 0x01)!= 0){ digitalwrite(controlpin0, HIGH); Serial.print("1"); else{ digitalwrite(controlpin0, LOW); Serial.print("0"); if( ((n>>1) & 0x01)!= 0){ digitalwrite(controlpin1, HIGH); Serial.print("1"); else{ digitalwrite(controlpin1, LOW); Serial.print("0"); if( ((n>>2) & 0x01)!= 0){ digitalwrite(controlpin2, HIGH); Serial.print("1"); else{ digitalwrite(controlpin2, LOW); Serial.print("0"); if( ((n>>3) & 0x01)!= 0){ digitalwrite(controlpin3, HIGH); Serial.print("1"); else{ digitalwrite(controlpin3, LOW); Serial.print("0");

if( ((n>>4) & 0x01)!= 0){ digitalwrite(controlpin4, HIGH); Serial.println("1"); else{ digitalwrite(controlpin4, LOW); Serial.println("0"); digitalwrite(enablepin, HIGH); delay(50); digitalwrite(enablepin, LOW); Appendix C This appendix includes the circuit schematic used on the Self-Playing Xylophone project. References

[1] How Does a Xylophone Work? [Online]. Available: https://ourpastimes.com/how-does-axylophone-work-12165630.html [2] Kids Xylophone [Online] Available: www.educationaltoysplanet.com/woodxylophone.html [3] SD Card Module Slot Socket Reader for Arudino UNO R3 Mega 2560 Nano [Online] Available: https://www.amazon.com/gp/product/b00wh7wxrc/ref=oh_aui_detailpage_o02_s00?ie=utf 8&psc=1 [4] ARDUINO UNO REV3 [Online] Available: https://store.arduino.cc/arduino-uno-rev3 [5] AVR 28 Pin 20MHz 32K 6A/D - ATMega328P [Online] Available: https://www.sparkfun.com/products/9061 [6] MM74HCT138N [Online] Available: https://www.mouser.com/productdetail/onsemiconductor-fairchild/mm74hct138n?qs=%2fxetzmhgucgdb8ctgzq3og%3d%3d [7] 100x 1N4001 Molded Plastic Case Rectifier Diodes, 1A, 50V DO-41 [Online] Available: https://www.amazon.com/gp/product/b06xc1v28z/ref=oh_aui_detailpage_o02_s00?ie=utf8 &psc=1 [8] 3V-12V DC 80mA-350mA Micro solenoid electromagnet push and pull dc Miniture electromagnet Mini Solenoid Electromagnet [Online] Available: https://www.amazon.com/gp/product/b00zc53kb4/ref=oh_aui_detailpage_o00_s00?ie=utf8 &psc=1 [9] Lyons 25-Note Xylophone (Glockenspiel) with Case [Online] Available: https://www.amazon.com/lyons-25-note-xylophone-glockenspiel- Case/dp/B001VO7FPC/ref=sr_1_1?s=industrial&ie=UTF8&qid=1521143716&sr=8-1&keywords=25+note+xylophone [10] Server Supply [Online] Available: https://www.serversupply.com/products/part_search/query.asp?q=ps-5231-5df1- LF&msclkid=7c383f8a1ccd167ce61c655562d48266 [11] ISO/IEC/IEEE 24748-5:2017 [Online] Available: https://www.iso.org/standard/60062.html [12] How to understand abc (the basics) [Online] Available: http://abcnotation.com/blog/2010/01/31/how-to-understand-abc-the-basics/