myUltraHarp is an ultrasonic musical instrument that uses the myRIO to interface with multiple ultrasound proximity sensors. A code running on the FPGA of the myRIO measures distance from all four sensors using pulse width measurements. the distance is then converted into a sine wave frequency, with a dfferent offset for each sensor so that they behave like different "strings". This frequency is used to generate an output on the myRIO's audioout, which can be outputted to a speaker or headphones.
The idea was inspired originally by the concept of laser harps, though scaled down to meet the time constraints of a one week project, and a smaller budget.
Ultrasound module operation:
The Ultrasound module is very straightforward to interface and operates in three main steps.
Step 1 : With the module appropriately powered and grounded, send a 10uS TTL pulse on the TRIG line to start a measurement. Note that at the moment the module is triggered, the ECHO line will be set to high, and remain this way until the final step.
Step 2: The module will emit 8 40khz sound pulses that will interact with the environment, before returning to be received.
Step 3: When a response is received, the ECHO line will be set low again. This means you will have a digital pulse with pulse width equal to the time of flight of the sound wave. Using pulse width measurement you can find this time, and using the speed of sound you can use it to find the distance.
Instructions on how to use Code:
The current iteration of this projects code runs entirely on the FPGA, and is straightforward to deploy and use:
Open the project
Note: all pins used in this project are on the connector C side of the myRIO
The pins used in the project and their purpose are as follows:
Pin 11 - DIO0 - Echo line for sensor 1
Pin 12 - DIO1 - Echo line for sensor 2
Pin 13 - DIO2 - Echo line for sensor 3
Pin 14 - DIO3 - Echo line for sensor 4
Pin 18 - DIO7 - Trigger line for all sensors
Pin 19 - DGND - Digitial ground for all sensors
Pin 20 - 5V - Vcc line for all sensors
Audio out - Speaker output
4 x HC-SR04 Ultrasound Sensors
Plastic pipe or similar to make arc
Velcro to attach sensors
Speaker for sound output (3.5mm Jack for myRIO audioout)
Wire to connect modules to myRIO
Stripboard - putting the modules on stripboard makes it easier to wire the lines through multiple modules.
To learn more about myRIO, visit the National Instruments website, where you can find information about the device, addons, courses and more.
Matt H Applications Engineer National Instruments UK