Difference between revisions of "S16: Laser Harp"

From Embedded Systems Learning Academy
Jump to: navigation, search
(Hardware Design)
(Hardware Design)
Line 152: Line 152:
 
Discuss your hardware design here.  Show detailed schematics, and the interface here.
 
Discuss your hardware design here.  Show detailed schematics, and the interface here.
  
[[File:MIDI_Pin_Connections.png|center|Figure #: VS1053b Pin Connections]]
+
[[File:MIDI_Pin_Connections.png|center|Figure #: VS1053b Pin Connections.]]
  
 
=== Hardware Interface ===
 
=== Hardware Interface ===

Revision as of 07:08, 24 May 2016

Grading Criteria

  • How well is Software & Hardware Design described?
  • How well can this report be used to reproduce this project?
  • Code Quality
  • Overall Report Quality:
    • Software Block Diagrams
    • Hardware Block Diagrams
      Schematic Quality
    • Quality of technical challenges and solutions adopted.

Project Title

Laser Harp

Abstract

Our plan is to design a budget version of a laser harp. This can be accomplished using infrared LEDs and infrared sensitive photodiodes. The two diode system will emulate strings of a harp. When the infrared sensor has detected an note that is played, the microcontroller will read the input from the ADC and send out a control signal to the MIDI board and the corresponding sound will play from the speaker. Controls include changing the loudness of the speaker.

Objectives & Introduction

Show list of your objectives. This section includes the high level details of your project. You can write about the various sensors or peripherals you used to get your project completed.

Team Members & Responsibilities

  • Abraham Carrillo
    • Sensor Circuit Design
    • Interfacing Sensors with ADC
    • Frame Assembly
  • Kristen Kan
    • Interfacing MIDI with SJ One Board/Sensors
    • Power Supply Circuit Design

Schedule

Week# Date Task Status Notes
1 4/3 Finalize following circuit designs and order parts

1. MIDI 2. ADC 3. Power Supply

Complete -Schematics completed 4/7.

-Physical circuits completed week of 4/10 due to parts coming in after.

-Power supply completed towards the last week due to wanting to finish other tasks first.

2 4/10 1. Interface MIDI with SJ One Board

2.Test sound projection and different commands

Complete -Completed 4/19. Issues with datasheet, improper wiring.
3 4/17 1. Lay out ADC, sensors, and power supply on prototype board

2. Calibrate sensors 3. Write drivers for ADC/MIDI circuit

Complete -Completed 4/22, except for power supply.
4 4/24 Basic input/output testing Complete -Completed 4/30.
5 5/1 Volume/Instrument/Octave Changing Complete -Completed 5/12. Includes cleaning up code.
6 5/8 Design improvements (Range/Sensitivity/Control) Complete -Completed 5/19. Includes cleaning up wire placement.
7 5/15 Final product testing Complete -Completed 5/23. Power supply completed.
7 5/24 Demo

Parts List & Cost

Part Quantity Price (Total) Description
SJOne Board 1 $80 Main microcontroller
Adafruit VS1053 Board 1 $25 Sound Decoder, used to produce sounds
MCP3008 1 $2.32 Analog to Digital Converter
SFH 4550 7 $2.87 Infrared 850 nm diode
SFH 213 7 3.08 Infrared Photodiode
220 Ohm resistor 7 $0
Part # $
Part # $

Design & Implementation

The design section can go over your hardware and software design. Organize this section using sub-sections that go over your design and implementation.

Hardware Design

Discuss your hardware design here. Show detailed schematics, and the interface here.

Figure #: VS1053b Pin Connections.

Hardware Interface

In this section, you can describe how your hardware communicates, such as which BUSes used. You can discuss your driver implementation here, such that the Software Design section is isolated to talk about high level workings rather than inner working of your project.

Software Design

There are two tasks: the MIDI Task(consumer) and the ADC Task (producer). Data is sent between modules over SPI and the value in which a sensor has been triggered is stored in a FreeRTOS queue. The consumer task sleeps while waiting for the queue to receive a value.

The MIDI Task is high priority and handles sending commands to the VS1053 to turn a note on. When a note is received in the queue, the task wakes and processes the note type. Communication is done with the SJ One Board through SSP1.

The ADC Task is medium priority handles reading values from the sensors through the ADC converter by looping through every channel and checking if the value is above 835. If it is, it sends a corresponding note type to the queue, which signals the MIDI to play a note. This task also includes the volume and instrument controls, because the MIDI Task may be asleep when the button is pressed. Communication is done with the SJ One Board through SSP0.

Implementation

MIDI Task Algorithm

1. Sleep while queue is empty.

2. When a note is received, a message is sent to MIDI to turn note on.

3. Return to sleep.

4. Repeat.

ADC Task Algorithm

1. Read 'change volume/instrument' push buttons.

2. If active, perform relevant functions.

3. Read ADC channels 0-7 via SPI.

4. If data is below a certain value for channels 1-7, the note to be played is sent to the queue.

5. A message is sent to MIDI when the data returns to default to turn the note off.

6. Repeat.

Testing & Technical Challenges

The sensor to ADC communication and MIDI to SJ One Board communication were tested separately before bringing the parts together and adding the power supply. The ADC and MIDI tasks were first written to test their corresponding circuits, then the queue and GPIO buttons were added.

It was difficult to line up the IR diode and photodiode to get a correct reading throughout the whole range. The range of the frame was tested at the farthest point successfully at first with one pair of sensors, however after everything was placed, some of the sensors didn't register towards the top of the frame.

The VS1053b breakout board took a little extra time because the datasheet lacks some information, especially regarding sending commands through SPI. Some commands only require one data byte following, and others require two. The data bytes that follow are the parameters that need to be set for each command, however not all commands are specified. There is also a need to add byte padding between each SPI transfer. Most of this information was found through research and some inferring.

Once the tasks were brought together and the frame was built, it became fairly simple since everything had already tested fairly successfully. There were still three diodes that only registered about three-quarters of the way. From here, additional features such volume and instrument control were added and tested. Minor improvements to the code were also made, one of them being setting a bool to hold a false value before every channel read to lower the chance of unwanted signals.

We would recommend having a clearer vision as to the physical layout of the frame and spending more time on creating a PCB. We wanted something that was similar to the feel of a harp, however it got pretty messy with all the wiring to 14 sensors and didn't end up very aesthetic. With a PCB, you can ensure that voltages will be more stable because we did come across some issues with voltages dropping.

My Issue #1

Talk about voltage drop?

My Issue #2

There was an issue with sending the note off command in the MIDI task because our queue only accounted for the note to be played, therefore some instruments would play the note forever. What we wanted to do was to have the note play as long as the sensor was blocked (indicated by bool variable in the ADC task), but we couldn't properly access the bool variable from the MIDI task. Therefore we have the note turn off in the ADC Task when the sensor is no longer blocked.

Conclusion

Conclude your project here. You can recap your testing and problems. You should address the "so what" part here to indicate what you ultimately learnt from this project. How has this project increased your knowledge?

Project Video

Upload a video of your project and post the link here.

Project Source Code

References

Acknowledgement

Any acknowledgement that you may wish to provide can be included here.

References Used

List any references used in project.

Appendix

You can list the references you used.