Updated: Motion Detection

Over 3 years ago I augmented my home security system with a Passive Infrared Motion (PIR) sensor and placed it at the front door. I quickly put together a Python script that runs on a Raspberry Pi (RPi) computer.  Basically it sends and email and triggers a IFTTT event whenever there is movement (detected by the RPi GPIO library) by the front door.

Side note: If you haven’t checked out IFTTT I highly recommend you check it out, there are a LOT of really cool things you can do with it.

There has been an issue with the sensor sending multiple text messages per “event”. This is due to how I wrote the code to handle the event detection with a callback. This would allow for multiple events / threads to be fired per movement in rapid succession. There are many ways I could handle this issue.

  • I could do some low level locks around the global variable
    • pro: control the date variable that’s being used by each thread
    • pro: very granular level of control
    • cons: more difficult to code
    • cons: more prone to errors
  • I could add all events into a global in-memory and loop on the main thread over the queue
    • assumption: there is a thread safe in-memory queuing library in Python
    • pro: easy to code
    • pro: could add extra functionality easy per event (e.g. logging messages)
    • con: need to find a thread safe queuing system
    • con: might be overkill
  • I could listen to different events that don’t run on a seperate threads
    • pro: after looking over the RPi GPIO (General Purpose Input Output) documentation again. It seems there are other events that might be more suited to the task.
    • cons: the events I’m looking out would likely miss the extra events that are triggered, but who cares! 🙂

I’m leaning towards the last option. I’ll start with that one tomorrow and see how it goes, and update the blog soon.



Okay, so updated the code. Haven’t checked it into GitHub yet and it is working well. I’m not getting the multiple notifications within the same second. However, I’m still get false positives on occasion. So since this is hardware, I thought maybe something is up with the voltage. Especially, since my RPi is about 40+ feet from the PIR sensor. I got the multimeter out and it was reading a constant 3.2V, so I think that’s fine. What I did notice was the connections were pretty loose, so I tightened those up a bit and we’ll have to wait and see if I still get those false positives.



Linear advance

If you have a Prusa i3 MK2 or later, since April this year the latest drivers/firmware were released that allowed for linear advance. What does this mean? It’s an algorithm that allows you print faster with the same and/or better quality that slower prints. Okay, that’s a bit overly simplified, but if you’d like to read more I’d go to this article by Matt Harrison.

Here is an example below. I printed this at 90mm/s and this was before I cleaned up the supports. This is Ziro Marble PLA I purchased from Amazon for $22 for a 1kg spool. Pretty good price and the print turned out great!

New to 3D Printing?

Here are a list of tips I’d give to anyone looking to getting into 3D printing or has just recently purchased a 3D Printer.

Watch a LOT of YouTube / Facebook

There are a LOT of resources for learning how to 3D print and one of the best is YouTube. Here are just a few people I would recommend you follow:

Keeping filament dry

  • Store your filament in dry place. I’m not just saying this… DO IT! I learned the hard way. I had a bunch of different filaments and I was having a hard time figuring out why my prints were turning out poorly. Finally, after drying them with a food dehydrator and putting the in a dry box. I’m getting really good prints.
    • Filament is hygroscopic, it absorbs moisture from the air and will mostly likely over time cause poor performance (here is more information)
    • I’ve created Containers that I can print from they only costed about $25 a piece to make and I can hold around 4-5 rolls of filament in a box. Here is a video from Thomas Sanladerer demonstrating how to create a dry box.  I based my box off of his.
    • If you are just starting out I’d do this right away, then you won’t need to a food dehydrator later. However, if you want too… you can learn more on this page and there is a table with settings for drying your filament.


  • If you are printing with ABS you’ll want an enclosure. ABS is really sensitive to a temperature change. If you’re printing in a relatively cool place, the print will cool too quickly and cause warping and layer separation.
    • Added bonuses of an enclosure is less fumes and quieter printing.

It is getting late, so more to come soon.

Olsson Ruby Nozzle

So a while back I purchased the Olsson Ruby nozzle. I print a few exotic materials like MatterHackers ABS Greenglow, Proto-Pasta’s #Highfive Blue, and I just purchased Ziro’s Marble. Since I was planning on printing more and more exotic filaments (e.g. Carbon Fiber). I decided it was time to upgrade my nozzle. It was pretty easy actually.

Most of the instructions came from the Olsson Ruby website support instructions.

  • First thing I did is print a torque wrench for installing the new nozzle. This is a very cool model and it turned out great.
  • Then I followed the Prusa i3 MK2 steps for replacing the nozzle (here).
    • However, I would suggest doing steps 1-5 first, then heat up the extruder before removing the nozzle.
  • Using the new torque wrench I was able to quickly install the new ruby nozzle.
  • Lastly, I ran a test print and adjusted the live z settings.

So far so good. I’ll keep you updated.

Here’s my story…

I’m a Pacific Northwest native. I grew up in the greater Portland metro area and currently reside in Vernonia, Oregon.

I’ve always had a passion for computers. When I was in the 2nd grade my father purchased the “Trash 80” (i.e. TRS-80 or Tandy Radio Shack 80 personal computer). I remember getting magazines with pages and pages of code. I would spend hours typing in that code into the computer and was AMAZED with the results. I was HOOKED!

For the past 19 years I’ve worked in software engineering. I continue to learn and evolve my craft. Taking online training classes from Pluralsight to building a home security system using a RPi. I enjoy programming at home and work.

I try to find a balance by playing tennis and doing home improvement projects around the house.

I’m a father of four and between them, projects, and work they keep me busy.