MezzoForte_Final_Presentation

advertisement
ELECTRONIC MUSICAL
INSTRUMENT
Final Report
Mezzo Forte
Background:
• Customer: Dr. Pinkston
• Problem Statement:
o Musical
instruments take a lot of practice time
to learn and play songs.
o A need
exists for a musical instrument that
the user can use to play songs without
previous knowledge of how to play any
instruments, while having similar flexibility of
playing an instrument.
Background: Product
• An easy to use instrument
• The note being played is controlled by a
song file loaded onto the device
• The timing and volume of each note is
controlled by the user
• Has a user interface to allow the user to
select from a list of songs in memory
Concept of Operations: Device
1)Plug SD card into the device
2)Power the device ON
3)After the device finishes initializing, choose
a song from the given menu using the up and
down buttons
4)Press the PLAY button to start the song
5)Play notes from the given song file by
pressing the resistive button. Change the
volume of the note by changing the pressure
applied to the resistive button.
6)Release the resistive button to stop the
current note.
7)Continue Steps 5 and 6 until you wish to change songs
8)Press stop if you are in the middle of a song to quit.
9)Choose another song, or power off the device
Concept of PC Software
1)Plug in SD card to the computer
2)Start Mezzo Forte’s Song Generator
3)Using the provided GUI, select notes
desired for new song
4)When finished, choose "Convert to .MFS"
under File.
5)From here, the user will be guided in
naming and saving a song file that the
device can read.
6)The user can transfer any other
completed songs onto the SD card
7)Remove SD card from the computer
Requirements:
• Be capable of playing the range of a piano
(27.50Hz-4186.00Hz) without sounding
out of tune
• Have an interface for choosing/aborting
songs
• Provide software for developing song files
and assisting in transferring them to our
device
Requirements:
• Have a means for the user to control the
timing and volume of notes
• Provide a master volume control for the
device
• The cost shall not exceed $150
• Output the notes to an 1/8th inch TRS jack
System Boundary Diagram
System Boundary Diagram
Block Diagram
Design Approaches
Design Approaches
• We choose Approach 1 (Micro to DAC)
o
Simplest hardware design
o
Most software out of any of the designs
o
Most familiar with the components involved
o
Seemed the most feasible for our application and with
the budget and time constraints given.
Component Selection: Microcontroller
Needs:
• Cheap development board
• Enough I/O to complete our project
• Software environment that is easy to debug
• Fast enough to synthesize audio
• Well documented
Component Selection: Microcontroller
Processor
C5505
ATMega328
AT91SAM7S256
Clock Freq.
100MHz
20MHz
60MHz
Memory
I/O
Dev. Board
Cost
320KB
15 GPIO,
SPI, I2C,
UART,
I2S
$50
31KB
14 GPIO
SPI, I2C
$30
256KB
30 GPIO
SPI, I2C
$45.95
Component Selection: Microcontroller
• We choose the C5505 (on the ezdsp development board)
o
In circuit debugger
o
Sample code inline with what we needed for our project
o
Development Board included a DAC
o
Several supported serial interfaces: SPI, I2C, UART, I2S
o
Fairly well documented board and development
environment
EZDSP C5505: Diagram
Design: Audio
• AIC3204 contains the DAC
o already attached to our development board
o sample programs existed showing how
to communicate with it
• Audio is synthesized on the DSP, then sent to the AIC3204
for convertion to an analog signal.
Design: Audio
• The different frequency sine waves are generated from a
pre-generated table, and stored in a buffer on the device
• We then use the DMA controller on the C5505 to send this
buffer to the DAC
o the buffer is auto-resent once it finishes
• The DMA controller allows the execution of the processor to
continue while data is being transfered the DAC
• This allows us to easily use the processor while playing a
note (to perform tasks such as filling a buffer for the next
note, changing the volume, etc.)
Design: Memory
• Design Specifications:
o
o
o
Memory Size: 45kB (4 notes per second for 10 minutes)
Device/Song Memory interaction
Connection to PC
• Three choices for song storage:
o
o
o
On-chip Flash memory
SD Card
USB Stick
Design: Memory
• On-board M95512 Flash memory
o Already on-board for program memory
o 64KB Flash memory (for Program and Songs)
o Loading data to this memory would require development
drivers and software from TI
o Small for our needs
• External SD card
o 1GB+ Memory
o Interfaced to the C5505 with SPI
o Can use multiple types of formatting to interface with PC
o This provides a simple interface for the user to add songs
on the PC: just by using the file manager
Design: Memory
• External USB Flash Drive
o 1GB+ Memory
o Additional components needed to interface with
development board.
o Multiple types of formatting can be used to interface with
PC
• Our Choice: SD Card for Songs
o No extra components needed
o PC interaction is simply drag and drop, no special
drivers
o Inexpensive, can be replaced.
SD Card Design: SD Layout
SD Card Design: Commands, Timing, and
Responses
1) Send Command to SD Card in
6 byte frames.
2) Card Responds with R1 Response
3) If Successful R1 Response, returns
start token, followed by data and
CRC for data.
4) If unsuccessful, Error Token is sent
SD Card Design: Initialization / Setup
File Allocation Table 32 (FAT32): Preparing to
read FAT32 Filesystem
Master Boot Record:
- Block 0
- Holds Boot Code, as well as
partition data
- Use Partition Data to find VolumeID
VolumeID:
- First Official Sector
- Explains Format and physical
layout of FAT's and data
- Also Points you to Root
VolumeID Format
Directory Sector
From here, the FAT's need to be located from the information provided
in the VolumeID.
File Allocation Table 32 (FAT32): The File
Allocation Tables
File Allocation Tables = Pointers
• FAT sectors grouped into 4 byte frames
• Frames in FAT's correspond to clusters
• Follow the chain to follow data
Analog Button
•
•
Based off of a force sensitive button SEN-09375
o Basically a resistor whose resistance decreases as the
force applied to the surface increases
We use the 10 bit ADC built in to the C5505
• The force sensitive button is
attached as show on the right
• This causes the input voltage to
the ADC to be proportional to the
force applied to the button.
Device Software - ADC
•
Dynamic Volume Control Procedure
o Poll the ADC for the current resistive button reading
o Scale and invert the measured value to our value range of
volume
o Compare the scaled value to our threshold value for
playing a note.
o If our scaled value is greater than the threshold, play the
next note (if not playing) or continue playing the current
note (if already playing)
o Write the scaled value to the DAC to modify the audio
volume level
o Poll the ADC again and repeat
Brief Description of I2C
• 2 wire bus
• Each device on the bus has a unique address
• When the bus is inactive all devices monitor for their address
• Once the master device writes a devices address it
acknowledges and prepares for future transfers
Design: LCD Screen
• Part is NHD‐0420D3Z‐FL‐GBW
• 4 lines, 20 Characters long
• Connected to the microcontroller via I2C
• Powered off of 5V
• Main method of output to the user
• Displays the menu, current song, state information
Design: Menu Buttons
• Our limited GPIO pins would be enough for up to 5 buttons
• In the interested of increased flexibility we choose to attach
the menu buttons to an serial expander
• The part we choose was MCP23017
o
o
o
o
16 GPIO pins
Configurable input, output, and pull-up resistors
I2C interface to the microcontroller
DIP makes it easy to work with
• The buttons ground a individual pin on press
Device Software - Menus
Design: Master Volume Control
• A DIY classic pocket amplifier design by Chu Moy was
used for the Master Volume Control due to:
o Familiarity with the design.
o Compact design
o Virtual ground circuit
Design: PCBs
•
•
Early in development we realized we were going to need
PCBs to fanout certain components
o SD Card Slot
o Edge Connector
Boards were also required for
o Menu Buttons
o Master Volume Control
Design: PCBs
Design: Power
•
•
Main device can be powered off a single 6V - 35V source
o Powered via a wall plug
o A linear regulator controls the power to the device
o We currently do not have this connected, as it would
disallow programming of the device (it has been tested
and does work)
Master Volume requires 9V source
o Currently a 9V battery
o Could be tapped off the main power line (wall cube)
Design: Packaging
•
•
•
We choose DC-47P
o 7.620 x 4.620 x2.555 inches
Using a Dremel Tool we cut the
necessary openings
Packaged project shown below:
Software: Block Diagram
Software Development Environment
•
Main Software development tool was TI's Code Composer
Studio v4
o Eclipse based environment
o Run-time debugging
o Developer ported functionality (printf)
•
Software Version Control - Tortoise SVN
o Allowed us to collaborate on different parts and merge
changes easily
o Simple to backup and revert code to working versions
PC Software - Music Creator
•
Assists the user in creating songs
for our device to play.
Presents to the user a piano
keyboard, which they can click on to
enter notes.
o The octave of the note can be
adjusted by the numeric box below
the piano keys.
o The reference note, octave, and
frequency effect how the notes are
converted.
o Non-converted song files can be
saved and reopened later
An install file was included with the PC
Program (the .NET installer and the
ALUT installer)
o
•
PC Software - MIDI Converter
• Each MIDI file contains any number of Tracks, or sections of
data
o Any Track can have up to 16 channels playing
simultaneously (16 different instruments)
o There is other data present in a Track, such as Tempo,
Key Signature, Note effects, etc.
• Our device can only play one channel of one track at a time.
o The MIDI converter breaks the file down into multiple
Tracks, then prints out every channel of every track to a
separate file
o While this works in getting the channels to play, the main
melody of a song tends to change channels, and as such
does not allow for a desired conversion
Budget
Component
Price
Count
Total Cost
C5505 ezDSP
Development Board
$ 49.00
1
$ 49.00
20 x 4 LCD Screen
$ 24.90
1
$ 24.90
Resistive Button
$ 6.95
1
$ 6.95
Tactile Buttons
$ 0.17
5
$ 0.85
Development Board Edge $ 7.00
Connector
1
$ 7.00
I2C Expander
$ 3.00
1
$ 3.00
Packaging
$ 8.00
1
$ 8.00
Misc.(SD Card, Master
Volume parts, etc.)
$ 10.00
1
$ 10.00
Total
109.70
Testing
Test Name
Sound Generation
Volume Control
Memory
Device UI
PC Software
Description
Desired Outcome
Observed Outcome
Validate that the generated
notes are the correct
Output is a sinusoid in tune Success
waveform and frequency.
Validates that volume can
be changed as more
pressure is applied to
resistive button or
potentiometer is turned.
The volume changes
smoothly
Success
Validates that songs can be All songs files are visible to
selected and played from device and are correctly
Success
SD card.
read
Validates that there is a
menu on the LCD and it is Usable UI
usable.
Success
Validates that software
creates songs usable by
our device.
Success
Creates usable songs for
our device
Issues Encountered
• Poor sample code
• Unstable development environment
• Errors in development board design
• Connectivity issues in hardware affecting software
development
• Stress while packaging caused the development board to be
damaged
Lessons Learned
•
SVN is very helpful
•
Built-in functionality doesn't always work right
•
Just because it works the first time, doesn't mean it will work
the next time.
•
•
The importance of reliable electrical connections
Dividing work up allows you to do two things at once, but its
also important to note it doesn't allow doing one thing twice
at the same time.
Next Steps
•
More built-in utilities (scales, demo songs)
•
Fabricate a custom PCB as opposed to using a
development board
•
Integrate master volume control into main packaging
•
More featured MIDI converter
•
Note visualization: show where the user is in the song better
•
More natural analog control for volume and notes
•
Allow for the user to choose different instruments
Acknowledgments:
•
Dr. Pinkston
•
Mr. Powers
•
Chris Lacey
•
Everyone in the capstone lab who had to put up with our
instrument all year
Demonstration
• Demonstrate the Device
o Power the device
o Insert the SD Card
o Choose a song
o Play chosen song
o In Settings, modify device settings
o Choose the same previous song
o Play the song, and demonstrate the modified properties
• Demonstrate the PC Software
o Create a song with the PC Software
o Load it onto the SD Card
o Start the device and plug in the SD Card
o Choose the created song
o Demonstrate that the created song plays as desired
QUESTIONS?
Download