Finding IP address of an WiFi device
One of the problems when playing with WiFi robots, is finding out what IP address it is so you can send commands to control or update its on-board program.
There are various manual methods
- give it a static IP (last resort method but it works)
- mount a display, can just be simple 7 seg display
- Flash a led using morse code – tedious and not child friendly
- etc etc
My SID method for a RaspberryPi using LAN broadcasts to send its IP but this doesn’t work if the LAN router doesn’t support broadcasts (and many don’t)
Yesterday, at Preston Hackspace meeting, Jim Burns came up with concept of using an intermediate server to store the IP.
So basic concept is robot (or any WiFi Iot device) finds out its IP and then sends it to a known server. The controlling computer contacts the server and retrieves the IP.
Luckily, @OmerK showed us dweet.io @WutheringBytes. which makes its trivial (and free ) to post data from a connected device up to a server and then that info can be read back by any other computer/device that knows the feed name.
So, I added some code to my NodeMCU miniBot and got the first bit working
So to find find out the last know IP address of my NodeMCU minibot – I just need to check
Only downside I see at moment is need for device to have internet access and not just LAN connection (and for dweet to be working of course)
I know have to see if I can turn it around as in my case, which is using Scratch with its broadcast mechanism, my bot needs to find out the IP of the controlling PC