I feel like I saw that same error when I didn’t have the sensor plugged in the correct pins. Can you double check the pins on your distance sensor?
USB power is fine. Im able to power my nodemcu from the USB plugged into my computer.
So this is weird. My connections are good, but I decided to move the distance sensor’s VCC from VIN on the NodeMCU to 3V on the NodeMCU. This seemed to solve the bootloop problem and I can get into the device in AP mode and give it my WiFi info and hit the web UI on my WiFi now.
So that feels like progress. But now it’s only detecting 0 cm and that the door is OPEN (just sitting on the couch next to me with nothing blocking it).
Thanks so much for your help, I feel like I’m getting closer. I’ll keep farting around.
Did you get it working?
My distance sensor gives an error when the max
Distance is reached. I.e nothing blocking it for 5 meters or so. In some arduino sketches this is implemented wrong and it tells you 0 distance.
Does it work when you put something close?
I did! Just today actually. I had to make some changes to your wiring, no idea why. I’ll try to post a wiring diagram tomorrow when I’m in front of a proper PC. Can’t do MSPaint on a laptop’s trackpad.
The short response is that I had to wire the distance sensor’s VCC to 3V3. That got the distance sensor working in the web UI. Then I couldn’t get the relay to trigger so I had to poke around with a voltmeter to find 5V relative to ground because Vin off the NodeMCU was giving me like 1.6 or 3V, don’t remember which. I could see the relay light turn red but it wasn’t triggering the relay itself until I found a 5V pin to connect it to. I figured that meant I was getting the signal to turn on but didn’t have enough voltage to cause the electromagnet inside to switch.
Not sure why my experience was different than yours–I followed all your links for purchasing the parts. Thanks again for all your help. I really don’t think I would have completed it without you.
By the way, anyone messing around with relays for the first time who doesn’t own a multimeter will be glad to know you can hear the relay click if it’s working.
Thanks for the thought. Turns out the wiring diagram above that I followed was not working in my case but I found a different pin off the NodeMCU that worked when I moved the distance sensor’s VCC to it.
it the first time i’m doing this kind of project and I’m probably doing something wrong. the esp8266 exactly fits the breadboard. I don’t extra holes to add the sensor, buzzer or relay. Any chance you can post more close up pictures or videos? really appreciate your help here
Here’s how my wiring differed from OP’s. Two changes highlighted in yellow. Not sure why mine wouldn’t work until I made these changes. (edit: @swbradshaw did some research and it’s because I have the v3 board instead of his v2)
I had the same problem so I used two breadboards side by side, highlighted here with red/green boxes in MSPaint. I’ll snug them up together (reconfigure so as to eliminate the space between the boards under the NodeMCU) for cosmetic reasons before I mount it in my garage. Sorry for bad pic, took it last night for a different purpose.
Ignore the tortilla on the carpet.
@rufusmccoot @drorengel I figured out why you are having different results than me. My write-up/diagram was based on the NodeMCU 1.0 (v2) board. I just realized, the AliExpress link I originally used was to the NodeMCU v3 board ( a newer revision). This newer v3 revision is wider and doesn’t fit on a the mini-breadboard. Also, as you have discovered, the 5V power is on a different pin. More explanation on the differences are here. I went ahead and corrected the AliExpress link, and noted that my instructions are for v2 revision. I apologize for the mix-up!
Figured it was something like that. Thanks again for all your help buddy.
@rufusmccoot @swbradshaw thanks a lot for your help. I also now use two breadboards side by side. I’m trying to flash open garage 1.0.5 bin and can’t see the AP in the wifi list after restart. Is there anyway to debug it? I used different bauds and versions and I still can’t see the AP in the list. The LED is blinking (not constantly)
I’m just starting out on garage door automation. Why do you use a distance meter to measure if the door is open instead of a reed switch like is common with other door open/closed sensors?
I also want to point out that after I flashed the firmware, I don’t have other components connected to esp8266 chip so I only boot NodeMCU without any other parts (distance sensor, relay etc’) connected. maybe is it the problem?
Connect the distance sensor - otherwise it will not work.
This topic is specifically about the OpenGarage hardware. I’d rather keep it focused on that rather than pros/cons for different types of hardware (distance sensor vs reed switch). I’m sure there are opinions on both. I’m not trying to be mean - I’m just trying to keep discussion on topic. I will say two reasons I like the distance sensor is 1) Install is quicker since everything is contained in one unit - I don’t need to attach a set of wires to a reed switch that is then mounted on the outside of the door. and 2) The distance sensor allows you to detect if a vehicle is present when the door is closed. This is an additional sensor in Home Assistant that you wouldn’t know from a reed switch.
Not trying to derail the focus of the thread, but would it be possible to just use the sensor component of this project (without the relay)? Does the relay need to be there also because the HCSR04 operates at 5V while the esp operates at 3.3v? Or how does the level-shifting take place?
@marksev1 I didn’t need to use a level shifter; I connected it to the NodeMCU +5V via VCC pin. Relay isn’t needed for the project - you just won’t be able to control the garage door. That said - perhaps ESPEasy would be a better firmware to use?
I believe the VCC on the esp is 5v
You need to at least have the distance sensor connected or it will reboot cycle. Try both @swbradshaw’s connections and mine–both diagrams above. I had the same problem until I switched to my layout (depends on your version of the NodeMCU board).
You don’t have to have the relay or buzzer connected for it to boot and get configured to your WiFi settings, just the distance sensor.