So Obvious.......

Tips, Tricks and methods for programming, learn ways of making your programming life easier, and share your knowledge with others.
chipfryer27
Valued Contributor
Posts: 2008
http://meble-kuchenne.info.pl
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 440 times
Been thanked: 655 times

So Obvious.......

Post by chipfryer27 »

Hi

I guess like many people I harbour an idea to do some "smart" monitoring in my house, whatever that actually means.... I hate when people say I have a "smart TV" or whatever as it invariably means they just have a very expensive remote-control in the form of a cellphone. Don't even start me on toasters.... (although I do like the one in Red Dwarf).

Anyway, I thought even a medium powered microcontroller and some FC would be a good ideal to control things. If nobody in the room then no lights etc. If it knew activity it could make decisions around such. Problem is how to detect the activity? Easy to interface lights such as Hue and also heating but how to detect without installing various sensors in each room?

The answer for me is so obvious, well now that I know. A very popular electronics magazine in Australia made me feel like a bigger idiot than I am for not even thinking on this obvious answer. Pretty much everyone I know has a burglar alarm and these have sensors going back to the control panel which may include PIRs and door contacts etc.

Those PIRs detect movement in rooms, hallways etc and contacts tell if doors or windows are open. I'm sure you get the idea, and these are already in place. It is a simple matter to connect to the appropriate pin within your alarm control panel and connect via suitable level-shifting to a microcontroller. Even if your alarm is not set, your detectors are still operating and you can capture that info in your FC chart to be useful.

Such a simple and great idea. No wonder it isn't mine......

Regards

mnfisher
Valued Contributor
Posts: 2037
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 160 times
Been thanked: 949 times

Re: So Obvious.......

Post by mnfisher »

... I had a brief play with a HLK-LD2410C LD2410C Millimeter Wave Radar Module Non-contact Heartbeat Motion Detection

Which are available cheaply on AliExpress etc.

They have Bluetooth and UART (some variants no BT) and detect human presence (not pets etc) and rather more discrimination than the PIR sensors.

They can be programmed via UART or there is a Bluetooth app - and i got one talking to an esp32 easily - although programming the device (sensitivity, zones can be adjusted) I did on the app.

Worth a look for smarter homes?

Martin

chipfryer27
Valued Contributor
Posts: 2008
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 440 times
Been thanked: 655 times

Re: So Obvious.......

Post by chipfryer27 »

Hi Martin

I do remember you posting about them and they do look to be very useful. If I were doing this from scratch they would certainly be a consideration if I was prepared to run cables to power them or create a case with batteries to change / recharge etc.

Being inherently lazy when it comes to doing things for my use, corners would not so much be cut, but missed out altogether <s>

The beauty for me is that the sensors are already there. No cabling or power to worry about so I'm more likely to do something. Likely to, not saying I will though..<s>

It is fast approaching 5 O'Clock here so you can guess the rest.......

Regards

PS
Didn't win a sausage in last night's raffle, didn't win anything.....

mnfisher
Valued Contributor
Posts: 2037
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 160 times
Been thanked: 949 times

Re: So Obvious.......

Post by mnfisher »

More beer == more entries == better luck?

I've never been wildly impressed with 'automatic' lights. I suspect everyone has sat on the throne somewhere and been plunged into darkness - making the next page hard to read?

I suspect the radar devices will come to alarm systems too - as they give a lot more 'detail' about what is happening. Interesting times - have just watched a video about an AI OS - and it will 'hallucinate' any app you like with no code - the demonstration had amongst others 'IOS', Encarta about .., calculator, IE and others - and while they weren't quite the real thing they did work (ie 5/3 = ). All done with co-pilot..

So - enjoy programming whilst you can - get some code running before it becomes verboten and we all spend all our days watching AI generated guff on youtube (or platform of your choice)

chipfryer27
Valued Contributor
Posts: 2008
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 440 times
Been thanked: 655 times

Re: So Obvious.......

Post by chipfryer27 »

Haha

I can so relate to lights going off at inappropriate times with no way of moving into range 🤣

Much prefer alarm PIR to microwave detectors but each have their uses and strengths.

Band just starting so....

Regards

BenR
Matrix Staff
Posts: 2223
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 613 times
Been thanked: 806 times

Re: So Obvious.......

Post by BenR »

I've had great experience with making a "smart" calender for my wife as a christmas present. It started off with a raspberry pi connected to the back of a touchscreen monitor and housed in a simple wooden frame. I started with DAC board and that worked well and integrated with her calender and for a while that was great. But me being me I knew it could be better.

Using AI I pivoted to running my own Linux OS and vibe coded a web interface that can do the following.
  • Connect to the cloud calender, add events and appointments etc
  • Photo viewer streamed from my local storage server
  • Get the local weather, both as a what's happening now, what's happening today and as a fortnight forecast
  • Control my "smart" heating system so I don't have to keep opening that sodding app
  • Integrate with Google tasks to be able to see, set and tick off tasks
There's a lot more I could do but it's already miles above what the free DAC board could do without paying a premium.

https://www.facebook.com/plugins/post.p ... 6907898156

An interface for automatic lights would be a nice next step.

How are you controlling your "smart" lights.

mnfisher
Valued Contributor
Posts: 2037
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 160 times
Been thanked: 949 times

Re: So Obvious......

Post by mnfisher »

That looks amazing..

And you look so much younger than we imagined !!!

BenR
Matrix Staff
Posts: 2223
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 613 times
Been thanked: 806 times

Re: So Obvious.......

Post by BenR »

Amazing the aging treatments you can get nowadays :D

It is very cool but I didn't do anything too clever, just a bit of woodwork which to be fair isn't all that good :D. The AI did all the hard work on the calender and heating integration, all stuff that would have frustrated me to tears.

chipfryer27
Valued Contributor
Posts: 2008
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 440 times
Been thanked: 655 times

Re: So Obvious.......

Post by chipfryer27 »

Hi Ben

So as you are using an RPi can we please, please have support for Pico 2W?
An interface for automatic lights would be a nice next step.
How are you controlling your "smart" lights.
I'm not actually doing anything yet, but having a sensor network already in place is a good start..... so I shall enjoy a well earned beer as soon as I get back.

When I first contemplated this, things were very different. You had to either buy off-the-shelf products which were notoriously difficult to integrate (and many products would disappear quickly) or you built them yourself and had to find a way to control everything.

To compound matters, there still are grave concerns over security. Where is your sensor data going to and are there any back doors?

Invariably sensors were sending to a server somewhere and your app connects to that server too. It is very easy to control this way and indeed Flowcode has examples.

I wasn't too fussed about switching / controlling things as you could just create a Zigbee network and I think Martin even spoke of putting the node in the ceiling rose / lamp itself to negate any expensive bulbs. Again this is something I did think on doing myself with FC powering some device I made.

However it is still dumb, being little more than remote-controlled. Yes I am aware of IFTTT but that is you again giving 3rd party software access to your data and home. If someone opened a window and left it open for over x-minutes and vacated the room, I would want the "home" to detect then switch off heating in that room or some other such rule I created. I actually think these systems should not be called "Smart Home" but "AutoParent Enabled" to switch off things you have left on and remind me to take my jacket coz it will rain later :lol:

Then there is the GUI to link it all together. Previously many products didn't play nice with each other so you had an app for this and an app for that. Again I thought on Flowcode as web developer would allow me to create nice looking interfaces to control my devices.

Now things have progressed. A leading piece of software is the open-source Home Assistant which can control your infrastructure without anything leaving your network and provides dashboards. If I were to go down the route of "AutoParent Enabled" I'd probably base on that, running on a RPi.

A lot of newer Alarm control panels allow you to login remotely via a network and interrogate / set / unset etc so that makes interfacing even easier. Well as long as you are comfortable in doing so.

However I have not explored things too much and I may just decide to do it all in Flowcode as I can control all aspects, especially as I have no need for anything too fancy.

Regards

BenR
Matrix Staff
Posts: 2223
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 613 times
Been thanked: 806 times

Re: So Obvious.......

Post by BenR »

Personally I have a headless micro ATX computer with a N150 CPU, the motherboard is designed to be a super low power raid NAS but it's also very good as a linux machine, photo storage and jellyfin media server too. 6 SATA sockets means I can connect up all those older and smaller HDD I have knocking around. Note the prices of these have gone up considerably, might be worth looking on eBay for a 2nd hander.

Another option would be to use a rapsberry pi. It's certainly not as powerful but works fine as a simple server to connect things together and do the database access. Interestingly I just got my hands on an Orange Pi (about half the price of the raspberry pi) and haven't really played with it yet but the M.2 socket on the back is a very interesting feature.

Once you have the local server you can install a LAMP setup (Linux, Apache, MySQL, PHP) and you can also install a Mosquitto server which is your local MQTT interface. The MQTT can be linked to the MYSQL to complete the setup and provides an easy link to the WIFI enabled microcontrollers on your local network. The server can also run node red if you want a IFTTT type action chain. Also if required you can install Python and an AI tool like cursor or claude and your ready to crack on.

This keeps everything local and off the internet and under your control (apart from the AI stuff). You can open up web access if you want so you can access the system externally but it's up to you what you provide to the web and the data is then secure and your own. Be sure to take backups. I sync all my photos etc every so often to an external hard drive using freefilesync and I keep this hard drive off site.

That's my take on things at the moment but I'm very much still learning and not particularily putting a lot of effort into it. The calendar was the first real thing that seems to have a significant use case. Also the wife had her eye on a £600+ smart calendar so I saved myself a lot of money doing that myself.

I'll look into the Pico 2W as these do look good and like they might solve the issues I have with the Pico range.

Post Reply