Pduino:
Arduino is another microcontroller interface for creating alternative tools to map physical interaction. It is the result of an open source hardware project aimed at providing the art and design community with a tool for creating electronic interfaces. By allowing users to interact in various new ways, these new interfaces can be seen as enabling more natural bonds with computers. Arduino consists of an 8-bit microcontroller and a port through which to communicate with a computer. This allows a connection to existing software packages such as, Pure Data. Pduino library provides communication between Arduino and Pd objects, which enables us to control analog and digital sensors with Pd interfaces. This involves receiving input data throughout the sensors as well as sending data to control and change states of the sensors. In order make this communication happen, first you need to connect your Arduino board to your computer ( see http://arduino.cc/ for how to install Arduino board driver and Arduino software). After you connect your Arduino board, you need to upload the Firmata firmware to the Arduino board that you will receive sensor data through your Pd interfaces. Here it is the instrcutions on how to upload Firmata firmaware to Arduino board.
First, double-click "arduino" in the Arduino application folder. After you run the Arduino application, in the toolbar, click the " Once you click the SimpleAnalogFirmata, the Fimata will be opened in your Arduino application.
In this chapter we will introduce analog sensor examples; therefore we will upload SimpleAnalogFirmata to the board. For other types of sensors, such as any digital sensor or servo motor sensor, under Library Firmata > you need to choose the related Firmata based on your sensor type.
In order to upload this Firmata to your Arduino board first you need to define your Arduino board type and the serial port that your Arduino board is connected.
In Arduino application click " Tools> Board " and choose your Arduino board type, i.e. if you have Arduino Deicimila board, choose the option "Arduino Diecimila or Duemilanova w / ATmega168". After you set the type of your Arduino board, set the serial port that Arduino board is connected. Click the " Tools> Serial Port" and choose the right serial port.
After setting up the board and serial port, in the tool bar click the " This will compile the SimpleAnalogFirmata and you will receive " Done compiling " message in Arduino application. If you receive any error messages simply go through the above instructions and compile the firmata again. Once the firmata is compiled, you can upload it to your Arduino board.
In order to upload firmware, first press the reset switch button on your Arduino board, which is located closer to the main Atmel AVR ATmega chip on your board. The location of the reset switch on the board might vary based the type of the Arduino board.
After pressing the reset switch, then in the tool bar, click the "
In Pure Data [arduino] object will set the connection with the firmata that you just uploaded to your Arduino board. When you create an [arduino] object in your patch, all the abstractions that are required for Pduino library will be loaded as well. The inlet of this object lets us to send messages to start serial port communication between the computer and Pd. Since there are more than one serial port in a computer, first we have to figure out the number of the serial port that the Arduino board is connected. Simply by sending a [devices( message to the [arduino] object, you can get the list of devices connected to your computer on the main Pd window. Once you are sure that you have connected your Arduino board to the computer, click the [devices( message box and you get similar type of information in the main Pd window as below.
[comport]: available serial ports : 4 /dev/ttyUSB0
In this case, Arduino board is connected on the port /dev/ttyUSB0 and its port number is 4. Therefore, in order to start Arduino - Pd communication, related to the above example, you send [open 4( message to the [arduino] object.
Main Pd window will display similar type of below information if the serial connection is opened successfully.
get_baud_ratebits: 115200.000000
Once you open the serial port connection, you can immediately receive data from your Arduino board. First you need to enable sensor data to pass through [arduino] object and later separate the sensor data types. In this below example, we focus on analog input sensors; therefore [route] object only enables analog sensor type. The later [route] object separates the analog input data so that you can receive each sensor data in a separate number box. Even though there is not any sensor connected to the Arduino analog pins yet, when you enable the data to flow through [arduino] object, analog input pins number boxes in above patch receive flow of numbers. These are simply noise data that the empty pins on Arduino board generates.
Below images show a basic photoresistor sensor connection with Arduino board. In this circuit 5V power, ground and Analog in 0 pins are used. After you build up the photoresistor circuit below, simply by blocking the amount of the light that photoresistor receives, you can change the value of the electric current in this circuit and you can receive the value changes in the above Pd patch.
Because in this circuit there is only one analog sensor and it is connected to the Arduino Analog in 0 pin, if you connect a0 number box output to a [send] object, you can receive the sensor data in different Pd patches as well. Just a reminder, you should use the same target name in both [send] and [receive] objects.
Below Pd patch example receives the photoresistor sensor data to control the amplitude value and the central frequency of the bandpass filter.
These are the basic examples for Pduino library; however arduino-test.pd includes other type of sensor connections through [arduino] object.
|