So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By celodnb
#92109 Hi all,

I'm a complete newbie at this ESP8266 thing! I've previously made (by copying) a simple ESP-01S WiFi connected iRobot so I could make it smarter, and it works great through SmartThings! So now I'm trying out my next project...

So for my next project, here's a little background. I want to make a detection device for the car, so I can see when it's in the garage. That way, via SmartThings, I can automatically open the garage door when I com home, but only when the car's not home (I use my phone as a presence sensor with SmartThings, and it works great, telling my garage door opener to open when I get home, but it does whether I'm in the car or not, so I wanted to try and take it to the next level).

So after doing some research, I settled on using this post to help me build a small ultrasonic sensor connected to a NodeMCU, where I have an HR-SR04 connected to the NodeMCU just like in the post shown below. I'm then sending a web request to IFTTT to turn a virtual switch on and off, dependent on the cars presence.

https://circuitdigest.com/microcontroll ... nic-sensor

I figured out how to modify the code so I can have the web interface say 'yes' or 'no' when the car's in the garage or not, and I've also tried to get my head around removing the bit's of the code I don't need.

So here's the problem. I can upload the code and test it, and everything works great where I've set the NodeMCU to send a request to IFTTT every 2 minutes, and I can see it works fine where the virtual switch in SmartThings turn's on and off...

However, it only works as I'd hoped when plugged into the USB on the computer, and only directly after I've flashed the code. Once I either disconnect and reconnect to the same USB port on the PC, or if I use a wall socket phone adaptor (which is my end goal as I want to plug it into mains in the ceiling of the garage), it will only send a web request once, and then won't send any more. The only way I can get it to send a new request is by either toggling the power on and off (pull the plug in and out), or refresh the webpage.

So it's probably a real newbie question, but I'd love to hear if anyone can help. I can see that when plugged into the PC, there is a small blue LED (dimly lit) near the micro USB socket that's always on. That same LED is not on when plugged into a phone charger (I've tried a few, all are 5v and supply at least 1A).

I can of course post my code if necessary, but just thought the above might spark something 'obvious' I'm doing wrong :lol:

Thanks in advance, and I hope someone can help.