Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 6 of 6

Thread: Interactive LED & audio Installation with capacitive Sensing

  1. #1
    Junior Member
    Join Date
    Oct 2019
    Location
    Germany
    Posts
    3

    Interactive LED & audio Installation with capacitive Sensing

    Hello together,

    I am always looking for already asked questions, but this time I will pull myself together and directly ask for advice.
    I am still relatively new to microcontroller projects and would be happy about any help and suggestions for my large project

    The plan is to create a wall mounted installation out of textile (felt) that looks like a kind of moss patch with led flowers. the flowers are felted with conductive wool to also function as capacitive sensor (this works and was already tested)

    The simplified aim is the following interaction behaviour:

    -if nobody is close to the flowerpatch, LED glows with its standard animation
    -if somebody approaches the Flowerpatch, LED glows brighter
    -if somebody approached for long enough and touches the flowers, start new excited led animation
    -if somebody touches the flowers too fast, LED extinguishes and waits some time, before it goes back to standard

    So the flowers are kind of "shy" and want to be approached slowly, to permit any touch.

    Right now, I create small prototypes with single sensors etc, but I realize I will have to make a structured plan to make it work in big and wanted some advice before I run into unnecessary problems.

    I discovered that Teensies allow a more performative touch-sensing function with only 1 Pin through the TouchRead function, and bought a Teensy 3.2, which allows to hook-up up to 12 sensors. I am using single (not strip) adressable RGB LEDs (WS2812) in combination with the FastLED library. I understood I will have to power the LEDs externally, connecting the teensy and the leds to a common power supply. I will connect it to a wall plug with a 5V DC converter to have a good solid common ground for the capacitive touch.

    Now I have following questions:

    1) My Idea would be to have 1 Teensy Controller connected to 12 sensorpatches + LEDs (maybe up to 10 LEDs per sensor). Will it be a problem, that one single controller controls 12 sensors and the correspondant behaviour of the LEDs for each sensor? Will it just be too slow when managing 12 sensors with their behaviours for the LEDs? Or do you have an idea for a code structure which would allow to run this smoothly? I understood I should avoid any delay() and probably use asynchronous (poll based) touch sensing (https://forum.pjrc.com/threads/54527...hronous+touch)

    2) I tried to manipulate the sensitivity of the touchRead() function as explained here: https://forum.pjrc.com/threads/33517...of-touchRead()
    But I couldn't see any difference when changing NSCAN CURRENT or PRESCALE...

    3) I would like to add a sound to this all. So there would be quite simple atmospheric music, which has to be of relatively good quality.
    So basically if one of the Flowers "hides", the volume is reduced by a certain amount. I understand it is possible with the Audio library (https://www.pjrc.com/teensy/td_libs_Audio.html)
    Is there a possibility to integrate small speakers into it all? Do I have to hook it all to a sound system with audio jack? (I have to admit, I am unexperienced in audio, I am more the visuals type of creator) Will it take too much computing power, so that I have to manage audio with an additional microcontroller?

    4) Do I have to use a logic level converter to address the LEDs, as the Teensy works on 3,3V and the LEDs on 5V? Right now it seems to work with a few LEDs without it, but I imagine it will create problems with more LEDs?

    Click image for larger version. 

Name:	Profil-Installation_2.jpg 
Views:	4 
Size:	30.4 KB 
ID:	18046

    Here is an image which shows one such flowerpatch (12 are planned to be spread on a surface of about 1,5m x 1m) and the connections from the side.

    I know that are a few questions and a big project, and I would be immensely grateful for any help and advice on any point.
    Thank you very much

  2. #2
    Senior Member
    Join Date
    Apr 2013
    Posts
    1,908
    1. The 12 sensors should not be a big issue as long as you are not trying to get too complex with the flower lighting effects. If you have a teensy already suggest adding the read logic for the other 11 inputs to your prototype, add more LEDs to your fastLED code (no need for more pixels, the code does not know how many you actually have) and maybe record millis() before and after one update cycle to find how long it all takes.

    2. Cannot provide to much advice on the cap sensing, other than that you may find problems having the controlling device too far from the actual touch sensing element so design acordingly and assume you will need some form of calibration every hour or whatever to handle humidity changes in the fabric.

    3. A teensy can probably play sound along with the other tasks, but from the programing perspective it may be easier to have a sound device (teensy or not) that is separate to the touch/lighting devices. One wrinkle with sound is that while playing a music file is easy it can be tricky to smoothly blend them together or intelligently respond to interaction. It would be possible to have a teensy generate musicish ambient effects on the fly based on amount if interaction etc but if you do not have a good background in music, specifically procedurally generated music that may be ambitious. To get this to actually make noise the prop shield may be an answer https://www.pjrc.com/store/prop_shield_lowcost.html, will drive a single mid sized speaker (think mobile phone on hands free). If you want larger audio shield and a full speaker set will give you as much volume as your stereo can handle.

    4. Level converters depend on the pixels. If you are lucky enough to have the first pixel work then you are fine and just got more tolerant LEDs. The pixels work by taking the data, extracting their data and sending the rest so 2nd 3rd etc will get a 5V signal from the pixel before.

  3. #3
    Junior Member
    Join Date
    Oct 2019
    Location
    Germany
    Posts
    3
    Hey GremlinWrangler, thanks a lot for your reply!

    1) Oh true, I don't have all pixels yet, but so I can also test this out without. Will try this out right away and also watch how it reacts to different cable lengths.

    2) Yes I am scared I will have to reduce the installation surface or work with multiple sensing teensies...
    I had calibrated the sensors with CS_Autocal_Millis before switching from the library to the teensy and it's touchRead(). I couldn't find an "official" way to do this with touchRead(). Did I miss something?
    I saw onecalibration methods on the forum, I will have to try this out. (https://forum.pjrc.com/threads/33249...ll=1#post98022)

    3)Hmm so I probably will add a Teensy responsible for the sound and add a Prop Shield or Audio Adaptor, connected to small speakers to test if it could be enough. But I see the problem, I may have to look for an audio-specialized friend to help me also decide how to create the sound (music file or procedurally generated).

    4) Ah I see!

    Thank you so much, the advice helps me to continue planing and testing and also reassures me
    I wish a beautiful day and will update after more experiments!

  4. #4
    Senior Member
    Join Date
    Feb 2016
    Location
    Australia
    Posts
    231
    1. I imagine you need two way communication from your controller teensy to your 12 sensorpatches. They need to update the touch info to your controller and your controller needs to update to all 12 sensorpatches the rgb data for 10 leds each.

    Your controller will run fastled and your code to create the rgb data for all 12 sensorpatches and send this raw data to the sensorpatches who may run fastled or maybe just octows2811 and update the leds.

    I would decide on a frame rate you want to achieve and calculate if you can get that through a serial/rs485 full duplex setup. Serial is pretty darn fast I think 120leds worth of rgb data is doable.

    Audio can just be another teensy on your rs485 bus turning the volume down.

    Thatís how I would approach it anyway.

  5. #5
    Junior Member
    Join Date
    Oct 2019
    Location
    Germany
    Posts
    3
    Hey Gibbedy,

    Thanks for your reply So if I get it right, you would suggest to attach a microcontroller to each sensorpatch and it's LEDs; then let 1 "master"-controller control it all through serial or rs485?
    I looked up rs485, and this could be a solution. I will first try to just adapt the size of the installation, but good to know rs485 could solve some problems for long cables.

  6. #6
    Senior Member
    Join Date
    Feb 2016
    Location
    Australia
    Posts
    231
    Your microcontroller + touch sensor is what I’m calling a sensor patch. Is that right?
    And yeah that’s what I’m suggesting. Rs485 is hardware protocol. I’m suggesting using 1 or more serial uarts on the teensy for communication and rs485 external hardware only because it works for multiple devices connected to a common bus. If it’s all relatively close and don’t need noise immunity benefits of rs485 I think you could rig up multidrop uart with some external components but I wouldn’t bother for the price of rs-485 hardware. Anyway I have never strayed from uart for my little projects. I’m hoping to read other solutions here that may work better for your application.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •