0

I'm working in the IoT field and just got started with the WiFi module ESP8266-01. I know how to use the AT comands and HTTP requests, but I want to use MQTT protocol.

I have found this library: https://github.com/tuanpmt/espduino, which seems to be good. But it was designed to use with Arduino and I only know AVR. I know Arduino "is" AVR, but reading C++ code to find out how this library works makes me so confuse!

Can someone please explain to me how this espduino library works? For example: How are the commands sent? What commands are sent to connect to Wifi, connect to a broker, subscribe to a topic, publish data etc. So that I can use those methods with AVR in avr-gcc code.

Any links to some tutorials or other helpful MQTT libraries are fine too.

m.Alin
  • 10,638
  • 19
  • 62
  • 89
  • 2
    "Any link to some tutorials or other handful MQTT library is fine too" Can't you just google this yourself? – m.Alin Jul 12 '16 at 12:47
  • I did, must be at least a week stay on google!!!! Cannot find anything that seem to be good and that why I'm here. By that sentence, I mean, if someone have a link I can't find. – Lông Nguyễn Jul 12 '16 at 13:05
  • 1
    If Google can't find it, neither can we. Yes, we are using Google too, there is no magical secret EE only resources.. – Eugene Sh. Jul 12 '16 at 13:08
  • Well, I hope I can find someone who worked with esp8266 and AVR with MQTT and give me some advises :D A real expert sometime is better than google, right :D – Lông Nguyễn Jul 12 '16 at 13:13
  • I believe you'll have a better chance of finding code online if you're willing to program the ESP module directly with the Espressif SDK, rather than program it with a separate microcontroller (AVR) through AT commands. – m.Alin Jul 12 '16 at 13:16
  • There are proabaly hundreds of tutorials for the ESP modules, just take your pick https://www.google.com/search?q=ESP8266-01&ie=utf-8&oe=utf-8#q=esp8266-01+arduino This one looks promising: http://www.instructables.com/id/noobs-guide-to-ESP8266-with-Arduino-Mega-2560-or-U/ – Voltage Spike Jul 13 '16 at 17:30

1 Answers1

2

If you just want MQTT on ESP8266, probably the easiest is to use NodeMCU, a prebuilt firmware which runs lua scripts and includes mqtt support. You'd have to learn a bit of lua, but it's not harder then c++ :)

Alternatively use the Arduino IDE + ESP8266 core, which has MQTT libraries available for it.

Or last option, use esp-open-dev with tuanpmt mqtt library: https://github.com/tuanpmt/esp_mqtt This is the hardest.

NOTE: All these options have you writing your own code on the ESP8266, but it can be a small and relatively easy amount of code :)

This question is probably better put on Stack Overflow or Arduino Stack Exchange.

bluemind
  • 168
  • 3