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
Internet of Things
  • Technologies
  • More
Internet of Things
Blog Connecting a Laser Doorbell to the Cloud
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Internet of Things to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: DaveYoung
  • Date Created: 7 Jan 2015 10:25 PM Date Created
  • Views 2947 views
  • Likes 3 likes
  • Comments 4 comments
  • xively
  • rpiintermediate
  • doorbell
  • xbee
  • raspberrypi
  • internet-of-things
  • arduino
  • laser
Related
Recommended

Connecting a Laser Doorbell to the Cloud

DaveYoung
DaveYoung
7 Jan 2015

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

Earlier this year I released the design for my laser tripwire doorbell. A handy device that does a great job of letting me know when someone arrives at the house. It’s been wonderful because it trips even if the doorbell is not pressed (e.g. for the mail) and it swaps an annoying tone for a pleasantly silent blue LED. While accumulated snow will render it useless, it has been working really well!

As a businessman I finalize designs and release them so they can be trusted by others and I can be seen at the finish line. But in reality I share the notion of every engineer that a design is never truly done.  My doorbell project is no different. Sure, I get an LED notification in my lab when someone approaches my door. But what if I’m not around? What if I’m at the gym and I don’t want to come home until I get the mail/package that I’m expecting? Clearly, this device is perfectly positioned to become another Internet of Things product. Maybe I’ll be able to sell it to some Wall Street speculator that can’t find enough ‘hype investments’ to buy! Ha!

 

Before I get started on this mod to my design, I’ll say that if I was to design everything from scratch, I’d buy an Electric Imp , set it up with the same laser circuitry, and push data to the cloud all with one device. But since I’ve already got my current Xbee/Arduino system tested and running on my desk, I’m going to use my Raspberry Pi with Xively to serve my data. My favorite feature about companies like Xively and Electric Imp is that they take care of the server for me which allows me to maintain the security of my network by not requiring any special ports opened or forwarded. That was a real problem with my Rpi sever setup that I used for my dog kennel status sensor.

 

This project will take us through 4 steps:

  1. Setup the Pi to communicate with Xively using their Tutorial.
  2. Modify the standard python script to read the IO signal from the Arduino
  3. Modify the Arduino code to pulse an IO pin on a laser trip event
  4. Determine a way to get the Xively information easily on my smartphone

 

Step 1: Setup the Pi to communicate with Xively

There is nothing I have to add to Xively’s tutorial, so I suggest following what they’ve got with a fresh Raspian SD card in the Pi which I link to at the end. However if you are planning on dedicating the Pi to this project (as most people do), I would (and did) skip the following two steps that create a dedicated environment. It will still work in the environment, however it has to be activated before the application can run.

$ virtualenv .envs/venv               %I wouldn't bother creating an environment

$ source .envs/venv/bin/activate      %If the environment isn't created, it doesn't have to be activated.

 

Step 2: Modify the standard Xively python script to read the IO signal from the Arduino

Thankfully, reading an IO pin on a Rpi is pretty straightforward. However the RPIO library needs to be installed to the environment that will run the program (The Xively tutorial has you install it to a specific environment, so either the Xively program needs to be setup in the home environment with RPIO, or RPIO needs to be installed into the specific environment with Xively).

$ sudo easy_install -U RPIO

I have uploaded my python script in this article for anyone to use.  Basically,it is a modification of the Xively tutorial script where I monitor GPIO 17, and when that pin goes HI I update the datastream with 'TRUE' and then 5 seconds later I read the GPIO pin again and update the stream with the value (which should be 0 if the person has left). It then sleeps for another 10 seconds and goes back to watching.


Note that because the Pi runs on 3.3V and the Arduino outputs 5V, I had to add a resistor divider to be sure the Pi's GPIO won't fry. Check out the schematic attached to this article to see exactly how I connected it.


In order to run my script, I enter the following over SSH to my Pi:

$ sudo FEED_ID=<my Feed ID> API_KEY=<my API key> DEBUG=true python dyoung.py

Here is a screen shot of my Xively dashboard for this project, where the 'stat' variable is TRUE for 5 seconds when the laser tripwire is triggered:


image


I also suggest using FileZilla to send files to the pi over the network in case you’d like to update the python script multiple times for debugging. There’s a great resource linked below that shows how to get that set up.

 

Step 3: Modify the previous Arduino code to communicate with the Rpi

This is a remarkably easy step since the program is already written to respond to the laser trip event and let the Rpi take it from there. All we have to do is:

  1. Create an additional I/O pin variable (in my case, pin 8) by declaring the ‘rpiPin’ variable
  2. Create an additional variable ‘RpiTime’ to set the number of milliseconds that pin 8 should remain hi on a laser trip event.
  3. Configure pin 8 to be a digital output pin
  4. Add a line of code to make pin 8 hi in the if statement that handles the laser trip event.
  5. Add a line of code to delay for ‘RpiTime’ ms after pin 8 goes hi
  6. Add a line of code to turn off pin 8 after the delay is complete.

 

Step 4: Determine a way to get the Xively information on my smartphone

I thought that I was going to have to login to the Xively website using my phone’s browser, but I found a Xively Feed Client app for Android which only cost $1.60. Once I set all of my project’s Xively parameters, I was up and running! It would be nice to be able to set Android notifications if the variable changed states, but for $1.60 I can’t complain. Here is a screenshot of the app which shows 'true' each time the laser is tripped, as well as the reset to '0' 5 seconds later.

image

Conclusion:

That’s everything it takes to get your very own cloud-enabled doorbell! I’ve got a little bit of usage under the keel, and it has been a real improvement! It’s a pretty snazzy setup. Let us know in the comments if you build one yourself.

 

Full Project Documentation Attached to This Article:

ZIP file of all documentation: 'Full Cloud Laser Doorbell Documentation.zip'

Schematic (EAGLE and PDF format): 'Cloud Laser Doorbell Schematic.zip'

Cloud Laser Doorbell Arduino Source Code: 'DY_Doorbell_Code_xi.ino'

Python script for the Raspberry Pi: 'dyoung.py'

 

Helpful Resources and Links:

Xively Tutorial

Nice description of RPIO library

Xively Android App that I used

How to use Filezilla to transfer files to an Rpi

Attachments:
Full Cloud Laser Doorbell Documentation.zip
Cloud Laser Doorbell Schematic.zip
dyoung.py.zip
DY_Doorbell_Code_xi.ino.zip
  • Sign in to reply

Top Comments

  • jw0752
    jw0752 over 10 years ago +1
    Hi Dave, This is a very nice project and very well presented. I hope your investment banker comes through. John
  • DaveYoung
    DaveYoung over 10 years ago in reply to jw0752 +1
    Ha! Here's hoping. Maybe calling the idea out as silly may not be the best marketing approach .
  • DaveYoung
    DaveYoung over 10 years ago in reply to deepankarmaithani +1
    The app that I used is on the play store (but you have to pay for it). Here's the link again: https://play.google.com/store/apps/details?id=com.ingamedeo.xivelyfeedclient&hl=en
  • DaveYoung
    DaveYoung over 10 years ago in reply to deepankarmaithani

    The app that I used is on the play store (but you have to pay for it). Here's the link again: https://play.google.com/store/apps/details?id=com.ingamedeo.xivelyfeedclient&hl=en

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • deepankarmaithani
    deepankarmaithani over 10 years ago

    @Dave Young Is that app also there on the playstore or is it going to be shared ?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DaveYoung
    DaveYoung over 10 years ago in reply to jw0752

    Ha! Here's hoping. Maybe calling the idea out as silly may not be the best marketing approach image.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • jw0752
    jw0752 over 10 years ago

    Hi Dave, This is a very nice project and very well presented. I hope your investment banker comes through.

    John

    • Cancel
    • Vote Up +1 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