Close
0%
0%

Captain Pugsley - Smart motion sensor

Smart wifi connected motion tracker & iOS app with a personality!

Similar projects worth following
Captain Pugsley has a mission to make sure who's home. He's a small device connected over your home wifi network that notifies you when there's motion. From the iPhone app you can then give further commands such as continuing giving reports for motion or turning off further alerts.

There are a lot of PIR sensors, connected and not. Some have further functionality such as taking photos. They all are fairly technical or boring though, Captain Pugsley takes care of all the technical details under the hood and gives the user a delightful interface.

High level system diagram:

Captain Pugsley has quite a stressful job so he'll try to sleep as much as possible, conserving previous resources (battery). Motion detected by the PIR will trigger an interrupt that wakes up the mcu to try to determine if it was a false alarm or not (settings can probably be adjusted from app). If somebody's there it'll send a push notification to the app. Ideally it'd try to determine if this person is allowed or not too but it looks like we can't access the ARP tables on the CC3000 to determine other devices on the network. I'll have to figure something out here.

In between there's the command center online to act as the bridge between the app and the device. This will most likely be based on nodejs, express, mongodb etc. It will log past events so the app can show them any time even if Captain Pugsley is sleeping.

  • First prototypes assembled

    akupila08/24/2014 at 11:15 0 comments

    With a box of components from Digikey, my trusty solder paste and the correct boards i set out to assemble a prototype to test the functionality.

    Generally i tend to remove all reference designators from the board as i want to make the board pretty. Instead i have the schematic & design open on my laptop while assembling. I then tick off items one by one in the BOM once placed on the board.

    First the .. bad :)

    1) I thought i had MAX17048 in stock already in my lab. I've used this chip before but apparently i had ran out. This chip is used to measure the remaining charge in the battery so i could get a notification that the power is running low. After all what's the point of a security device that's out of battery? Turns out i didn't have these in stock but for the first prototype this isn't critical so i simply left the component out.

    2) The reference design for the CC3000 antenna matching includes a 10pF capacitor. I accidentally had marked this as 10uF (that's only 1000000 times too big..) and hadn't ordered the correct 10pF cap. During assembly this of course was quite obvious and i put in the closest thing i had which ended up being a 15pF cap. Without any network tools available i had to hope for the best knowing that at minimum the reception would be degraded. Turns out 10x sanity check should have been 11x.

    3) The EKMC1603 PIR sensor datasheet was a bit unclear and i left out a pulldown resistor on the output. 

    For commercial work i always use a stencil but i didn't feel like paying or waiting extra for it in this case. This made assembly much slower but still everything went well with only minor rework required. 

    Tested so far:

    1) MCU works fine. Programming is all good and i can get the lights to blink (these lights will act as a status indicator to display things like wifi connectivity, low battery etc). There is a small issue when sometimes the programming fails and i've pinned this down to being caused by the CC3000. Trying to be smart by actually disabling the power for it may turn out to be a bad choice..

    2) PIR senses motion great (after a 10k resistor soldered across OUT and GND). The datasheet states a 30sec startup period with random activity after which it should be stable. Funny to test a PIR sensor when instead of sitting in front of a laptop and lab equipment you have to hid behind doors and walk around. As expected fully sideways the detection isn't super accurate so most likely this can't be placed on a table pointing upwards.

    3) Power works great. The circuit has a soft on switch that turns on the MCU which then keeps the power alive until i want to shut down from software. The power is nice and stable with only 20mV or so noise. The battery input isn't as stable though, should probably put a ~4.7uF ceramic cap on the input (as stated by the datasheet, d'oh).

    4) Wifi can connect and get an IP with DHCP. That's pretty much where it ends though. While i haven't tested this extensively yet (could be software related) it seems like the 15pF cap is causing issues. I could try to simply replace it with a 0 ohm resistor to see if this improves, we'll see. Another thing is the trace antenna which by the numbers is good but i haven't seen in any other CC3000 designs. Further testing is required to pin down the issues though

    <CC3000 rant>

    After some research it seems like TI has removed all references to the CC3000. Wtf? Also a lot of people seem to be complaining about the issues which are firmware and/or hardware related. TI is dropping the ball and not responding, only touting their new CC3100 and CC3200. Changing to another one isn't a trivial task but it seems like the CC3000 won't be long-lived. Not cool, TI, not cool.

    </CC3000 rant>

    Another issue seems to be the PIR sensor which seems great in every way except availability. The usual suspects (Digikey, Farnell, Mouser) all have 0-stock with new ones arriving months from now. Changing to something else would be fine except a lot of the industrial design depends...

    Read more »

  • Correct boards received!

    akupila08/19/2014 at 21:30 0 comments

    Ha! Right after posting the intro video i received the boards. OSH Park did a great job fixing the mistake at the fab and shipped them with express shipping. Can't beat good service.

    I ordered the parts from Digikey and should receive them in the next couple days. Hopefully i can assemble one of these guys in the weekend.

  • Intro video added

    akupila08/19/2014 at 21:19 0 comments

    Tired and akward in front of camera but still here's a short 2min video presenting the project. It's quite brief of course but gives a high level overview. Have a look :)

  • Hardware files on GitHub

    akupila08/14/2014 at 20:58 0 comments

    Needs cleanup, verification and probably other kinds of love but in case you're curious: https://github.com/akupila/Captain-Pugsley

  • PCB prototypes received..with a 'but'

    akupila08/14/2014 at 20:33 0 comments

    D'oh! Something happened at the OSHPark fab and the boards weren't cut out correctly. Only the milling was wrong (electrically they should be ok) and they were quick to re-submit the board to a new panel without my intervention (go OSHPark!). Being in Europe the shipping still adds quite a delay.

    I could assemble the boards i got but as the new ones have already been sent i'll wait for them.

    Here's a pic anway. I like the way the exposed PCB antenna looks :)

  • Hardware design decisions

    akupila08/14/2014 at 20:20 0 comments

    Captain Pugsley is a battery powered motion sensor connected using wifi. Here are some high level design decisions for the various parts. More details will follow once i've validated these things to work (still waiting for PCBs). The Rev A PCB is a 50mm diameter round PCB with everything fitting quite nicely.

    Battery

    Lithium polymer battery. Charging circuitry and fuel gauge on board, charging using USB or similar.

    Wifi

    CC3000. The W23 from Atmel looks interesting but not available yet. The CC3000 has a lot of code already (yay Adafruit!) and seems great for this application. For the antenna i'm experimenting with a 2.4Ghz trace antenna (TI DN0007), we'll see how that turns out.

    Motion

    Initially i was considering using a raw PIR sensor and doing the amplification myself. However my analog design is pretty much as good as my French (pas très bon) i decided to go with an integrated sensor instead. Given the low volume the higher cost won't have much of an impact considering the risk of something going wrong. Panasonic's EKMC1603 turns out to be perfect. It has a digital output. The downside is that it's quite difficult to find but on the upside it comes in black and white.

    Power supply

    Nothing crazy here, just need to cover the power consumption of the CC3000 during transmission. Keeping everything at 3.3v lets me run of a single power rail. An LDO could work (from 3.7v LiPo) but i decided to go with a switching supply based on TPS62203D. I have plenty of board space for the inductor so size isn't an issue. We'll see how this pans out.

    User interface

    All configuration is done using the iPhone app. However before this it needs to connect to wifi and it'd be good to know what the status of the connection is. For this i added two leds that will shine out right next to the PIR sensor. They're connected to timer outputs so we can do some nice fading lights. During normal operation these would be off though, both to save battery life and probably more importantly not have a bit "look at me" light on the secret motion tracker..

  • Huh? Wtf? Where did this come from?

    akupila08/14/2014 at 19:57 0 comments

    Because me and my girlfriend are lazy we have a cleaner who comes every two weeks. We pay for 2.5h but sometimes things were still spotty so we were wondering if they're actually here all that time. After "can't your just build something to figure that out" + a couple hours i had a proof of concept that sent me SMS messages every time the cleaner was there and left. My 15min algorithm for tracking presence wasn't exactly perfect and i ended up getting hundreds of "THE MAYANS ARE COMING!!" SMS messages. I ended up paying for all of these but found out the cleaner was there 2:27 (her name is Maya).

    Having worked previously on a project requiring cellular connectivity i used the SM5100B. The datasheet is notoriously incomplete/wrong here so i had fought through a lot of issues to get things running. Because of this i already had the basic building blocks for connectivity and it was trivial to just add a PIR sensor. 

    For Captain Pugsley i wanted to improve on a couple things:

    1) Wifi instead of cellular (free)

    2) Nicer form factor (no Arduino wire mess)

    3) More reliable & accurate

    4) Option for remote control

    5) Keep the attitude!

    For motion tracking PIR was a fairly obvious choice. They're cheap, reliable and easy to use. The PIR requires a lens though which would have to be visible. I took this as a design opportunity and started thinking of options that include a dome. A UFO came up fairly quick. Inside this small UFO is Captain Pugsley who's sole mission is to monitor your house. Perfect!

View all 7 project logs

Enjoy this project?

Share

Discussions

akupila wrote 05/21/2015 at 09:16 point

@Roeland Kindt Yeah i think nRF24L01 would work great but my whole idea was not to have something else to receive the signals. With wifi i have an easy connection to send push notifications to my phone directly. Perhaps overkill but i was curious to try the CC3000 (and now will never use it again..)

  Are you sure? yes | no

Roeland Kindt wrote 05/21/2015 at 07:42 point

Hi,
I am wondeirng wouldnt you make it around nRF24L01, the processor is capable of doing most of the heavy lifting. You would only need to create a pcb for the PIR sensor and the battery checking.

  Are you sure? yes | no

Tomas Holmqvist wrote 08/21/2014 at 20:23 point
Hey, nice. I used something similar (commercial hw) when in school. I implemented a tracker on a network of those things. Although the primary function of localization didn't really get that accurate. https://www.nada.kth.se/utbildning/grukth/exjobb/rapportlistor/2006/rapporter06/holmqvist_tomas_06007.pdf

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates