Monday, December 18, 2017

AIY Google Assistant Kit Start on Boot

I picked up the AIY Google Assistant kit from MicroCenter the other day. Man it is a cool project. All the instructions you need to get up and rolling are in the box. The MicroCenter deal came with the Raspberry Pi 3 included and only cost 35$, essentially you get the kit for free.

After the build I wanted a way to start the Google Voice Python script on startup. The AIY project site has great instructions that I will summarize here.


  1. Create a new file in /home/pi called voice_assistant.service using the command: sudo nano /home/pi/voice_assistant.service
  2. Enter the following text into the file

    Description=My awesome assistant app
    [Service]
    ExecStart=/bin/bash -c '/home/pi/AIY-voice-kit-python/env/bin/python3 -u src/assistant_library_demo.py'
    WorkingDirectory=/home/pi/AIY-voice-kit-python
    Restart=always
    User=pi

    [Install]
    WantedBy=multi-user.target

  3. Move the file to the correct folder using this command: sudo mv voice_assistant.service /lib/systemd/system
  4. Enable your service: sudo systemctl enable voice_assistant.service
  5. Start your service: sudo service voice_assistant start
  6. Reboot the pi: reboot
  7. After reboot check the status of the service: sudo service voice_assistant status
  8. The status should be started and you should be able to say "Okay Google"



Friday, December 1, 2017

ESP8266 Servo Control from Website

I wanted a way to host a web site on the ESP8266 and control a Servo from that website. I had to search around for a bit and piece together a few bits of code, but it was pretty simple once I found the right combo.

The code is pretty straight forward. Enter your SSIS and your password. Set the int servoPin = to whatever pin you connected the servo data line to. Update the webPage line to style the web page like you want. I am going to mess around with some mobile frameworks to see if I can get it to build a good mobile looking site for me.

You can see where we are moving the servo if you find the Servo1.write() lines. You can tweak the angles to meet your needs. If you want to add a button just copy and paste the section that starts with server.on

Paste your new section above the line that says server.begin(). You will also need to add the button in your webpage+= line to add the new button: <a href=\"socket1On\"><button>UP</button> Make sure the ahref matches whatever you call the new button in the server on section.

Upload the script to the ESP and you should be rockin and rollin.

If you open the Serial Monitor you will see the IP address assigned to the ESP.


The main reason I wanted this servo functionality is because I saw the Paper Signals Google project. The voice thing is cool, but I just wanted a simple way to do the Arrow up and down. So I am going to print out the paper molds and try to assemble it this weekend.

The goal being I can have a web enabled Up Down arrow. When someone walks by my cube and gives me some lame idea I will click the down arrow. If they say something funny I will click the up arrow. The cool part is if this works well I can attach whatever symbol I want to it and move it around with the web enabled servo.

UPDATE:

Remote Boss Thumbs UP/DOWN

While planning the Paper Signals build I decided to make a remote Thumbs UP/DOWN for my boss. Now from his desk he can give me a Thumbs up or Thumbs down by hitting a web site from anywhere in the office.







I also baked in the Bootstrap Mobile framework into the web site hosted on the ESP, however Blogger was having a hard time displaying the code since it had several <script> tags. I have included the .INO file below that you can load up in Arduino IDE.