Monday, July 24, 2017

TJBot New Recipe (post #5 about TJBot)

TJBot has learned some new tricks!
 
I loaded a new recipe to show to the Children at the Vacation Bible School (VBS) at Church a few weeks ago! The Children and parents liked meeting TJBot!

 This is all mostly technical stuff for people who ask me questions about how I did it, so if you're not technically minded, you can skip this blog post.

 First, here are the links to previous posts on TJBot:  #1 order parts,  #2 test the hardware, #3 assemble the cardboard , #4 TJBot Talks


One thing I missed in the assembly instructions:
Use a screw to connect the TJBot Arm to the servo, otherwise it will keep falling off! (not mentioned in any of the instructions anywhere)





So, here are a bunch of my notes I took. They are sporadic because I stumbled on them over the course of trying to get this to work. 

I loaded a new recipe:
Recipe for TJdashboard - https://github.com/victordibia/tjdashboard
  
After done loading it, you can retrain Conversation to add more intents. I did this and added a bunch of intents and dialog entries to correspond to the Bible topics of the VBS week.
May need to get a new trial account since there is a limit to the number of services.
 
Booting up TJBot without a monitor and keyboard
I couldn't get auto boot up to work (see links below), so needed to ssh from laptop to get TJBot started, so used these instructions
https://www.raspberrypi.org/blog/use-your-desktop-or-laptop-screen-and-keyboard-with-your-pi/
those instructions are very complicated, so basically I just did the following:
Connect up a cable
arp -a
ssh pi@raspberrypi.local
Then, once connected, modify the wpa_supplicant.conf file for adding new wireless SSIDs and pwds
https://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md
http://weworkweplay.com/play/automatically-connect-a-raspberry-pi-to-a-wifi-network/
do ifconfig to get IP address (see below), then Then to start TJbot Dashboard:
cd /home/pi/tjdashboard 
and 
sudo node dasshboard.js

Control-C will stop the dashboard program from running on tjbot.  You should do sudo shutdown to gracefully shut down the pi

To select the correct microphone
arecord -l
sudo config.js
modify it for the correct device ID
(can also flip the camera there too)

you may also need to Blacklist audio
https://github.com/ibmtjbot/tjbot/tree/master/recipes/speech_to_text#troubleshoot


to get to the "dashboard" from a browser...
ifconfig to get ip
http://192.168.1.2:8078/
 
Dashboard buttons: 
"See" will take a photo and tell what it sees
Text will take a photo and look for text in the picture that tells a color 
Dance: will dance and wave arm
Wave: will wave arm
LED: to change LED color


Turn "Listening" on and off then it will not respond

Faces: uses local Face detect and will load your picture in dashboard
Sentiment: only if you connect sentiment 

Note that Everything you say is sent to Watson Conversation Service (WCS), but only acted on if an intent is found

Here are some posts I used to try to boot into the dashboard at startup, but I can't get it to work
http://www.instructables.com/id/Nodejs-App-As-a-RPI-Service-boot-at-Startup/
https://raspberrypi.stackexchange.com/questions/44957/running-node-js-with-forever
http://www.linuxcircle.com/2013/12/30/run-nodejs-server-on-boot-with-forever-on-raspberry-pi/
Tried the comment at the beginingof /etc/rc.local:
node /home/pi/tjdashboard/dashboard.js < /dev/null &
It started up, but can't reach the dashboard URL without getting errors
 

No comments: