Coder Social home page Coder Social logo

tjweather's Introduction

TJ Weather

Don't forget to say "Watson" when you talk to it!

Video demo here.

This module provides Node.js code to talk to IBM TJBot and get a response back on the current weather conditions. It uses Watson Speech to Text to parse audio from the microphone, processes your commands (e.g ask a weather related question) using [IBM Weather Insights API] and uses Watson Text to Speech to "read" out a text response!

This is designed to run on a Pi with a microphone and speaker attached. See Connecting mic and speaker for how to connect your mic and speaker Before you start, it is recommended you become familiar with setting up your TJBot/Raspberry Pi by looking at the instructions here.

How It Works

  • Listens for voice commands. See Running for a list of voice commands supported in this sample.
  • Sends audio from the microphone to the Watson Speech to Text Service - STT to transcribe audio to text.
  • Parses the text looking for commands
  • Once a weather command is recognized, an appropriate action (e.g current weather conditions in san francisco) is taken and TJBot verbalizes this action as well using Watson Text to Speech to generate an audio file.
  • The robot plays back the response through using the Alsa tools

##Hardware Follow the full set of instructions on instructables to prepare your TJBot ready to run the code.

Note: You must have a mic and speaker connected to your Pi.

##Build Get the sample code (download or clone) and go to the application folder.

git clone [email protected]:suprbh/tjweather.git
cd tjweather

Update your Raspberry Pi. Please see the guide [here to setup network and also update your nodejs] (http://www.instructables.com/id/Make-Your-Robot-Respond-to-Emotions-Using-Watson/step2/Set-up-your-Pi/) installation sudo apt-get update sudo apt-get upgrade curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - sudo apt-get install -y nodejs

Note : Raspberry pi comes with a really old version of nodejs and npm (0.10), hence the need to upgrade it to the latest version.

Install ALSA tools (required for recording audio on Raspberry Pi). (Some of the sample code integrate voice commands)

sudo apt-get install alsa-base alsa-utils
sudo apt-get install libasound2-dev

Install Dependencies

npm install
# try 'sudo rm -rf node_modules'  and 'sudo npm install --unsafe-perm' if you run into errors installing dependencies

Set the audio output to your audio jack. For more audio channels, check the config guide.

amixer cset numid=3 1    
// This sets the audio output to option 1 which is your Pi's Audio Jack. Option 0 = Auto, Option 2 = HDMI. An alternative is to type sudo raspi-config and change the audio to 3.5mm audio jack.

Create config.js

# On your local machine rename the config.default.js file to config.js.
cp config.default.js config.js

Open config.js using your favorite text editor # (e.g // nano) and update it with your Bluemix credentials for the Watson services you use.
nano config.js

Note: do not add your credentials to the config.default.js file.

##Running

Start the application. (Note: you need sudo access)

node weather.js     

Then you should be able to speak to the microphone. Sample utterances are

Watson what is the weather in san francisco california ?

Whats Next

There are a few things you can do .. and ways to take your robot forward!

  • Use Watson Entity Extraction service to make it retrieve global weather conditions instead of only U.S.
  • Leverage machine learning capabilities within Watson conversation to better match intents even when recognized text is not accurate.
  • Animate robot interactions LED

Dependencies List

License

MIT License

tjweather's People

Contributors

suprbh avatar sonalipandey avatar

Stargazers

John Harney avatar  avatar Sam Zhao avatar Dan avatar

Watchers

Victor Dibia avatar Pedro Zatta avatar  avatar John Harney avatar

Forkers

lchaves001

tjweather's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.