{{:public_namespace:enocean.jpg?200|}}{{:public_namespace:raspberrypi.png?80|}} ====== Install EnOcean on Raspberry Pi ====== ===== Connecting EnOcean Pi with Raspberry Pi ===== {{:public_namespace:enoceanpi.jpg?200|}}{{:public_namespace:raspberry_enoceanpi.jpg?200|}} First of all you have to connect the EnOcean Pi to the Raspberry. Do this before powering up the Raspberry Pi. The serial port of the GPIO must be disable (it's normally used for console debugging in standard configuration). To achieve this, you have to do the following commands: wget https://raw.githubusercontent.com/lurch/rpi-serial-console/master/rpi-serial-console chmod +x rpi-serial-console sudo ./rpi-serial-console status If the returned message is ''Serial console on /dev/ttyAMA0 is disabled'' you don't have to do anything, else, you have to do: sudo ./rpi-serial-console disable ===== Install the Fhem.de building automation server for testing purposes ===== Fhem is a building automation server . We will use it to verify that everything is well configured. ==== Install Fhem for testing purposes ==== As an example, to be able to test if your environment is well configured, you can install Fhem. Do the following to achieve this. sudo apt-get install perl libdevice-serialport-perl libio-socket-ssl-perl libwww-perl sudo apt-get install -f wget http://fhem.de/fhem-5.6.deb sudo dpkg -u fhem-5.6.deb To display the web interface of fhem, you can connect to the Raspberry on 8083 port. http://:8083/fhem ==== Headline ==== === Install Dolphin View Advance to test on Windows === To be able to test your hardware and discover it under Windows, you will need to install Dolphin View (or Dolphin View Advanced). You can download this software after registration on [[https://www.enocean.com/fr/download/|EnOcean Development Tools]]. {{:public_namespace:dolphin_view.jpg?400|}} === Configure Fhem to test on Raspberry Pi === Go to ''Edit files'' and select ''fhem.cfg'' Add the following lines if then OceanPi is not automatically recognized: define TCM_ESP3_0 TCM ESP3 /dev/ttyAMA0@57600 The go to ''Everything'' and select ''TCL_ESP3_0''. Send the following command: set TCP_ESP3_0 teach 600 Then take all your EnOcean devices and click on them: click on switches to send an event and click on the learn button to send a datagram to discover the equipment. Then you can go the ''EnOcean'' and you can find all the equipment recognized by Fhem. So now you know that everything is functional without programming anything. Be careful: you must stop and/or uninstall the Fhem server before trying to communicate with another program to listen to events, else you will notice some problems like not receiving all events (some of them may be cacthed by Fhem). ===== Compile EnOcean Link Library ===== To be able to develop your own program with EnOcean protocol, you will have to get and compile the library. - Download [[https://www.enocean.com/it/enocean-software/enocean-link/|EnOcean Link]]. - Instruction to [[https://www.enocean.com/fileadmin/redaktion/support/enocean-link/compile.html#raspberry|compile the library for Raspberry Pi]]. * Modify ''Sandbox.cpp'' to specify ''#define SER_PORT "/dev/ttyAMA0"'' instead of /dev/ttyUSB0 if you use EnOcean Pi (/dev/ttyUSB0 is used for EnOcean USB300 key) * To compile the library on the Raspberry Pi (not using cross-compilation) sudo apt-get install autoconf automake autotools-dev m4 libtool cd EOLink chmod +x configure ./configure CPPFLAGS="-Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s" make * Libraries are compiled in the ''.libs/'' directory. To test the library you have multiple programs in ''Tutorial'' directory. With the current version tested, there is a problem with missing and depcomp files, so I replaced them. cd ../Tutorial chmod +x Tutorial.sh mv depcomp depcom.sav mv missing missing.sav ln -s ../EOLink/depcomp . ln -s ../EOLink/missing . ./Tutorial.sh cd Tutorials ./Tutorial1 ===== Configure to TeachIn sensors ===== When you try the Tutorial1 program, you will only recognize the switches. This is due to the fact the you will only recognize this type of sensor. Teaching is defined using ''myGateway.TeachInModule->SetRPS(0x02,0x01);''. So you only are listening to RPS modules categorized with 0x02 function and of type 0x01. This is the categorized profiles of the different equipments. Here is the list of defined [[https://www.google.fr/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0CCUQFjAA&url=https%3A%2F%2Fwww.enocean.com%2Ffileadmin%2Fredaktion%2Fenocean_alliance%2Fpdf%2FEnOcean_Equipment_Profiles_EEP_V2.6.2_public.pdf&ei=FmgVVc22A42saffLgMgD&usg=AFQjCNGABhOdpm_vLy4krYXBxMX5gV6rQA&sig2=pHiyKIxjs17L5uLf2xyw_g&bvm=bv.89381419,d.d2s|EnOcean Equipment Profiles EEP 2.6]] So to be able to detect different kind of sensors, you will have to add them to the TeachInModule like this: myGateway.TeachInModule->SetRPS(0x02,0x01); myGateway.TeachInModule->Set1BS(0x00,0x01); myGateway.TeachInModule->Set4BS(0x02,0x20); This code will allow you to detect the following type of devices: * RPS Telegram: F6-02-01: Light and Blink Control - Application Style 01 * 1BS Telegram: D5-00-01: Single Input Contact * 4BS Telegram: A5-02-20: 10 bit Temperature Sensor Range -10°C to +41.2°C