2019-05-01_Linux_Format

(singke) #1

http://www.techradar.com/pro/linux May 2019 LXF249 37


Open source smart home


SETTINGUPTHERESPEAKER


TheSeeedReSpeaker4-MicArrayPiHATis,astheysayinthe
business,a niftybitofkit.Aswellasfourmicrophones,it hastwelve
LEDswhichcanbeusedtoindicateaudiodirectionofarrival,orjust
toflashrandomlyandconcerningly.It hasGPIOandI2Cconnections
sothatotherdevicescanbedaisychainedtoit,orit canstackdirectly
ontoSeeed’sGrovePihub,allowingevenmoresensorstobe
connected.It usestheAC108codecwhichatpresentisn’tsupported
bytheRaspbiankernel,sowe’llneedtoinstalla customone.Connect
tothePi,eitherbySSHorkeyboard,andquittheMycroftCLI.Run
thefollowingcommands:
gitclonehttps://github.com/respeaker/seeed-voicecard.git
cdseeed-voicecard
sudo./install.sh
Theinstallscriptwillchugalongfora while,andeventuallyyou’llbe
abletorebootandactivatethenewkernelwith sudoreboot.
Reconnectif youwereSSHing,thenrunsudoraspi-configtoset
uptheaudio.Select‘7.AdvancedOptions’,then‘A4.Audio’,then
‘1.Force3.5mmjack’.Thenrebootandenjoy.
If yourunintodifficultiesyoumayneedtoinstallPulseaudioand
restartMycroft’sdaemons,with:
$ sudoaptinstallpulseaudio
$ ./start-mycroft.shallrestart
If it stilldoesn’twork(and
remember,if indoubta reboot
neverhurts),thePulseaudio
inputdevicemayneedtobe
changed.Listthedeviceswith
pactllistsources andthen
changethedefaulttomatchthe
linebeginning Name inthe
output,with:
pactlset-default-source“alsa_
input.platform-soc_sound.
multichannel-input”

TheReSpeakerissuitablyequippedwith
twelveLEDsandfourmicrophones.No
turntables,though.

(Text-to-speech) engine locally. This will take a long
time on an older machine, but will be worth it if you
want Mycroft to talk to you during those dark times of
internet outage. Finally you’ll be asked whether to add
the Mycroft Helper command path to your profile; this
will make your life easier, so say yes here. All Mycroft
commands begin with mycroft , so typing this then
pressingTabwillhelpyoumanipulateit.You’llbeasked
forasudopasswordandthena quiteconsiderable
numberofpackageswillbedownloadedandinstalled.
Youmayseea warningaboutanoutdatedversionof
Pip(wenoticedit onUbuntu18.04.2),butthisis
apparentlysafetoignore.
Nowwe’rereadytorunMycroftforthefirsttime,
whichisdonefromthemycroft-core/directorywith
$ ./start-mycroft.shdebug
The debugoptionstartsa commandlineinterface
andshowsextensivestartuplogs.Onceeverything’s
loaded,it willgiveyoua uniquesix-character
registrationcodetopairthisdevicewiththeMycroft
Homeservice.Takea noteofthatbecausewe’llneedit
ina moment.There’snota lotMycroftcandountilthis
pairingiscomplete.


Creatinga Mycroftaccount
Visithttps://home.mycroft.ai, asthevocalprompts
shouldtellyouif yourspeakersareworking,tocreate
anaccountfromwhereyourMycroftdevicescanbe
managed.Enterthepairingcodeandgiveyourdevice
a nameanddescription.TheCLIstartedearliershould
acknowledgethenewdevice,andyou’llbeabletoenter
natural-languagequestions,commands(startedwith:



  • type:helptoseea list),or,audiosetuppermitting,
    speakdirectlytoMycroftthroughyourmicrophone.
    It willtrytoansweranythingwhichyouprecedewith
    “HeyMycroft”.
    Atthispoint,youcancontinuewithkeyboardand
    monitorpluggedin,whichisprobablya goodideafor
    themoment.However,if you’replanningona headless
    MycroftPisetupyou’regoingtobeconnectingtoit
    overSSH,soyoumayaswellpractisethatnow.You’ll
    needyourPi’sIPaddress,whichyoucaneitheraskit
    fordirectlyortype:
    whatsmyipaddress
    intotheCLI–Mycroftdoesn’tcareaboutapostrophes,
    incidentally.It shouldrespondvocallyandoutput
    somethinglike


    MynetworkI.P.addressis 192 dot 168 dot0 dot 23






This means you can SSH into it from another
machine with the following:
$ ssh [email protected]
If you’re talking to Picroft, the username
will be pi and the password will no longer be
mycroft because of course you diligently
carried out our earlier instruction to change it
assoonaspossible.
If themicrophonelevelintheCLIdoesn’t
respond,quitoutoftheCLIwithCtrl+Cand
checktheoutputof:
$ arecord-L
If yourmicisnotdetected,youwillneedtobattle
withsortingoutyourparticularhardware– thefairly
ancientPlaystation3 Eyecamera/micisstrongly
recommendedbytheMycroftteam,andworksoutof
thebox.If ontheotherhandit isdetectedthere,you
mayneedtoinstallandtweakPulseaudio.
Thisisalmostexclusivelygoingtobea Piissuesince
allmajordistroswillhavethisalready.It wasnecessary
onourReSpeakerHAT,sochecktheboxbelowfor
someguidance.Bearinmindthatyoucanalways
returntotheCLIclientwith:
$ mycroft-cli-client

Mycroft’s glorious ASCII splash screen. Yet another opportunity for Cool
Retro Term to make an appearance.

The PS3 Eye works
out of the box with
Mycroft, even if
we are only using
its PS3 ear. Image
credit: Evan Amos/
public domain.
Free download pdf