How to do Bonjour / zeroconf with ESP8266 and Espruino Pico? #5422
Replies: 1 comment
-
Posted at 2016-09-18 by Kolban To my understanding, bonjour/zeroconf is the notion that one can find the IP address of a device on a TCP/IP network using "multicast DNS". The idea being that the device may have a dynamic IP address obtained through DHCP but we have client applications that wish to connect to it. Since it doesn't have a static IP address, we need a mechanism to determine its IP address at runtime. Multicast DNS allows a client to broadcast a request to locate a specific named device. If ESP8266 supported multicast DNS (which it does), then it would determine that a request to locate it was being made and it would broadcast a response with its own current IP address. This would be received by the original requestor (and as a side effect .. possibly other devices) and a normal TCP/IP connection could progress. While the raw ESP8266 provides support for multicast DNS, I can't remember whether or not that was exposed through Espruino. If it was, then we are good to go. If it wasn't, then a change request would have to be made through Github to see if it could be added. As for implementing a Web Service, I'm am assuming you mean a REST client or server ... using JSON over an HTTP request. That can be achieved using Espruino today. Posted at 2016-09-19 by samppa Yes, exactly. Hmm. That would work with Ethernet but WiFi requires still SSID and pw to connect.. Could that be avoided somehow too? Posted at 2016-09-19 by Wilberforce Once the ESP is connected to the network, a The workaround if mDns is not available then you can add the Mac address to your router and use the deco reservation, so tht it gets a known ip. Then you can set the hostname in the wifi init, and any browser can refer to the ESP by hostname. Posted at 2016-09-19 by @gfwilliams @Kolban and @wilberforce, @user68159 is talking about using Espruino on a Pico with an ESP8266 running the AT command firmware - so I'm not sure some of the stuff you're suggesting applies here (eg At the moment Espruino doesn't natively provide UDP support, so it'd be tricky to implement something like Bonjour (especially when using ESP8266 as a separate module). It might be possible to hack something up by communicating directly with the ESP8266 module to send UDP packets (if someone had some example code of doing DNS on something like an Arduino then we could probably port it across though). As suggested, setting up the router to allocate specific IPs/names would be by far the easiest way forward though I think. Otherwise you could make it request a webpage from a server every so often - which would allow you to figure out its IP?
The ESP8266 can be an access point - so you could make it appear as an access point that you can connect to and set the WiFi info with (and it could then go and connect itself)? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2016-09-18 by samppa
How could I implement web service that can be found with bonjour?
Beta Was this translation helpful? Give feedback.
All reactions