Git Product home page Git Product logo

esp8266_uart_mqtt's Introduction

#Readme ESP8266 This Project is for those who want to speak MQTT with a microcontroller that has no WiFi capabilities. You will speak serial to an ESP8266 and the ESP will handle all the WiFi and MQTT stuff for you.

Compile/Install

I used arduino IDE just from the arduino website and configured it in a way that it is possible to programm EPS's with it. Once thats done(Please refer to https://github.com/esp8266/Arduino for exact informatin) you have to download the PubSubClient library from knolleary (https://github.com/knolleary/pubsubclient). You can just download and extract it to your arduino installation library folder. In my case it was ~/Downloads/arduino1.6.8/libraries. Once thats done you need the ESP8266Wifi library but this should be available automatically if you follow the instructions for the esp8266-arduino IDE. Once you have all that in place you can open a new sketch and copy & paste the contents of esp_sketch/esp_sketch.ino. If you have everything installed and running you can use the following commands to communicate with the ESP:

Usage of the UART Interface

The Task of the ESP is to be an MQTT2UART-Gateway. After you flashed the code you should be confronted with the following Message

<DBG> need to be configured.
<DBG> Config me like this:<delim><mqtt_server><delim><ssid><delim><pw><delim><topic><delim><topic>

How to config

You can choose any "delimiter"-character which ist not '\r'. Choose one that does not appear within the IP-address, WLAN-passphrase or the topics. The program uses the first character it receives as the delimiter. Put the IP-adress between the first and second occurence of the delimiter, the WLAN-SSID between the second and the third, the password between third and the fourth and after that you can list all topics you want to subscribe to delimited by the delimiter. Do not put the delimiter at the end of the config String. The string has to end with '\r' (carriage return).

Example

If you want to attach to an MQTT Server at Port 1883 (this is hardcoded for simplicity) at the IP 10.0.0.1, SSID: klausdieter and password: brunhildebrigitte and you want to subscribe to the topics /lotto /gluecksspirale /bingo you have to use the following configstring

%10.0.0.1%klausdieter%brunhildebrigitte%/lotto%/gluecksspirale%aktionmensch\r

The response should look like this:

<DBG> System configured. Here is your config: 
<DBG> MQTT-Server: 10.0.0.1
<DBG> SSID: klausdieter
<DBG> pw: brunhildebrigitte
<DBG> You subscribed to 3 topics.
<DBG> /lotto
<DBG> /gluecksspirale
<DBG> /bingo
<DBG> Attempting MQTT connection...
<DBG> MQTT Connected

Some things to say about the Output

As you may have seen every line that says nothing about a subscribed topic starts with <DBG>. If a line says something about a subscribed topic the output follows this syntax: <topic>:<message>\r

Publish over UART

Once the ESP is configured you can publish messages over UART using the following input:

<delim><topic><delim><message>\r

esp8266_uart_mqtt's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

esp8266_uart_mqtt's Issues

Do you have any example code?

I am trying to use this with an Arduino Uno and not having to much luck, I might have something out of order with the communication. If I use the Serial monitor, I can get this to work.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.