Skip to content

A PLAY EXPERIENCE MAKER'S WORK LOG FOR FUTURE SELF©2001 – 2023 Kyle Li 李肅綱 All Rights Reserved.

Category: Experiements

Kano Harry Potter Wand

Posted on November 18, 2026November 19, 2026 by admin
The plastic wand design went through over the course of more than 100 mockups and models (dezeen)

The Harry Potter Kano Coding Kit pairs a build-it-yourself Bluetooth motion-sensing wand with a companion coding app.

How It Works:

  • Hardware Assembly: You start by snapping together the wand’s outer plastic shell around a printed circuit board (PCB). The board houses an accelerometer, gyroscope, magnetometer, rumble pack, RGB LED, and a button, powered by two AAA batteries.
  • Block-Based Coding: Once paired via Bluetooth Low Energy to a tablet or computer (Windows, macOS, iPad, or Android tablets), you use the Kano app to complete more than 70 step-by-step challenges across locations like Hogwarts, Diagon Alley, and the Forbidden Forest.
  • Spell Casting: You drag and drop visual code blocks—learning logic like loops, variables, and if-then statements—to program what happens on screen when you wave the wand in specific motions (such as making feathers fly, spawning pumpkins, or changing spell colors). You can also view the underlying JavaScript generated by your blocks.

Notable Quirks & Considerations:

  • Software Support: Kano Computing shifted focus away from its older hardware kits in the early 2020s, and the companion app was last updated in 2021.
  • Calibration: Because the wand relies on internal motion sensors rather than a camera, it occasionally needs to be re-centered during play, and some users report finicky Bluetooth disconnects.

I had originally thought to built a Processing 4 sketch to work with the wand. However, Processing 4 (which runs on desktop Java) does not have a reliable, cross-platform native Bluetooth Low Energy (BLE) library to connect directly to the Kano wand.

  • A lightweight Python BLE bridge (bleak + python-osc) running in the background on a Mac, Windows, or Linux machine. It connects to the wand’s Nordic nRF52832 chip, subscribes to the reverse-engineered BLE characteristics, and streams the data over local UDP via Open Sound Control (OSC).
  • A Processing 4 sketch using the oscP5 library that listens for those OSC packets and maps the wand’s 3D orientation and button presses to visuals—or forwards them anywhere else.

The two-part setup above was a failed attempt. It would’ve worked if it was a newer Bluetooth hardware. The Kano wand does not support OS-level Security Manager (SMP) pairing. When Windows tries to bond with it, the wand rejects the pairing request, causing Windows to abort with that red error. I have tried downgrading my Python to 3.12, resetting power cycle on my PC, implementing longer connection wait time, nothing seems to work.

Since it worked fine with the nRF connection app on my phone, I am going to try using my phone as a wireless BLE-to-Wi-Fi bridge, so it completely bypasses Windows’ Bluetooth stack. The most straight forward way to do this is a Web Bluetooth + WebSocket relay:

  • Runs a tiny Python script on my PC (phone_relay.py) that hosts a local webpage + WebSocket server on the Wi-Fi network (I was only able to get this to work on my phone’s tethering Wi-Fi) and translates incoming messages straight into the exact same OSC packets (127.0.0.1:12000) the Processing 4 sketch already expects.
  • My phone opens that webpage in Chrome (Android) or Bluefy (specifically for iPhone because standard iOS Safari/Chrome blocks Web Bluetooth), connects directly to the Kano wand via Web Bluetooth, and streams the quaternion and button data over Wi-Fi to my PC.

To set up Python on a Windows PC:

  • Download the Python Installer: Go to the official Python downloads page and click the yellow button to download the installer for Windows. I used the latest Python manager 26.4.

    https://www.python.org/downloads/release/pymanager-264/
  • Run the Installer: Say yes to all questions
  • Verify the Installation: I can confirm the current version of the Python installed on my computer by running the following command in the terminal (cmd):

    python --version
  • Install dependencies
    In the terminal, install aiohttp (serves the phone webpage + WebSocket), cryptography (creates the local HTTPS certificate so Web Bluetooth works), and python-osc

    pip install aiohttp cryptography python-osc
  • Save, Unzip, and Run phone_relay.py
    1. Open File Explorer and go to the folder where the .py script is unzipped and saved.
    2. Click the address bar at the top of the File Explorer window, type cmd, and press Enter.
    3. This opens a terminal window already pointed at that exact folder.
    4. Type python followed by your file’s name and press Enter

      python phone_relay.py

      Note to myself: something similar as the image below except that the URL might be different from network to network.

Note to myself: After some trails and errors, the setup that worked for me was through my phone’s Wi-Fi hotspot, and the URL appears differently what’s in the image: https://10.213.146.64:8443

  • Connect the wand on your phone:
    1. Make sure Bluetooth and Location are both switched ON in your Android quick settings (Android requires Location enabled for Chrome to scan nearby BLE devices).
    2. Press the button on your Kano wand once so the LED starts pulsing.
    3. On your phone’s Kano Wand Wi-Fi Bridge page, tap the blue Connect Wand button.When the Chrome Bluetooth popup appears, tap Kano-Wand-0d-ab-63 and tap Pair.

      Note to myself: The text below the button changes to Streaming live to Processing 4!, and your PC’s terminal prints Phone connected to WebSocket relay!.
  • Launch the Processing 4 sketch
    Make sure the oscP5 library is installed in Processing 4:
    • Go to Sketch → Import Library… → Manage Libraries…
    • Search for oscP5 and click Install.
  • It was magical when it works!
    Point the wand comfortably at the screen and press the wand’s button once to re-center (“tare”) its forward orientation.

    Note to myself: Tilting, pitching, and rolling the wand rotates the 3D wand on my PC screen in real time, and holding the wand button turns the tip cyan.
    • Wand Button or Spacebar: Point the wand straight at the monitor and press the wand’s button (or SPACE) to set that direction as dead-center forward.
    • Hold Wand Button: Turns the wand tip cyan (buttonState == 1), which I can hook into any spell-casting or drawing trigger inside draw()

Note to myself: Always uses a new Incognito tab on the phone: Chrome silently blocks WebSocket/page reconnections when a local IP’s self-signed certificate fingerprint changes until you hard-reload the tab and accept the certificate again. On phones,

Native Web Speech API

Posted on September 16, 2026September 16, 2026 by admin

I was looking for a small murder mystery program, and I found this gem of a submission to js13kGames in 2021.

  • Blanks Detective (2021) — Procedural Deduction Mystery
  • Developer: Daniel Cohen
  • Zip Size: 12.38 KB
  • Format: A logic-grid mystery/detective game featuring procedurally generated crime cases. You cross-reference clues and fill out board deduction matrices (similar to Clue) to catch criminals.

Impressively, the game manages to include text-to-speech within its 13 KB budget. It is made possible with the Native Web Speech API. Here is a quick demo, it works so well!

🔍 Suspect Generator

🕵️‍♂️
Press “Generate Suspect” to inspect a case.
Initializing Web Speech API…

Letterpress & Screen Printing

Posted on November 19, 2025May 24, 2026 by admin

Gakken Otona no Kagaku (大人の科学)’s recent issue and the screen printing issue back in Dec 2022.

Version 1.0.0
Version 1.0.0

The RISO (PG-5) Screen Printer Kit that I used for my thesis graduation show back in 2008.

Some initial ideas:

Augmented Reality (AR): Uses the print result as the marker and produce digital content to go on the marker.

  • Potentially incorporating generative AI tools.
  • Location based AR gallery.

Sound: Embeds audio/recording on to the print using magnetic tape and recorder.

Digital Fashion: Uses the print results as the design on digital garments.

Audio/Visual: Print inspired (interactive) audio/visual experience.

Virtual Gallery (VR): Displays the digital version of the prints in a virtual gallery.

11/20 Maywa Denki is back in the conversation with 2 time slots 5/11 – 5/20 and 8/20 – , both dates are impossible for DT students.

Creative Coding Exercise

Posted on October 21, 2025October 21, 2025 by admin

Stage 1: draw a ball and assign behaviors to it — in this case, bounce around the edges
https://editor.p5js.org/megagpxp/sketches/hwRM3G0aQ

let posx;
let posy;
let xSpeed;
let ySpeed;

function setup() {
  createCanvas(400, 400);
  posx = width/2;
  posy = height/2;
  xSpeed = random(-5, 5);
  ySpeed = random(-5, 5);
}

function draw() {
  background(220);
  posx += xSpeed;
  if (posx > width || posx < 0) {
    xSpeed *= -1;
  }
  posy += ySpeed;
  if (posy > height || posy < 0) {
    ySpeed *= -1;
  }
  ellipse(posx, posy, 10);
}

Stage 2: make the ball into a class
https://editor.p5js.org/megagpxp/sketches/FAVtr2ZsG

let oneBall;

function setup() {
  createCanvas(400, 400);
  oneBall = new ball(random(0, width), random(0, height), random(-3, 3), random(-3, 3));
}

function draw() {
  background(220);
  oneBall.update();
  oneBall.display();
}

class ball {
  constructor(px, py, sx, sy) {
    this.px = px;
    this.py = py;
    this.sx = sx;
    this.sy = sy;
  }

  update() {
    this.px += this.sx;
    if (this.px > width || this.px < 0) {
      this.sx *= -1;
    }
    this.py += this.sy;
    if (this.py > height || this.py < 0) {
      this.sy *= -1;
    }
  }

  display() {
    ellipse(this.px, this.py, 50);
  }
}

Stage 3: bounce 100 balls
https://editor.p5js.org/megagpxp/sketches/v3DmiOK-B

let manyBalls = [];
function setup() {
  createCanvas(400, 400);
  for (let i = 0; i < 100; i ++) {
    manyBalls[i] = new ball(
      random(0, width),
      random(0, height),
      random(-3, 3),
      random(-3, 3)
    );
  }
}

function draw() {
  background(220);
  for (let i = 0; i < 100; i ++) {
  manyBalls[i].update();
  manyBalls[i].display();
  }
}

class ball {
  constructor(px, py, sx, sy) {
    this.px = px;
    this.py = py;
    this.sx = sx;
    this.sy = sy;
  }

  update() {
    this.px += this.sx;
    if (this.px > width || this.px < 0) {
      this.sx *= -1;
    }
    this.py += this.sy;
    if (this.py > height || this.py < 0) {
      this.sy *= -1;
    }
  }

  display() {
    ellipse(this.px, this.py, 50);
  }
}

Stage 4: define the relationship between bouncing balls
https://editor.p5js.org/megagpxp/sketches/YYVsvsTkf

let manyBalls = [];
function setup() {
  createCanvas(400, 400);
  for (let i = 0; i < 100; i++) {
    manyBalls[i] = new ball(
      random(0, width),
      random(0, height),
      random(-3, 3),
      random(-3, 3)
    );
  }
}

function draw() {
  background(220);
  for (let i = 0; i < 100; i++) {
    manyBalls[i].update();
    //manyBalls[i].display();
    for (let n = 0; n < 100; n++) {
      let d = dist(manyBalls[i].px, manyBalls[i].py, manyBalls[n].px, manyBalls[n].py);
      if (d < 60) {
        let w = ((60-d)/60)*3;
        strokeWeight(w);
        line(manyBalls[i].px, manyBalls[i].py, manyBalls[n].px, manyBalls[n].py);
      }
    }
  }
}

class ball {
  constructor(px, py, sx, sy) {
    this.px = px;
    this.py = py;
    this.sx = sx;
    this.sy = sy;
  }

  update() {
    this.px += this.sx;
    if (this.px > width || this.px < 0) {
      this.sx *= -1;
    }
    this.py += this.sy;
    if (this.py > height || this.py < 0) {
      this.sy *= -1;
    }
  }

  display() {
    ellipse(this.px, this.py, 50);
  }
}

Casey Reas’s Process

Ghost Sniffer

Posted on June 8, 2025June 8, 2025 by admin

When Dr. Peter Venkman visited Dana’s apartment in the first Ghostbusters movie, he used a device known as the “Ghost Sniffer”. 

This device is actually a Bacharach model 300 sniffer combustible gas detecting device, a real-world gadget used to detect specific gases and oxygen levels. Venkman used it to purportedly detect “Ectoplasmic vapor trails” and analyze the air for paranormal activity. It’s mentioned that Venkman himself wasn’t entirely certain if he was using the device correctly in the scene.

Hmmm… what play experience can be made for a ghost sniffer like controller? I personally really like the tiny pump action.

Momotarō 桃太郎

Posted on May 26, 2025June 6, 2025 by admin

I was researching for a story backdrop for a game prototype. Preferably an adventure that involves traveling, making friends, and fighting evils. As someone who grew up in Asia, the first two that came to my mind was the Journey to the West (西遊記) and Momotarō (桃太郎). When I research further, I found some interesting articles about using a modified version of the story Momotarō as a propaganda tool in the colonial Taiwan.

Finding 1: 日本國民童話「桃太郎」在殖民地臺灣的傳播 LINK
Japanese citizen of country children’s story Momotarō expanse in colony Taiwan

本研究的起因是我第一次到臺灣的時候,碰到一位臺灣老人,她會說日文,因此本研究透過分析日治時期公學校國語教科書的童話「桃太郎」,藉以探討日本殖民政府的教育政策,以及日本教育對臺灣人的影響。
首先比較戰前日本的國語教科書和臺灣的國語教科書。分析在兩種國語教科書中出現的童話為何,並比較在日本民間故事和日本教科書中童話之差異點。
其次,爬梳日本國語教科書和臺灣教科書中的桃太郎故事。分析教科書所賦與桃太郎的意義。
最後,調查教科書以外的如報章雜誌及學校中學藝會、演講等使用桃太郎故事的情形,以分析桃太郎故事的擴散。此外,分別對8位受過日本教育的臺灣人訪談,分析他們對桃太郎故事的印象。
本研究認為,在日本五大童話中,桃太郎是具有日本特色,而且最容易操作的童話。日本殖民地時期,日本的教育關係者透過學校教育及各種管道,將帶有日本國民色彩的童話──桃太郎普及於殖民地臺灣,藉以教化臺灣兒童。

The motivation for this study originated from my first visit to Taiwan, during which I encountered an elderly Taiwanese woman who could speak Japanese. This inspired me to analyze the fairy tale Momotarō from the Japanese-language elementary school textbooks used during the Japanese colonial period, in order to explore the educational policies of the Japanese colonial government and the impact of Japanese education on the Taiwanese people.

First, this study compares prewar Japanese language textbooks with those used in Taiwan during the colonial period. It analyzes which fairy tales appear in both sets of textbooks and compares the differences between Japanese folktales as they appear in oral tradition and as they are presented in textbooks.

Next, it closely examines the Momotarō story as found in both Japanese and Taiwanese textbooks, analyzing the meanings assigned to the tale within these educational materials.

Finally, it investigates how the Momotarō story was used beyond textbooks—in newspapers, magazines, school arts festivals, speeches, and other settings—to analyze the tale’s dissemination. In addition, interviews were conducted with eight Taiwanese individuals who had received a Japanese education, to explore their impressions of the Momotarō story.

This study argues that among the five major Japanese fairy tales, Momotarō is the most characteristically Japanese and the easiest to utilize. During the colonial period, Japanese educators used school curricula and various channels to popularize the Momotarō tale—imbued with Japanese national identity—in colonial Taiwan as a means of instructing and assimilating Taiwanese children.

Finding 2: 战前中日两国间的桃太郎形象建构 LINK

桃太郎是全面抗战前中日两国重点关注的童话形象。日本建构的桃太郎形象始终围绕着“正义—桃太郎—日本”和“恶者—鬼—被征伐地区”的近代殖民文化逻辑展开。日本借助文人赴台宣讲、小学课本增列《桃太郎》、报刊宣传等方式,促成了桃太郎形象在中国台湾地区的普及、移植和变貌。但是,中国文人早已识破了日本对外殖民掠夺过程中以桃太郎为核心的“殖民合理化宣传”陷阱。如章太炎批判了此故事蕴含的侵略意念,启发了芥川龙之介改写桃太郎并揭露日本“桃太郎主义”中的伪善正义;连横追溯了桃太郎的汉文化传统、展现出浓厚的民族认同和家国情怀;杨逵则提炼出桃太郎故事的左翼精神,主张积极践行“行动主义”, 激发劳苦大众勇于抗争殖民掠夺和阶级压迫。

Before the full-scale war between China and Japan, Momotarō was a prominent fairy tale figure closely followed by both countries. The Japanese construction of Momotarō consistently revolved around a modern colonial cultural logic that framed “justice–Momotarō–Japan” against “evil–demons–conquered territories.” Through means such as sending intellectuals to give lectures in Taiwan, adding the Momotarō story to elementary school textbooks, and promoting it via newspapers and magazines, Japan facilitated the popularization, transplantation, and transformation of the Momotarō image in Taiwan.

However, Chinese intellectuals had already seen through Japan’s use of Momotaro as a tool of “colonial justification propaganda” in its external expansion. For example, Zhang Taiyan criticized the story’s underlying message of aggression, which in turn inspired Akutagawa Ryunosuke to rewrite Momotarō and expose the hypocrisy in Japan’s so-called “Momotarō-ism.” Lian Heng traced the story’s roots in Han Chinese cultural traditions, expressing strong national identity and patriotic sentiment. Meanwhile, Yang Kui extracted a leftist spirit from the tale, advocating for proactive “activism” and encouraging the working class to courageously resist colonial plunder and class oppression.

Reminds me of: Drop Your Whip (放下你的鞭子)

司徒乔 油画作品 《放下你的鞭子》1940年作

This reminds me of the street skit “Drop Your Whip” that I learned at the drama club in college. “Drop Your Whip” (放下你的鞭子) is a well-known Chinese street performance with propaganda significance, but it actually predates the Cultural Revolution and was later revived and repurposed during that period.

“Drop Your Whip” was originally a street skit (快板剧 or 小品) created in 1931 by dramatist Chen Liting (陈鲤庭) based on a play by Tian Han during the Anti-Japanese War era. The performance featured a young beggar girl being beaten by her stepfather. A passerby intervenes, scolds the stepfather, and gives the girl money. In the skit, the girl explains that her suffering is due to the Japanese invasion, not personal misfortune. This scene becomes a metaphor for national suffering under imperialism, encouraging anti-Japanese resistance.

During the Cultural Revolution (1966–1976), the piece was revived and adapted as revolutionary propaganda, often performed in public squares, workplaces, and rural areas. Its class struggle themes—a cruel oppressor (the stepfather) and a suffering innocent (the girl)—aligned neatly with Maoist ideology. The performance was used to foster revolutionary fervor, targeting both historical enemies (like imperialists) and class enemies within (landlords, counterrevolutionaries). In some cases, it was even staged as a criticism or denunciation session, with parallels drawn between the stepfather figure and actual individuals labeled as “class enemies.”

The “whip” came to symbolize oppression, and dropping it was a metaphor for overthrowing old systems—imperialism, feudalism, and capitalism. The emotional appeal, direct messaging, and performative nature made it effective for mass mobilization, especially in rural and less literate populations. Therefore, while “Drop Your Whip” wasn’t originally created during the Cultural Revolution, it became part of its broader repertoire of revolutionary propaganda, often adapted to fit shifting political narratives.

PaHub – 1 Servo

Posted on May 24, 2025May 24, 2025 by admin

Found this:
https://github.com/m5stack/M5Unit-EXTIO2/blob/main/examples/Unit_EXTIO2_M5Core/SERVO_CTL/SERVO_CTL.ino

/*
  Servo control
  舵机控制
*/
#include <M5Stack.h>
#include <M5GFX.h>
#include "M5_EXTIO2.h"

M5GFX display;
M5Canvas canvas(&display);
M5_EXTIO2 extio;

void setup() {
    M5.begin();
    display.begin();
    canvas.setColorDepth(1);  // mono color
    canvas.setFont(&fonts::efontCN_14);
    canvas.createSprite(display.width(), display.height());
    canvas.setPaletteColor(1, GREEN);
    while (!extio.begin(&Wire, 21, 22, 0x45)) {
        Serial.println("extio Connect Error");
        M5.Lcd.print("extio Connect Error");
        delay(100);
    }
    // extio.setAllPinMode(DIGITAL_INPUT_MODE);
    // extio.setAllPinMode(DIGITAL_OUTPUT_MODE);
    // extio.setAllPinMode(ADC_INPUT_MODE);
    extio.setAllPinMode(SERVO_CTL_MODE);
    // extio.setAllPinMode(RGB_LED_MODE);
}

char info[50];

void loop() {
    canvas.fillSprite(0);
    canvas.setTextSize(2);
    canvas.drawString("SERVO CTL MODE", 10, 10);
    canvas.drawString("FW VERSION: " + String(extio.getVersion()), 10, 40);
    for (uint8_t deg = 0; deg <= 180; deg += 45) {
        for (uint8_t i = 0; i < 8; i++) {
            extio.setServoAngle(i, deg);
            Serial.printf("CH:%d DEG: %d", i, deg);
            canvas.drawRect(0, i * 20 + 75, 200, 15, 1);
            canvas.fillRect(0, i * 20 + 75, map(deg, 0, 180, 0, 200), 15, 1);
            canvas.setCursor(220, i * 28 + 10);
            canvas.setTextSize(1);
            canvas.printf("CH:%d DEG: %d", i, deg);
        }
        canvas.pushSprite(0, 0);
        vTaskDelay(500);
    }
    canvas.setTextSize(2);
    canvas.drawString("SERVO CTL MODE", 10, 10);
    canvas.drawString("FW VERSION: " + String(extio.getVersion()), 10, 40);
    for (int pulse = 500; pulse <= 2500; pulse += 100) {
        for (uint8_t i = 0; i < 8; i++) {
            extio.setServoPulse(i, pulse);
            Serial.printf("CH:%d P: %d", i, pulse);
            canvas.drawRect(0, i * 20 + 75, 200, 15, 1);
            canvas.fillRect(0, i * 20 + 75, map(pulse, 500, 2500, 0, 200), 15,
                            1);
            canvas.setCursor(220, i * 28 + 10);
            canvas.setTextSize(1);
            canvas.printf("CH:%d P: %d", i, pulse);
        }
        canvas.pushSprite(0, 0);
    }
    delay(100);
    canvas.pushSprite(0, 0);
}

PaHub – RFID 2 Unit

Posted on May 24, 2025May 24, 2025 by admin

My next book game idea is of course a miniature battle royal style game. I had a quick prototype setup and didn’t expect the most difficult part is getting M5Stack’s PaHub to work with multiple I2C devices at the same time. It seems there is not enough documentation and code samples available on the internet.

The two major challenges that I ran into were:

  • RFID 2 I2C unit requires initiation when creates the instance (MFRC522 mfrc522(0x28);), how do I work this into the channel selection while using PaHub?
  • I used the PaHub example from M5Stack, somehow 0x28 (RFID 2 default address) shows up in CH0 when RFID 2 unit was plugged into CH1.

It looks like other folks also ran into the same problem.
https://community.m5stack.com/topic/6995/rfid-2-unit-and-i2c-hub-1-to-6-expansion-unit/9

Interestingly, I used the I2C Scanner Example Code from Adafruit. It actually sort the 0x28 under the right channel which is 1 in this case.
…
PCA Port #1
Found I2C 0x10
Found I2C 0x28
Found I2C 0x68
Found I2C 0x75
…

#include "Wire.h"
#define PCAADDR 0x70

void pcaselect(uint8_t i) {
  if (i > 7) return; 
  Wire.beginTransmission(PCAADDR);
  Wire.write(1 << i);
  Wire.endTransmission();  
}

// standard Arduino setup()
void setup()
{
    while (!Serial);
    delay(1000);

    Wire.begin();
    
    Serial.begin(115200);
    Serial.println("\nPCAScanner ready!");
    
    for (uint8_t t=0; t<8; t++) {
      pcaselect(t);
      Serial.print("PCA Port #"); Serial.println(t);

      for (uint8_t addr = 0; addr<=127; addr++) {
        if (addr == PCAADDR) continue;

        Wire.beginTransmission(addr);
        if (!Wire.endTransmission()) {
          Serial.print("Found I2C 0x");  Serial.println(addr,HEX);
        }
      }
    }
    Serial.println("\ndone");
}

void loop() 
{
}

I continued to follow the Adafruit tutorial, with some modifications, I got it to work! Now on to the 2nd I2C device. Original code can be found here: Multi-Sensor Example Code

#include <M5Stack.h>

#include "MFRC522_I2C.h"
#include "ClosedCube_TCA9548A.h"

#define FRONT 2

#define X_LOCAL 100
#define Y_LOCAL 35
#define X_OFFSET 160
#define Y_OFFSET 34

#define PaHub_I2C_ADDRESS 0x70
//#define DEV_I2C Wire

ClosedCube::Wired::TCA9548A tca9548a;
MFRC522 mfrc522(0x28);

void pcaselect(uint8_t i) {
  if (i > 6) return;
  Wire.beginTransmission(PaHub_I2C_ADDRESS);
  Wire.write(1 << i);
  Wire.endTransmission();
}

void setup() {
  M5.begin();
  M5.Power.begin();
  Wire.begin();
  tca9548a.address(PaHub_I2C_ADDRESS);  // Set the I2C address.
  M5.Lcd.setTextFont(4);
  M5.Lcd.setCursor(70, 0, 4);
  M5.Lcd.setTextColor(YELLOW, TFT_BLACK);
  M5.Lcd.println(("PaHUB Sensors"));
  M5.Lcd.setTextColor(TFT_WHITE, TFT_BLACK);

  Serial.println("CH1 MFRC522");
  // define the port on the PCA9548A for the first sensor
  pcaselect(1);
  mfrc522.PCD_Init();  // Init MFRC522
}

void loop() {
  // define port on the PCA9548A
  pcaselect(1);
  M5.Lcd.setCursor(40, 47);
  if (!mfrc522.PICC_IsNewCardPresent() || !mfrc522.PICC_ReadCardSerial()) {
    delay(200);
    return;
  }
  M5.Lcd.fillRect(42, 47, 320, 20, BLACK);
  for (byte i = 0; i < mfrc522.uid.size; i++) {  // Output the stored UID data
    M5.Lcd.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ");
    M5.Lcd.print(mfrc522.uid.uidByte[i], HEX);
  }
  M5.Lcd.println("");
}

Meta QR Code

Posted on March 23, 2025March 23, 2025 by admin
  • Unity Hub: 3.11.1
  • Unity Version: 6000.0.43f1
  • Project Setup Tool checked, including both Passthrough over Meta Quest Link and Spatial Data over Meta Quest Link are enabled in the Meta Quest Link settings.
  • NuGetForUnity installed through NuGetForUnity.4.3.0.unitypackage
  • ZXing.Net 0.16.10 by Michael Jahn installed
  • ZXING_ENABLE checked
  • Imported TMP Essential Resources
  • Opened up the QRCodeTracking scene for the first time and got 3 of the same warnings:
    “Your project uses a scriptable render pipeline. You can use Camera.stereoTargetEye only with the built-in renderer.”
  • Opened up Build Profiles
  • Switched Platform to Android
  • Build And Run

This is the 3rd try and it worked. The first two tries, I didn’t know there were dependencies needed to make it work. This is very fun, but still not what I wanted exactly. I wanted an AR Marker tracker.

M5Stack Grove Cable Hack

Posted on February 5, 2025February 7, 2025 by admin

M5 Red only comes with 1 Port B and I would to use 2 Port B units without the hub which added to the overall formfactor. The two units I need are the Limit Switch unit (U145) and the Vibrator unit (U059) and, fortunately, they are hooked up to a different GPIO pin on Port B. The Limit Switch unit is on GPIO 36 (Input, Whit) while the Vibrator unit is on GPIO 26 (In/Out, Yellow).

Theoretically speaking, if I split a grove cable into 2, I should be able to connect both units to Port B at the same time. I have done this a couple times for other projects to save space, but I do worry the vibrator might draw too much power from the same cable and eventually cause the switch to stop working properly.

It works beautifully.

Programing the vibrator is super fun. I had in my mind the “pew pew pew” sound, and this is what I ended up with. I have not played with the frequency and resolution yet.

[Note to myself] The ESP32 can generate a PWM signal with a frequency of up to 40 MHz. It is currently set to 10000. If the PWM resolution is “n” bits, the timer counts from 0 to 2n-1 before it resets. For example, if we configure the timer with a frequency of 1 Hz and a resolution of 8 bits, the timer will take 1 second to count from 0 to 255 (28-1). In the case of a frequency of 1 Hz and a resolution of 16 bits, the timer will still take 1 second, but it will count from 0 to 65,535 (216-1). The resolution is currently set to 10.

//Vibration
        for (int ii = 0; ii < 6; ii++) {
          ledcWrite(ledChannel, 512 - ii*40);
          delay(40 + ii*10);
        }
        ledcWrite(ledChannel, 0);  // set buzz off

Posts navigation

Older posts

Recent Posts

  • Kano Harry Potter Wand
  • ダビロボ君
  • 8bitworkshop Notes – Include binary files
  • 8bitworkshop Notes – Display an external Nametable V1
  • 8bitworkshop Notes – Player Running and Jumping

Archives

Proudly powered by WordPress | Theme: MiniZen by Martin Stehle.