|
Forum Index : Microcontroller and PC projects : Annex-Picomite-MQTT
| Author | Message | ||||
| MikeO Senior Member Joined: 11/09/2011 Location: AustraliaPosts: 275 |
MQTT test using my new, cnc milled, Picomite pcb. Esp01 loaded with Annex running a mqtt test (using my RPI mqtt broker) Simple serial receive on the Picomite. ![]() serial.mode 115200 ' MQTT test program ' Using mosquitto test server wlog mqtt.setup("192.168.0.9") wlog mqtt.connect("emonpi", "emonpimqtt2016") ' No login / pass required wlog mqtt.subscribe("emon/AnnexTest") ' subscribe to the topic /AnnexTest onmqtt mqtt_msg for z = 1 to 10 ' send messages to the topic /AnnexTest wlog mqtt.publish("emon/AnnexTest", "Annex"+str$(z)) pause 100 next z wlog ramfree wait ' receive messages from the server (send to Picomite) mqtt_msg: print "TOPIC : "; mqtt.topic$ print "MESSAGE: "; mqtt.message$ return Test program running on Picomite shows received subscription messages > list SetPin 1,uart0tx:SetPin 2,uart0rx Open "com0:115200" As #1 Do Line Input #1,a$ Print a$ Loop > run TOPIC : emon/AnnexTest MESSAGE: Annex1 TOPIC : emon/AnnexTest MESSAGE: Annex2 TOPIC : emon/AnnexTest MESSAGE: Annex3 TOPIC : emon/AnnexTest MESSAE: Annex4 TOPIC : emon/AnnexTest MESSAGE: Annex5 TOPIC : emon/AnnexTest MESSAGE: Annex6 TOPIC : emon/AnnexTest MESSGE: Annex7 TOPIC : emon/AnnexTest MESSAGE: Annex8 TOPIC : emon/AnnexTest MESSAE: Annex9 TOPIC : emon/AnnexTest MESSAGE: Annex10 Codenquilts |
||||
| Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 8297 |
Nice! Now I don't have to set mine up with an ESP 'cos you're doing the testing for me. :) There'll be a new issue of the Backpack manual very soon. I've covered the display backlight in more depth, and more detail about the sounder. There are a few more tweaks here and there too, but nothing about the ESP. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
| lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3478 |
Sweet, Mike. Picomite plus Annex looks like a winning combination. PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
| Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 8297 |
(To be perfectly honest, I've no idea whatsoever how to use an ESP8266 and only a vague idea what it does! I included a connector for it because it seemed like a good idea at the time and might allow for wireless control systems, possibly home automation.) Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
| MikeO Senior Member Joined: 11/09/2011 Location: AustraliaPosts: 275 |
I use a lot of them to monitor sensors for weather , temperatures solar power etc. Mostly I use them flashed with ESPeasy which is extreamly reliable I then send the data via UDP packets. Annex has become quite mature now and especially using an ESP32 instead of the 8266 version would give some enhanced features due to far greater speed and ram memory available , larger json downloads come to mind , processed in the ESP and the required fields just sent to mmbasic . MQTT is another area where the ESP can send data derived picomite for example to a broker on your network (eg rasp pi) for storage and visualisation. Like this (wild winds here tonight) ![]() Edited 2021-08-15 23:00 by MikeO Codenquilts |
||||
| MikeO Senior Member Joined: 11/09/2011 Location: AustraliaPosts: 275 |
Annex Json example running in ESP01 connected to any micromite. 7 Day Forecast from openweathermap. https://api.openweathermap.org/data/2.5/onecall?lat=-38.19&lon=146&units=metric&exclude=hourly,minutely&appid=[Your API Key] serial.mode 38400 onwgetasync syncload gosub refresh_site timer0 60000, refresh_site wait Refresh_site: wgetasync"api.openweathermap.org/data/2.5/onecall?lat=-38.19&lon=146&units=metric&exclude=hourly,minutely&appid=[Your API Key]",443 return ' -------------------------------------------------------------------------------------------------- syncload: result$ = wgetresult$ 'wlog result$ 'wlog len(result$) print "{temp:";json$(result$, "current.temp");"}" print "{feel:";json$(result$, "current.feels_like");"}" print "{pres:";json$(result$, "current.pressure");"}" print "{dew:";json$(result$, "current.dew_point");"}" print "{speed:";json$(result$, "current.wind_speed");"}" print "{gust:";json$(result$, "current.wind_gust");"}" print "{deg:";json$(result$, "current.wind_deg");"}" for x=1 to 7 print "day"+str$(x);",";"{temp:";replace$(json$(result$, "daily.temp["+str$(x)+"]"),"{","");"}" print "day"+str$(x);",";"{feels_like:";json$(result$, "daily.feels_like["+str$(x)+"]");"}" print "day"+str$(x);",";"{pres:";json$(result$, "daily.pressure["+str$(x)+"]");"}" print "day"+str$(x);",";"{hum:";json$(result$, "daily.humidity["+str$(x)+"]");"}" print "day"+str$(x);",";"{dew:";json$(result$, "daily.dew_point["+str$(x)+"]");"}" print "day"+str$(x);",";"{speed:";json$(result$, "daily.wind_speed["+str$(x)+"]");"}" print "day"+str$(x);",";"{gust:";json$(result$, "daily.wind_gust["+str$(x)+"]");"}" print "day"+str$(x);",";"{deg:";json$(result$, "daily.wind_deg["+str$(x)+"]");"}" print "day"+str$(x);",";"{weather:";replace$(json$(result$, "daily.weather["+str$(x)+"]"),"{","") next x result$="" return Result in MMbasic Codenquilts |
||||
| Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 8297 |
I saw that some people seem to have had problems in reliability (missing characters etc.) using UDP on connections to/from the ESP8266-01. Have you come across that? Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
| MikeO Senior Member Joined: 11/09/2011 Location: AustraliaPosts: 275 |
Mick, I can honestly say that I have not experienced that problem. I have six units transmitting via UDP (some sending HTTP messages as well) plus another 3 receiving and transmitting UDP packets. For the ones transmitting only, sensor data, I use ESPeasy and ones running code I use annex. Most of the Espeasy modules are being fed from micromites. Mike Codenquilts |
||||
| lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3478 |
I can also say that with multiple-times-a-day UDP messages from various ESPs running Annex I have not noted missing characters. PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |