Difference between revisions of "Swagbadge2021 MQTT"

From Open Hardware Miniconf
Jump to: navigation, search
(Created page with "= Controlling your badge over MQTT = == About the LCA Swagbadge MQTT server == The badges have MQTT configured to talk to a dedicated server hosted by Andy Gelme, one of the...")
 
m (Making your badge perform)
Line 18: Line 18:
 
# Install an mqtt client on your machine
 
# Install an mqtt client on your machine
 
# Connect to the mqtt server (if you forget what it is, the IP address is shown on bootup)
 
# Connect to the mqtt server (if you forget what it is, the IP address is shown on bootup)
# Using your badge's topic (aiko/your_badge_id/0/in) send it a message
+
# Using your badge's topic (public/esp32_your_badge_id/0/in) send it a message
  
 
Messages are usually in the form of <code>(component:command arguments)</code>.
 
Messages are usually in the form of <code>(component:command arguments)</code>.

Revision as of 01:47, 26 December 2020

Controlling your badge over MQTT

About the LCA Swagbadge MQTT server

The badges have MQTT configured to talk to a dedicated server hosted by Andy Gelme, one of the OHMC organisers. We have done this for security and privacy reasons, and because it gives us an Australian server so it's faster.

This server is at 101.181.46.180, the configuration for which is held on the badge at configuration/mqtt.py. The server has some special features:

  • The upgrade/ topic path prefix is public read: only Jon and Andy can update it.
  • The aiko/ topic path prefix is public read/write
  • We have some server monitoring to look for things snooping for all the channels, or who aren't using aiko/on a badge, and mitigations in the event a badge goes beserk and starts a spamming DOS attack.

You are welcome to change which MQTT server your badge uses, by updating the mqtt.py configuration file. Some publicly hosted alternatives are provided (commented out) in the config.

Making your badge perform

The easiest thing to do is send messages to show up on your screens.

  1. Install an mqtt client on your machine
  2. Connect to the mqtt server (if you forget what it is, the IP address is shown on bootup)
  3. Using your badge's topic (public/esp32_your_badge_id/0/in) send it a message

Messages are usually in the form of (component:command arguments).

OLED messages

(oled:clear)
clears both screens
(oled:log Hello World!)
writes a message along the bottom of the screens, scrolling up whatever is there out of the way
(oled:pixel x y)
lights a pixel at that spot
(oled:text x y This is a test !)
Puts some text at the position x,y. It will be displayed over the top of whatever's there.

If you'd like to make your application MQTT aware, take a look at the oled code.