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
      Feb 05 2011 | 8:57 am
      Thank for this Andrew. It's simple and easy to use. It did just what I needed.
      Share
    • jasonD's icon
      jasonD's icon
      jasonD
      Apr 18 2011 | 6:32 am
      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
      Andrew Benson's icon
      Andrew Benson
      Apr 28 2011 | 12:14 pm
      Hi JasonD, that looks right to me. If you have trouble with it, let's look at it in the forum.
    • carlo's icon
      carlo's icon
      carlo
      Dec 14 2011 | 1:42 am
      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
      edsonedge's icon
      edsonedge
      Jun 13 2012 | 1:20 pm
      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
      kaziem's icon
      kaziem
      Jun 28 2013 | 3:58 am
      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
      sponde2nd's icon
      sponde2nd
      Jan 05 2014 | 4:44 pm
      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
      dtr's icon
      dtr
      Jan 05 2014 | 9:25 pm
      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
      Andrew Benson's icon
      Andrew Benson
      Jan 06 2014 | 8:39 pm
      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
      JonTayler's icon
      JonTayler
      Jan 08 2014 | 11:48 am
      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
      Andrew Benson's icon
      Andrew Benson
      Jan 10 2014 | 9:13 pm
      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
      Daniel Hoy's icon
      Daniel Hoy
      Mar 02 2015 | 3:39 pm
      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
      Alejandro Reyes's icon
      Alejandro Reyes
      Jun 02 2015 | 4:44 pm
      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
      M's icon
      M
      Jun 26 2015 | 2:16 pm
      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
      Pieter Jansen's icon
      Pieter Jansen
      Feb 22 2016 | 5:42 pm
      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
      Benson's icon
      Benson
      Apr 06 2016 | 1:15 am
      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
      Snickers's icon
      Snickers
      Mar 06 2019 | 1:37 am
      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
      Dani Ploeger's icon
      Dani Ploeger
      Jun 12 2019 | 5:07 pm
      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!