Mycroft Community Forum

MycroftOS - A bare minimal (production type of) OS based on Buildroot

HAPPY NEW YEAR

@gez-mycroft To comment on your sound over HDMI feedback; Yes indeed, I have sound auto select on boot. If there is a HDMI connected, it uses the HDMI as sound output. If you boot without HDMI connected, the 3.5 jack will be used. Later on in time, I will see if I can make this switchable, but for now, you need to boot with either HDMI or without.


I uploaded a sixed alpha version to my STACK drive for you guys to test.

Changelog:

  • Disabled Pulse-AEC as default for now.
  • Bumped Mycroft to latest 19.8.5
  • Switched starting all mycroft services to proper systemd units
    – This in preparation for watchdog support
    – Services linked to each other
    – Not starting if network is not up
    – Wait for internet before starting mycroft stack within systemd.
  • Make the HDMI screen pretty again.
    – This in preparation for FRamebuffer support within the enclosure code.
  • Fixed the whole WIFI system. @Dominik
    – When no wifi configuration present at the first boot it will setup an Open Acces point; MycroftOS-WiFiSetup.
    – Use another wifi device such as a phone or tablet.
    – Connect to the open network.
    – Modern devices will automatically open the webbased configuration. (mimic a captive portal)
    – The webbased config scans for available networks.
    – Select your SSID from the list.
    – Insert your WIFI password and press the connect button.
    – (or select the skip at the bottom to disable the AP. You need to use a LAN connection then)
    – The device will reboot and connect to your wifi and continue.
    (If you would like to skip the whole setup and just use your own wpa_supplicant.conf settings/setup; Just copy the wpa_supplicant.conf at the FAT /boot partition before youi start the device)

Two more things to go before I consider this a first official release;

  1. Enclosure code to be run for;
    – Shutdown/Reboot handle
    – Enable/Disable SSH (default user/passwd == mycroft/mycroft )
    – PulseAudio volume control
    – Listener/Thinking/Speaking visuals over the Framebuffer
  2. Pull and build precise from source at build time.
    –(This would allow me to take a stab at 64bit support)

From there on I can start adding features such as ;

  • Airplay 1
  • Spotify
  • Bluetooth
  • mpd
  • Squeezebox
  • etc. (open for ideas)

Here are the download links for this intermediate test release;

RPI3:
https://j1nx.stackstorage.com/s/9zbgEWywJAEjbWy

RPI4:
https://j1nx.stackstorage.com/s/t74ohd06ib2v8NO

DISCLAIMER: As my RPI wifi is broken, I did all above coding with a cheap ass wifi dongle. Really hope it all works with the onboard wifi as well

1 Like

MPD with Snapcast support?
Would be great for some of the music skills.

1 Like

Do you have an rpi4 build again?

Not yet. Will merge the rpi3 with rpi4 later today for a clean build, but it will take quite some hours.

Will report back as soon as the download is available.

1 Like

Yeah, forgot to mention. Snapcast (both client and server) is on the top of the list, together with Shairport-sync as those two are already readily available for Buildroot.

Easy quick, pull, change, build procedure.

Anyhow, the biggest challenge is to connect everything to PulseAudio and to control pulseaudio from mycroft. The default SINK is for the normal default speaker output, but as soon as we are going to create multiple SINK’s like a Snapcast-SINK, we need to implement a; “Play blabla on from youtube on Snapcast”

*But one hurdle at a time :slight_smile:

1 Like

@suisat Took some time, but here is the RPI4 build. (Again; Untested by me, so happy to hear your results)

https://j1nx.stackstorage.com/s/t74ohd06ib2v8NO

Anybody who could confirm that all the WiFi stuff actually works with the onboard WiFi chip as well?

Time for me to invest in a rpi4.

Rpi3 version is there as well😉

Sorry, I was not home or did not have time since you rls this. I will write you, hopefully tomorrow.

No worries! I just carried on developing. The next version is already around the corner.

Would be great to have some feedback on the whole WiFi system though, so hope you mange to find some time to test.

I would like to push another test release out into the world. I really, REALLY could use some feedback/testing/bug hunting/etc. from other users then myself. There is only X amount of test work you can do, and even then… I will always do thing the way I have them intended to. Other people might do things in a way I haven’t thought about and it is just those things I am after.

So by all means, if you have some spare time, please download this version and give it a spin. I am open for any type of contributions.

Alright…


MycroftOS - Version 0.1.0 - alpha 7

This 7th version comes with some fixes and additional features. I would also like to visualize the whole “First run / setup - wifi system” by showing some pictures of it. Hopefully I am able to create a nifty little video show casing it as well this weekend, but then again; Said the same to myself last week…

Changelog:

  • Started developing the Python enclosure code. Although in the end when finished, this should be handled as an enclosure, for now I migrated it all into a Skill of which a very first intial version is added.
  • Mycroft visuals on the HDMI if used for “listening”, “thnking” and “speaking” (see screenshot below).
  • Prioritising the loading of soundcard drivers, giving external sound cards more priority over the broadcom onboard chip without blacklisting it as module or diabling the overlay within config.txt
  • Couple of filesystem - permission errors/fixes.
  • WIFI fixes when using the onboard Broadcom wifi chip.
  • Bluetooth fixes when using the onboard broadcom bluetooth chip.
  • Fixing the respeaker HAT Led skill, hanging the whole device. The respeakers skill can now be installed and use if wanted (All drivers are already included)
  • Latest & Greatest Mycroft 19.8.6 version

Added smart speaker functionality and features:

  • Added Spotify support. When enabled, you have a “MycroftOS” spotify connect device within your Spotify app. By default for Spotify connect on the same network you do not need to configure any credentials. If you want to control spotify by voice, you need to istall the Spotify skill and configure it. More on that later…
  • Added Airplay support. When enabled, you have a “MycroftOS” airplay device within your iOS music player.
  • Added Bluetooth speaker support. When enabled, you have a “MycroftOS” bluetooth audio device you can pair with. No PIN required at the moment, will look into setting a PIN for it some time later on.
  • Added Snapcast Server support. When enabled you can make your MycroftOS device a Snapcast server device, forcing all audio output being pushed to Snapcast clients. (Note: You still need to configure this via SSH)
  • Added Snapcast Client support. When enabled you can make your MycroftOS device a Snapcast client device, receiving multiroom audio from a Snapcast Server. Yes this could be the Snapcast server on the same MycroftOS device. (Note: You still need to configure this via SSH)
  • Added MPD support. When enabled you can make your MycroftOS a MPD server/player. (Note: You still need to configure this via SSH)

First run and Wifi configuration

After you have flashed the image onto a SD card and booted your machine, the following visuals are present when you also attach an HDMI screen.

Depending on how fast your screen switches, a boot message screen is shown;

At first boot, it will first expand the filesystem over the whole size of the SD card and check if the wifi is configured. If not it will show below screen;


At the moment above text is not being spoken out loud. Need to look into that. How to cache Mimic2, because Minic1 sounds to robotic as it will be the very first impression people will get. It has to sound beter than Mimic1 :wink:

On you phone or tablet, go to your wifi settings and connect to the open MycroftOS-WiFiSetup network.

When it connects it will auto detect, and open a browser to configure your MycroftOS wifi settings. It acts as a captive portal. iOS opens the browser itself;

On Android devices you need to “click to login”;


Anyhow, select your WiFi from the select box. Insert your credentials for it (don’t make a typo mistake !) and hit the connect/send button.

Your wifi will be configured and the device will reboot and continue the process of setting up your MycroftOS device. A few notes on above system;

  1. If you want to use LAN, click the “cancel link” at the bottom of that page to configure a blank wpa_supplicant file and therefor not configure the wifi, but make it look like it is configured for the system.
  2. At the moment, I have not yet figured out how to check for a LAN cable connection while still having no wifi configuration. In that regards, you HAVE TO cancel the wifi via above or accept the open wifi network being created.
  1. If you have a wpa_supplicant.conf file at hand that you would like to use instead of going through the above wizard. Just save the wap_supplicant.conf at the boot FAT partion before you start up the device. The file will be moved to the right folders, skipping the above wizard because of it.

Second boot after the WiFi wizard

When the device reboots, again booting visual is shown. After a while and depending on how fast the network setup at your place is you will see (or not at all);

After that, when internet is established;


Which means the Mycroft A.I. software stack is being started. After some time the logo will disappear when every thing is done and dusted. That means, pairing your device (not yet being shown on the HDMI screen) and installing and loading all default skills.

First boot will take a bit of time as it will download all the default skills including their pip packages. Have a little bit of patience. Mycroft will speak out, when it is fully done.

When everything is done and dusted and Mycroft is ready to rock and roll, the following HDMI visuals are used to communicate it different stages.

Listening / Wake word being heard.

Thinking

Speaking

One more remard to make about the whole HDMI section. At boot it will decide where to output it’s sound. If it sees an HDMI screen attached, it uses the HDMI for audio autput. If not, it uses the 3.5 speaker jack. This system is not hot swapable however later on in time I will make it configurable to be also forced to one or the other.


MycroftOS Configuration Skill

Above features and services can be enabled via the same enclosure skill that handles the Framebuffer visuals. At the moment, starting and disabling these services via voice is disabled. Still figuring out the best way forward for that.

When you have paired your device, you will have a MycroftOS Skill settings section available at your mycroft account page;

The smart speaker functionality just works as it is after enabling them (Snapcast client being the exemption). At a later stage I will explain how to setup the Spotify skill, so you could also voice control your Spotify devices.

All the other system services can be enabled and they will be started with default configuration files. But for them to work properly, you will need to SSH into your box and configure them.

Talking about SSH. ALL services are disabled by default. Different users different use cases, however I dislike everything being started. I take the other way approach. If you want it you need to enable it. For now, while still developing the system SSH is the only one that is enabled by default. However as soon as some sort of final release it there, SSH will by default disabled as well.

If you enable and log into your device. The credentials are still; mycroft / mycroft

CHANGE THE PASSWORD !!!


The firmware / images are currently being uploaded. You can download them at my downloads section;

Happy testing. PLEASE let me know your thoughts, both positive and negative.

Thx

3 Likes

Configuring the Spotify Connect daemon

To make use of the Spotify Mycroft Skill, you will need to configure MycroftOS to use your Spotify premium credentials. It uses a different daemon called “Spotifyd” instead of “raspotify”. Spotifyd is based on raspotify, with some extra things. (Checkout their github repo for more information)

Log into your MycroftOS device via SSH (see above post for more info).
When logging in the mycroft-cli-client will been shown.
Cancel out of it with; CTRL-C

No onto the linux CLI issue the following command.

sudo nano /etc/spotifyd.conf

A text editor will open, showing the following content;

[global]
# The port `spotifyd` uses to announce its service over the network.
zeroconf_port = 57621

# Cleartext username and password for remote Spotify access.
# Make sure the file is only accessible by spotifyd.
# username = USER
# password = PASS

# alsa, pulseaudio or pipe
backend = pulseaudio

# Name in Spotify Connect, cannot contain spaces:
device_name = MycroftOS

Go to the username / password section and fill in both your Spotify premium username and password and remove the HASH sign (#) infront of it.

# Cleartext username and password for remote Spotify access.
# Make sure the file is only accessible by spotifyd.
username = my-spotify-premium-username
password = my-spotify-premium-password

Exit out of the text editor by; CTRL-X It will ask if you want to save, answer by; Y

Now we need to restart the spotify connect daemon with the following command.

sudo systemctl restart spotifyd.service

Spotify on the MycroftOS device is nwo properly configured.

Just install the Spotify Mycroft Skill as ussual and follow the installation instruction.

First OAUTH Mycroft via the button. Then fill in the username and pasword at the mycroft skill section. You do not have to use the real user/passwd combo, just fill something in as there is a check for empty fields. They will not be used, our username/password setup above will be used instead.

Enjoy Spotify connect with voice control.

I will see if i can get some tinkertime this weekend for this. I am sure i have an sd card lying around here somewhere.

Perfect! All I can ask for.

SD card doesn’t have to be big. Had to increase the default starting size from 1 GB to 1.5 GB because I left the MPD depency for Samba there nbecause at some point I will start using sharing some folder over the network anyway (config files, local music, update partition, etc)

All with all with all default skills installed after the first run, you end up with; 1.2 GB in use.

mycroft@MycroftOS:~ $ df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                14.3G      1.1G     12.6G   8% /
devtmpfs                925.1M         0    925.1M   0% /dev
tmpfs                   958.1M         0    958.1M   0% /dev/shm
tmpfs                   958.1M     24.4M    933.7M   3% /run
tmpfs                   958.1M         0    958.1M   0% /sys/fs/cgroup
tmpfs                   958.1M      4.0K    958.1M   0% /var/tmp
tmpfs                   958.1M    128.0K    958.0M   0% /tmp
tmpfs                   958.1M    268.0K    957.8M   0% /var/log
tmpfs                    20.0M      8.0K     20.0M   0% /ramdisk
/dev/mmcblk0p1           31.9M      9.4M     22.5M  30% /boot

So an old 4 GB card is more than enough. (Not takingh the speed into account ofcourse)

This looks very promising. Excellent work.

1 Like

Lets see if i can make use of this new toy for some testing…
image

4 Likes

(more) pics or it didn’t happen…

5 Likes

oh! it’s happening!!!
image

2 Likes

Preliminary testing results and recommendations.
Tested on…

  • new out of the box rpi4 (4gb)
  • 8 gb sd-card (class 4, not great, all I had lying around)
  • no microphone
  • hdmi connection to samsung tv
  1. Download from the provided link - No issues
  2. Flashed image to sd-card utilizing balena etcher (1.5.53) - No issues
  3. Booted the rpi4 - Noticed the “Safe to turn off screen” showed up momentarily, a bit confusing since I just turned it on.
  4. Wifi - setup instructed to connect to “MycroftOS-Setup” when actually the SSID was “MycroftOS-WiFiSetup”
  5. Wifi - setup showed some wifi networks as “ID List” and showed both my access points “Kelsey.AI” It did not show any 5Ghz networks.
    image
    image
  6. Wifi - recommend a “show password” option when entering SSID password.
    image
  7. Wifi - After setting up the wifi the web browser indicates the device will reboot but the TV showed “safe to reboot”, I was unsure if I should cycle power or wait. I waited.
  8. Booting - I think a boot progress bar or spinning mycroft logo :slightly_smiling_face: :upside_down_face: would be helpful to know if it is actually booting or frozen.
  9. When connecting mycroft to the mycroft.ai website showing the pairing code on the hdmi splash screen would also simplify the connection process.
  10. Showing the device IP address on the hdmi splash screen would also be helpful. I had to check my router.
  11. Paring to mycroft.ai occured without issue once I figured out i had to turn up my tv to hear the pairing code.
  12. Network Hostname - i noticed my router reported a MycroftOS hostname, I like this, but if I have more than one MycroftOS device what will happen when trying to identify the hostname.
    image
  13. SSH - Attempted to connect but could not figure out the username / password as there are several listed in the forum topic. I did figure it out eventually.
  14. SSH - the mycroft-cli-client worked as expected
  15. SSH - when attempting to install a skill an error was reported with package manager.
    image
  16. SSH - attempted “msm update” and received merg conflicts (this could be mycroft.ai issue).
  17. Mycroft.ai websettings skills page - I really like this and wanted to try the snapcast client but was not certain on the instructions required to get this working, maybe a link to snapcast configuration?
  18. I attempted to install the snapcast client but “dpkg” was not found in the OS.
  19. At this point my device began to become slugish. I was unable to determine if this was MycroftOS related or a thermal throttling of my rpi4.
  20. I suspect thermal throttling, and eventually my rpi locked up completely.
  21. Does the MycroftOS include the latest rpi4 firmware (reduces thermal issues) or should this be installed separately?
  22. Will the MycroftOS stay up to date with the latest Mycroft.AI builds?

I will resume testing later when I have some time and my rpi4 cools down a bit.
My initial impressions on MycroftOS were very good, and I will definitely consider using this as my “go-to distro” for Mycroft.AI.
I hope these notes are helpful, keep up the good work!
:partying_face: :100: :facepunch: :+1: :clap:

2 Likes