Jump to content

Wireless security system + IoT

Recommended Posts

So I've been meaning to work on something for this for quite some time, but I finally bit the bullet and started.  


I'm designing a wireless security system - with the intention that it'll upload data to a personal API I'm developing.  It started out as purely a security system (door open/closed, motion detection) - but I threw in some sensors while I was developing the boards.  This isn't intended to replace a real security system - but it's a fun practice on many levels.  I'm working on learning the CC3200, setting up a node network, etc.  


Wireless devices consist of MSP430's and a NRF24L01+ (cheap - had a few on hand).  


Door sensors will probably be 2452's - they're very basic.  Run by a coin cell.  I purchased some cheap magnetic door/window sensors on ebay.



Motion sensors will run a 2553 and contain several other sensors.  These will be run on 2xAA's.  

I've added a temperature sensor (TMP102), light sensor (same as the one I used on the badge), and volume circuit (not to capture audio - just room volume levels - based on a sparkfun breakout).  

It's designed to support a 20 pin DIP 2553 or a 28 pin TSSOP if extra IO are needed.

Motion sensor is the cheap PIR sensor board from eBay - I'll be taking off the voltage converter because it runs at 3v levels




I've got a ton of work ahead of me - here are just a few things off the top of my head

  • Sensor unique identification (ideally I'd like the sensors to auto-id themselves)
  • Set up the CC3200 as a hub
  • Easily accessible web services (I'll be writing this in .NET most likely - although I may consider a local phant.io install) + a decent database
  • Visualization of sensor output
  • Alerts
  • Security - not a huge concern (not sure who would hack it) but I want to consider it - likely a later phase

One thing I'd like to add - RFID for arm/disarm of the system.  I've got some RFID boards on hand - should be able to whip up something.  


Cases for the sensors will be 3D printed.  Should be pretty simple to do but it'll be a good exercise in designing nice & accessible cases.  I'll probably add an easily-accessible programming header for easy updates.


I'll post the eagle files + gerbers later.  If you're really itching to see them - let me know.

Link to post
Share on other sites

Seriously, Access can make those diagrams. There's nothing wrong with nice diagrams ;-)


In fact, I've known people to use PowerPoint for technical drawings. That too is laughable. ;-)


I do my database design in a spreadsheet because it's trivial to upload that right into mysql with an import command. Easy peasy.

Link to post
Share on other sites

Hi cubeberg, very cool project!  My project, imp.guru connects to the phant.io service at data.sparkfun.com, the API has been very simple to use.  I do think that phant.io will be a great data backend for your sensors.  My advice would be to keep the sensors as dumb as possible, just let them push data out to the web then build your security logic as a web application.  


Personally I'm not too crazy about .net but I guess to each their own...  My issue is that there is not as much open development going on with C# .NET as there is with something like node.js.  Ruby or Rails is decent but I don't even know it that would be the best fit.  The things that you mentioned about data modeling, migrations and seeding are all things that Rails does easily, I don't know as much about the node ORM but I would hope so...


As far as I know, phant can use mongoDB out of the box which IMO is the best solution for storing the sensor data, then I would use a relational database for the security logic piece.


In the last few days I've been trying to get MQTT streams working using a project called MOWS, this is something that is built into phant already.  You can see it work when new rows are inserted into the tables, check out https://data.sparkfun.com/streams/8dX9xNz1m3sOv044oz1m.  If you are a clever javascript debugger in chrome you can even step through the code.  (see phant-manager.js line 10453 after you unminify the code)  So in this example, you can attach a javascript function to fire every time that a sensor event happens.  Using this event driven design, you could do some pretty cool things.

Link to post
Share on other sites

@@Lgbeno - I'm a C#/.NET developer so that's the reason behind the technology choice, and I'm partially using this as an excuse to learn some new tools.  However - there's a good chance I may use something like phant.IO as a simple data service to start off while I'm working on the CC3200 end of  things.  I've also considered the problem with sharing the project since not a ton of people will be interested in .NET as they'd be looking for a less expensive alternative - I understand that there may not be a ton of interest.  

The issue with using something like phant.io as the back-end - in order to act off of any of the data (such as a possible intruder) - you'd need something polling looking for problems - rather than have the logging layer watching for exceptions.  


That being said - using something like SQL for the back-end for multiple sensors makes for a challenging database design - as opposed to Mongo that doesn't care about the data structure.  


Ideally - I'm hoping that whatever I design from the CC3200 + sensor standpoint could be easily adapted to Phant.io, etc.  I'm planning on making it flexible and probably providing some alternative upload options like phant.io.

Link to post
Share on other sites

I understand, the best tool for the job is something that you are already comfortable with.


It probably got lost in my tangled web of a explanation but phant can actually support event driven messaging so there would not be the need for polling.


I doubt that you will ever get to the point where one security installation will choke SQL so that is all good.


In the case of electric imp, making web connected sensors is really easy, only about 10 lines of code.


I just finished an update to imp.guru that has this event driven update check it out here: http://imp.guru/fq

Link to post
Share on other sites
  • 4 months later...

So I recently tried to get a solution up and going on Azure.  Worked great until I realized that the lower-cost and free options were limited by CPU time (I think the "free" option was 5h) and the next level up with 100% uptime was $56 a month.  So - scrap that idea.  I might still see about doing something with .NET, but I'd have to set up a computer at home for cost purposes.  


I'm going back to sparkfun's Phant and data.sparkfun.com service.  I've been working with @@Lgbeno a bit on his imp.guru site as well as some new stuff he's cooking up.  Visualizations are great - gives me a way to look at sensor activity.  


I still need to post some information on my sensors - I'll try to get pictures up soon.  As of last night - I've got two door sensors (also transmitting temperature, battery and light levels) as well as three motion sensors (again, transmitting battery, temperature and light).  I've got 3D printed enclosures for both sensor types, although the enclosure for the motion sensor is way too large - I need to redesign to conserve filament as well as reduce bulk.

Link to post
Share on other sites
  • 4 weeks later...

Hey @@cubeberg Thanks for the message!  Sorry I've been so busy I haven't been on 43oh in awhile.  Also I usually access it via Tapatalk and for some reason, I'm discovering that it really doesn't work.


Anyway I think that it is about time that I talk about the new project that you were talking about :)

I started a separate thread http://forum.43oh.com/topic/6414-analogio/?p=54698


I'd love to talk to any one else on the forum who is interested in testing out the site.



Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...