M5Stack Atom Speaker Kit

These are the (too quiet) devices I’m using for reference:

@alfwro13 when I’ve tried the TTS on my devices, I don’t think they drop any words but they are very quiet.

this is what I have: M5stack Official Atom Speaker Kit (ns4168) - Demo Board - AliExpress
the output via the little speak is OK (not too loud) but it is much louder if I connect old 3.5mm jack headphones - so I was thinking about connecting a spare speaker to that port

:rofl: :rofl: Yeah, not exactly what I meant :rofl: :rofl:

Did you experience these sympthoms while developing your extension? The low volume and/or heat? You seem to be one the first that got such a device, and I thought maybe you had experienced something like that?

TIA

Heat not, but the volume on the device is indeed low. Is ok for me up to about 3 meters, but beyond that it is not very usable for TTS announcements. It is a very small devices, so the volume it produces actually matches my expectations.

1 Like

@alfwro13 Glad it fixed it and got you going. :+1:

Now for your light :slightly_smiling_face:

If you turn your light ON in HA and click on the light icon you will see a big colour wheel. The light must be ON to see this. We will have to put some effects in so you can select some. So under light you will have to put this.

from this

light:
  - platform: fastled_clockless
    name: ${friendly_name}
    pin: GPIO27
    chipset: SK6812
    num_leds: 1
    rgb_order: grb

to this

light:
  - platform: fastled_clockless
    name: ${friendly_name} Light
    pin: GPIO27
    chipset: SK6812
    num_leds: 1
    rgb_order: grb

## This "on_turn_on" action makes default light values when turned on either via HA or button.
    on_turn_on: 
      then:
        - light.control:
            id: ${friendly_name} Light
            effect: Orange Strobe

## These are your effects. You can add more or remove them.
    effects:
      - pulse:
          name: Pulse
      - addressable_rainbow:
          name: Rainbow
      - strobe:
          name: Red Strobe
          colors:
            - state: true
              brightness: 30%
              red: 100%
              green: 0%
              blue: 0%
              duration: 1s
            - state: false
              duration: 1s
      - strobe:
          name: Orange Strobe
          colors:
            - state: true
              brightness: 30%
              red: 100%
              green: 50%
              blue: 0%
              duration: 1s
            - state: false
              duration: 1s

This will give you some effects. You can add as many as you like and can see how it is done. Below is a link for the light effects you can add. Have a look through it and give it a try :slightly_smiling_face: I have also added some info for your light so you know what it is in HA. From “${friendly_name}” to “${friendly_name} Light”. I find it easer when writing code as you know what you are controlling.

if you would like to use the button on the Atom Lite to turn the light on/off you will need to add this

from this

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO39
      inverted: true
    name: ${friendly_name} Button
    on_click:
      - media_player.toggle: media_out

to this

# Atom Lite Toggle Switch
binary_sensor:
  - platform: gpio
    pin:
      number: GPIO39
      inverted: true
    name: ${friendly_name} Button
    on_press:
      then:
        - media_player.toggle: media_out
        - light.toggle: 
            id: ${friendly_name} Light

Hope this helps you again

PS: Not sure if this matters but I use “on_press:” rather than “on_click”. Don’t think it matters but I don’t have the speaker kit so I can’t test it. You don’t have any time in your code so I changed it to “on_press”. Just change it back to “on_click” if you like. Below are the usages definitions for them

I just got a couple of M5Stack Atom Echo device. Haven’t fired them up yet, so thank you for discussion.

Just wanted to note that I saw some hardware warnings in the product spec sheet, at
m5-docs

They repeatedly mention that you should never do any of the following:
-DC output from I2S channel
-Playing white noise for long time
-Playing full square-wave audio

I’m guessing that doing those things probably cause hardware over-heat.

WHAT??? That’s why I brought it :frowning:

I brought it to play a white noise MP3 though Node Red when I get into bed. Using the headphone jack on the lager device connected to an amp

M5Stack ATOM Speaker Kit (NS4168)

Has anyone used the bigger one?

Also, what’s first steps? Plug it into the PC, flash it though ESPHome with the YAML and this will stop it from burning out? ie dont just plug it in and expect it to show up?

Im a little confused about that

EDIT; Ok as per the media player page; ESPHome Media Players

Pick your product and install ESPHome on it to use it directly as a media player inside Home Assistant. No programming or other software required.

i am using this home-coded player with the atom echo

1 Like

I’ve got both Atom Echo and Atom Speaker Kit units. Interesting toys, but disappointing in usefulness. I had hopes of using these for Home Assistant announcements / notifications. I also bought SeedStudio Grove Speaker unit, thinking to use that as external speaker for either one of those. But haven’t tried that yet.

I was also disappointed to find that the built-in I2S-interfaced microphone in Atom units is not (yet?) supported in ESPHome. I’m hoping that Home Assistant’s upcoming “Year of Voice” might address that.

Meanwhile, I’ve been deploying Alexa devices, going with Alexa Media Player (thru HACS). The Echo devices are so cheap – $15 each for gen-3 Echo Dot’s.

1 Like

Do any of you guys experience a bit of a stutter at the start of a TTS output?

Yes, but that happens with every speaker I use.

TTS works fine with M5StickC .
However the speaker hat is too quiet, and thus not really usable.
Problem is a weak signal output from DAC at GIO26 (1.5V +/- 0.3V) with volume set to max.

Had to include a switch to unmute

Below the yaml, replace passwords with your own


esphome:

  name: m5stick

esp32:

  board: m5stick-c

  framework:

    type: arduino

# Enable logging

logger:

# Enable Home Assistant API

api:

  encryption:

    key: "ZdFsnl+iGmcdks;cmds;kcmsdk;cmsdl;cm,dsl;o7Adk="

ota:

  password: "66622ncdsklcmdsk;cmsdkcdsmkcsd1d5"

wifi:

#  ssid: !secret wifi_ssid

#  password: !secret wifi_password

  ssid: "yourwifi"

  password: "blahblah"

  # Enable fallback hotspot (captive portal) in case wifi connection fails

  ap:

    ssid: "M5Stick Fallback Hotspot"

    password: "STcndsjlcndsclsncmklsc9zF"

captive_portal:

   

# Example configuration entry

media_player:

  - platform: i2s_audio

    name: ESPHome I2S Media Player

    dac_type: internal

    #i2s_lrclk_pin: GPIO33

    #i2s_dout_pin: GPIO26

    #i2s_bclk_pin: GPIO19

    #mode: mono

    mode: left

switch:

  - platform: gpio

    pin: GPIO0

    name: "un-mute"

1 Like

I found the M5StickC Speaker Hat unusable.
According to other posts the same is true for the ATOM Echo kit. Plain unusable.

So I came up with this solution, costing around 20Euros (or $20) . It just needs an easy to make custom cable. https://community.home-assistant.io/t/15-minute-holiday-hack-wifi-media-player-tts-audio-for-around-20-euros/510111/2

3 Likes

FWIW: I have 4 of the M5Stack ATOM SPK Speaker Kits. They’re pretty good if you’re planning to use the 3.5mm jack. They include a micro speaker in the kit, but that is a bit tinny sounding if you use that speaker alone. Sound outputs to both the micro speaker and the headphone jack simultaneously.

You can EASILY replace that speaker OR just use the headphone jack – which essentially is the same thing you’re doing with the ATOM via your cable. Over the holidays I’ve been playing internet radio throughout my house. I’m super happy with the Speaker Kits and they cost roughly the same as your DIY solution.

I also have 4 ATOM echos (which people confuse for the SPK kit). Those are fine for TTS, but they’re bad for listening to audio for more than 30 seconds. I use those with Rhasspy as portable voice assistants connected up to M5Stack TailBats.

Just to add, @hellebauer I think your DIY solution is super clever and makes it a bit more compact than the whole kit. Plus supplies for the kits can be hit or miss depending on where you live.

I really love the stuff from M5Stack. For someone like me with not a ton of skill, they make projects like this way more approachable.

1 Like

Thanks wryandginger, the main disadvantage of my “hack” is the audio quality. I use the DAC-pin to produce the audio signal, and it’s a tad noisy. It is fine for text-to-speech (TTS) or some LoFi-music. It suits my needs.

The ATOM SPK Speaker kit you mentioned has an I2S interface. Chances are that the audio output of that kit is much cleaner than that of the ATOM DAC pin. So yes, the ATOM SPK Speaker kit might be the better choice for someone seeking HiFi like music. I might just try it one day.

The 10Euro Bluetooth speakers I use (see link in post) are actually producing pretty good sound and loudness for their size. However you cannot Stereo-link them in Bluetooth mode.

Hey, I know you ended up saying the StickC Speaker Hat is unusable (along with the ATOM Echo kit), but I happen to have the Speaker Hat and was trying to make it work.

Using your example yaml here, I wasn’t able to make it work. I get static out of the speaker but nothing plays (quietly or not) if it an appropriate url to play. Is the the yaml config that you had working for the Speaker Hat?

Edit: looking at it more closely now, it looks like it’s crashing my device somehow.

INFO m5stick-watch.local: Error while reading incoming messages: Error while reading data: [Errno 104] Connection reset by peer
INFO m5stick-watch.local: Ping Failed: Error while reading data: [Errno 104] Connection reset by peer
INFO Disconnected from ESPHome API for m5stick-watch.local
WARNING Disconnected from API
INFO Successfully connected to m5stick-watch.local

Thanks.

@wryandginger are you getting static/buzzing/crackling over the 3.5mm jack? Or were you able to work around that?

I just got a couple of the M5Stack ATOM SPK Speaker Kits, once I flash them using the ESPHome Media Players website they all behave that way. Connecting them to a 3.5mm output before flashing them gives a low “white noise” sound.

I’m using this yaml:

substitutions:
  name: "m5stack-atom-speaker-kit"
  friendly_name: "M5Stack Atom Speaker Kit"
  wifi_ap_password: ""

esphome:
  name: "${name}"
  name_add_mac_suffix: true
  project:
    name: m5stack.atom-speaker-kit
    version: "1.0"

esp32:
  board: m5stack-atom
  framework:
    type: arduino

logger:
api:
ota:

dashboard_import:
  package_import_url: github://esphome/media-players/m5stack-atom-speaker-kit.yaml@main

wifi:
  ap:
    password: "${wifi_ap_password}"

captive_portal:

improv_serial:

media_player:
  - platform: i2s_audio
    id: media_out
    name: ${friendly_name}
    dac_type: external
    i2s_lrclk_pin: GPIO21
    i2s_dout_pin: GPIO25
    i2s_bclk_pin: GPIO22
    mode: mono

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO39
      inverted: true
    name: ${friendly_name} Button
    on_click:
      - media_player.toggle: media_out

light:
  - platform: fastled_clockless
    name: ${friendly_name}
    pin: GPIO27
    chipset: SK6812
    num_leds: 1
    rgb_order: grb

Yes, that YAML worked with Stick and speaker hat.
You have to activate the unmute switch (GPIO 0) though Homeassistant

https://docs.m5stack.com/en/hat/hat-spk

Yes, I notice some noise, but I have some fixes.

It appears that somewhere in an esp library the left and right channels are backwards coming out of the audio jack. I raised an issue in Esphome, but I don’t think there’s much movement on the problem. You can nearly eliminate the white noise/hum/distortion by:

  • Slightly unplugging the 3.5mm cable from the output device. You want to pull it out just enough so the plug is still in the jack, but not all the way.

  • Use wire strippers and cut the aux cord, connect red to white and white to red to swap channels.

  • Use 2 3.5mm to RCA stereo adapters and cross the left and right channels.

These all significantly improve audio quality. I tried switching the DAC from mono to stereo in the yaml and that also helps, but you get a phase issue if you’re trying to use the speaker and the jack at the same time.

It may be worth looking at the squeeze amp or the ESP32-A1S Audio Kit if you want much better audio quality.