Translate

Saturday, September 24, 2016

Playing with Alexa

It is amazing how time's fly !
Are already almost two months since my last post !

Many things happened of course, busy life, work work work and only recently I restarted to play with something new, for fun.

Amazon made public a demo project to use a Raspberry Pi to be like an Echo, the Amazon  vocal command toy.
So I decided to try, I did put my hands on a Raspberry Pi 3 (in order to have embedded WiFi and Bluetooth), a nice USB microphone and a speaker (as suggested in the Amazon project) and one evening, with a friend, we followed the instructions and installed Alexa on a Raspberry.

Here few notes about

Time


It took about 4 hours to install everything. The longest time was spent updating Raspbian, probably the update alone was about 1 hour and half.
The installation of tools and environment (the project is in Java, uses Node.js and Maven) took the other long part and the configuration the rest.
And yes, we did enjoy ourself watching Youtube (comedians) while waiting :)


Is it working ?


YES ! Amazingly it did work immediately and all considered is not bad at all !
It is possible to hear some static/digital noise in the speaker, especially if a monitor and USB keyboard is connected to the Raspberry, but the audio quality is not bad.

Let see some pro and cons

Pro


  • Relatively cheap
    A Raspberry Pi, a speaker and a microphone is what is needed. Many of us have this stuff in some box by sure :)
  • Easy to install
    The instructions are quite clear, some not updated to the last version parts but for somebody who plays with Raspberry or somebody with a basic computer science knowledge is not a problem.
  • It works
    Well yes, is a pro :)

Cons

  • You need an Amazon account. No problem for me but is important to realize that Alexa become a part of the Amazon account.
  • Is not an Echo !
    This is important !! The project is a demo and has some not intuitive/cumbersome way to activate Alexa, so don't expect Echo performances !
    In details :
    • A X11 graphic environment is needed ! Specifically they suggest to use VNC in order to connect from other computers.
      Is not a real embedded system like Echo.
    • Everytime the Raspberry is turned On is necessary to open terminals and start a local server plus a client.
    • When the client starts it is requested an https connection to retrieve a certificate.
      A browser is needed thus plus some manual operations.
      Once retrieved the certificate Echo works until the Raspberry is shutted off or the application is stopped
    • Some functionalities are disabled by default, like streaming music.
      Need to investigate if is possible to enable them.

Capabilities

So far I tried different things. The default of course is asking Alexa things like the time, the weather, news, etc.
And I have to say I'm impressed with the capability to recognize my accent !
I tried many vocal command systems in the past and all of them, ALL OF THEM, always failed to recognize my English.
I estimate for Alexa a recognizing average of 90/95% of what I say !
Simply amazing !!

Then I was able to interface Alexa with my google calendar and now I can handle it via voice. Cool.
Another interface was with IFTTT, so I can now create different triggers. So far I installed a trigger to call my cell phone.

So .. what is for ?


Fun ! :)
And is a relatively cheap way to test the capabilities of Echo.
I'll investigate few things in the next week or months (no time as usual ..) to see if is possible to modify the code to build something more close to the real Echo with maybe some custom capabilities. 

For example connecting a bluetooth microphone, controlling I/O, interfacing something personal like my Logitech Squeezebox, enabling the streaming music, connecting a bluetooth speaker and so on.

Surely the evaluation aspect of this project is worth alone the time spent to put together the gadget and playing with it

Friday, July 8, 2016

Squeezebox and VPN

With the VPN installed (My Little VPN) and few tweaks now I'm able to stream my music where ever I am from my Logitech Media server.

This article describes what I had to do on my Android phones to enable the remote streaming from my Logitech Squeezebox server.

On many Android phones I have, I used two apps to control the media server and stream music from it :

  • SqueezePlayer (not free)
    This is the player for the phone, the app that receive the stream from the server
  • Logitech Squeezebox Controller (free)
    This apps control the server, allow to choose the player and what to stream, radio, podcast or local music archive
These two apps works very well together and actually the SqueezePlayer links automatically with the controller.
However on newer versions of Android, the Logitech Squeezebox Controller is not working anymore.
That lead me to look for other applications to control the server, and I found two :
Squeezer works fine in the network but for strange reasons is not capable to work via the VPN leaving the Squeeze controller as only choice.
So, to recap, on older versions of android (up to 4.4.4) I use the apps:
On newer Android versions (5.0), I ended up to use:

Since my Logitech media player is totally behind firewall, i.e. there is not a public access (no open ports) it works only if the phone is connected to the local network.
With the VPN, without doing much effort, the applications recognize the server and allow the streaming without problems since the phone is actually IN the network.

On the VPN settings, I just enabled the Seamless tunnel and the ForcesAES-CBC option.
No specific settings for the Squeezebox apps.

Very nice to have everywhere your own music library.

Tuesday, July 5, 2016

My little VPN

Having around a Raspberry Pi I decided to set up a VPN to access to my network and from there, to internet.
There are a lot of tutorials, guides, suggestions, so in the end I opted for Open VPN since is well supported for Android, my main remote access to my network.

Sunday, May 22, 2016

CAUTION ! When update is critical

Long long time since my last post.
I'm still around but very very busy with the job and other activities.
I have many projects that needs my attention, halted, waiting for better time.

Among the many things I have to do and I'm doing, after long time I decided that it was necessary to finally upgrade my server from the 15.04 Ubuntu to the latest LTS Ubuntu distro, the 16.04 LTS.
As usual when there is an upgrade, not the usual update, I'm always quite nervous.
In the past almost every time I ended up to format everything from the scratch since the upgrade always failed along the way.

So after the usual backup of data, I started the upgrade.
First I had to upgrade from the 15.04 to the 15.10.
It took about 3 hours and I "lost" only a couple of services.
Then, since the system was still working I decided to risk everything and upgrade from the 15.10 to the 16.04 LTS.

It worked ! It took an additional couple of hours crunching, deleting old libraries, clean up the system, upgrade configurations but it worked.
But I had to pay a price.

After restoring the broken services, sometime simply re-installing a new version, I discovered that ALL my websites based on Joomla hosted on the server, were off line.
Dead. All dead.

Ubuntu 16.04 LTS installs ONLY PHP 7.x. Older versions of PHP are not supported, actually the notes suggests to DON'T Try to install PHP 5.x at all.
And my Joomla websites were bases on old versions of Joomla, requiring PHP 5.x or even older ones.

Only Joomla 3.5 supports PHP 7.0 so I ended up with very few choices :

  1. erase the Ubuntu 16.04 LTS from the server and install something older
  2. try to install other PHP versions other than the 7.x on the server
  3. install virtualbox on the server and set up a old version of Ubuntu only for the web servers
  4. install Joomla 3.5 and rebuild all the websites converting from the old versions
Let's cut the suspance :) in the end I opted for the last option.
Ubuntu 16.04 LTS works really nice on the server, the only flaw is PHP.
So far the server is much faster and stable than before.
Installing older version of Ubuntu was not really a choice.

The choice number 2 required to have a lot of time to overcome the errors certainly coming out as well as the choice 3.
I did try to install virtualbox but I ended up with errors.
The version I tried to install was incompatible somehow with the 16.04 and not yet enough support or other people doing that to find solutions fast.

So I decided to recreate all my websites from the scratch, using Joomla 3.5.
It will take some time to convert the data (I'll maybe write another article to describe the pain for this operation :) )  but in the end is the least expensive, safest way to proceed and I'll end up with a better working websites.

So, if you are planning to upgrade your machine to Ubuntu 16.04 LTS and you need PHP 5.x or older ... BE VERY CAREFUL.
You'll lose a lot but also gain a lot from other areas.

Saturday, November 14, 2015

Timer for UV box

Ok, here the deal.
The need is to develop a timer, faster, capable to control up to 16 UV fluorescent bulbs.
Up to 2 hours, 1 second precision, display to show the countdown and menu' management, digital encoder for input, pushbuttons/LEDs.

It can be done in thousands ways, but this time I'll try to put it together using Energia and a BIG help from Roberto.

Wednesday, November 4, 2015

Embedded RPOf

The next thing to do about the RPOf is to embed it in a piggy back board over the Raspberry Pi.
The Raspberry Pi GPIO connector has both the 3.3V and 5V rail available, so to have a more compact system, embedding the RPOf on the "shield" connected to the Raspberry Pi, can helps to reduce the space and number of boards.

Friday, October 30, 2015

Working on the iRis project

[To be updated !]

A step-by-step guide to work on git for the iRis project.
If you are new on git and github, read this article first.

The iRis project is on github, so if somebody wants to join it, or just follow the progress, can clone the git repo for iRis.

Working on RPOf project

Here a step-by-step guide to work on git for the RPOf project.
If you are new on git and github, read this article first.

Working on my projects

Here a step-by-step guide to work on git for some projects I maintain.

This guide assumes:

  • you like Linux, you USE Linux
  • you know how to work with the terminal
  • the instructions are based on Ubuntu, but they should be easily used on other systems.
    The main difference could be the application to install code. apt-get for Ubuntu, yum for Red Hat/CentOS, ecc.
  • you know how to set up a cross compiler for different microcontroller under Linux

Introduction


The most important thing to remember working with git, is that normally ALL the operations are LOCAL to your machine !
Only few specific and explicitly called operations operate on a remote server, in our case, github.

Specifically :

  • The first time, when we clone the project from github
  • Every time we want to update our code from github
  • Every time we want to save our work on github

First time

git Installation


The first time we want to clone the project from github.
How we do that ?
First of all we must have git on our machine.
So if you don't already installed it, open a terminal and type :

  • sudo apt-get update
  • sudo apt-get install git


(note, I'm using for this article, the git version 1.9.1 on a Ubuntu 14.04 LTS)

After the installation, is better to set it up with some basic info :

  • git config --global user.name "your name"
  • git config --global user.email "youremail@domain.com"
  • git config --list will show the configuration for your git
For example :

git config --global user.name "John Smith"
git config --global user.email "jsmith@mystery.com"

I'm not sure if is valid for every type of operation, but it is possible github will require a SSH key in order to clone/update a project.
In that case I strongly recommend to follow this brief tutorial about how to generate and deploy an ssh key with github.

At this point you are ready to clone the project from github !

Clone a project

Cloning is the act that duplicate on your hard drive what is present in a remote git repository, in this case github.
The cloning is strongly suggested in case you want to collaborate to the project.
Cloning the project recreate on your local machine the project and it's history and allows to merge it back on github if you do modifications.

First of all create or go on a directory that will host the project.
For example, create a directory called SteveProjects on your home environment :
  • cd ~
  • mkdir SteveProjects
  • cd SteveProjects
Now is possible to use git to clone a project, with the command :

  • git clone URL_repository
That's it !
On your directory Projects, will exist a directory called as the project name, containing the project.

Download a project


In case you are not interested to collaborate to the project but wants to have the project on your machine, or in case you don't want to install git or generate SSH keys, from github is possible to download the project as a zip file.

Update project

Now that you have the project on your machine, to keep it updated is even easier.
Simply go in the project directory and issue the command : git pull

  • cd ~/Projects/project_name
  • git pull
That's it !  If the code on the github is changed, it will be updated on your machine

Working on the project

Commit the project


If you want to collaborate to a project, you can modify the code on your machine, and keep track of the modifications locally, using git.
Issuing the command git status returns the status of the modifications made to the code.

Every time you modify a file, git status will indicate a modification.
Every time you will have to add it with:

git add file_name

git add * will add all the modified files.

Then it will be possible to commit the file with:

git commit file_name

All these operations are LOCAL to your machine !

If you are a registered collaborator to the project (ask me), then you should be able to "push" your modifications in the github with:

git push

Working protocol


In order to reduce the conflict between developer, I suggest this protocol:


  1. Clone the project
    git clone URL_of_github_project
  2. Create a branch
    git checkout -b branch_name
  3. Work on your modifications, add and commit regularly
  4. When is time to push the modifications:
    git push origin branch_name
  5. If allowed, merge the branch on the master.



Tuesday, October 13, 2015

iRis project - an introduction

The purpose of the iRis project is to have a "head" for medical training purpose related to eyes illness.
Basically the idea is to build a "eyes simulator" capable to react to the light like an eye does, in order to simulate  different types of illness retina/nerve related.