Thanks both for your answers! Indeed I had already considered the reed switch option, actually an alternative of it because I need to sense the "join" event from both cubes at the same time... this means that I might put the reed switch and a magnet (to activate the other's cube switch) next to it. This could be a mess right? The alternative that I considered is this one: How to Make a Reed Switch - YouTube
Basically is a reed switch that get activated with the repulsion force of a magnet, and putting one of these in each side of the blocks might trigger the events exactly at the same time. This event is sent via wifi to a server where I can synchronize events by time and deduct which were the joined cubes.
The only drawback of this approach is that when users try to join the blocks they might experience an small repulsion force that could feel a bit contradictory and non intuitive. However I'm planning to overcome this issue using adhesive tapes on the the contours of the sides in order to make the cubes stay attached rather than getting away of each other as a result of the repulsion force. I could also use more magnets in the corners and make the blocks attract each other (opposite polarities) but is imposible to find a configuration where all sides could be joined with all sides of any of the blocks... isn't it? I uploaded a new drawing (
circuit-switches-blocks-.jpg ) explaining the circuit and the switches
Their is no point in all those resistors the way you have wired them because any single closure will produce the same drop. Just wire all of the switches in parallel.
I put 6 resistor with 6 switches in order to detect each side and cover the case where the cube has more than one joined cube (see the drawing attached).
Be aware that the ESP's ADC can read only 0-1V, not 0-3.3V as you may expect.
The easiest is to wire your reed contacts high side in that case.
1k resistor between ADC and GND.
2k3 resistor + reed between Vcc and ADC for the first side (ADC about 1024).
3k for the second side, ADC about 676
4k third side, ADC 520
5k5 fourth side, ADC 375
12k fifth side, ADC 260
24k sixth side, ADC 135
That idea. Use convenient resistor values. First must be at least 2k3 to bring the ADC voltage down to 1V.
Good, but this only works when we assume that the cube has only one cube joined. What happens when there are many cubes joined to a single one? I.e., when many of the switches are activated at the same time...For sure there is a way to calculate the voltage for each switches combination, but the math there is not that easy... right?
To wrap up, the alternative reed switch in theory is fine, but I'm not yet sure because I'm not sure about the precission I could get from these home made switches. And also the repulsion feeling make me have some doubts about this solution...
thank you so much again!!!