davekrnavek.com
8Mar/100

arduino -> max/MSP

so i wanted to hook up my arduino to maxMSP so i could use data grabbed from the microcontroller to do fun stuff with audio.  maxMSP has some dead-simple serial objects which just read data off a serial port, but i wanted to go a bit further and have my arduino send OpenSoundControl packets.  unfortunately, the arduino needs an ethernet shield to send network packets, but since they're usually connected to a computer, i decided to write a c++ program to grab data off the serial port and format it into OSC packets.  gave me a chance to play around some more with visual studio...

so here's a screenshot of the program -- it's got a dropdown box showing your serial ports, along with some IP address/port text boxes and a preface string.  so far, i'm just grabbing a single byte sent on the port, but i'll probably modify it a bit to allow more precision than 0-255.

and here's a basic arduino program that just sends a random byte every second, for testing purposes.

i made a pretty simple maxMSP patch that grabbed the OSC packet and just changed the frequency of a sine wave, but there's so many possibilities here.  multiple people can send data with unique preface strings, and i could do whatever i want with the audio.  fun, fun! :)

--dave

Filed under: arduino, projects No Comments
12Feb/101

arduino + nxt sensors

so i figured a decent project would be hooking up some of my lego mindstorms NXT sensors to my arduino microcontroller.  the local dorkbot group is spinning off an arduino group, which has definitely renewed my interest in the platform.

the nxt sensors all use an i2c two-wire interface to communicate with the main microprocessing brick.  there's a wire.h library for the arduino that simplifies most of the i2c communication with devices such as eeproms and other modules.  so, it's definitely possible to get the two communicating -- just a matter of figuring out the proper sequence of calls to make.  i've seen some pages online getting the arduino to talk to the main NXT brick, so this should be hopefully somewhat similar.

first step is hacking a NXT cable (i asked for some spare ones a couple of christmases ago).  the wires are stranded, so i soldered them to some solid-core hookup wire and insulated them.  so i'm able to plug it in to the arduino, at least...

so you can see the arduino sitting on my breadboard, along with another project -- a group of RGB LEDs with a 5941 PWM controller.  the connected part is one of the NXT motors, which also has a built-in rotation sensor.  so one idea is to use three of these to fade the red, green, and blue levels of the LEDs, for a little color mixing.  the NXT also comes with an ultrasonic sensor, a touch sensor (button), a color sensor, and i also picked up a third party 3-axis accelerometer.  so there's lots of interesting possibilities here...

Filed under: NXT, arduino, projects 1 Comment