A simple howto install on Armbian OS in cli mode


#1

Not sure how many people would be interested in mycroft on an armbian OS without desktop - I find armbian works well and you can get very really powerful pi devices that blow rpi3 out of the water on specs for 1/2 the price

I installed in on quadcore orange pi running armbian… the hardest thing was getting the audio to work as you have to use Pulse Audio. ( you can get pulse audio installed easier if you like just run armbian-config while login as your user and install minimal desktop) but this is for a very minimal install

first off you need to enable your orange Pi mic which is relatively simple - alsamixer basically tab over to capture on mic1 and hit the space bar to enable it …

  • optional – install mpv it just installs pretty much all the audio prerequisites files you can also install vlc if you like
 apt-get install mpv  vlc 

download a small test wav file to the device for testing
ie mvp test.wav
when playing the file it will tell you it is playing with alsa engine

installing pulse audio in a base server CLi enviroment

   apt-get install pulseaudio pulseaudio-utils

next you need to give it permission to the user ie root or your user

 usermod -a -G pulse root
 usermod -a -G pulse-access  root

 usermod -a -G pulse ai
 usermod -a -G pulse-access  ai

logout or reboot

once done that you can run pulseaudio --system or pulseaudio -D ( depending if you are runnng as root or User )

if everything is setup right now when you play an audio file with mpv it will say using pulse audio engine

now you can proceed with the mycroft install - preferably as a user

  • cd ~/
  • git clone https://github.com/MycroftAI/mycroft-core.git
  • cd mycroft-core
  • bash dev_setup.sh

once done run

./start-mycroft.sh unittest

hopefully it will be error free it might display error as audio files did not finish downloading as that can take a while after it finished installing the core…

next test your audio with mycroft

./start-mycroft.sh audiotest

if all worked out well mycroft will now be able to hear you and speak to you. :slight_smile:

next just run

 ./start-mycroft.sh all or debug

to register and get it up and running .

it will give you a pairing key and a way you go… pair it on their website

the Mic sensitivity is so on the orange pi – you can use a usb mic or add in a much higher sensitivity Mic – I used fairly high sensitivity mic commonly mic found in most arduino kits CZN-15E . did not even have to remove the existing mic just soldered it to the mic pins on the back of the orange pi… now you can speak normally even at slight whisper and it will work well. and normal voice work with in a 10- 15 foot radius

to get pulse audio to run in server Cli mode best way is to create a script

then just add these lines to /etc/rc.local ( assuming you called your user ai)

  sudo nano /etc/rc.local

this line executes the file as the ai user

 sudo -H -u ai /home/ai/./startup

create the startup

  nano startup

add these lines - optional mpv /home/ai/intro.wave plays an startup sound file

  pulseaudio -D
  sleep 5
  #mpv /home/ai/intro.wave
  cd /home/ai/mycroft-core
  ./start-mycroft.sh all

by default zram-config is installed on a armbian os it compresses your ram so you have more memory by about 50% more if not run

sudo apt install zram-config

``
to enable simply reboot

if using smaller memory device ie <1gig use a high quality class 10 SD

sudo swapon --show

to display available swap

sudo fallocate -l 1G /swapfile

will create a 1gig swap file

sudo chmod 600 /swapfile

to set it at the correct permission

sudo mkswap /swapfile

sets the file as a swap device

sudo swapon /swapfile

turns on the swap file

to make run at boot edit fstab

sudo nano /etc/fstab

add this

/swapfile swap swap defaults 0 0

you can edit your swappiness so it only writes as little as possible to the swapfile 10 or lower

sudo sysctl vm.swappiness=10

i find even if you have 1 gig of memory it is advantageous to have a swap file it used rarely - but mycroft tends to use more memory than it has when doing updates and other functions in the background if you find mycroft stuttering from time to time adding a swap file normally corrects that issue

oh well good luck have fun


#2

Thanks @krywenko this is excellent.

I’m particularly interested in your use of the swapfile, did you try this on devices with less than 1GB of memory? How did it go?


#3

it works fine, i tried it on orange pi zero that has only 500m (my main one is on a orange pc plus+ which has 1 gig )- for that you are better using a 2 gig swap and set the swapiness a bit higher … zram will increase the functional ram to about 750 m. so most everyday stuff it works fine stuff will work purely in ram. but if you want to compile mycroft speech engine and allow room for high memory usage then a large swap is required it work fines with the swap file (not quite as zippy as the Opi PC ++ with 1 gig ). but with the use of a good quality industrial grade class 10 SD just use a fairly large one >=8 gig then with SD wear management the SD should last several years depending how much actual writes it does to the swap.

I also tried it on minipc - alfawise V83 - intel Atom x5-z8350 but that a monster compared to most Pi devices at 4 core- 2ghz 2 gigs of memory with built in mic and audio ports and only cost <$70 when on sale I suggest Lubutu >=18.10 64bit works the best as the OS. if someone want I can create a howto for that as well… but a $25 OPi PC ++ is more then enough


#4

Yes. This is very much appreciated. I’ve got a couple of Orange Pi PC’s that I’ve got running Armbian and have them tweaked up quite nicely, but was dreading the attempt to get Mycroft installed on them.

As part of my tweaking process, I’ve installed a script I’ve found that uses ZRAM. It really helps on machines with lower RAM like 1 GB or less. On the Orange Pis that I have, it cuts the load time of Libre Office Calc on the desktop in half.

From here

It works on the Orange PI PC with Armbian and the Orange Pi 2G-IOT that has 256MB Ram that I got as well.


#5

hi Theandamus
I had no problems installing mycroft ( with complied speech core - yes on everything on the mycroft install script) if the pi has 1 gig of memory if using cli server mode on with fresh default install of Armbian ( or with minimal desktop installed) the same can not be said about Ubuntu or other OS it will not install until you install zram-config and /or a swap it will run out of memory and fail on the compile . i see Mycroft generally uses about ~550 m of ram when running with local speech core install ( not sure what it is if not using speech core as I prefer the higher privacy and never really tried - but I would assume lower)