Skip to content

Latest commit

 

History

History
122 lines (92 loc) · 5.22 KB

File metadata and controls

122 lines (92 loc) · 5.22 KB

stackchan-bluetooth-simple

Japanese | English

Overview

This is a simple implementation that adds Bluetooth speaker functionality and Stack-chan's servo control features based on M5Stack-Avatar. It is modified from the Bluetooth_with_ESP32A2DP example in M5Unified.

Development Environment

  • VSCode
  • PlatformIO

Supported Models

  • M5Stack Basic/Gray/M5Go
    For Basic, only models with 16MB Flash memory are supported.

  • M5Stack Fire

  • M5Stack Core2 / Core2 for AWSIoT

Required Libraries

Arduino-ESP32 has been tested with version 2.0.4 (2.0.0 for Fire only). M5Stack Fire has issues with arduino-esp32v2.0.4 and won't start.

For detailed version information, please check platformio.ini.

Compilation Notes

  • M5Stack Fire V2.6/M5Stack Basic V2.6
    When using TF card, we found that SD.begin() cannot read at speeds above 20MHz. We have lowered it to 15MHz.

  • M5Stack Basic V2.6
    When compiling with VSCode+PlatformIO, select env:m5stack-grey as the env.

Configuration

If there is no YAML configuration file on the SD card, default values will be used. (Set to connect servo to PortA.) Place /yaml/SC_BasicConfig.yaml on the SD card to use your own settings.

On 2022/10/18, we changed from JSON to YAML. You can convert from JSON to YAML using JSON to YAML Converter.
Please note that comment handling has changed. On 2025/03/24, we changed to use the stackchan-arduino library. Please create SC_BasicConfig.yaml based on the contents of SC_Config.yaml.

For details, please refer to the YAML file.

Configuration Items

(Values in parentheses are default values)

  • servo

    • pin
      • x(Core1 22, Core2 33, CoreS3 1)
        Specify GPIO for X-axis (RX for serial servo)
      • y(Core1 21, Core2 32, CoreS3 2)
        Specify GPIO for Y-axis (TX for serial servo)
    • offset
      Parameter to correct misalignment when servo axis is at 90°
      • x(0)
        Set X-axis offset value
      • y(0)
        Set Y-axis offset value
    • center
      Specify servo center position
      • x(180)
        X-axis center position
      • y(270)
        Y-axis center position
    • lower_limit
      Specify servo lower limit
      • x(0)
        X-axis lower limit
      • y(240)
        Y-axis lower limit
    • upper_limit
      Specify servo upper limit
      • x(360)
        X-axis upper limit
      • y(280)
        Y-axis upper limit
    • speed
      Specify waiting time and servo movement time during standby and when sound is playing through Bluetooth speaker. Random values are used within the range specified by minimum and maximum values.
      • normal_mode
        • interval_min(3000)
        • interval_max(6000)
        • move_min(500)
        • move_max(1500)
      • sing_mode
        • interval_min(500)
        • interval_max(1000)
        • move_min(500)
        • move_max(1000)
  • bluetooth

    • device_name(M5Stack)
      Specify the Bluetooth speaker device name.
    • starting_state(false)
      Specify whether to start in Bluetooth mode.
    • start_volume(100)
      Set initial value for Bluetooth speaker
  • auto_power_off_time(0)
    Core2 only. Powers off after the specified time has elapsed after USB power supply is turned OFF. (0 means no power off)

  • balloon
    Configure speech bubble settings.

    • font_language("CN")
      Specify font language. "JA" or "CN", uses Latin font if not specified.
    • lyrics
      Set lines to display randomly in normal mode. Maximum of 10 lines.
  • led_lr(0)
    LED lights according to volume in GoBottom1/2. *Requires source code modification and recompilation.

    • 0: Stereo
    • 1: Responds to left volume only
    • 2: Responds to right volume only
  • led_pin(15)
    Specify GPIO pin number for LED (GoBottom1: 15, GoBottom2: 25)

  • takao_base(false)
    Setting for using Stack-chan_Takao_Base. (*Currently only supported on Core2)

  • servo_type("DYN_XL330")
    Specify servo type

    • "PWM": SG90 series PWM servo
    • "SCS": Feetech SCS0009 serial servo
    • "DYN_XL330": Dynamixel XL330 serial servo
  • extend_config_filename("")
    Configuration filename for application

  • extend_config_filesize(2048)
    Buffer size for feature extensions

  • secret_config_filename("")
    Configuration filename for personal information

  • secret_config_filesize(2048)
    Buffer size for personal information

  • secret_info_show(true)
    Whether to output personal information to log

Usage

  • BtnA
    Enter Bluetooth mode. (Only valid when bluetooth_mode = false)

  • BtnB
    Decrease volume.

  • BtnC
    Increase volume.

Credit

LICENSE

MIT

Author

Takao Akaki