Evaluation Type: Independent Products
Did you receive all parts the manufacturer stated would be included in the package?: True
What other parts do you consider comparable to this product?: I looked at Mathematica which comes bundled with the Raspberry Pi as an alternative to Fhem. Both are excellent programs but I found Mathematica more intuitive. But Mathematica would not recognize the contact sensor. However I will keep this my back pocket for future projects.
What were the biggest problems encountered?: There was little information on the sensor itself. Fhem was a challenge when you had to use Bing translator. I had to do some intensive troubleshooting to get Dlog to work. I After a couple of evenings I realized that the fhem.db was not being created in the /opt/fhem directory. I tested it outside of the directory and was able to create it using sql. I then moved it to the directory and created the current and history table. One lesson learned was not to use SD cards that had been formatted too many times. I had "Kernel Rage" on the SD card and on my backup. I could not fix the issue and had to rebuild the program again.
Fox Tracker Project
My initial idea was to set up a tracker and provide the kit to the Red Urban Fox Project at the University of Prince Edward Island. The project had placed two GPS trackers that were lost. I was intrigue with sensors that needed no batteries. The two months have flown by and I learned so much about engineering and physics. Okay I spent considerable time reading about magnetic readings and using a reverse lookup for XYZ to find longitude and latitude. Maybe too much time . But time well spent to compare the advantage of XYZ readings over GPS.
Raspberry Pi and FHEM set up
I have used the Raspberry Pi in an audio and camera project so I had the power adapter, wireless dongle, case and SD cards already. I had a current image of the operating system Raspbian on a SD card. I also had a compliant wireless keyboard and a wireless mouse with an Acer monitor should I wish use the command line in Raspberry Pi. I have Putty installed on my Acer laptop so I could use the terminal.
The next steps was to configure Raspberry Pi:
1. Plug SD card into Raspberry Pi and connect with keyboard and monitor
2. Login with user pi and password raspberry
3. Configuration menu starts automatically
4 I love this simple program to set up wireless:
sudo apt-get curses
sudo wicd-curses (Once the program starts it will scan your house for all wireless and LAN connections. You can set up your preferences for wireless with encryption. It also give you an idea on the strength of the signal. )
5. Update Raspberry Pi software and firmware
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install rpi-update
6. Once complete you need to reboot the Raspberry Pi:
Now set up the EnOcean pi on the Raspberry Pi
As default the serial port of the GPIO interface is used for console debug outputs. In order to use this port for EnOcean Pi, this feature has to be disabled:
sudo wget https://raw.github.com/lurch/rpi-serial-console/master/rpi-serial-console -O /usr/bin/rpi-serial-console && sudo chmod +x /usr/bin/rpi-serial-console
Now you can disable the port:
sudo rpi-serial-console disable
Install the Perl Libraries
sudo apt-get install perl libdevice-serialport-perl libio-socket-ssl-perl libwww-perl
sudo apt-get install –f (did not work - unable to find package. Not certain what the impact was.)
Install Fhem software
sudo dpkg –i fhem-5.5.deb
The program is installed in /opt/fhem folder. This information will come in handy later.
I first tried Firefox to display the Fhem home page:
You can find out your IP address for the Raspberry Pi with the following command:
I received "connection failed" I tried Chrome and received the same error. I went from wireless to hardwire and still having the same issue. I checked port 8083 thinking it may be a firewall issue so I turned the firewall off . No connection. I tried a different Raspberry Pi and a different power adapter. It as not until I set up the software on a different SD card did it work.
Once on the Fhem homepage I was immediately interested in the graphing front end found here:
So this was in German. After translation to English in Chrome I started the installation by a copy and paste to Putty. I was now in trouble. The code did not translate correctly and often put extra characters in Putty. After a hover over the code I was able to copy and paste the correct code in Putty. I skipped the initials steps and started with install of Sqlite3.
Sudo Apt-get install sqlite3
Sudo Apt-get install libdbi-perl libdbd-sqlite3-perl
Sudo Apt-get install-f (Please note the package was not found)
Preparing the Database
Prompt shows in Putty as sqlite3> (mine showed as SQLite>
I created the tables as follows:
CREATE TABLE `history` (TIMESTAMP TIMESTAMP, DEVICE varchar (32), TYPE varchar (32), EVENT varchar (512), READING varchar (32), VALUE varchar (32), UNIT varchar (32));
CREATE TABLE `current` (TIMESTAMP TIMESTAMP, DEVICE varchar (32), TYPE varchar (32), EVENT varchar (512), READING varchar (32), VALUE varchar (32), UNIT varchar (32));
And one for the front end:
CREATE TABLE frontend (id INTEGER PRIMARY KEY, TIMESTAMP DEFAULT CURRENT_TIMESTAMP TIMESTAMP, TYPE TEXT, TEXT NAME, VALUE TEXT);
Now we can
<.tables>see if three entries appear (current, history, frontend) I skipped this step and regretted it later .
<.exit>SQLite3 we leave and go back to our Putty prompt.
Before we define in FHEM DBLOG, we need to create our db.conf. This is done using
<nano db.conf> .
Is filled with this configuration file
% Dbconfig = ( connection => "SQLite: dbname = /opt /FHEM /fhem.db" user => "",password => "");
Store by pressing CTRL + X and "Y" and exit nano again.
In the folder /opt/FHEM should contain db.conf and are fhem.db.
Rights are given by:
Chmod-R g + w fhem.db
ChmodR o + w fhem.db
Then in the Fhem command line :
define myDbLog DBLOG /opt/fhem/db.conf *:.. *
Well I never checked the folder /opt/fhem and assumed they were there. So I could not get DBLOG to work. I received a message that I had to be a user. I liked the graphs with the front end but wanted more. After troubleshooting I opened up the directory and the files were not there ! I executed the sqlite3 fhem.db again and still nothing. Hmm.. So I decided to execute the command at the root. Sure enough the fhem.db was created. I moved it to /opt/fhem folder and created my tables. Now I had access to DBLOG. It is a very versatile graphing tool and worth the effort to have access to it.
Now about that sensor. Yes I came into this project knowing very little about the sensors. I chose this sensor as a possible tracking tool to measure distance, velocity and acceleration of the movement of an object. The sensor was immediate recognized by Fhem and assigned a unique number. The magnet is the actuary and when it comes near the sensor the circuit will close and moving it away the circuit will open. A telegram is sent to Fhem with a time stamp showing when it changes from Open or Closed state. With Dblog I had many new choices for graphing. The software allowed one reading called State to be graphed with different statistical functions i.e. Hourly Count. So what I can do with Hourly Count ?
Well I have measured the magnet trip due to motion at 6.5cm per trip. Ran out of time for completion. Will continue though.
Thanks to Element 14 !