I have a grid of square slots inside which can be placed cubes. One cube per slot.
-
What would be the best way to know if a slot has been filled? My ideas so far are a) have a weight sensor in each slot b) have a piece of wire on the cube that closes a connection inside the slot.
-
What if I want different types of cubes. Same size, but different coloured cubes. Would there be a way to know which one has been placed in a slot? I thought a) if I used weight sensors, I could differentiate cubes by weight. b) have various connection points per slot and have different cubes close different connections in order to differentiate them.
Any ideas? Thanks in advance...

You could use reed switches and magnets, or micro switches to detect presence. You could also use retro reflective sensors.
Picking colour (or differentiating specific blocks) will be harder.
Weedpharma
Reflective sensor in slot for presence, overhead camera for color, or just camera alone, could be noisy without a reflective sensor.
Thanks guys,
I'm going to research your suggestions! I'll write back if I have any other questions.
Again, hugs thanks.
Great community here!
I looked into it.
Main problem is how to detect variation, not only presence. (different types of cubes)
Overhead camera is impossible.
I was thinking the slot could be a matrix of connections. let's say 9 holes. Then there could be a pin or a pin combination on the cube. So when you insert it, only certain holes in the matrix would be filled, hence you could detect variation this way.
Does that exist? A kind of matrix connector system?
Hi,
The whole matter depends heavily on the "contour conditions":
- Is it just a(n almost) theoretical proposal or, conversely, it is going to be a solid project?
- Have you (un)limited possibilities on adding to the individual cubes (and the grid) some electronics (or, at least, some wires)?
Best Regards
It's a solid project if it can be done for a decent cost.
The number of slots is not precisely determined yet. It will depend on cost. Minimum would be 20ish, maximum around 100.
The colours was just an example for variation. The variation could be created by a slightly altered shape as well. Whatever way I can find that is easily and cheaply detectable. It would be nice to have something like 6 or even more variations possible per slot. For example, perhaps the height of the cube could be changed, making it a rectangle. Ideally, the variation would be under the cube so that it doesn't show. i could then put a sticker on the cube, or draw on it, to indicate which variation it is. I just need to find a mechanism, or a sensor of some sort that can permit me to use different variations. I'm not really sure what my options are.
Hi
It is (relatively) easy to code things (colour, shape) by placing at the bottom of every cube electrical connections (just wires; no need of resistors, caps, batteries, etcetera). This case you would need a wiring in the base of the grid a little bit more complicated (mechanically speaking: something similar to the connectors of the batteries on cellular phones; a "heavy" -say 30 g/cm2- cube would be necessary for a reliable sensing). You will need, also, to make sure that the cube is inserted with the correct base at the bottom (or having every face "coded").
Best regards
Some of the crazy ideas I had.
A) Put 4 micro-switches per slot giving 4x3x2x1 possibilities. Then have 4 possible protrusions at the bottom of the block. The problem, microswitches are nearly a buck a piece. And even at 40cents or so, that makes more than a dollar a slot.
B) Make a block close a connection and put a resistor in the block. Use different resistor strengths to create variation. Figure out a way to measure the voltage to find out which variation was triggered. The problem - seems complicated, and manufacturing blocks with resistors in them doesn't sound fun.
C) Have a proximity sensor that has very good distance analysis. Like in the millimetres. Find a way to have blocks that go to various depths in the slot.
D) Find a way to have a camera placed in an unobtrusive way. Seems hard as I don't want one above the board. If it's under the slots, then how to have it see all the slots without placing it much lower thus having to make the board super think. The board would be a few centimetres high at most.
Thank you, vffgaston. The idea of having a different code made up of only wires on the bottom of the cubes is extremely enticing because I could create many codes + it would be cheap.
I'm thinking conductive paint might be a good way to code various connections for each slot. Instead of wires. Not sure what those batteries use, like strips of conductive metal?
Thank you, vffgaston. The idea of having a different code made up of only wires on the bottom of the cubes is extremely enticing because I could create many codes + it would be cheap.
That's correct. The point are the "sensors" on the grid (then you have to poll them; it would be made using a technique similar to the one to read -for instance- 16 keys by using 8 wires (8 being 4 + 4; 4 being the square root of 16 -keys-). It is not -very- difficult using a DUE or MEGA).
You have to find the grid connector (like battery ones, I insist). What material is the whole thing going to be made of?
Regards
I'm thinking conductive paint might be a good way to code various connections for each slot. Instead of wires. Not sure what those batteries use, like strips of conductive metal?
I refer to the "male" part of the connection; dismount your phone and look to how the battery (cube) contacts to the phone (grid). The contacts "protrude" from the body and have something like a spring to help making good contact. As I see it, this is the (mechanical) critical part of your project. On the other hand, cubes should fit quite well in the grid; they should slide with the minimum possible friction (and have a minimum weigth, I insist)
Correct: you can use conductive painting.
Regards.
Ha ha, I insist...
I'm thinking of doing the project in wood using laser cutting. This is the material that would please me most. Again, cost will play a role. For now, just prototyping in cardboard.
I'm going to go with 4 connections for each slot. that gives me 4x3x2x1 = 24 possible variations (including all off). So I will need 4 pins per slot. If I have something like 50 slots, that's 200 pins. Perhaps I can use multiplexing to increase the number of pins.
I'm thinking I could do circular legs that protrude from the cubes, like a lego type system. The legs would either be conductive or not, so when they are placed in the receiving holes they could potentially close connections.
I'm going to check out the phone battery system as well. In case. Do you know what those metal strips with springs are called?
The main issue I see with painting conductive paint on the legs, is for the paint to wear off after time. Perhaps having metallic legs could work.
Anything on the block means that the blocks can only be places in a specific orientation. Unless it is on all faces.
Weedpharma
I'm going to go with 4 connections for each slot. that gives me 4x3x2x1 = 24 possible variations (including all off).
To my kwnoledge you have 2^4=16 possibilities with 4 pins 
So I will need 4 pins per slot. If I have something like 50 slots, that's 200 pins. Perhaps I can use multiplexing to increase the number of pins.
Yes; is what I tried to explain above (16 keys keypad).
The main point are the connections on the bottom of the grid (and every cube): fixed protrusions have the inconvenient that have to be almost "perfectly the same"; a slight difference of heigth will make them fail.
Regards
I've already seen color recognizing sensors in china and someone using them to sort Skittles. You can use that
This project is pretty nebulous in terms or goals, deadlines, budget. If you are the one controlling all three, get them straight. You can always make things work if you have lots of money and time. Put some color sensor and white led in each slot? If someone else is controlling goals, deadlines and budget, make them specify.