Contact Sensing Switch

Discussion in 'The Projects Forum' started by SEBASTIAN MARICHAL, May 31, 2018.

  1. SEBASTIAN MARICHAL

    Thread Starter New Member

    May 29, 2018
    7
    0
    Hi!

    I'm working in a project that consist in "smart cubes" (symetrical 4cm x 4cm) for tangible interaction. My knowledge of electronics is quite limited so I'm sorry if I do silly questions :)

    I need to detect when a cube is "attached/joined" with another cube, i.e., when the faces of 2 cubes touches each other. How can I build a kind of contact swith that detect when both surfaces touch each other?

    Inside the cubes I have a microcontroller with I/O pins, some of them PWM capable.

    Could you help me to design a solution for this?

    thank you!
     
  2. AlbertHall

    AAC Fanatic!

    Jun 4, 2014
    8,152
    2,020
    One possibility would be to have, on each face of the cubes, a disk in the middle of the face and a ring around it of some conducting stuff. When two faces are adjacent these areas will form capacitors and allow the two uC to communicate. The software to work this would need to be fairly clever as the two would need to negotiate which part of the pattern should transmit and which should receive.
    upload_2018-5-31_11-9-40.png
     
  3. danadak

    Distinguished Member

    Mar 10, 2018
    3,493
    785
  4. Sensacell

    Moderator

    Jun 19, 2012
    2,425
    803
    Put magnets inside, use Hall sensor IC's to detect the magnetic field.

    You could make the squares hold together with magnets too, separate from the sensor idea.

    Make them bigger- so you can actually fit stuff inside without bleeding from your eyeballs.
     
    -live wire- likes this.
  5. AlbertHall

    AAC Fanatic!

    Jun 4, 2014
    8,152
    2,020
    My first thought too, however it has problems.
    If the cubes are to be identical with magnets in the same place and polarity then the cubes will repel each other.
    Also the magnets and sensors (hall, reed switch) will be in the same place on each cube so in each cube the sensor will need to be next to the magnet but somehow shielded from it while still being sensitive to the magnet in the adjacent cube.
     
    -live wire- likes this.
  6. SEBASTIAN MARICHAL

    Thread Starter New Member

    May 29, 2018
    7
    0
    Hi! thank you all for the answers! I'll explain and detail more the project bellow after reply to each one of you.

    This would be great, but ... how does it work? Could you give me some further directions in order to build this communication system?

    Dana, inside of each block I have a capacitive contact sensor because I want to detect when the user is touching the block. I covered the inner side of each block with a conductive textile and I connected the textile to the touch sensor pad, this allows me to sense when the user is touching the block. However, this solution seems to be too sensitive and when the user is touching a block that is also touching another block, then both sensors trigger.. i.e., the second block is "indirectly" touched...
    Maybe I could do something to reduce the sensitivity of the sensor, for example not covering the whole inner surface of the block with the conductive textile?

    Yes, I have considered this solution but the main problem is that in some cases magnets will repeal each other...

    ------ Project details --------

    ---> Inside each block there are the following components:

    * ESP8266 Wifi and Microcontroller module (https://es.wikipedia.org/wiki/ESP8266). I still have 6 I/O digital pins and 1 analog pin free.
    * Capacitive Touch Sensor (I'm testing the Tinkerkad version but I'll replace it by this one: https://www.sparkfun.com/products/14520
    * One reed switch on the bottom of the block. I use the reed switch to detect when the blocks are placed on a special surface that
    have magnets. The use of this surface is related to the game/activity.
    * A buzzer and a vibrator motor to provide feedback to the user

    ---> Touch Sensing:
    Individually is working fine but it seems that there is some interference when blocks are touching each other.
    (See the attached picture "TouchSensor.png")
    ¿Is it posible to regulate the sensitivity of the sensor?

    ---> Magnetic Surface: I'm attaching an image, this is one of the "special" surfaces where the blocks are placed. Inside the surface there are small magnets that trigger the reed switch placed on the bottom of the blocks. (see the picture "surface.png but ignore the fact that the conductive textile it's in the outer side of the block, it's and older prototype).

    So, this is how things are right now. What I would like to achieve is:
    - Individual touch sensing in each block
    - Detection when the block is placed on the surface
    - Detect when blocks are placed together, i.e., each blocks should know whom are the neighbours

    Sorry for such a long post!! Now that I explained the whole picture maybe we can find a solution together :)

    thanks!!
     
  7. AlbertHall

    AAC Fanatic!

    Jun 4, 2014
    8,152
    2,020
    How many blocks are there?
    Do the blocks always have the same face downwards?
    Is it only the top face which needs to respond to touch?
     
  8. SEBASTIAN MARICHAL

    Thread Starter New Member

    May 29, 2018
    7
    0
    - There are 5 different types of blocks (the smallest is 4x4cm and the biggest is 21X4cm aprox).
    - For now yes, they always have the same face downwards. However (ideally), I would like to find a flexible enough solution
    without this constraint. But let's say that right now this constraint could be accepted.
    - No, all the faces have to respond to touch, this is a non-flexible requirement.
     
  9. DECELL

    Member

    Apr 23, 2018
    96
    19
    What you can do is treat your special surface as a sensor matrix- use it to work out where the cubes are in relation to each other and then wireless address each cube on how to behave.
     
  10. SEBASTIAN MARICHAL

    Thread Starter New Member

    May 29, 2018
    7
    0
    Thanks for the answer! I understand your idea but interaction with the blocks can also happen out of the surface. Actually, the
    feedback and behaviour of the block change if they are on the surface or not. So, joining blocks is an action that can also take place
    outside of the surface.
     
  11. DECELL

    Member

    Apr 23, 2018
    96
    19
    Do the blocks need to have a dialogue with each other? Each face of the cubes will need its own unique proximity sensor or you can use a six axis sensor to work out where it is in space relative to its start position- say
    iNEMO inertial module: always-on 3D accelerometer and 3D gyroscope.
    So like now it knows where it is and where it is facing. Then you need some kind of wireless links to communicate with your private Air traffic station.
     
  12. AlbertHall

    AAC Fanatic!

    Jun 4, 2014
    8,152
    2,020
    Wireless to the blocks may be difficult as the box is covered by a conducting layer effectively enclosing the box in a faraday shield.
     
  13. SEBASTIAN MARICHAL

    Thread Starter New Member

    May 29, 2018
    7
    0
    Each block communicates through wireless with a tablet, that part is working. Actually, the blocks and the tablets are time synchronized using the NTP protocol.
    The problem with this solution is that it will constraint a lo the interaction. There shouldn't be a fixed initial position, the blocks could be anywhere (no onlt on the special surface). Also, a block could be reset at any time without being a big problem.
     
  14. Sensacell

    Moderator

    Jun 19, 2012
    2,425
    803
    I think you will find the capacative sensing tricky, it will behave in ways that are very bizarre and frustrating - until you understand why.

    Rule number 1- Capacitive sensing is not magic, there must always be a return path for the sensing current, even if it's via another capacitor.
    It seems like a ridiculous idea that current flows through thin air, but it does, through the mutual capacitance between conductive bodies.

    Example- Capacitive proximity sensor works great on the bench, final project runs on batteries. The project is completed and the sensor totally doesn't work! Why? What's is missing is the closed loop to ground, through the power supply. Even though the sensor has only one wire, the ground of the circuit is essential for it to work, the capacitance of the sensed object also has capacitance to ground, a minute current flows through this capacitance, completing the circuit.

    Another example- Student attempts to build a touch sensitive box, running on batteries.
    Student builds circuit, running on batteries, tests by connecting it to the box- works fantastic, student is thrilled.
    Student places circuit and battery inside box, connects box to circuit- total fail, touching box does nothing.

    What's wrong?

    The box acts as Faraday cage, there is no path for current flow from the box - to sensed object - back to circuit ground.
    Current flows, but only through the fixed and unchanging capacitance between the circuit and the inside of the box.

    Your boxes are floating, isolated electrical systems. You can make this work, but you need to provide an additional electrode that completes the circuit, so that the capacitive currents have a return path. One electrode on a face is not enough. Be very careful to always test in the exact configuration, with no external wiring attached.
     
  15. SEBASTIAN MARICHAL

    Thread Starter New Member

    May 29, 2018
    7
    0
    Exactly! I had this problem in my first prototype, it was very disappointing. I used the CapSense library for arduino and built my own capacitive touch sensor. I tested the system wired to the laptop and was perfect. However, the behavior running on batteries was quite a mess. For this reason I bought the touch sensor module rather than doing it myself, I tested with batteries and it works better but I have the "false positive" detection when cubes are touching each other.


    I didn't test inside the box yet because I just ignored the Faraday cage issue, thank you very much for the warning.

    Could you please explain me what should I do? My knowledge of electronics is quite limited, sorry.

    Also, Do you have any suggestions to detect when a block touch other block? Right know I'm considering to use infrared communication... but I would like to consider other solutions too.

    thanks!
     
  16. Sensacell

    Moderator

    Jun 19, 2012
    2,425
    803
    Infrared is not a terrible idea.
    Beware that you will have issues with range- you want this to only work when the blocks are very close, IR will not care if it's 1 mm or 1 cm, unless you you use angle geometry or other tricks.

    Capactitive sensing would work if you have two coaxial electrodes (target shaped) with the outermost being ground reference.
    Then you have the problem of getting "touch" and "communication" out of one central electrode, possible, but not easy.

    Sensing and com signals couple between the blocks via both electrodes, forming a closed circuit path.
     
  17. SEBASTIAN MARICHAL

    Thread Starter New Member

    May 29, 2018
    7
    0
    Like AlbertHall proposed? :

    What do you mean with "communication"?

    I'm sorry but I'm not sure of being understanding how this solution works.. is there any example/project I could check? Is still a bit abstract for me...

    thank you!!!
     
Loading...