Skip to content

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

Month: February 2025

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

おぱんちゅうさぎ展

Posted on February 1, 2025February 1, 2025 by admin

I can’t believe it and now I want it.

Escaping Criticism by Pere Borrell del Caso, 1874
Unable Escaping Criticism by おぱんちゅうさぎ, 2023

Recent Posts

  • Ghost Sniffer
  • 臧式毅
  • Momotarō 桃太郎
  • PaHub – 1 Servo
  • PaHub – RFID 2 Unit

Archives

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