Spider uses esp-link for its wifi connectivity. This custom esp8266 firmware offers many functions in addition to plain network connectivity. The one feature that was very useful from day one was the AVR firmware update: An avr with a suitable boot loader can receive firmware updates over WiFi via the esp.
Spider uses the optiboot boot loader. This means it's flashable through its serial port. It should even be possible to flash a Spider board from the Arduino IDE, although most programs will probably not work as expected due to the 8 Mhz clock.
Another nice feature of esp-link is that it can take care of maintaining a connection with an MQTT-broker. It allows the AVR to publish messages and to subscribe to topics. The AVR and esp-link must use the SLIP protocol in order to have both plain serial communications and in-band esp-link commands on the same serial port.
For Arduino, there is already an esp-link client library that takes care of the SLIP communications and the format of the command packets that are sent from and to the esp-link. Stubbornly, I decided that this library could not be used for Spider:
- The Arduino library depends on the Arduino environment and, for instance, the Arduino serial port. This would mean that in order to use the library, I'd have to use the Arduino environment and somehow adapt for the 8Mhz clock. All in all not impossible, but quite an undertaking. Additionally I have some fears that depending on Arduino libraries would cost me more program space and RAM than I have available (Spider uses an Atmega328 or Atmega88).
- Although the esp-link client library is well-written, it is written in C++'03. C++11 offers features that make programming for microcontrollers a lot easier and I thought it would be a good exercise for both the modern C++ muscles and the microcontroller C++ muscles to write my own version.
In other words: I'm a walking example of the NIH syndrome.
The library is still a work-in-progress. As always, writing my own version of this library took way more time than predicted. It has also taught me a lot about how the esp-link firmware works though, so in the end I don't consider it a complete waste of time.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.