A voice controlled smart mirror powered by Raspberry Pi3B+ and AndroidThings. Mirror is capable to display or hide widgets such as weather, news, time, calendar when the correct voice command is given.
At the moment Black Mirror supporting commands in polish language only. If you would like to change the language, see the setup section below. Mirror listen the command only after "wakeup mirror" keyword spotted, this action will be indicated by mic animation.
- Showing/hiding weather widget:
"Pokaż pogodę dla miasta (Lokalizacja)"
"Zamknij widok pogody"
- Showing/hiding news widget.
"Pokaż wiadomości ze świata"
"Pokaz wiadomości z Polsatu"
"Pokaż wiadomości z TVNu"
"Zamknij widok wiadomości"
- Showing/hiding time widget.
"Pokaż czas dla kraju (Lokalizacja)"
"Zamknij/Ukryj zegar"
- Showing/hiding/changing calendar month.
"Pokaż kalendarz"
"Pokaż kolejny miesiąc"
"Pokaż poprzedni miesiąc"
"Zamknij widok kalendarza"
Paste your api keys in gradle.properties. You need to register in OpenWeatherMap, TimeZoneDb, GoogleGeoApi to obtain api keys. It's completly free.
To work with google speech recognition you need credentials.json file placed in /res/raw directory. More info at: https://github.com/GoogleCloudPlatform/android-docs-samples/tree/master/speech/Speech
If you want to change default keyword "wakeup mirror", you should change line in PocketSphinx.java (line:24)
private static final String ACTIVATION_KEYPHRASE = "wakeup mirror";
- Set your language code in SpeechService.java (line: 262)
mRequestObserver.onNext(StreamingRecognizeRequest.newBuilder()
.setStreamingConfig(StreamingRecognitionConfig.newBuilder()
.setConfig(RecognitionConfig.newBuilder()
// Change this line
.setLanguageCode("pl-PL")
.setEncoding(RecognitionConfig.AudioEncoding.LINEAR16)
.setSampleRateHertz(sampleRate)
.build())
- Change all vocabularies in TextCommandInterpreter. For example:
private final ArrayList<String> countryVocabulary = new ArrayList<>(Arrays.asList("kraj", "kraju", "krajowi", "krajom"));
change to:
private final ArrayList<String> countryVocabulary = new ArrayList<>(Arrays.asList("country", "countries", "land", "state"));
Comment or delete this in AndroidManifest.xml
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<!-- Comment this <category android:name="android.intent.category.IOT_LAUNCHER"/> -->
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
You need to remember to grant permission via adb or android settings for:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
- Raspberry Pi3
- Anbes Super Mini New High-Quality Sound USB 2.0 Microphone Audio Adapter (works with AndroidThings out of the box)
- Compaq 17' 4:3 LCD Display
MIT License
Copyright (c) 2017 Przemek
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.