Cannot see it on the network
Closed this issue · 8 comments
HI,
My PCBs arrived I setup platformIO for the first time and I think I've compiled it correctly and it writes the compiled code to the ESP but I cannot see it on my network.
I set the information in the secrets.h.template and saved it as secrets.h my MQTT server is an external one so I added "M20.cloudmqtt.com" as the MQTT server IP address, will this work?
If I move a magnet to the reed switch the blue led flashes and again as I move it away so I assume the ESP is powered and running it just doesn't seem to connect to my network, any ideas?
I also monitored my MQTT account to see if there were any messages received but there were none :-(
The best thing to do first is to check if your ESP successfully connects to your router via Wifi. Since the router probably assigns the IP addresses automatically via DHCP, you should first comment out the line:
// WiFi.config(ip, gateway, subnet);
and only later define it as a fixed IP address in the router and ESP.
Unfortunately, I am not familiar with external MQTT servers. But if this works with your other (ESP-based?) devices, it should also work here.
If you don't get further, you can still output additional "Serial.println("...");" via RX/TX and your USB-to-TTL converter and debug it this way.
The blue flashing is the usual behavior when something changes at the reed switch.
By the way, I love the redesign of your PCB!
Thanks, it's all down to your video :-)
I think it is connecting but it's going offlline so quickly my router isn't showing it, I think I need to disable the sleep.
I have now seen a couple of messages on the MQTT cloud so it is connecting OK.
Thanks
It looks like setting it to a fixed IP address stops it connecting to my router, using DHCP means it connects OK but takes around 7 seconds to send the MQTT, I'm OK with that delay.
Of course, you also need to be able to assign a fixed IP to the device in your router. In my router (Fritzbox) I always connect first via DHCP, so that the ESP gets an automatic IP, and this I can then change to a fixed IP.
This is not only a matter of delay, but also the time it takes for the ESP to connect. Of course, the longer it takes, the more battery power is used. That is why you should consider changing it again.
I set the IP address in the router via DHCP then fixed it but it still won't connect at all, maybe it's my router that's causing the problem. I have some other ideas about increasing battery life but still trying to work it out.
OK, and after you fixed the IP in the router, did you also fix it in ESP? Strange that something so basic causes problems.
But I'm happy if you have ideas for further optimization. Let me know if you have any new findings in this regard.
Yep I fixed it both, I have fixed IP addresses for other devices like Raspberry Pis etc. it's strange.
If my ideas bear fruit I'll let you know.
OK I would like to run this sensor on a single AA battery so I've designed a circuit using an MCP1640 to step up 1.5V to 3.3V and noticed the converter has an enable input on it so I was thinking of switching on the 3.3V to the ESP with another XOR gate acting as an inverter for the current enable signal and changing the pulse width to a vaule that allows the ESP to boot up and switch the enable pin from a GPIO pin also until the transmission is finished.
The problem with this is that the logic gates would need to be powered all the time therefore a higher battery voltage would be needed making the step-up converter redundant so if I use a single cell lithium with a voltage regulator as currently I could use a P channel MOSFET to switch on the ESP power from the logic gates triggered by the reed switch and hold on the power until finished.
The second way is by keeping it as it is now and using ESP-NOW to communicate which doesn't need an IP address from the router as it talks directly to another ESP, this would require a permenantly powered ESP as a receiver/bridge/gateway (https://www.youtube.com/watch?v=xPPdYvKbSFk) which could then send MQTT messages.
Using ESP-NOW you are looking at a transmission time of around 200mS from powerup to power down.
Using ESP-NOW would allow a smaller L-ION cell to be used to get a similar or better usage period.