A couple of thoughts after quickly reading through the posts (sorry if I missed something you already discussed): there are a number of spare pins that OG doesn’t use, particularly if you use your own custom hardware, these can be easily freed up. For example, GPIO4, 5 (these are also the I2C SDA/SCL pins), GPIO16 (on OG circuit it’s tied to Reset in case some application requires putting OG to deep sleep, using GPIO16 tied to Reset pin can wake up ESP8266 from deep sleep, but since this is not used currently, GPIO16 can be freed for something else), GPIO2 (connected to ESP8266 module’s internal LED, but is free to use); in addition, GPIO13 can be freed if you don’t want buzzer.
Next, if you have N ultrasonic distance sensors, you only need N+1 pins, because you can have all of them share the same TRIG pin, but each having their own individual ECHO pin. Of course the problem is if these sensors are too close they can end up interfering with each other on the reflected signals, but if they are put far away or facing different directions, it should be fine. Be careful that since HC-SR04 requires 5V and ECHO pin outputs 5V, you should have a 1K resistor in line from each ECHO pin to ESP8266’s GPIO pin, this is enough to serve as a simple level shifter. There is a new type of sensor called HC-SR04P, that can be powered with 3.3V and won’t need the in line resistor.
Finally, IO expander as you mentioned is also a good idea. I am more familiar with the PCF8574 I2C IO expanader, which is very common and cheap.
- This reply was modified 5 years, 11 months ago by Ray.