
I made a cheap home motion sensor and controller - StavrosK
https://www.stavros.io/posts/building-cheap-home-sensorcontroller/
======
zyxley
For people looking to do interesting things with MQTT messages passing between
devices, take a look at Home Assistant.

[https://home-assistant.io](https://home-assistant.io)

You can use it to integrate various 'smart home' devices, generic MQTT
messaging, and a variety of web services.

~~~
StavrosK
Home assistant looks great, I had installed it a while ago but didn't have
time to really configure it. I should go back and devote some more time,
thanks for the mention.

~~~
gh02t
I've been using it for a while and quite like it. it isn't as flexible as
OpenHAB, but I actually think that's a positive because it is a million times
simpler to set up and tweak. Home Assistant really feels like the fully
realized version of the various scripts and dashboards I had made myself
before finding it.

~~~
StavrosK
Yep, I'm going to change all my embedded controllers to be compatible with it
and blog about it. Home Assistant also led me to OwnTracks and I love that
too.

------
girkyturkey
Wow, I really liked this article. The entire process looked great and the
explanation was rather simple.

~~~
StavrosK
Thank you! I was afraid it didn't contain enough code, or enough interesting
bits. I'm glad you like it! You can take a look at the code on Github,
hopefully it'll be easy enough to understand (it's a bit ad-hoc, so I don't
know how much sense it will make to others).

~~~
roymurdock
I liked the use of the Expounder tool as well. Less work than jumping up and
down to read footnotes, the explanations were well-written and fit into the
article flow, and the animation was quick but nice. Nicely done!

~~~
StavrosK
Thank you! I hate footnotes as well, so that's part of why I made Expounder.

------
ParanoidShroom
That looks awesome! I made a similar thing:
[https://medium.com/@christophe.smet1/flux-irl-building-a-
hue...](https://medium.com/@christophe.smet1/flux-irl-building-a-hue-clone-
bd62df85a456) Would you be interested in a collaboration ?

~~~
csytan
I'm working on a project like this as well!

Still in the early stages -- I just got my parts. I'm planning on using the
ESP8266 chip + Arduino core
([https://github.com/esp8266/Arduino](https://github.com/esp8266/Arduino))
controlled with a simple web-app.

There's a handy library for doing the Chromecast style wifi setup here
([https://github.com/tzapu/WiFiManager](https://github.com/tzapu/WiFiManager)).

~~~
StavrosK
The hardest part of the LED project for me was finding the right components
(especially MOSFETs). Send me an email at hi at stavros dot io if you want to
talk about it, I can also send you my KiCad files for the controller PCB
(which I'll blog about after I get the fabricated PCBs).

------
mkj
More circuit boards should have a label 'BRAINS'!

------
pussinboots
expounder's pretty neat, wish there was a way to click on the explanation
after reading it to hide it tho

~~~
StavrosK
I got that from other people as well. My rationale is that, once clicked, the
explanation now becomes part of the text, so why would you want to hide it?
You read it and move on, so there's no sense for the link staying there and
cluttering the text.

If there's significant demand, though, I can certainly make it an option. It
sounds like leaving expanded stuff expanded bothers some people's OCD, which I
can certainly understand :)

~~~
hanniabu
I'm in agreeance with you here. I like how it becomes part of the text. It's
not like your adding paragraphs and that make the page unruly longer and cause
you to lose you place. I say leave it as is. I thought it was really nifty
when I saw it too. :)

~~~
StavrosK
Yep, exactly. The idea is that you'd write the sentences being part of the
text (as you would normally), and then just hide them behind an expounder
link. You just need to take some minimal care for the next sentence to make
sense, but other than that, it produces great results. For example, I like the
effect it has on the "NodeMCU" link in the article, which you can click if
you're unfamiliar with it and you'll get a fitting explanation.

Another section I like is the "rather optional", which explains the rationale
for people who may not be aware of it. An author should not fall into the trap
of hiding information that's not strictly relevant to the link, though,
because then they trap the user into a "okay I need to expand all the links
because who knows where the author has hidden useful information" mentality,
which kills its usefulness.

------
saintfiends
This is really cool. How does one print these PCB's after design, is there
some consumer grade printer?

~~~
StavrosK
I just send them off to dirtypcbs.com, and get 10 boards 2-4 weeks later.
They're pretty cheap.

------
jonahx
How hard would it be to add AI that could distinguish between human and
dog/cat motion?

~~~
StavrosK
Impossible right now, as the sensor just gives you motion/no motion readouts.
I think it has a way to configure for mass, though, so it only considers large
masses moving. If anyone has any information on that, please let me know,
because my blind cat keeps making my lamp turn on :P

~~~
squeaky-clean
I really don't know much, but was looking up exactly this because of your
post. It seems like there are two ways. With a single device, you're limited
to just smart placement (orienting it away from the floor or surfaces the
animal climbs on) and adjusting the sensitivity of the detector, which will
reduce the range and still trigger if the animal gets very close. The Adafruit
PIRs come with a pot for this [0][1].

The other method, which most of the ones that seemed high quality used is a
dual-sensor system, tuned for different ranges and sensitivity. Most of the
commercial ones on Amazon seemed to use a combination of PIR and something
else, like sonar or microwave detection.

My idea for a quick "hacky" way to do it, would be double up on the sensors
and place one 3-4 feet above the other and maybe use some tape on the lenses
so the detection areas don't overlap. This way it would trigger for a person
walking by, but not a cat walking on the ground, or jumping past a higher
sensor.

Awesome project by the way. I'm also working on my own home automation project
as well, I'm mostly avoiding low-level hardware stuff for now, but definitely
want to play with it in the future. Bookmarking this and your other posts for
inspiration.

[0]
[https://learn.adafruit.com/assets/13829](https://learn.adafruit.com/assets/13829)
[1] [https://learn.adafruit.com/pir-passive-infrared-proximity-
mo...](https://learn.adafruit.com/pir-passive-infrared-proximity-motion-
sensor?view=all)

~~~
TheOtherHobbes
PIRs measure temperature changes, not motion. I set one up in my kitchen and
it got very confused whenever I turned on the kettle or the toaster. :)

Sharp make a range of IR distance trackers that are more useful for checking
whether or not there's an object/person in front of the sensor.

[https://acroname.com/articles/sharp-infrared-ranger-
comparis...](https://acroname.com/articles/sharp-infrared-ranger-comparison)

Adafruit sell one of the short range models, but the GP2Y0A710 is better for
domestic applications.

If you're clever you could probably track the level of multiple WiFi receivers
in an area and watch as people and pets change the distribution pattern. I
think there was a commercial system that did that.

It sounds quite hacky and potentially unreliable to me, but I haven't tried it
in practice.

I would have expect some kind of domestic super-RFID system to have appeared
by now, but it doesn't seem to. There are issues with RFID and longer ranges
but they should be solvable, and the potential market could be huge.

------
alain94040
At last year's Startup Conference, I really liked one of the pitches:
Realiteer. It works with Google Cardboard, and it's the cheapest controller
you'll ever see: 100% paper. And it worked really well, I tried it.

