SensorBox

A simple Arduino sketch and Max patches for using an Arduino as a sensor interface. Includes code for driving multiplexers as well. The provides an easily extensible example for beginners and students to build projects around MaxMSP and Arduino.

Tool Files

  • SensorBox

chrisbob12's icon

Thank for this Andrew. It's simple and easy to use. It did just what I needed.

jasonD's icon

Hi Andrew, I am trying to hook up four 4051 multiplexers to use with your Sensorbox but wanted to check that I have the below code right, to get all four muxes in via the Arduino A0, A1, A2, A3 analog channels. Is this correct? Many thanks in advance.

//select analog channels to multiplex
char is_muxPIN[6] = {1,1,1,1,0,0};//This is the only line of code I need to change;
//for A0, A1, A2, A3 analog pins hosting four muxes
char muxcount;//variable to store the number of multiplexed inputs

Andrew Benson's icon

Hi JasonD, that looks right to me. If you have trouble with it, let's look at it in the forum.

carlo's icon

Hi Andrew, I am trying to put all arduino mega's analog input to max msp , is there a sensor box built for this need?
many thanks
Carlo

edsonedge's icon

Hi Andrew

I have the same question as Carlo,

I am trying to use eight analog inputs on the Arduino mega, but I can only get a reading from six (not five, as I would excpect if the code and patch was made for the standard arduino board?)

I can´t seem to figure out how to change the patch or the arduino code to acoomidate more analog sensor inputs (except I suppose the spray object needs to be changed to [spray 8] ?

All the best

kaziem's icon

Hi Andrew,
This works great! I have used it with 24 light sensors interface.
I am actually thinking of turning it into kickstarter project and was wondering what license there is on this Arduino sketch and Max patch. How can I get in touch with you?

All best,

sponde2nd's icon

Hi Andrew,
thanks for the nice and simple patch - very useful to be able to get this quick progress :) - I am slightly confused though that I have sensors only on 2 pins on the arduino board (0 and 2) and yet all the analogue sliders are responding! :) - 2 or 3 sliders for each pin showing similar levels. any ideas ?

Are you working on more max patches for things like arduino ? (eg for output?) ... also do you have a blog I can follow, to keep track with projects etc ? ... ie projects in general

thanks,
sponde
UK
:)
ps. is MUX simply an extended version of the other patch (to cater for more analogue inputs) ... or is more going on ?

dtr's icon

Your other inputs are 'floating', ie. they have no reference to ground. Your seeing noise / crosstalk from the 2 connected inputs. Ignore it or pull inputs to ground to get stable 0's. https://www.google.nl/search?q=floating+input+arduino

Andrew Benson's icon

Yeah, what you are seeing is just floating unconnected pins. It's harmless, but if it really bothers you, just tie those pins to ground and you won't see them moving around. The MUX code is for use with one or more analog multiplex chips to multipy the inputs if you need lots of analog sensors. Depending on usage it might require a little customization in the arduino sketch.

JonTayler's icon

Im trying to use this to just read the value coming from 3 analogue pins, but I cant seem to get anything through. Im a bit of a novice at this so I'm sure it's something stupid. I have my arduino uno plugged in, with the standardfirmata example on. One thing i think it could be is on the umenu it doesnt have com3, 4 etc, but usbserial-a4001tfl. Is this right?
Any help would be massively appreciated

Andrew Benson's icon

There is an Arduino firmware sketch included. Load that on your board. This patch wasn't intended to be used with Firmata.

Daniel Hoy's icon

Hi

I am using this sensor box patch but using it in max for live to control audio effects in ableton live for a performance at uni.

Can someone help me how to connect the pins and how get it to work in general in max for live for ableton live audio effects.

Thanks

Alejandro Reyes's icon

Hi

i would like to connect my own sketch to your SensorBox patch but i would like to know where i can do it because i see that the boxes in the low side of your sketch are outputs.

Gracias

M's icon

Hi there, I seem to be having an issue with the .pde. I haven't altered the file in any way but it keeps giving me the following message regarding the first line:

expecting RBRACK, found '12'

What should I do?

I'm using Mac OS X 10.10.3, the newest version of Processing and Arduino 1.0.5 if that helps any. I'm sorry if this is a stupid question, I'm very very new. So far nothing is reading in max.

Thanks!

Pieter Jansen's icon

Hey guys,

I don't know if this thread is alive and kicking but trying it anyways! I'm using a Bitalino instead of an Arduino. Would it still be possible to use Sensorbox then?

Thanks in advance!

Benson's icon

How do you get this working with more than 13 analogue pins? I want to have 24 analogue pins.

I'm a noob and would really appreciate some guidance! Changing [Spray 13] to [Spray 24] in the 'SensorBoxMuxAB' patch doesn't work. Only gray lines can be connected to the sliders instead of black

Snickers's icon

Hi,

Where can I go to download this patch? is it available here on this thread? Am I missing something?
Thanks

Dani Ploeger's icon

Dear Andrew,
I made a work with your Sensorbox patch a number of years ago (this: https://fourthree.boilerroom.tv/film/dani-ploeger-electrode) It worked like a charm - and still does - but I lost the Arduino sketch and can't find it online anymore. It's still on the Arduino I used back then, so all is good for now, but just in case, would you be able to upload the sketch somewhere please (and maybe also the patch as Snickers above seems to have been looking for it)?
Many thanks and all best!

Published

Creative Commons License