element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Forget Me Not Design Challenge
  • Challenges & Projects
  • Design Challenges
  • Forget Me Not Design Challenge
  • More
  • Cancel
Forget Me Not Design Challenge
Blog [FMN#02] : Ubuntu, meet enocean Pi
  • Blog
  • Forum
  • Documents
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: vish
  • Date Created: 10 Aug 2014 7:27 PM Date Created
  • Views 670 views
  • Likes 0 likes
  • Comments 0 comments
  • forget_me_not
  • Ubuntu
  • openhab
  • iot_home_intelligent
  • enocean_pi
Related
Recommended

[FMN#02] : Ubuntu, meet enocean Pi

vish
vish
10 Aug 2014

This is quick post on how to interface enocean Pi to your laptop and use it with openHAB running from your laptop. In this post, I'm using Ubuntu 14.04 as my OS with openHAB 1.5 installed.

 

As my raspberry pi will be arriving a little late, I set out to find out whether it's possible to interface enocean pi to my laptop. Searching on google I found that Enocean Pi module uses only four pins from raspberry pi - VCC 3.3V, TXD, RXD, and GND. It immediately came to me that with an USB to TTL serial converter it is possible to interface the enocean module to my laptop. But there is a small problem -- I need a 3.3V USB to TTL serial converter and what I have is a 5V converter. Either I had to buy new converter or make a simple level shifter circuit. It's sunday so no shops will be open. I thought of postponing my plan to next weekend ( or dump the plan in case I receive my rPi this week ). When I'm about to stop the tinkering for the day, my eyes fell on "Ti Connected Launchpad" which I got as a part of my past roadtest. It is USB programmable and has a debugger too. Can I use it as my USB to TTL serial converter. I rushed to TI connected launchpad site and checked the specifications. PERFECT!!! This guy operates at 3.3V and perfectly fits my puzzle.

 

What all I need to do is to write a small code on Code Composer Studio, compile it and upload it to launchpad. The code will just set up two serial ports in my launchpad -- one I connects to my laptop and other to my enocean pi -- and acts as a serial repeater. And it worked perfectly well. Only problem I faced was I initially set baudrate as 115200 and tried to connect via my serial monitor. Nothing happened. After a few minutes I was able to debug the problem and fix it. image

 

These are a few pics while I was setting up the circuit :

imageimage

imageimage

The last two above are fully assembled circuit along with rocker switch.

With my serial monitor(moserial for ubuntu) I am able to see the hexdump of the communication happening. Only rocker switch is working at this moment, may be others are out of charge.

In my serial monitor, I'm able to get this hexdump while pressing the rocker switch. Each line corresponds to either one press or one release.

// Rocker Switch
//    |*| |
//    | | |......antenna
55 00 07 07 01 7A F6 50 XX XX XX XX 30 01 FF FF FF FF 2B 00 5E     // Press
55 00 07 07 01 7A F6 00 XX XX XX XX 20 01 FF FF FF FF 2C 00 86     // Release
55 00 07 07 01 7A F6 50 XX XX XX XX 30 01 FF FF FF FF 2C 00 35     // Press
55 00 07 07 01 7A F6 00 XX XX XX XX 20 01 FF FF FF FF 2C 00 86     // Release
55 00 07 07 01 7A F6 50 XX XX XX XX 30 01 FF FF FF FF 2B 00 5E     // Press
55 00 07 07 01 7A F6 00 XX XX XX XX 20 01 FF FF FF FF 2B 00 ED     // Release
//    | | |
//    |*| |......antenna
55 00 07 07 01 7A F6 70 XX XX XX XX 30 01 FF FF FF FF 32 00 4A     // Press
55 00 07 07 01 7A F6 00 XX XX XX XX 20 01 FF FF FF FF 32 00 07     // Release
55 00 07 07 01 7A F6 70 XX XX XX XX 30 01 FF FF FF FF 2F 00 F4     // Press
55 00 07 07 01 7A F6 00 XX XX XX XX 20 01 FF FF FF FF 2F 00 B9     // Release
55 00 07 07 01 7A F6 70 XX XX XX XX 30 01 FF FF FF FF 2F 00 F4     // Press
55 00 07 07 01 7A F6 00 XX XX XX XX 20 01 FF FF FF FF 2F 00 B9     // Release

 

In the above dump, I've replaced a few bytes with 'XX'. I'll soon explain what they are. image

 

Next step is to configure my openHAB installation to 'see and hear' from enocean pi.

First make sure that openHAB runtime is stopped.

Now go to '${openHAB_runtime}/configuration/openhab.cfg' file and enable openHAB binding and serial port. In my case with laptop, I've to set 'ttyACM0'. If you are raspberry pi, you may have to set 'ttyAMA0'. Edit the openhab.cfg file and add serial port.( Enocean bindings portion in the file will be usually commented. You can uncomment it and add your port )

image

Now go to '${openhab_runtime}/addons' and make sure that you have enocean bundle in place. Else copy it from the downloaded addons folder to this folder. The file name will be like "org.openhab.binding.enocean-1.5.0.jar"

 

Now open openHAB-Designer and quickly create these two files : "{$openhab_runtime}\configurations\items\model0.items" and "{$openhab_runtime}\configurations\sitemaps\model0.sitemap". Here 'model0' is my site name. Even if you already have a site running from openHAB, this site can coexist with it.

 

And type the following contents to the files :

// model0.items
Group All

Switch Rocker0 (All) {enocean="{id=XX:XX:XX:XX, eep=F6:02:01, channel=B}"} 
Switch Rocker1 (All) {enocean="{id=XX:XX:XX:XX, eep=F6:02:01, channel=A}"}

where you have to replace the XX with your device ID. From the serial monitor hexdump and searching through the web for a while I figured out the position of my device ID in hexdump and reused it here. Although the device ID is supposed to be printed on device, mine had none.

What I tired in the above script is to define my both rocker switches to openHAB. But only channel B is working, the one I defined with channel A is not working at this moment. I don't know what went wrong image

This is the listing for model0.sitemap

// model0.sitemap
sitemap model0 label="Main Menu" {
    Frame label="Enocean Devices" {
        Switch item=Rocker0 label="Rocker 0 Channel B"
        Switch item=Rocker1 label="Rocker 1 Channel A"
    }
}

 

Before starting the runtime, edit 'start(_debug).sh' and add

-Dgnu.io.rxtx.SerialPorts=/dev/ttyACM0

to the command in last line. Remember to replace the port with your USB port.

 

We're all set. Let's start by

$./start.sh

openHAB will display a few messages and will report like

00:45:53.896 INFO  o.o.b.e.i.bus.EnoceanBinding[:290] - Connecting to Enocean [serialPort='/dev/ttyACM0' ].

Now we are good to go. Open chrome web browser( not Firefox! ) and goto this url

http://localhost:8080/openhab.app?sitemap=model0

where 'model0' should be replaced with your sitename.

Yup,we are done. You can see enocean switches listed in UI. Try pressing the rocker switch and see what happens.


Here is a demo video of my laptop working with enocean pi and rocker switch.

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

That's all for now folks, it's 1.00AM here and I've a class to attend at 8.00AM. I'll soon post my experiences with temperature sensor and reed switch.

Happy hacking,

vish


<< Prev | Table of Contents | Next >>

  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube