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
Pi IoT
  • Challenges & Projects
  • Design Challenges
  • Pi IoT
  • More
  • Cancel
Pi IoT
Blog Pi Control Hub:Spoke 2:Blinds Automation-- Setting up EnOcean Sensor and Blinking LEDs
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: carmelito
  • Date Created: 3 Aug 2016 10:53 PM Date Created
  • Views 901 views
  • Likes 5 likes
  • Comments 4 comments
  • fhem
  • en ocean
  • picontrolhub
  • piiot
  • enocean
  • enocean sensor kit
  • raspberrypi
  • piiot challenge
Related
Recommended

Pi Control Hub:Spoke 2:Blinds Automation-- Setting up EnOcean Sensor and Blinking LEDs

carmelito
carmelito
3 Aug 2016

This blog post is a prerequisite for the Blinds Automation spoke. As part of this spoke we will automate the opening and closing of the blinds using the EnOcean Push button switch module connected to the Raspberry Pi B+.In this blog post we will attach EnOcean module to the Raspberry Pi B+ and create a simple circuit  to light up LEDs as shown in the video below, when a energy harvesting sensor are used, that is PushButton switch(PTM210) ,Magnet Contact Transmitter(STM329) and the Temperature sensor(STM332). We will also have to install FHEM home automation server and run the python program below,which takes advantage for the FHEM server telnet port.

 

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

 

Here are are the steps you will need to follow to blink the LEDs when you click the Push button/Magnetic Contact sensor and when temperature is detected by the temperature sensor.

#1 Create a simple cuircuit

     Connect the EnOcean module to the Raspberry Pi B+

     And then connect the LEDs to the following pin on the Pi B+, you will also need a 330 ohms resistor

  •     Blue LED  to pin 6 on the Pi B+ , this corresponds to the one side of the push button switch, basically the side on which you see a small piece of blue tape in the picture below,basically when  you click on the  blue tape the LED is turned on and when you click on the opposite site the LED is turned off
  •     Green LED to pin 12 which corresponds to the other side of the button
  •     Yellow LED to  pin 13, this LED goes on when the magnet is in contact with the Magnetic Contact sensor
  •      Red LED to pin 16, this LED is turned on when temperature reading is received by the FHEM server

 

image

#2 Installing FHEM

      To install FHEM start of by updating the software and firmware on the latest version of Raspbian (the latest version of Raspbain when writing this blog is 2016-05-27-raspbian-jessie.img)

        sudo apt-get update

        sudo apt-get upgrade

 

      Remove the references to /dev/ttyAMA0 from the /boot/cmdline.txt file

      sudo nano /boot/cmdline.txt

      Comment out the top line and add line

      dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait

image

     Install the dependencies for FHEM

     sudo apt-get install perl libdevice-serialport-perl libio-socket-ssl-perl libwww-perl

 

     Get the latest deb from the fhem.de website

     wget http://fhem.de/fhem-5.7.deb

 

     Install the deb

     sudo dpkg -i fhem-5.7.deb

    image

       Get the IP address of the Pi using the ifconfig command and check if FHEM server is up and running

      image

#3 Check out the Event Monitor of FHEM server webpage above, to check if the sensors are detected when you click the push button and the other sensor

image

In addition check out EnOcean Tab, where you should see all your sensor detected.

    image

Note: In the screen shot ignore the second record under the Switch section, this is an extra push button switch, which I received in another kit .

In addition , if you receive the following when you press the button on the temperature sensor ""No EEP profile identifier and no Manufacturer ID"-wait for the sensor to charge, it took the sensor about 4-5 mins before it returned a reading.Also this is my first time using the enocean kit , so do leave a comment if there is way to resolve this image..

 

For more info refer to the pdf at - http://www.enocean.com/fileadmin/redaktion/pdf/white_paper/wp_Raspberry_talks_EnOcean.pdf

 

#4 Run the program below to light up the LEDs as shown in the video above

      Copy paste the code below  to you Pi using nano

         sudo nano LedButtonMagnetTemp.py

      run the python program using

         sudo python LedButtonMagnetTemp.py

Here is output once the PushButton switch(PTM210) pressed at all the 4 ends,and the magnet is brought close to Magnet Contact Transmitter(STM329) and the Temperature sensor(STM332)

image

 

File name : LedButtonMagnetTemp.py

import telnetlib
import RPi.GPIO as GPIO
import time
#Connection details to the fhem server installed on the same Pi
#For the telnet details check out URL - http://IpAddressOfPi:8083/fhem?detail=telnetPort
HOST = "127.0.0.1"
PORT = 7072
tell = telnetlib.Telnet()
#Connecting to the fhem server
tell.open(HOST,PORT)
#Send command to intiantiate fhem server to get the data
tell.write("inform on\n")


def string_after(s, delim):
    return s.partition(delim)[2]
#LEDs connected to the following pins on the Pi, in addtion to the Enocean module
fullBlindLedPin = 12
halfBlindLedPin = 6
doorLedPin = 13
isTempLedPin = 16
GPIO.setmode(GPIO.BCM)
GPIO.setup(fullBlindLedPin,GPIO.OUT) #Green LED
GPIO.setup(halfBlindLedPin,GPIO.OUT) #Blue
GPIO.setup(doorLedPin,GPIO.OUT) #Yellow
GPIO.setup(isTempLedPin,GPIO.OUT) #Red


try:
 while True:
        #get the value after the carriage return
  output = tell.read_until("\n")
  #Check the value of the button press of the Pushbutton Transmitter switch module - blinds open close
        if "channel" in output:  
  print output
  if "A0" in output:
  GPIO.output(fullBlindLedPin,GPIO.HIGH)                       
  print "Button 1 pressed"
  if "AI" in output:
  GPIO.output(fullBlindLedPin,GPIO.LOW)
  print "Button 2 pressed"            
  if "B0" in output:
  GPIO.output(halfBlindLedPin,GPIO.HIGH)
  print "Button 3 pressed"
  if "BI" in output:
  GPIO.output(halfBlindLedPin,GPIO.LOW)
  GPIO.output(isTempLedPin,GPIO.LOW) # Also reset the Temperature LED.
  print "Button 4 pressed"
        #Check the value of the Magnet Contact Transmitter module - Door open close
  if "contact" in output:
  print output                      
  if "closed" in output:
  GPIO.output(doorLedPin,GPIO.HIGH)                     
  print "Mangentic contact closed"
  else:
  GPIO.output(doorLedPin,GPIO.LOW)
  print "Magenetic contact open"
        #Checking the temperature sensor
  #if you get the error-No EEP profile identifier and no Manufacturer ID -wait for the sensor to charge
  if "sensor" in output:
  print output
  GPIO.output(isTempLedPin,GPIO.HIGH)
  delim = "temperature:"
  print string_after(output, delim)
#clean up GPIO when exiting out of the program using ctrl+C
except KeyboardInterrupt:
  GPIO.cleanup()

 

 

And for more cool projects/blog post using the EnOcean Sensor Kit refer to the Forget Me Not Design challenge at - Forget Me Not Design Challenge

  • Sign in to reply
Parents
  • balearicdynamics
    balearicdynamics over 9 years ago

    Hi Carmelito, Did you used a PI2, is true ?


    As far as I know there are some issues in the several parts, are you dure that the described installation worked fine without issues? What version of Fhem did you used, the last 5.7 or the 5.5 version linked on the E14 EnOcean documentation ?

     

    Enrico

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • fvan
    fvan over 9 years ago in reply to balearicdynamics

    Enrico Miglino wrote:

     

    Hi Carmelito, Did you used a PI2, is true ?

     

    According to the post, it's a Pi B+ image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
Comment
  • fvan
    fvan over 9 years ago in reply to balearicdynamics

    Enrico Miglino wrote:

     

    Hi Carmelito, Did you used a PI2, is true ?

     

    According to the post, it's a Pi B+ image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
Children
  • carmelito
    carmelito over 9 years ago in reply to fvan

    Hi Enrico,Frederick

    I used the Pi model B+, this was the second Pi which I revived as part of the challenger Kit.In addition, i live in Canada  and received the Enocean Pi 902MHz transceiver..

    Thanks - Carmelito

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
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