Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 14:17 19 Nov 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Annex-Picomite-MQTT

Author Message
MikeO
Senior Member

Joined: 11/09/2011
Location: Australia
Posts: 275
Posted: 10:07am 15 Aug 2021
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 8297
Posted: 10:17am 15 Aug 2021
Copy link to clipboard 
Print this post

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 States
Posts: 3478
Posted: 11:15am 15 Aug 2021
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 8297
Posted: 11:30am 15 Aug 2021
Copy link to clipboard 
Print this post

(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: Australia
Posts: 275
Posted: 12:59pm 15 Aug 2021
Copy link to clipboard 
Print this post

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: Australia
Posts: 275
Posted: 07:15am 16 Aug 2021
Copy link to clipboard 
Print this post

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
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
 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

  Quote  {temp:10.25}
{feel:9.31}
{pres:1022}
{dew:6.21}
{speed:3.62}
{gust:11.77}
{deg:262}

day1,{temp:"day":10.04,"min":8.49,"max":11.35,"night":8.71,"eve":10.12,"morn":8.94}
day1,{feels_like:"day":9.29,"night":7.02,"eve":9.22,"morn":6.25}
day1,{pres:1021}
day1,{hum:84}
day1,{dew:6.92}
day1,{speed:5.5}
day1,{gust:15.5}
day1,{deg:282}
day1,{weather:"id":500,"main":"Rain","description":"light rain","icon":"10d"}

day2,{temp:"day":12.47,"min":6.79,"max":12.47,"night":8.74,"eve":8.38,"morn":7.46}
day2,{feels_like:"day":11.26,"night":8.74,"eve":8.38,"morn":6.55}
day2,{pres:1025}
day2,{hum:57}
day2,{dew:3.86}
day2,{speed:3.09}
day2,{gust:10.64}
day2,{deg:268}
day2,{weather:"id":500,"main":"Rain","description":"light rain","icon":"10d"}

day3,{temp:"day":13.15,"min":5.28,"max":14.1,"night":9.03,"eve":8.6,"morn":5.61}
day3,{feels_like:"day":12.09,"night":9.03,"eve":8.6,"morn":5.61}
day3,{pres:1023}
day3,{hum:60}
day3,{dew:4.97}
day3,{speed:2.88}
day3,{gust:6.93}
day3,{deg:271}
day3,{weather:"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}

day4,{temp:"day":14.3,"min":8.62,"max":14.3,"night":10.18,"eve":10.84,"morn":8.84}
day4,{feels_like:"day":13.09,"night":9.03,"eve":9.73,"morn":8.84}
day4,{pres:1021}
day4,{hum:50}
day4,{dew:3.42}
day4,{speed:1.86}
day4,{gust:4.11}
day4,{deg:296}
day4,{weather:"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}

day5,{temp:"day":13.92,"min":6.06,"max":13.92,"night":10.38,"eve":10.32,"morn":6.1}
day5,{feels_like:"day":12.88,"night":9.98,"eve":9.86,"morn":5.21}
day5,{pres:1015}
day5,{hum:58}
day5,{dew:5.42}
day5,{speed:4.38}
day5,{gust:17.61}
day5,{deg:332}
day5,{weather:"id":501,"main":"Rain","description":"moderate rain","icon":"10d"}

day6,{temp:"day":14.23,"min":6.46,"max":14.23,"night":6.46,"eve":10.21,"morn":9.1}
day6,{feels_like:"day":13.28,"night":6.46,"eve":9.14,"morn":7.07}
day6,{pres:1014}
day6,{hum:60}
day6,{dew:6.15}
day6,{speed:5.16}
day6,{gust:15.59}
day6,{deg:325}
day6,{weather:"id":501,"main":"Rain","description":"moderate rain","icon":"10d"}

day7,{temp:"day":16.61,"min":5.54,"max":16.61,"night":14.3,"eve":13.51,"morn":5.54}
day7,{feels_like:"day":15.58,"night":13.3,"eve":12.51,"morn":4.69}
day7,{pres:1013}
day7,{hum:48}
day7,{dew:5.24}
day7,{speed:4.09}
day7,{gust:15.1}
day7,{deg:312}
day7,{weather:"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}

Codenquilts
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 8297
Posted: 07:54am 16 Aug 2021
Copy link to clipboard 
Print this post

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: Australia
Posts: 275
Posted: 10:11am 16 Aug 2021
Copy link to clipboard 
Print this post

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 States
Posts: 3478
Posted: 11:44am 16 Aug 2021
Copy link to clipboard 
Print this post

  Mixtel90 said  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?

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
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025