OpenGarage Forums Hardware Questions Custom sensors – where to connect? Reply To: Custom sensors – where to connect?

#1365

Ray
Keymaster

“but this seems to disable the ultrasound distance sensor” — that’s correct, it assumes that you are using one or another, not both, since if you are using both, then it needs to know the logic of the two difference sensor results (AND, OR, or something else).

About your suggestions:
1. Because the ultrasonic distance sensor only senses distance at one spot, you are right that when it’s reporting closed the door may not be fully closed. The solution is to move it close to the door so that as soon as the door is up a little bit, it can sense the distance change. In most cases, the door is fully closed or fully open (unless if there is a power break, or if someone manually stopped the door from closing).

2/3. You can add more sensors but the ESP8266 microcontroller has quite limited number of GPIO pins. You have correctly labeled the pins that are used and are spare. GPIO0 and GPIO2 are not usable for sensors: for one, GPIO0 is connected to button, and GPIO2 is the built-in LED, so they are not spare pins; in addition, these two pins must be remain HIGH during booting, otherwise ESP8266 will not boot successfully, for that reason, they should not be used for general purpose sensors since we don’t know the sensor status at booting time.

GPIO16, however, is a spare pin — in the original design it’s tied to RESET to allow hardware reboot, but since then I’ve found that this is not necessary as we can use software reboot. So if you cut the trace of it from RESET pin, then it becomes a spare pin.

GPIO4 and 5 are spare pins and they are also the default I2C pins so they are useful for connecting to I2C sensors or I2C io expanders if you need a lot of more spare pins.