I've built a very simple WiFi thermometer out of an Adafruit ESP8266 HUZZAH breakout board and a TMP36 temperature sensor. I have it reporting the temperature over wifi to my computer which will be storing the data in a database for monitoring purposes. I'd like to make multiple of these devices and place them around the house. My question: I currently have the location of the board as a const char*
on the board itself. Doing this for multiple devices is just a bad idea and a nightmare to manage. Is there some way of setting a location variable on the board that will persist across shutdowns? Or am I coming at the problem from completely the wrong direction?
-
Why not just use the (unique) IP address of each module to identify it and map that to a name on the PC?Majenko– Majenko2016年06月24日 19:16:37 +00:00Commented Jun 24, 2016 at 19:16
-
I was thinking that would solve the issue, but I'd rather have the resolution contained within this system rather than relying on configuring my router as well.Taelsin– Taelsin2016年06月24日 20:26:16 +00:00Commented Jun 24, 2016 at 20:26
1 Answer 1
With a set of DIP switches or jumpers on some of the GPIO, you could encode a unique number for each one - 16 of them with 4 I/Os f/ex. The same code could run on all of them, sample the unique ID report it along with the temperature. Let the PC-side map IDs to locations.
-
I like this. Your answer gave me an idea though. I can get a MAC address from the breakout board. Would the MAC ever change? If not, I could send the MAC of the board along with the other data and do some server side mapping with the MAC.Taelsin– Taelsin2016年06月24日 20:25:20 +00:00Commented Jun 24, 2016 at 20:25
-
I don't know how the Lua firmware works, but the AT+ interpreter firmware includes commands to set the chip's MAC address, so, yes, it can be changed, but that's a change you would have to make, not one that I could ever imagine would be programmed to happen without you taking explicit action.JRobert– JRobert2016年06月24日 21:59:22 +00:00Commented Jun 24, 2016 at 21:59
-
The MAC address comes from the ESP8266 chip, not from the breakout boardJaromanda X– Jaromanda X2016年06月26日 23:55:30 +00:00Commented Jun 26, 2016 at 23:55
-
@JaromandaX: Yes, that's correct. And ?JRobert– JRobert2016年06月27日 11:34:32 +00:00Commented Jun 27, 2016 at 11:34
-
Just clearing up @Taelsin's misconception that the breakout board has something to do with the MAC address, if that's OK with youJaromanda X– Jaromanda X2016年06月27日 12:05:27 +00:00Commented Jun 27, 2016 at 12:05