Mqtt blinker for topic notifications

Last year I’ve made a led pole with digital fireworks.

Time to replace for something else ..

I’ve made a mqtt 1-D game in december.

I needed to change a lot to the javascript on the website to fix some stuff.

  • Fix IPhone control. (I hate iphone)
  • Fix screenlock timeout
  • Added meta refresh

The XMAS/Fireworks controller was often used, and I got notifications via my TV. (see other posts)

Now I want to see when MQTT movement when I’m in the livingroom.
So I programmed a Wemos controller to blink the internal when MQTT messages are received.

CODE:

#include <ESP8266WiFi.h>
#include <PubSubClient.h>

const char* ssid = "WIFIAP";
const char* password = "WIFIPASS";

const char* mqtt_server = "MQTTBROKER";  // MQTT broker IP
const char* mqtt_topic  = "game/tilt";

WiFiClient espClient;
PubSubClient client(espClient);

String lastPayload = "";

void setup_wifi() {
  delay(10);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
  }
}

void blinkLED() {
    digitalWrite(LED_BUILTIN, LOW);   // LED ON
    delay(200);
    digitalWrite(LED_BUILTIN, HIGH);  // LED OFF
    delay(200);
}

void callback(char* topic, byte* payload, unsigned int length) {
  String message;
  for (unsigned int i = 0; i < length; i++) {
    message += (char)payload[i];
  }

  // Blink only if topic value changed
  if (message != lastPayload) {
    blinkLED();
    lastPayload = message;
  }
}

void reconnect() {
  while (!client.connected()) {
    if (client.connect("WemosClientMqttBlink")) {
      client.subscribe(mqtt_topic);
    } else {
      delay(2000);
    }
  }
}

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
  digitalWrite(LED_BUILTIN, HIGH); 

  setup_wifi();

  client.setServer(mqtt_server, 1883);
  client.setCallback(callback);
}

void loop() {
  if (!client.connected()) {
    reconnect();
  }
  client.loop();
}

New own-hosted spotify alternative

I’ve tested many opensource tools to have a personal own hosted spotify.
Now I have migrated to navidrome.

List of alternatives i’ve used:

  • …. to be filled in

I can access this with a browser or an android app named amcfy music.

Why?

  • I like self hosting stuff
  • I’ve got a lot of obscure music, which can’t be found on main streaming services
  • Our folkband stuff is for personal use only (Tapsalteerie/NaeBother)

I don´t have time posting other stuff, I’m balancing almost 10 projects at the same time ….

LoRa and more LoRa

I’ve been playing with LoRa for some time now, mostly with two adhoc LilyGO nodes.
After seeing a YT clip from Andreas Spiess I installed a meshtastic node on a Heltec V3.
Wanting more, I bought a Heltec V4 and an 8DBi (60cm) antenna.
Heltec V3 got a new home in Tyrone’s home.

GPS for the Heltec V4 module!

Via meshtastic I communicated with a guy here in the neighbourhood.
I installed Meshcore and my LoRa playground grew!

A Nebra Helium Miner was bought, and repurposed !

There is a Raspberry CM3 in there (Compute module)
Some big antenna’s and a waterproof case.
Using POE to power the thing, the plan is to have this installation at a high point around my house. (LED pole?!? 🙂 )

Meanwhile I got these : Seeed Xiao Lora ESP32 modules

MeshTUI

Bat detector

I’ve got a DIY Bat detector, today I designed and printed a Case for this PCB.

Below a link to the design files

https://media.henriaanstoot.nl/bat-case.zip

Next todo:

  • Weatherproof case
  • Alternative power
  • Audio Jack
  • Remote access with remote sound

STM32 Nucleo-64 development board

I’ve been playing with all kinds of MicroControllers, but not this one.

Something new to learn.

The STM32 Nucleo-64 board provides a flexible way to try out the STM32 microcontroller. The Arduino Uno V3 can be connected as a shield.

STM32 excels in high-performance, deterministic industrial control with better real-time capability, lower power, and rich peripherals, using ARM Cortex-M cores, while ESP32 dominates IoT with built-in Wi-Fi/Bluetooth, lower cost, easier Arduino/PlatformIO access, and strong community, but with higher power and less precise real-time control (Xtensa cores), making ESP32 great for connected projects and STM32 for industrial/precision tasks.

STM32 (STMicroelectronics)
Strengths:

  • Performance: Superior real-time processing, deterministic behavior, efficient for complex control.
  • Power: Advanced low-power modes, excellent for battery-powered devices.
  • Peripherals: Rich, precise analog (ADC/DAC), extensive interface options (USB, SD, LCD).
  • Reliability: Strong for industrial, medical, and automotive applications.
  • Tools: STM32CubeIDE/MX, HAL/LL libraries.

    Weaknesses:
  • Higher cost and learning curve.
  • Requires external modules for Wi-Fi/Bluetooth.

ESP32 (Espressif Systems)
Strengths:

  • Connectivity: Integrated Wi-Fi and Bluetooth (BLE).
  • Cost & Ease: Cost-effective, easy entry with Arduino IDE/PlatformIO, great for rapid prototyping.
  • Community: Strong open-source community.
  • Features: Dual-core (often), built-in OTA updates, good for audio/AI.

    Weaknesses:
  • Less deterministic/real-time performance than STM32.
  • Higher active power consumption, less precise analog.
  • Can have complex debugging/compilation.
  • When to Choose Which
  • Choose STM32 for: Industrial automation, precise instrumentation, medical devices, complex motor control, low-power wearables, general embedded systems learning.
  • Choose ESP32 for: IoT devices, smart home products, Bluetooth beacons, educational projects, rapid prototyping, audio/voice applications.

Fireworks LED addition and modifying Arcade buttons

I’ve given people on the street control over my Xmas/Fireworks lights last month. (This month it is going to be converted to an interactive game)

I saw some LED strip dividers on Aliexpress, next year it’s going to have a star on top.

Like this….

Another LED related project I started today is a Whack-A-Mole game with multiple levels.
For this I need to convert a simple arcade button to a programmable multicolor version.

From single white LED to multi color, programmable.

Analog Meters to display CPU and memory load

While this is a old project from 2019, I decided to make a more responsive one, after my friend Tyrone mentioned a project somewhere on the internet (forgot where).
Time to dust off this project!

2019 version

Above version worked but was slow.
I used a python script to send values to de controller.

Memory setup was the same.

Below my new schematic, using an opamp to drive the analog meter.

Untested design .. Yeah I got bored on new year’s eve

Utilizing a MCP41000 digital potmeter and a LM358 signal amplifier I hope to get a more responsive setup.

Input to display MQTT and maybe Serial.

Old version

Added group control to my Mobile Pong game.

Two player mobile pong using secure mqtt I made a few months ago.

Today I tested my group playing mode while at family to celebrate xmas.

I was filming during testing to get responses. I can’t post this because of everyone being in the shot.

What worked:

  • Response of multiple mobile phones was good
  • Measuring average movement worked great
    (3 People moving up and one down? – going up)
  • 8 Players tested

To do:

  • Iphones have a problem sending tilt, I’ve got a problem with Iphones in general 🙂
  • Screen timeout, I have to add javascript to keep the mobile device screen on. No problem
  • Number of players on the left and number of players on the right visible in the screen. Do-able
  • Timeout for disappearing phones! ..
  • QR join code on the play screen
  • Starting ball futher away from paddle, to give player more time to react

Nice to have:

  • Muliple games at the same time. Now hard coded.
  • Manual
  • ?