Take the 2-minute tour ×
Arduino Stack Exchange is a question and answer site for developers of open-source hardware and software that is compatible with Arduino. It's 100% free, no registration required.

I have a device built with an Arduino uno:

  • Arduino software installed on an Arduino uno

  • can be controlled via serial commands

  • can be controlled via physical buttons and sensors

  • on any button/sensor state change it writes the current state to serial

  • if no message has been sent within 5 seconds, it sends a no-change serial message


What is needed:

  • Use an ESP8266 to provide a bridge between current Arduino software and MQTT / web

  • I can program the ESP8266 as a web server, MQTT client, etc with the Arduino IDE or Lua (but I prefer the Arduino IDE since I can reuse parts of the code to generate / interpret communication).

  • the ESP8266 will handle everything that is required for wifi / web / MQTT; without the MQTT module the Arduino part will work stand-alone, only the remote control will be missing.

  • I would like to make minimal changes to the Arduino code (or none, if possible). Any changes would involve extensive re-testing, which I try to avoid.

  • the ESP8266 can be missing in some installs.


What options I found:

  1. Serial

ESP8266 can read the serial output and be a bridge between web/MQTT and serial, will store the current state in memory to be sent when requested to avoid polling the device every time.

One of the benefits is no code changes / testing required for the Arduino part.

  1. I2C

Make the Arduino the I2C master and the ESP8266 the slave (or the other way around) and implement bi-directional communication. Got the idea by reading this thread.


Some other information about the serial commands:

A data packet (command or state description) consists of 1 to 20 characters, with a possible peak of 20 packets in 5 seconds, and an average of one packet every 3 seconds. If needed, I can make this send 5 unsigned integers instead of alphanumeric characters.

If more than the I2C / serial pins are needed I can upgrade to an Arduino Mega (so the number of free pins is not an issue).

Are there any other options for this? (protocols, pre-made libraries for serial communication, etc). I'm trying not to reinvent the wheel..

Thank you for your time!

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.