(first post, BTW.)
My son asked how I would implement a "WiFi pushbutton." The first thing that came to mind was a Raspberry Pi Zero. Then I thought about the cost for a WiFi dongle, cable and so on. The next thing that came to mind is the ESP8266 as I think that should be an optimal H/W platform for this kind of device. Stated requirements are
- Drive an LED or multiple LED indicators (no more than three I think.)
- Be able to associate a 16 bit number with a unit.
- Transmit a UDP message when the button is pressed.
- Battery operation
- Way to program/store SSID/password
- I would add a reply from the server to confirm receipt of the packet.
- I would add WPA2 as a requirement to maintain privacy of the traffic.
For the 16 bit number He suggested a dip switch connected to some GPIO pins. I suggested they associate the MAC with an assignment in their server. An alternative would be to long press the button and count 1/second flashes on an indicator LED to set the ID.
For SSIW/PWD it would be ideal to operate a tiny web server on the device to enter this info. If that's not feasible, a custom client could be written that would accept connections and collect the necessary information. It looks like there is a 4KB block of flash that could be used for non-volatile storage. (Or is that 4Kb?)
I think the LEDs would require transistor drivers as the spec I find for GPIO current is 12 mA.
I also think an external antenna might be required.
For a device like this which is going to sit w/out operating for long periods of time - perhaps days or weeks, I would want it to either go into a deep sleep or power down between operations to save battery. I presume it would need to power up, initiailze the radio, associate with an access point, send a message, provide some feedback to the user via LED and then go back to sleep. How quickly can all of this be done? I would also want to produce a heartbeat pulse on an indicator LED, say once every 5 seconds to indicate health. Perhaps this could be stretched to every ten seconds to indicate low battery (or the unit could transmit battery condition with each message.) I guess that implies an analog input to monitor battery voltage.
Anything I'm overlooking?
Thanks!