The purpose of choosing a Raspberry Pi Zero was the full array of GPIO (General Purpose Input Output) and enough processing power to render quality sound. Getting the GPIO to work with the computer wasn’t as difficult as feared. Arduinos were made to control hardware while Raspberry Pis are computers first and hardware controllers second. For this reason I don’t have much experience with Raspberry Pi but they seem capable of replacing Arduino in at least some of my projects.
Code was written to display a statement to the command prompt when a pin on the Pi was connected to ground. This was the largest step in getting valuable feedback from the computer because this was the bridge between the computer and the real world. Several examples were studied and copied in order to get working code. Raspberry Pi can use a software defined pull-up or pull-down resistor. Arduinos were only capable of setting a pull-up resistor.
Once code was in place to perform computer actions with button presses it was a simple matter to play sounds based on button presses. The first try was to continuously play ascending music notes whenever the pin state was true. In other words it would cycle through the music notes whenever I connected the pin to a 3.3v voltage source. It should be noted that there are 5V pins on the GPIO array of a Raspberry Pi but the inputs are only meant to handle 3.3V which is also available on the GPIO pins.
An excessive amount of time was spent soldering inexpensive tactile switches to some protoboard in a keyboard configuration. However, this should be valuable for testing future code until the piano hardware gets built for this project. Seriously, over an hour was spent soldering these switches and even though it got done without problems it was probably a waste of time. Video was made showing that each switch plays a unique note. A cat can also be heard on accompaniment from the next room.
This blog, including pictures and text, is copyright to Brian McEvoy.
Code was written to display a statement to the command prompt when a pin on the Pi was connected to ground. This was the largest step in getting valuable feedback from the computer because this was the bridge between the computer and the real world. Several examples were studied and copied in order to get working code. Raspberry Pi can use a software defined pull-up or pull-down resistor. Arduinos were only capable of setting a pull-up resistor.
Once code was in place to perform computer actions with button presses it was a simple matter to play sounds based on button presses. The first try was to continuously play ascending music notes whenever the pin state was true. In other words it would cycle through the music notes whenever I connected the pin to a 3.3v voltage source. It should be noted that there are 5V pins on the GPIO array of a Raspberry Pi but the inputs are only meant to handle 3.3V which is also available on the GPIO pins.
An excessive amount of time was spent soldering inexpensive tactile switches to some protoboard in a keyboard configuration. However, this should be valuable for testing future code until the piano hardware gets built for this project. Seriously, over an hour was spent soldering these switches and even though it got done without problems it was probably a waste of time. Video was made showing that each switch plays a unique note. A cat can also be heard on accompaniment from the next room.
Unique notes from a $0.25 keyboard
Disclaimer for http://24hourengineer.blogspot.com/
This disclaimer must be intact and whole. This disclaimer must be included if a project is distributed.
All
information in this blog, or linked by this blog, are not to be taken
as advice or solicitation. Anyone attempting to replicate, in whole or
in part, is responsible for the outcome and procedure. Any loss of
functionality, money, property or similar, is the responsibility of
those involved in the replication.
All digital communication regarding the email address 24hourengineer@gmail.com becomes
the intellectual property of Brian McEvoy. Any information contained
within these messages may be distributed or retained at the discretion
of Brian McEvoy. Any email sent to this address, or any email account
owned by Brian McEvoy, cannot be used to claim property or assets.
Comments
to the blog may be utilized or erased at the discretion of the owner.
No one posting may claim claim property or assets based on their post.
2016-06-05 (Su)
Comments
Post a Comment