The idea is to read the photoelectric sensor an to operate the relays on the board.
To do so here is the wiring:
Sensor:
BLUE to GROUND
BROWN to +12V
BLACK … if i test the sensor I get +12v far object, 0 volt close object…
BLACK to V1 (stepdown)
so far so good!!!
Stepdown:
V1 to BLACK (sensor)
Grd to Ground
V0 … if I test it before connecting it to the board I get +3.3V but if is connected to GPIO14 all fails!
V0 to GPIO14 (board)
Board:
GPIO14 to V0(stepdown)
Ground to Ground.
when every thing is connected the voltage reading are:
Far Object:
V0 8.4 volts Ground
V0 -3.6 volt (+12v)
Close object
V0 7.4 volts (Ground)
V0 -4.6 volt (+12v)
as you can see if we add 8.4+3.6 =12 and 7.4+4.6 = 12…
but I’m lost here!!!
You might want to start with the actual problem you are trying to solve instead of what you believe to be the solution.
Why did you pick that sensor? It seems like a not good choice for interfacing with a modern MCU (that is only 3V3 tolerant).
Why did you choose a buck converter to reduce the voltage of a logic signal? Most people would use a resistor divider, since most GPI pins need very little current.
How are you powering the esp board (looks like it uses 12V).
How did you choose which wires to use on the sensor?
My reading of the picture says the sensor should use:
Black - ground
Brown - 12V
Blue - signal
So, it seems you have the sensor wired backwards for signal and ground. In low voltage electronics, black is almost always ground. In high voltage power circuits, black is the opposite (in the USA). In most other parts of the world brown is high voltage (and will take you down).
You might have damaged your esp in your relay board (unless it has VERY good protection).
I want to implement a solution for my work. I have a box on a conveyor belt that needs to be stop for a few second (the box need to be stop not the belt). To do so I decide to install a 12 volt linear actuator, connected to the board relay. I need to sense the position of the box, and for that I´m using the photoelectric sensor.
That is pretty much…
Answering you questions:
1.- I pick up that sensor because I thought it may work…
2.- I choose a buck converter because I didn´t know any better but it seams a great solution using a resistor divider… (I´m not an electronic engineer just an enthusiast!)
3.- the board has a 12v input.
4.- the sensor wire connection is according to this pictures:
Can you just please measure the voltage WITHOUT ESP. Sensor output through ~3:1 voltage divider directly with multimeter.
When you have that ok, you connect it to Esp pin which is set up as input without pullup or -down.
then I will go back to my earlier statement, you are following the likely bad info about which wire is which on the sensor.
Also the advice of using a resistor divider was to replace the buck converter. If you draw pictures (schematics) that are not correct, no one will be able to follow what you are saying.
You can use a square box to represent the sensor in your picture as long as you label it that. If you use a resistor divider in your schematic and do not say it is representing the sensor, no one will understand.
But, why don’t you try switching the black and blue wires. I believe it will just work if you do. Prove me wrong, if you are convinced I am wrong about it.
you are right about the schematics, I should do it in with better info, never the less, for this exercise I´m not using the sensor, only the voltage divider so is simple…