ArduinoMax_InOut_forDummies (Really, for a Complete Idiot)

    Feb 11 2013 | 11:49 pm
    Hi there - this patch is amazing and I can get it to work going from Max to my Uno (i.e. controlling the on board LCD etc) but cannot get digital sensor data to stream into Max because I am far more than a Dummy, I am a complete Idiot.
    I am using Max 6 / OSX 10.6.8 / Wiring 1.0.3 with an Arduino Uno + a SHT11 Sensirion digital sensor (Humidity and Temp) from Adafruit. I have attached both the Max patch and Wiring file below but it is also here, I imagine many have used it:
    If there was a manual for this I would have RTFM 10x. And I have done every Max tutorial 3x. So please trust that I am far from lazy but very close to stupid. I am looking at the digital outputs which are toggles and wondering: how can I adjust this patch so I am receiving digital sensor data which I see perfectly in the serial monitor of Wiring? Analog sensors work fine for me and I can get them into Max. It's the digital end that is revealing the smallness of my brain.
    I also get a stream of error messages in the Max window when attempting to get data in after sending Wiring the code and closing the serial monitor. The errors are typically "spray: requires list" and "spray doesn't understand..." The second message at least tells me that Max is seeing to get that something to turn into cute perfect like floats...
    Thank you for any help or ideas.
    Sincerely, Dummy #1

    • Feb 13 2013 | 2:03 pm
      Hi apocom
      Dummy #0 here ;-) -I happen to be the one who did the max-part of the software you are looking into. -The following is straight from the hip, so I can not guarantee in regards to mis-information from my part. -Also I do not have any controller boards lying around here - am not at work, and these things are forbidden in the house, my wife find them ugly and un-aesthetic (she is actually the one with a science-degree, I´m from Arts- so where did that come from??? :-) ) -so I can not test either. -Anyway reading through your message, and briefly (very briefly) looking into the specs/setup of the sensor you mention -which I have no experience with, whatsoever. -It looks like you are trying to do something that is not possible with our software. It says that the output of the sensor is a "2 wire digital interface" on a "3-state data pin". this could mean, am not saying that it does, but it could mean, that depending on the clock pin on the sensor the data-pin is either input or output-ready. So this is one issue; you do not necessarily send data from the sensor to the Arduino pin, because, as far as I know, the digital inputs on Arduino´s have internal pull-up resistors, and looking into the manual for the sensor (a bit more now :-) ), it says that "To avoid signal contention the microcontroller must only drive DATA low. An external pull-up resistor (e.g. 10kΩ) is required to pull the signal high", so possible, you unknowingly drive the signal high, meaning that the sensor is standby for receiving - not sending - data - something like that..... -I am not engineer, -but this could possible be an issue, as mentioned....... -Actually an issue we could look into an prepare for in an eventual future version of the dummy-software, since other sensors use this format as well - But have to talk to Lasse about that, -he is the clever guy, who did the Arduino-code for it. Ok, another issue could be that I suppose the sensor transmits, and you expects, digital output data from it with higher resolution than 1 bit? I am not clear on the format the sensor use. But it is not a format that is readily readable on an Arduino digital pin - am preeeeettyyyy sure here, but again, -you never know, -could be wrong, no guarantee´s :-) -1 arduino digital input pin means 2 states - not much of resolution here ~ either boiling water or frozen water - so to speak. It is possible to sync several arduino digital in pins to perform a bit array, so you in practice get a larger resolution, but it would take a encoding/decoding shift-register circuit - something like that - have never tried this. But it should be possible - ask your nerd-friends.... OR, you might be able to use the TX/RX ports on the Arduino - then you need some coding advice, which I can not provide - after all, I am dummy #0, remember! :-) -We could ask Lasse, he is the man.
      BUT, anyway! -Non of the above potential solutions are prepared for in the Dummy-software! If you get several digital in pins to perform a bit-array, you can actually, based on the switching of the toggles in the dummy-software on the several pins, do an algorithmic conversion in max. But it is not recommendable, it would be tedious work and would soak up a lot of scheduler/performance-power in max - unless you yourself or you nerd-friends code it in a custom mxj-java object.
      So my personal solution - being the ultimate dummy - would be to get 2 analog sensors (humidity and temperature), and hook them up on the analog pins, straight from the gate, no bullshitting around with smart-ass code or electronics, and do the reading in max and focus on the aesthetic/artistic/whaetever outcome instead of the technical and coding issues.
      In regards to the spray-object error-messages you get in max - I have never experienced that myself, but have had others mentioning them. -"spray requires list" is a standard easy-to generate (read; provoke) error-message, since (as it says) spray requires a list. Therefore the two functions we use ( p x x and v x x) is translated to and returned from the arduino-software (via the ArduinoMaxInOutDummyCom01 subpatch) to a list-format that spray understands. -So it is kind a hard to get that error in the patch (?) and I have no readily explanation for it. -From other cases, it is known that the performance does not seem to be affected however (if the other parts of the system is all ready up an running). (hmmm, -Could be somekind of clock-error between the serial input and max - have to ask Lasse.....) -anyway does not seem to be of a serious matter... The other one "spray doesn´t understand...." - doesn´t understand what? -It probably says more? Anyway this (and actually the "spray doesn´t understand..:" as well, in your case at least, coming to think of it) could potentially relate to some kind of unaccounted for data coming from the sensor, not interpretable by the Arduino - and therefore either by the max-patch. -So these two error-messages (or at least the last one) maybe pointing in the direction of the second possible issue mentioned in regards to the sensor; that you do get data, but not in a format that is usable as is.
      Hope this makes sense, at that (at least some of) this is correct :-)
      Greetings and good luck Rasmus
    • Feb 15 2013 | 1:22 am
      Rasmus - you are the kindest person in the world. Thank you so much for all these helpful ideas. Honestly, analog sensors are sounding very attractive right now...I am not turned on by code but by sound! Thank you again and again and again!
    • Feb 19 2014 | 6:24 pm
      Hi There! Informative thread. A question for RASL: How to control servos with ArduinoMax for Dummies? Thanks BRO Best, -M