Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

IS ESP8266 CAPABLE OF THIS ?

Status
Not open for further replies.
Hello,

I am trying to see if esp8266 is capable of a certain task. So we have a board that has lets say 9 spots. On each spot you can put a cube. Each cube has 6 sides. Now the board itself will house an ESP8266. U need to put the correct cube on each of the spots, but not only that, u need to use the correct side of the cube. The system will alert the user whether he put the correct one, with the correct side on the correct spot. Now obviously, i need a way to detect this.

So for this small scale example, we have 9 cubes with 6 sides. That means system has to be somehow able to differentiate 54 different "sides". There are a couple of ways i can think of to do this:

- each side having different resistance and i am measuring that
The problem here is that i only have 1 ADC, which means i can only measure 1 cube. That is not enough, i have to be able to measure 6 cubes at once which means i would need 6 ADCs.

- each side has different voltage
Same as above ... i only have 1 ADC ..

- i supply a 3.3V to each cube. Then i have some pins ... some of them are connected to this 3.3V, some of them are connected to GROUND. I use GPIOs to measure which pins are "1" and which are "0" and i differentiate cubes and sides by that.
The problem is that in order to read differentiate 6 sides, i would need 3 GPIOS (2^3 = 8) for each cube, which is 18 GPIOS for the whole thing. I dont have that many GPIOS.

Any other ideas ?

edit: just thought of kind of a solution, though will need your input still. DS18B20 temperature sensors each have an individual ID number on them. So if each side of the cube had this sensor, i could just read its ID number ... and have that ID number stored in the system so i could configure which is correct and which is not. Those sensors are cents a piece, though it somehow seems a waste to use them for just that. But if there is no other way, i guess thats ok too
:)
 
Just before I got to your edit, I was going to suggest using DS2401 "Silicon serial number" devices - one wire (& ground) no power, just needing an I/O pin configured as open collector and a pullup resistor.

They are less than half the price of the DS18B20.
 
Just use an ESP32 instead (it has multiple analogue inputs) - the Wemos one is a nice small board, but use a larger one for more I/O's.

However, you should be aware that pretty well all microcontrollers only have one A2D, which is multiplexed to the different input pins - so you could always use an external analogue switch with an ESP8266. But when you say 'at once' what do you actually mean? - presumably you actually mean 'in quick succession'? - your application (which involves physical movement) is EXTREMELY slow - you could do it with clockwork, never mind wanting simultaneous analogue readings.
 
One way would be to use Capsense and detect change in C from one side to another.
Coating one side in something that will change the C of that side from the other
sides.

Many processors have Capsense these days.

Here is an approach that detects C but not with Capsense.


An ESP32 does have Capsense -



Regards, Dana.
 
To add to your idea of making each side digital, as you only have 54 unique sides then you only need 6 bits of information. Six bits gives 64 combinations. I'd guess you would have to make the contacts concentric rings so the orientation doesn't matter. You could have a central ground pin and only have ring contacts that are zero on the sides - most micros have internal pullup resistors so detecting low is easier than high.

Note, by only supplying ground to one cube at a time, you can read all of them with 6 pins - probably need a port expander for this. You would also need some diodes to prevent ghosting.

Mike.
 
Awesome ideas !

Right now i am just trying to make a simple prototype or if possible more than one using a different approach and then i will see which one works best. The person playing the game will only move 1 cube at a time or at max 2, if he uses both hands, but for esp8266 it will be like 1 after the other since esp8266 works so much faster than human can.

Right now using DS2401 sounds like the easiest way. What is more ... i only need 1x DS2401 per cube ... Dont know why i didnt think of this before but, if i detect the right ID number from DS2401, that means the cube is at the right spot. If not ... then it means it is not. Each cube will house a simple green and red led light. So if the cube is positioned on the right spot, it should light the cube red. And if it is in the right spot, it should light it green.

The led thing always poses a problem to me since i need 1 GPIO for green light and 1 GPIO for red light. I have been trying to find 2 things that would really help me with that but nothing i found was appropriate:

- 3 pin red/green led light: 1 for 3V source, 1 for ground and 1 for control. If control pin is low, it lights green, if control pin is high, it lights red. That would cut my GPIOs need in half. Sadly the only 3 pins i found was 1 pin for green, 1 pin for red and 1 pin for ground.

- a multiplexer but a true multiplexer like in theory. Very simple: you supply voltage to multiplexer - in my case 3V. Then you have 1 ground input and 3 control pins. That means 8 outputs, yes, including one for 0 0 0. This way i could control 8 leds with only 3 GPIOs. I saw some multiplexers for arduino but they were far from N = 2^n where n is number of inputs and N is number of outputs.

The end version will have 9 cubes. Which means .. 9 GPIOS for DS2401, 9 for buttons, a few for some other things and 9 or 18 GPIOs for led lights, which is just insane.
 
- 3 pin red/green led light: 1 for 3V source, 1 for ground and 1 for control. If control pin is low, it lights green, if control pin is high, it lights red. That would cut my GPIOs need in half. Sadly the only 3 pins i found was 1 pin for green, 1 pin for red and 1 pin for ground.

you only need one GPIO pin for red and green.
also, look up "charlieplexing" to see how few pins you need for many LED combinations.

GPIO high output
76A7EADF-E7A8-4E13-8983-FBC97314E6F8.jpeg

GPIO output Low
2F2F788B-FE6A-4D1D-9103-95487643F932.jpeg
 
you only need one GPIO pin for red and green.
also, look up "charlieplexing" to see how few pins you need for many LED combinations.

GPIO high output
View attachment 132494
GPIO output Low
View attachment 132495
I couldnt find those leds with only 1 GPIO pin, red/green ones. If u know where to find them, please post a link. But looking at the schemes i think i understand. If you pull GPIO low, it will act as ground and led will be powered by 3.3V pin. If you put the GPIO high .. it will serve as 3.3V pin and ground as ground. Which would work great in my case. Btw .. in this case its either green or red but impossible to turn both off or on right ? Nevertheless, this information will help me since i often just need either red or green.

As for charlieplexing, i only found this on aliexpress but no instructions or anything. Also kind of an overkill, would be great to have something to control like 5-10 leds:

 
The main system to the cubes ? Well the concentric rings idea is awesome but i have no idea how to do that with household items. So right now i am just thinking of making a little security plastic pin in the central plate and make the same size hole on each side of the cube - that way the cube will be positioned correctly no matter which side u use. Correctly meaning i know where ground is, where ID pin is, etc. to make sure i dont short it by mixing the two. As for how i will suply voltage to the cubes for leds and how to read the ID from them ... i would simply make small metal circles on each side that would make contact when you put the cube on the plate.
 
The DS2401 seems to be fairly expensive - >$1. Depending on your programming skills you may be able to use an 8 pin pic chip - the PIC16F15213 starts at $0.31 or $0.42 for one off. You could communicate and power it with 2 wires - see model train digital systems. It could identify the cube and light the LEDs.

Mike.
 
So right now i am just thinking of making a little security plastic pin in the central plate and make the same size hole on each side of the cube
You could make the "pin" a 3.5mm plug and have a socket in the cube faces.
Three or four connections as soon as it's in place.
 
This is something I did ages ago, but it might be applicable here. It's simmilar to how game controllers in the 80's would send button information back to the game consol. In your case, each side of the cube emits a different serial pattern based around the circuit below.. The 4017 core would be the same (One per cube), but the diode pattern would be different for each side.

1626413500379.png
 
Charlieplexing



Red/Green LED
Yes, you need two LEDs, one green, one red. One will be on when output Low, other when output High. You can turn both off if you use some type of charlieplex - source or sink with another GPIO. Many options.
 
The 4017 idea is a possibility - use one such circuit and feed the "start" bit plus one or more other bits to each connection, using different diode combinations for each output.

Or, forget RS232 type encoding and have the first two outputs always connected (via diodes) to give a double width pulse, next alway open and one or more other non adjacent outputs combined for the unique code.

That means you can wait for the long pulse for synchronisation, then read the other bit(s) and decode from the relative time offsets.
The steps would be multiples of half the sync pulse duration so it can be done in software without needing precise clock speeds in each "sender".
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top