Forums > MaxMSP

Serial and Arduino

September 17, 2007 | 2:31 pm

Hi,

cannot currently read data from my Arduino board using ‘serial’ under
Max/Msp/Jitter 4.6.3, Mac OS 10.4.10, Apple Powerbook 1.67 ppc, 1 GB
Ram.

Tried searching for duplicated externals to no avail.

With the old Max 4.5.7 everything is ok (same patch)

All the best


Alessandro Fogar

http://www.fogar.it


September 17, 2007 | 3:38 pm

you could alternately try PD’s comport object, which incidentally
doesn’t freeze the whole computer, like serial does, when not treated
right. i did the port out if the same neccesity, the [serial]
limitations when using it with the Arduino board…

http://www.jasch.chl/dl/jasch_objects_beta/comport_UB_20070508.zip

cheers

/*j

On 17.09.2007, at 16:31, Alessandro Fogar wrote:

> Hi,
>
> cannot currently read data from my Arduino board using ‘serial’ under
> Max/Msp/Jitter 4.6.3, Mac OS 10.4.10, Apple Powerbook 1.67 ppc, 1 GB
> Ram.
>
> Tried searching for duplicated externals to no avail.
>
> With the old Max 4.5.7 everything is ok (same patch)
>
> All the best
>
> —
> Alessandro Fogar



Ron
September 17, 2007 | 3:40 pm

Hi,

Can you keep me informed about your work. I’m trying to get my Arduino to work with a new Intel Mac PowerBook Pro, to handle input from moving wheels. I’m using current MAX/MSP.

Any input will be greatly appreciated.

What are you doing with the Arduino?

ron

Alessandro Fogar wrote: Hi,

cannot currently read data from my Arduino board using ‘serial’ under
Max/Msp/Jitter 4.6.3, Mac OS 10.4.10, Apple Powerbook 1.67 ppc, 1 GB
Ram.

Tried searching for duplicated externals to no avail.

With the old Max 4.5.7 everything is ok (same patch)

All the best


Alessandro Fogar

http://www.fogar.it


September 17, 2007 | 3:51 pm

Glancing at the code, I don’t see much difference between comport and
the serial object, but maybe I’ll look a little closer before the
version 5 object is called finished. Thanks for the port.

jb

Am 17.09.2007 um 17:38 schrieb jasch :

> you could alternately try PD’s comport object, which incidentally
> doesn’t freeze the whole computer, like serial does, when not
> treated right. i did the port out if the same neccesity, the
> [serial] limitations when using it with the Arduino board…


September 17, 2007 | 4:02 pm

HI,

> Can you keep me informed about your work. I’m trying to get my Arduino to
> work with a new Intel Mac PowerBook Pro, to handle input from moving wheels.
> I’m using current MAX/MSP.

Ok.

> Any input will be greatly appreciated.
>
> What are you doing with the Arduino?

I’m reading 4 accelerometers for an installation.

All the best


Alessandro Fogar

http://www.fogar.it


September 17, 2007 | 4:13 pm

well,
the main difference from a user/usability perspective is the close
command…

/*j

On 17.09.2007, at 17:51, Jeremy Bernstein wrote:

> Glancing at the code, I don’t see much difference between comport
> and the serial object, but maybe I’ll look a little closer before
> the version 5 object is called finished. Thanks for the port.

sure thing

>
> jb
>
> Am 17.09.2007 um 17:38 schrieb jasch :
>
>> you could alternately try PD’s comport object, which incidentally
>> doesn’t freeze the whole computer, like serial does, when not
>> treated right. i did the port out if the same neccesity, the
>> [serial] limitations when using it with the Arduino board…


September 17, 2007 | 8:14 pm

HI,

many thanks, will try it…

All the best


Alessandro Fogar

http://www.fogar.it

2007/9/17, jasch :
> you could alternately try PD’s comport object, which incidentally
> doesn’t freeze the whole computer, like serial does, when not treated
> right. i did the port out if the same neccesity, the [serial]
> limitations when using it with the Arduino board…
>
> http://www.jasch.chl/dl/jasch_objects_beta/comport_UB_20070508.zip
>
> cheers
>
> /*j
>
> On 17.09.2007, at 16:31, Alessandro Fogar wrote:
>
> > Hi,
> >
> > cannot currently read data from my Arduino board using ‘serial’ under
> > Max/Msp/Jitter 4.6.3, Mac OS 10.4.10, Apple Powerbook 1.67 ppc, 1 GB
> > Ram.
> >
> > Tried searching for duplicated externals to no avail.
> >
> > With the old Max 4.5.7 everything is ok (same patch)
> >
> > All the best
> >
> > –
> > Alessandro Fogar
>
>


September 17, 2007 | 8:15 pm

Jeremy,

I seem to remember you have an Arduino board.

I assume it works for you…

Can you send me the patch you use to read the data ?

If it’s possible I’d like to use the standard serial object.

All the best


Alessandro Fogar

http://www.fogar.it

2007/9/17, Jeremy Bernstein :
> Glancing at the code, I don’t see much difference between comport and
> the serial object, but maybe I’ll look a little closer before the
> version 5 object is called finished. Thanks for the port.
>
> jb
>
> Am 17.09.2007 um 17:38 schrieb jasch :
>
> > you could alternately try PD’s comport object, which incidentally
> > doesn’t freeze the whole computer, like serial does, when not
> > treated right. i did the port out if the same neccesity, the
> > [serial] limitations when using it with the Arduino board…
>
>


September 17, 2007 | 9:50 pm

hi folks

I was teaching MAX and Arduino last year and wrote a little package called Arudino2Max to solve just this problem. I just updated it recently. It brings in readings from each pin ( 12 digital and 6 analog) at a pretty good refresh rate. In MAX you just make a receive object like "r a5" to receive analog pin 5 data.

The latest version has been tested and works fine with the latest version of Max and an Intel mac running 10.4.10. It’s offered as-is, but works well. It would actually be great if some of the Max folks upgraded it a bit! I would love it if someone could get a drop-down menu working to select the port on the serial object. I’m proficient on the hardware side but a bit of a n00b in the max world. Another upgrade would be to write a little code to toggle the pin functions from input to output…. I may get around to this eventually.

Here’s the link, scroll down half-way: http://www.arduino.cc/playground/Interfacing/MaxMSP

Daniel


September 17, 2007 | 10:32 pm

Daniel, thanks for making things simple(r). i used some of your code.
for arduino/max communcation i use the SimpleMessageSystem it allows for
easy serial read and right as well as digitalanalog readwrites. works a
charm.

i use the PWM and interrupts, so coding the arduino directly is something i
need.
the gui and higher-logic is max based.

for oroginal poster, i am xp based, but one thing (in common) to remember
when dealing with the arduino is u cant have both the arduino programing
applet and max talking to the same com port.
that’s way jasch option to close the serial is so nice, shame its only for
mac…

On 9/17/07, terminalcity wrote:
>
>
> hi folks
>
> I was teaching MAX and Arduino last year and wrote a little package called
> Arudino2Max to solve just this problem. I just updated it recently. It
> brings in readings from each pin ( 12 digital and 6 analog) at a pretty good
> refresh rate. In MAX you just make a receive object like "r a5" to receive
> analog pin 5 data.
>
> The latest version has been tested and works fine with the latest version
> of Max and an Intel mac running 10.4.10. It’s offered as-is, but works
> well. It would actually be great if some of the Max folks upgraded it a bit!
> I would love it if someone could get a drop-down menu working to select the
> port on the serial object. I’m proficient on the hardware side but a bit of
> a n00b in the max world. Another upgrade would be to write a little code to
> toggle the pin functions from input to output…. I may get around to this
> eventually.
>
> Here’s the link, scroll down half-way:
> http://www.arduino.cc/playground/Interfacing/MaxMSP
>
>
> Daniel
>
>


September 17, 2007 | 10:57 pm

hey no sweat,

when I need to have outputs I will write the code to make Arduino2Max do that too! At the moment there are so many other things calling. It is pretty trivial if people have a handle on the Arduino code and the serial comms. It would be great if someone did it first and posted it to the Arduino Playground wiki, but as is often the case in OS projects, people do it but don’t post it! :)

Do you need SimpleMessageSystem? I originally used it but the latest versions of Arduino2MAx don’t need it.

D


September 23, 2007 | 3:33 am

That’s great, this will make a lot of things easier for my current project. This way I don’t have to format the data in the Arduino code, with the pin indices, as I was having trouble dealing with the order getting scrambled when it got to Max (zl group) — the indices wouldn’t always be the first byte received, etc. This separates the data by pin automagically and will be very useful.

To toggle from input to output, just have a toggle in Max that sends the 1 or 0 to the serial as some "command number" (like 100 for off, 101 for on). Then have a serial.read() in the code that looks for those specific (unique) numbers, set the pins, voila!

Drop-downs? I tell ya, this Max stuff is *cake* compared to what you’re probably used to on the hardware side… ;)

Thanks for the info and the patch!

– CJ

———————————

dropdown serial selector and some other stuff:

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P hidden newex 335 135 152 9109513 bgcolor 120 120 120;
#B color 1;
#P window setfont "Sans Serif" 14.;
#P comment 385 73 204 9109518 Speed of serial reading (ms);
#P objectname comment_num[2];
#P window setfont "Sans Serif" 18.;
#P number 404 98 59 18 20 0 1 139 0 0 0 220 28 28 222 222 222 0 0 0;
#P toggle 414 30 38 0;
#P window setfont "Sans Serif" 9.;
#P hidden newex 309 73 73 9109513 metro 100;
#B color 1;
#P button 274 68 28 1;
#P window setfont "Sans Serif" 10.;
#P window linecount 3;
#P comment 46 116 139 9109514 Speed of output (default = 50 millisecond intervals). Settable to 1 ms.;
#P objectname comment_num[14];
#P comment 198 104 123 9109514 Serial info to drop-down menu subpatch (double-click to see);
#P objectname comment_num[13];
#P window setfont "Sans Serif" 18.;
#P number 66 163 59 18 1 0 1 139 0 0 0 220 28 28 222 222 222 0 0 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 31 195 81 9109513 speedlim 50;
#B color 1;
#P window setfont "Sans Serif" 14.;
#P comment 318 182 273 9109518 < -- Raw data from board output;
#P objectname comment_num[4];
#P window setfont "Sans Serif" 24.;
#P message 193 181 115 9109528 231;
#B color 1;
#P window setfont "Sans Serif" 9.;
#P hidden newex 193 154 81 9109513 prepend set;
#B color 1;
#N vpatcher 13 88 484 450;
#P outlet 24 246 20 0;
#P inlet 24 32 20 0;
#P window setfont "Sans Serif" 12.;
#P newex 304 196 127 9109516 prepend setitem 7;
#B color 1;
#P newex 264 170 127 9109516 prepend setitem 6;
#B color 1;
#P newex 224 145 127 9109516 prepend setitem 5;
#B color 1;
#P newex 184 119 127 9109516 prepend setitem 4;
#B color 1;
#P newex 143 197 127 9109516 prepend setitem 3;
#B color 1;
#P newex 104 171 127 9109516 prepend setitem 2;
#B color 1;
#P newex 64 146 127 9109516 prepend setitem 1;
#B color 1;
#P newex 24 120 127 9109516 prepend setitem 0;
#B color 1;
#P newex 24 89 293 9109516 unpack s s s s s s s s;
#B color 1;
#P newex 24 59 93 9109516 route port;
#B color 1;
#P comment 167 235 258 9109516 Manages serial name data. Each port name (up to 8 , in this case) replaces an item in the drop-down menu of the parent patch (items in drop-down are numbered 0 – 7).;
#B color 1;
#P connect 11 0 1 0;
#P lcolor 2;
#P connect 1 0 2 0;
#P lcolor 2;
#P connect 2 0 3 0;
#P lcolor 2;
#P connect 10 0 12 0;
#P lcolor 2;
#P connect 9 0 12 0;
#P lcolor 2;
#P connect 8 0 12 0;
#P lcolor 2;
#P connect 7 0 12 0;
#P lcolor 2;
#P connect 6 0 12 0;
#P lcolor 2;
#P connect 5 0 12 0;
#P lcolor 2;
#P connect 4 0 12 0;
#P lcolor 2;
#P connect 3 0 12 0;
#P lcolor 2;
#P connect 2 1 4 0;
#P lcolor 2;
#P connect 2 2 5 0;
#P lcolor 2;
#P connect 2 3 6 0;
#P lcolor 2;
#P connect 2 4 7 0;
#P lcolor 2;
#P connect 2 5 8 0;
#P lcolor 2;
#P connect 2 6 9 0;
#P lcolor 2;
#P connect 2 7 10 0;
#P lcolor 2;
#P pop;
#P newobj 200 74 62 9109513 p sorter;
#B color 1;
#P window setfont "Sans Serif" 20.;
#P user umenu 37 229 212 9109587 1 64 257 1;
#X setrgb 12 0 214 255 255 255 255 255 255 221 221 221 170 170 170 119 119 119 187 187 187;
#X add COM1;
#X add COM2;
#X add COM4;
#X add 3;
#X add 4;
#X add 5;
#X add 6;
#X add 7;
#P window setfont "Arial Black" 14.;
#P message 31 37 63 9568270 print;
#B color 1;
#P window setfont "Sans Serif" 18.;
#P newex 31 74 161 9109522 serial d 9600;
#B color 1;
#P window setfont "Arial Black" 14.;
#P comment 105 37 290 9568270 Click to get list of serial ports;
#B color 2;
#P objectname comment_num[1];
#P window setfont "Sans Serif" 9.;
#P newex 253 233 78 9109513 prepend port;
#B color 1;
#P hidden connect 0 0 2 0;
#P hidden connect 3 0 2 0;
#P lcolor 2;
#P hidden connect 13 0 2 0;
#P hidden connect 2 0 9 0;
#P lcolor 2;
#P hidden connect 5 0 4 0;
#P lcolor 2;
#P hidden connect 10 0 9 1;
#P lcolor 2;
#P hidden connect 9 0 6 0;
#P lcolor 2;
#P hidden connect 6 0 7 0;
#P lcolor 2;
#P hidden connect 2 1 5 0;
#P lcolor 2;
#P hidden connect 4 1 0 0;
#P lcolor 2;
#P hidden connect 14 0 13 0;
#P hidden connect 15 0 14 0;
#P hidden connect 16 0 14 1;
#P window clipboard copycount 19;


September 23, 2007 | 3:43 am

excellent, thanks!

I will integrate it into Arduino2Max in the next couple days and post a new version.

Hardware is cake… code is more like liver.

thanks

D


September 23, 2007 | 4:12 am

well, code in Max is more like liver pate, it’s a lot easier when you do it all graphically…

glad you could use it, and thanks again for the Arduino2Max!

–CJ


October 31, 2007 | 6:28 am

@Seejay:

i just uploaded the latest version of Arudino2Max to the Arduino "Playground" wiki. Now includes your spiffy pull-down menu. Your name is plastered all over the credits, hope that is OK! I have been using this version in my class, so my 20 students thank you as well.

Thanks

Daniel

Arduino2MAX version .4

http://www.arduino.cc/playground/Interfacing/MaxMSP


October 31, 2007 | 8:25 am

That’s great — I’m famous! heh.
Thanks again for this great tool. It will be coming in very handy for my next project, and many other projects methinks… I’m happy with the Arduino itself, and this tool allows it to be even easier to manage.

One thing to satisfy my restless brain… where did the value of 78 come from in the zl group? I can’t figure that out based on the number of data bytes coming in. Is it exact, or a "larger than any list you’ll ever get" kind of thing? Just wondering how that works.

–CJ


Viewing 16 posts - 1 through 16 (of 16 total)