Here is a very basic setup for how to connect a Ping))) ultrasonic sensor to a host computer and receive incoming data, converting it to MIDI continuous control messages. In fact, this is probably the simplest I can think of right now in order to get data from Ping))) to elsewhere.
Demo video: http://www.youtube.com/watch?v=fBtEjIX4pmc
The response of the sensor is so-so, and sometimes I seem to get weird data readings with mine. However, this could either be a) some of the maths scaling that I have added to the Arduino code or b) something in my environment (which is quite cluttered) could be interfering with the sensing mechanism.
You will need
• 1 x PING))) sensor
• 1 x Arduino board
• A breadboard
• Some jumper wires
• A USB A to B cable
Please note that an older NG board was used in this demonstration, but a Diecimilia board etc. should of course be fine as well.
Breadboarding the Circuit
1. Here we have the basic breadboard set up next to the Arduino. Note the way that the breadboard is structured - the vertical blue and red columns are electrically linked as long, single lines, and the horizontal half-rows of five points are electrically linked.
2. Place the Ping))) sensor onto the breadboard. Note that the sensor has three pins. When looking at the front of the sensor, these three pins are marked GND (ground), 5V (the power supply) and SIG (the data signal pin).
3. Set up the power bussing for the breadboard. Make a connection between the 5V pin on the Arduino board and the red vertical line. The red vertical line is now the supply voltage bus. Make a connection between the GND pin on the Arduino board and the blue vertical line. The blue vertical line is now the ground bus.
4. Connect the data signal (marked SIG) pin of the PING))) sensor to digital pin 7 of the Arduino board.
5. Connect the power supply pin (marked 5V) of the PING))) sensor to the red vertical line (the power supply bus).
6. Connect the ground pin (marked GND) of the PING))) sensor to the blue vertical line (the ground bus).
The software setup is made up of three main parts:
A) Upload the sketch to the Arduino board (this only has to be done once).
B) Open and set up the Max/MSP patch.
C) Connect to your favourite electronic music making / synthesis environment (SuperCollider, Max/MSP, Ableton Live etc).
A) Upload the sketch to the Arduino board.
1) Download the code from here:
2) Open the Arduino software. Version 010 was used for this demonstration.
3) Paste the code into a new sketch.
4) Verify the code by going to Sketch > Verify.
5) Make sure the Arduino board is connected to the computer.
6) Select the correct serial port by going to Tools > Serial Port. The Arduino should come up as /dev/tty.usbserial-A4---
7) Upload the sketch by going to File > Upload to I/O Board. Depending on the type of Arduino board you have, you might need to physically press the reset button while you execute this command.
8) The RX and TX LED's on the Arduino board should flash, indicating the upload process.
B) Open and set up the Max/MSP patch.
1) Make sure the Ping))) circuit is set up and that the Arduino board is plugged into the host computer.
2) Open up the Max/MSP patch in Max/MSP. The patch can be downloaded here:
3) You may need to adjust the first argument of the serial object, depending on which serial port your Arduino board connects to your computer. Experiment or use a print message connected to the serial object in order to work out which symbol is which serial port.
4) You may wish to adjust the continuous controller number (the argument of the ctlout object).
C) Connect to your favourite environment
By sending the control data along a virtual MIDI path, you can now send the Ping))) data to may other types of places and control other things.