Jarvis is a voice and motion activated home automation platform. It provides developers with everything from: automating lights and doors, to welcoming users home with the news and their favourite song on Spotify.
Jarvis is built in a modular fashion, allowing additional functionality to constantly be added, as long as data can be transmitted through shared sockets.
An example of an extension can be found here: Jarvis Extension
To get started, clone the repository and install the required dependencies:
git clone https://github.com/Ewan-Roberts/Jarvis.git
npm install
-
Node.js: You will require the latest version of Node.js, that can download here: https://nodejs.org/en/download/
-
API Keys: You will require an API key for the news, weather functions and you will require your user id from Spotify for Spotify to work. These API keys are to be replaced in the userInformation.js file under modules. Keys can be created below
- api.openweathermap.org
- api.nytimes.com
- Spotify ID can be found when you share your profile link, and it should be after http://open.spotify.com/user/
-
MacOS: Currently functionality for Spotify is using applescript and therefore requires macOS
-
Arduino: You will require an Arduino, Firmata and servos set up on any light switches you would like to automate. More details of which can be found in the hardware and Arduino sections below.
-
Modules: For a full feature list please refer to https://github.com/vanguard12/Jarvis-RaspberryPiExtention for controls of additional lights, the open and closing of doors and buttons to control functionality.
-
Johnny-Five: A good understanding of http://johnny-five.io/ is highly recommended for additional extensions. They have created a very user friendly and simple API. API documentation here: https://github.com/rwaldron/johnny-five
Johnny-Five is one of the corner stones of the functionality and uses a protocol called Firmata to communicate over USB to the microcontroller.
- Before you can start you will need to load Firmata onto your Arduino-compatible microcontroller:
- Connect your Arduino-compatible microcontroller via USB
- Launch Arduino IDE and open the Firmata sketch via the menu: File > Examples > Firmata > StandardFirmata
- Select your Arduino board type (e.g. Arduino Uno) via Tools > Board
- Select the port for your board via Tools > Serial Port > (the comm port of your Arduino)
- Upload the program by selecting File > Upload
- If you are having trouble uploading, a full trouble shooting guide can be found here: http://ardx.org/TRBL
excerpt from the very helpful http://node-ardx.org/
The layout of the hardware wiring for Jarvis and the additional extension can be found below:
For the extension the wiring is below, with more information on the extension here: https://github.com/vanguard12/Jarvis-RaspberryPiExtention
Once the prerequisites are completed, go to root and run:
node main.js
Then load https://localhost:3003/
This will require going through unsecure local network and allowing the microphone to listen for key words, held in the command.js file. The list of commands can be found below:
Tests have not been created for each function, however most complicated functionality is covered. You can run these tests at root with "npm test"
In Jarvis spats are used. Effectively they represent an input and pass the string to the back end to be interpreted. If these spats are to indicate an on or off state, they are digested as demonstrated below:
BOOL statements are linked to the below words:
True | False |
---|---|
'true' | 'false' |
'go' | 'off' |
'on' | turn off' |
'turn on' | 'stop' |
'begin' | centered |
'start' | 'halt' |
'wake' | 'pause' |
For example: "bedroom {on}", "bedroom {turn on}", "bedroom {start}" would all turn the light on.
'what is the weather'
Reads out the weather for the day and displays the weeks weather on the front end
'bedroom ' BOOL STATEMENT || 'bathroom ' BOOL STATEMENT || 'lights ' BOOL STATEMENT
Turns on or off the bedroom lights || Turns on or off the bathroom lights || both
'spanish word'
Reads out a new word from a list of a few hundred words in english, then translates it into spanish and conjugates it in present tense
'what is the time'
Reads out the current time
'what is the news'
Reads out your specified news articles from the New York Times
'Pause' || 'play' || 'next' || 'back' || stop
Issues Spotify with the above commands
'open' 'Facebook' || 'You Tube'
Opens an instance of Google/Facebook/YouTube
'Facebook' || 'You Tube' 'search for' *Spat
Open Facebook or YouTube and search for the spat specified
'play my playlist' || 'play some music'
Plays users Spotify playlist || Plays a song of your choosing
'search for song' *Spat
Searches Spotify for the spat you specify and plays the best match
'Wikipedia' *spat
Searches Wikipedia and reads out the definition of the selection
'Clear'
Hides the front end divs for news and for weather
'Volume' 'up' || 'down' || 'full' || 'half'
Regulates the volume in relation to the above selections
'screen ' BOOL STATEMENT
Takes a BOOL statement and turns on/off your screen
'timer for ' *Spat / stop / reset
Takes the number of minutes, creates a timer on the front end and tells the user when the timer is complete / pauses / resets
'reload' or 'refresh'
Reloads current page
This is just an update so my repo goes higher and recruiters dont see so much of me mucking around being bored