Translate

Friday, December 2, 2016

5V Solar Power Supply for Raspberry Pi - first results

The introductory article was about describing the feasibility of the project.
Let's see some preliminary results.

The measurements


Until now I did run the system with an external voltmeter to see if the solar panel was able to keep up with the system.
It seems that so far the answer is no.


The graph shows the battery level measured in few days.
Note that basically there was no real load to the battery, only the Dc/Dc converter, so very few mA were drawn from the battery.
The days were pretty cloudy all the time, so no full sun for long time. In the best scenario (see the latest days) the battery level barely reached the 2.9V, well well below the minimum of 3.5V, and again I stress the fact there was no real load on the system.

The solar panel used so far is a 6V 2W, capable to provide in full sun a current of 330mA.
Definitively not enough to keep the battery charged AND powering something else (the Raspberry Pi has an estimated drawing current around 300-350mA).

Until there was sun the system did run happily, but as soon as the solar panel was not in full sun, the system had to use more and more the battery to power up the project and of course there was no battery charging there.

The battery is a nominal 3.7V 6600mAh and can last just few hours when not charged, so the system starting with a loaded battery in a sunny day can run almost all the day, but that only the first day.

What to do ?

There are few things to try.

  1. Use a bigger and powerful solar panel.
    A bigger solar panel, still 6V but maybe 6 or 9 W, probably can give more energy even with less light.
    In full sun the power should be enough to charge the battery AND power the system.
    Adafruit has a 6V 5.6 W solar panel, capable to give up to 930 mA in full sun and presumably more juice even in less than ideal conditions.
     
  2. Implement an intelligent power management
    We can assume to don't have the system running 24 hours a day.
    An external circuit (like the RPOf) can monitor the charge of the battery and shutdown the Raspberry when the battery level is below a specific threshold.
    When the battery threshold level is above a specific value the circuit can power on back the Raspberry.
  3. Reduce as much as possible the Raspberry Pi current needs.
    It can be done disabling every thing not needed, like the HDMI port or the LEDs.
    Even better adopting a Raspberry Pi 3, eliminating also the need to power the USB ports (currently the USB ports are in use for the WiFi dongle).
Very probably all the solutions will be needed.

Sensor modification


To better handle the solar management, a modification is needed on the light sensor.
Currently the light sensor is based on a photoresistor.
It can indicate if there is light or dark but is not enough to determine the "quality" of the light.
In other words the value returned is not enough to determine if the light is enough to generate ppower via the solar panel or not.
To do so a better light sensor is needed.  So in the near future I'll use a solar light sensor rather than the generic light sensor.


Tuesday, November 29, 2016

Entertainment system evolution


After long time I decided to do something to improve little bit my entertainment system.

In the past I played with some streamers and lately I ended up to use the glorious Wii to watch Netflix or Chromecast with the same purpose.
For a while I tried to use some Android sticks without much success.
They did work but all suffered by a bad video quality and connection problems.

In fact the connection to the network is the real problem.
The TV is located far away from the WiFi router and even using a repeater it didn't improve much the connection reliability.

So after a long time experimenting with cheap and wireless streamers, I decided to set up something better.
Here my basic requirements :

  • Wired connection
  • Faster streamer
  • Decent user interface
  • HD quality
  • Possibility to be connected to the main network
  • Possibility to stream from my server
  • Possibility to stream from local memory (flash pen)
  • Support for all video formats
  • More streaming choices than Netflix
  • Possibility to receive local HD program via antenna
Looking for something capable to cover these requirements, I ended up with two choices :
Wetek Play 2 is a nice and faster streamer with also the possibility to install a digital HDTV receiver (ATSC).
It is Android based and uses Kodi as main streaming management.

Amazon Fire TV is an Android based streamer with Alexa (the Amazon voice interface) integrated in it and very nice intuitive way, plus it supports Plex for streaming.

I tried to install Kodi on the server but I had some problems, then it was not clear when the Wetek Play 2 would be available.
I then installed as media server Plex on the server, after reading some interesting reports, and it went perfectly, plus Amazon Fire TV was readily available.

Because of that I decided to go with Amazon also if is missing the possibility to connect an ATSC receiver in order to see local HDTV channels.
As bonus it has Amazon Alexa that helps to integrate vocal commands to search for programs or activate applications. 

So after a while, here some pros and cons of using Fire TV.

Pro


  • Easy to configure and handle
  • Fast streamer. No I mean ... FAST.
  • Nice to search/select some programs using Alexa
  • Fast streaming from my server using Plex
  • Quite reliable
  • Very small, very easy to hide
Cons
  • Vudu is blocked because competitor of Amazon
  • No possibility to connect an ATSC receiver
  • Not integrated with Amazon Echo even if both are using Alexa
  • Too many apps require subscription (I guess is the same for all streamer though)
  • Quite close system. Is Android but is not open to install whatever you want

Sunday, November 27, 2016

Playing with Alexa and Echo

After my first tests with the Raspberry Pi and Alexa it was time to try an Echo.
Since now is available a more cheap version, the Echo Dot, I bought one of these and started to play.
Here some notes about.

Is it good ?


Yeah :) It is good.
Of course is not perfect, there is a huge space for improvements, but it is already something, especially when I was able to link it with my HA system.
But let see some details.

What it can do

Well, like the things I tried with the Raspberry Pi  you have the usual activities, asking the time, setting timers, creating lists, emulating Eliza :)
Other than that, the big advantage of Echo Dot is the possibility to ask and listen music, podcast, etc.
Of course to have decent results is better to pair it with an external bluetooth speaker.

Then, with some plugins and extra work, is possible to interface Alexa with different things, like my HA system (based on X10) and other appliances.
Now is really nice to turn on/off/dim the lights of my house simply asking Alexa to do it.

Yeah, nothing really new, already 20 years ago it was possible something like that, but the cost to set up a system capable to respond to vocal commands was huge and the system was surely less responsive and less easy to use.
Alexa really is impressive and all considered is easy to set up.

Well, OK, easy relatively speaking.
For example, in order to connect Alexa to my HA system I had to do some vodoo :)

Interface Alexa with X10


As I said, my HA system is still based on the old, glorious X10 protocol.
Why ? Well, I had around tons fo X10 modules and the newer systems, like Zigbee or Zwave, are still quite expensive.
I would love to migrate on Zigbee for example, but I still have a lot of still good X10 working modules.
I hate to trash away something that still work.

I have a server running Heyu that controls the lights and it handle some macros and timer.
So the natural question was, is it possible to interface Alexa with my server ?
A quick search with google said yes !

I found a very nice and detailed article from Corey Murnaghan : Amazon Echo X10 Home Control.
From there actually there was a link to an update : UPDATED Amazon Echo X10 Home Control

The two articles (I strongly suggest to use the updated version) discuss about how to interface Alexa with a Raspberry Pi running Heyu.
I already had a server running Heyu, with the glorious Ubuntu 16.04, so I used that article as main guideline, changing things here and there and in the end, voila', everything worked just nice.

The main differences from the Corey's article were about of course the Heyu installation and setting, since I already had that done years and years ago :)
In the end I just installed the Ha-bridge and configured little bit differently, also because my server hosts some websites, so it was impossible to follow some suggestions like erase the /var/www/html directory.

I had to change also some ports, since I was already using the port 80.
At least my version of Echo/Alexa requires to use the port 80 to recognize the Ha-bridge>
In order to have Alexa recognizing the server, I had to change the UPNP IP Address, forcing to use the one of the server.
Of course I had also to modify some firewall configuration for security reasons, to make the HA system local to my network and not be accessible from outside.


But in the end, I have now a very nice and useful way to control my lights :)

Wednesday, November 16, 2016

5V Solar Power supply for Raspberry Pi - feasibility phase

Ok, here the deal.
The goal is to have a 5V solar power supply for Raspberry Pi in order to power up a project (fHelper).

Playing with Vagrant

Vagrant is a way to handle virtual machines for development or other uses.

Here some practical notes about this tool and how to use it.

Friday, September 30, 2016

iFood - lasagne Bodini

Right. Here another "technical" post on a different technology :)
Lasagne.  Yes, I use the term "lasagnE" rather than the other term "lasagnA", is more commonly used from where I'm coming from :)
Apparently we geek love lasagne :)

I want to share here our recipe we use to prepare lasagne (we, my wife and I).
I'm not claiming this recipe to be "the" recipe, there are millions ways to prepare lasagne but surely is more Italian than many recipes I saw here in USA.
This is ours and we love it :)

Attention ! This recipe requires a LOT of time and a lot of work, up to two days to prepare everything !
This recipe should allow to prepare two big baking pan and a small one of lasagne, plus some extra
pasta.
It should be enough for at least 10-12 people.
To prepare this recipe, you need to have three things :

  1. The meat sauce (ragu' di carne)
  2. The pasta
  3. The besciamella

The three things are needed to be prepared in the listed order.
It is suggested to prepare the sauce the day before since it can take between 7 to 9 hours to be ready.
It is also possible to prepare lasagne the day before to eat it.

The meat sauce

The meat sauce, or “ragu' di carne”, also known as “bolognese”, is a meat based sauce.
Tools needed :

  • a big pot
  • (optional) a big crock pot

Ingredients :


  • Grounded lean Beef Meat (at least 4 pounds)
  • 2 or 3 big Onions
  • Garlic (2 or 3 small cloves)
  • 2 or 3 carrots
  • 3 big cans Crushed tomatoes
  • Extra-virgin olive oil
  • Sugar
  • Salt
  • Pepper
  • Dry white wine

Cut the onions, the carrots and garlic in small pieces.
Put them in the big pot with some oil and bring up to medium-high heat and cook for few minutes, until the onions starts to have a lightly golden color.
Put the ground beef in the pot and cook the meat until it turn all brown, mixing it with the onions and
carrots.
It will take a while.

When the meat is all brown, add some dry white wine and let it evaporate.
Then add the tomato, add salt , some sugar (helps to reduce the acidity) and a little sprinkle of black
pepper and cook until the sauce starts to be hot (bubbles starts to come out).

If you have a big crock pot, capable to contain all the sauce prepared, move the sauce in the crock pot
and set it up for 6/7 hours at high temperature, or 8/9 hours at lower temperature.
If you DON'T have the crock pot, reduce the heat to low and let cook for at least 4 hours, checking that the sauce doesn't become too dry.
Add hot water if necessary to keep the sauce moist and mix the sauce not too often.
At the end of the cooking on the surface should be present a lot of grease/oil (it depends about the kind of meat used. Lean meat will leave less grease/oil)
Gently, with a big spoon, remove as much as grease/oil as you can.
Don't trash the oil away in the sink !! It will clog the pipes and create problems to the sewer system!
Collect it in a old bottle and recycle it.
The meat sauce is ready.


The pasta

Of course the most important ingredient for lasagne is the pasta.
It is possible to buy ready-to-use pasta for lasagne, however is much better to prepare the pasta from
the scratch.

Tools needed :


  • (optional) Bread machine
  • Pasta maker
  • a big bowl
  • dough cutter or small pizza cutter
  • A large area where to put pasta

Ingredients :


  • 4 Eggs
  • 4 cups white Flour
  • Water

The bread machine is perfect to mix the raw ingredients and create the dough.
Put in the bread machine pan the 4 eggs and 500 g of flour (about 4 cups).
Start to mix and add little bit of water until the dough starts to be firm.
If become too wet (sticky) add white flour until is fixed.
If become too dry add little bit of water.
Without the bread machine you need another way to mix the ingredients.
Can be manually or another kind of machine. The bread machine is the best option for my experience.
At this point we need to prepare the “sheets” of pasta.
To do so, we need to use a tool called “pasta maker”.

Here a step-by-step guide to prepare the pasta sheets :

  1. From the main dough, cut it out a little piece and form a small ball, about 2-3 inches diameter
  2. Select the maximum opening on the pasta maker and put the ball in it , then start to roll it
  3. Repeat the process folding the sheet of pasta and spreading a little bit of flour between every passage
  4. When the sheet of pasta start to be tight and without crumbling and without “holes”, select the medium opening and repeat the process two or three times
  5. Select the smallest opening and pass the sheet of pasta in it. A long sheet of pasta should come out.
  6. Cut it in pieces, 5 or 6 inches long and place them on a table. Better to cover the table with a cloth.
  7. Repeat the process from 1 until all the dough is done.
If everything is done correctly, the entire table should be covered by 5 or 6 inches pieces pasta sheets.



The besciamella

The besciamella is another sauce based on milk and butter.
To prepare it is necessary to have just a medium pot.

Just as referral :

  • 1 Tablespoon=15g
  • 1 Teaspoon= 5g
  • 1 cup = 250 ml

Ingredients :


  • Butter (100 g - ~7 tablespoon)
  • Milk (1 liter - ~ 4 cups)
  • Flour (130 g - ~9 tablespoon)
  • Salt
  • Nutmeg

Put all the ingredients in the pot and cook at medium-low until a “sauce” medium tick is forming.

Let's prepare lasagne !


Without the tool is better to place 2 or 3 sheets of pasta in the water at the time, leave them in it for 3-4 minutes, then retrieve them with a big fork or something that can drain the water.
When some pasta sheets are ready (cooked) is possible to start to build the lasagne.
Better to be at least in two. One cooking the pasta sheets and preparing them ready to be used, and the other building lasagne.


  1. Pick a up one baking pan
  2. Scrub the entire pan with butter
  3. Start to put a layer of pasta
  4. Put on it a thin layer of grated Parmesan cheese
  5. Put on it a layer of besciamella
  6. Put on it a layer of meat sauce
  7. Go to the point 3 and repeat until there are enough layers of pasta to reach the top of the baking pan

Cover the baking pan with aluminum foil. It is ready to put in the oven.
When all the baking pan are ready, pre-heat the oven for 400 and then put the pans in it for at least 40
minutes.
Lasagne are ready !


What to do with leftovers

Usually some pasta sheets and some meat sauce are left over.
A neat way to use them is to cut the pasta sheets (using the pasta maker tool) in spaghetti or fetuccine.
Cook the pasta in the water used to cook the other pasta sheets, for 3-4 minutes.
Remove the pasta from the pot and add in it some meat sauce.
You end up with a wonderful home made “spaghetti alla bolognese” plate.
Extremely yummy ! Add some grated Parmesan cheese on the top.

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.