Bare conductive touch board + changing threshold for proximity sensing

viemaob's icon

Hi,
I would like to make the Bare Conductive touch board communicate with Max, and I have tried this tutorial: http://www.bareconductive.com/make/the-touch-board-maxmsp/
It works fine, but I need to adjust the thresholds for proximity sensing, but this is set in the code...
Any help on that would be very much appreciated...!

E

Touch-Board-Communication.maxpat
Max Patch
davidestevens's icon

You'll need to download the free Arduino editor from the Arduino site, make a tiny change in the proximity code (which is, if I remember, documented in the tutorial and also commented in the code) and re-upload it to the touchboard. It's not especially difficult. After all, I managed to do it, and my brain bleeds out of my ears when I try to make sense of text code.

David

(If you're really stuck, I could post the modified code, but you'd still need the Arduino app to upload to the board)

viemaob's icon

I wanted to use the max patch that i posted above – and the corresponding Data stream Arduino code gives not much possibility of adjusting the thresholds. At least I could not change, so I succeed. Which code exactly, you are referring to...? This one?: https://github.com/BareConductive/proximity-mp3
This is designed for the MP3 function with the SD card – and I need to design my interactive sound system in Max. And I wish to use both touch and proximity as input values...

I don't know what you exactly used your modified code for, but it could be helpful to look at it... And any other tips would help.

I have the Arduino app – but my brain is not trained much in text code either...

davidestevens's icon

Hm. I've made three attempts to reply with my max patch include, and each time the Chrome tab just goes blank. I'll try again shortly with a different browser.

EDIT: Not working with Safari either - is there a problem with the site at the moment?
By the way, the Arduino sketch you want is called Datastream.ino

Stefan Dzisiewski-Smith's icon

Hi chaps

To make this easier, I have just updated the DataStream code to add two extra lines setting the Touch and Release thresholds explicitly. The MPR121 library defaults to 40 for the touch threshold and 20 for the release threshold, but now you have a place where you can easily see to make the adjustments in code.

Lower values make the board more sensitive (i.e. more set up for proximity triggering), higher values make it less sensitive. Also, touch thresholds must ALWAYS be larger than release thresholds.

You can download the updated code be redownloading and installing the MPR121 library, just as you did to get Datastream going in the first place. Alternatively, the altered file (with the lines I have added highlighted) is available here.

Hope this helps

Stefan

Stefan Dzisiewski-Smith's icon

[EDIT] Deleted post as it was now not relevant.

viemaob's icon

thanks a lot, i replaced the MPR121 library with the updates version – i will test with various threshold values. will be back with the results..

btw, is there a plan to implement auto-calibration..?
last time i was using the ink i found out that the input values can swing a lot during the exhibition period and according to humidity in the room, and need frequent calibration (i was using the ink with an Arduino board + CapSense library + MaxMsp at that time). I did the calibration manually each time, but it would be great to implement auto-calibration somehow. preferably in the MaxMSP patch... though I would need some help for that.

Stefan Dzisiewski-Smith's icon

Hi Viemaob

The MPR121 and the Arduino CapSense library have almost nothing in common other than the fundamental physical principle they operate on. The MPR121 IC has onboard hardware data filtering and baseline tracking which should take care of the issues you are mentioning.

For reference, the FDAT values coming from Datastream are filtered data points. BVAL is the baseline value (this will adjust to long-term variation, provided that the rate of change is not too high as this is interpreted as a touch event). DIFF is the difference between the two - effectively this is the filtered data with baseline tracking allowed for. This is the value I would use predominantly in your application.

Hope this helps

viemaob's icon

thanks, that helps.

viemaob's icon

Stefan,
it's smth else – but do you have experience with the board and longer usb cable...? possibly i will have to have the board far away from the computer. though i would not make long wires for the sensors – i have bad experience with that (due to interference).
what is the max length for the usb that you would recommend...?

Stefan Dzisiewski-Smith's icon

Hi Viemabob

I would never recommend using a USB device over a distance larger than 5m. That said, there are a number of USB extender cables and USB-over-ethernet products out there. Try Googling "USB active extension cable". However, I can't vouch for any of them as I have never used them.

Sorry I don't have more first-hand experience!

viemaob's icon

Thanks for the advice! I will experiment with the active extension cable, and see what's possible!
Last time I experienced some interference of the sensor cables, as I needed to use longer ones – I am shortening them this time, but I am wondering, if it is still suggested to use shielded wire for instance..

Stefan Dzisiewski-Smith's icon

For sure, long cables on the touch electrodes effectively act as aerials and can interfere with one another, as well as picking up interference from radiation in the air. Also, the cable itself becomes sensitive to touch.

Shielded cable sorts some of these issues out, if the centre core is connected to a touch electrode and the shield is connected to ground at the Touch Board end. However, the capacitance between the electrode and the shield will reduce the sensitivity of the system - this is particularly noticeable in a reduction in distance for proximity detection.

I would suggest experimenting before committing to anything - your exact setup will have its own requirements and you will find the best setup by trying different stuff out. As a tip - neat and tidy wiring counts for a lot - loose wiring that can move with respect to its neighbours can cause false triggers, so keeping everything well organised will avoid you chasing ghosts.

davidestevens's icon

Ha! Finally got to somewhere with internet access.
I've been using a powered USB lead from Lindy (in the UK) with my Touchboards. I tried three, but that seemed to be too much, but no problems with 2 touchboards and a dancemat.
If you ARE in the UK, I strongly recommend Lindy for cables & stuff.

viemaob's icon

thanks for the advice – I'll experiment what works best!Will try with unshielded cables, as short as possible...

viemaob's icon

Hi,
I have been doing some tests with proximity sensing... though I could not succeed better then approx. 10 cm distance from the ink.
I have been trying to adjust the threshold values back and forth (release always lower than touch), even going down to 10/5 and 2/1.
Any tips are very welcome – how I could get a longer distance working. It would be great to come up to at least 25 cm. I have also been trying with different sizes of the ink area, but the result is more or less the same...

Stefan Dzisiewski-Smith's icon

Hatching the electrode (like the right-hand example here) with about a 50% fill can help. Also, in order to sense 25cm away, you will need an electrode of a similar size, at least in one dimension (so maybe 25x25cm or 10x25cm would be suitable minimum sizes).

How long are the interconnect cables you are using between the board and the electrodes? The maximum sensing distance can only be achieved when the electrode is close to the board.

viemaob's icon

Ok – I will figure out a design that allows the hatching with 50% fill. Was planning to screen print, so I will have to make some test samples...

The cables are approx. 2 meters long – but minimum 1,7 m. I cannot make them shorter in the design...

John Dumais's icon

I have gone through your post and understand what you want to do.
First of all Free Arduino's editor and make the required changes according to your hardware in the code you designed and again flash into the board.
Check again your hardware functioning and make it working by changing the code.