I am new here and tried to find the best place for my post. After looking around general guidance was the best fit. I don't mind moving it around if necessary, just let me know. I have not figured out the search yet, so it is possible this has already been asked and I do apologize in advance if that is the case. Additionally, this might not be the correct place for this type of question, I understand and don't mind looking elsewhere if necessary. If you can point me in the right direction I will be on my way. :)
A long story short, I am looking for suggestion(s) for my project. I suspect there are different ways to do it, but I would prefer some advise before I go spend money only to find out there is a better way. I understand, there is always a better way, but its one thing to just buy stuff and brute force my way vs asking in advice and save myself some time and possibly help others along the way who have similar type questions.
My project... Initially I want to hard wire up a door sensor to trigger an siren. I know the sensor can be wired to an arduino, This got me to thinking about down the road. If I am going to do this, later I will want more and more. So, I should plan for more things such as door and motion sensors. Given the size of my house and doors and locations for motion sensors I came to realize the Mega 2560 might be my best bet given the number of pins. It also occurred to me that later I might want to tie this into home assistant or some type of home automation as well.
Having said all that, lets approach one thing at a time and see how well things play together. Just so you know, I have experience with programming, but not much with hardware. Lets talk about my initial idea and work out my questions as time permits.
I already wired my entire house with CAT6 and most rooms have a network jack along with over the air connector as I put an antenna in the attic with a booster so I could have OTA TV in just about every room in the house. I repurposed a couple of old wireless router to extend my network in the garage and the far end of the house. I would like to run hard wire for each of the sensors. Running CAT6 took time and was not bad.
Questions:
May I buy any off the shelf door sensor and connect to the arduino board or should I stick to specific types of door sensor? The same question applies to motion detectors?
How to power these sensors without damaging the board? Starting out it would be one sensor and one siren. Ideally I don't want to run power to each sensor location so are there options to power over the wire for the sensor(s) and sirens. Over time I can see this growing to maybe 8 - 10 door sensors and maybe the same amount of motion sensors. I may want to run one or more sirens, just to make sure the neighbors wake up and call the police for me when I am not home.
If I have to add another board because I need more sensors, how does one track the actual sensor that has triggered? As an example, how would you know door 1 vs door 10 has been opened if connecting an extension board to increase the number of sensors?
Down the road, I could see where I might want to have some type of home assistant working with the sensors. How much work is it to communicate between the arduino and say a raspberry pi 5 running home assistant? I think a quick and dirty would be USB and parsing text but are there better ideas? I realize restful APIs and networking would be option, but it would require a router handing out IPs in the mix which may add to the complexity. How reasonable would it be to use USB vs the options I pointed out and others that might be suggested.
What I have found online seems to think this will work, but having done software before I find that your mileage may vary. Since I will be working with hardware and software that saying might be more true than I realize right now given my lack of experience with hardware.
Thanks for any advise and suggestions you may have.
you did not specify the size of your house. Do you plan to run wires to every door and window or should each sensor be self sufficient (battery and communication) ?
I use Apple HomeKit as my main user interface but some underlying elements are published through HomeAssistant.
For the sensors, I have some I built, some I purchased (mostly EVE and Sonoff), with various radios (WiFi, LoRa, Zigbee, Bluetooth) and infrastructure (including KNX) which accumulated over the years. More recently I have used Thread, along with Matter as the layer that increasingly sits on top of it to unify device control across ecosystems.
For my DIY sensors I've mostly ESP32s with HomeSpan published directly into HomeKit.
if you are just starting, this is a very large world - which is fun to explore. I would advise to go slowly esp. if you want to develop sensors which relates to security in your home. Personally for those I go with market's products.
You have asked a question that I have been dwelling on and not getting very far.
Home automation is a huge subject, and constantly changing.
I have a Mega acting as a coordinator for XBee sensors plus another network of Sonoff devices as a dabble into commercial devices.
Both work well and the phone access for Sonoff has been very useful. I haven't ventured into repurposing them.
I wouldn't recommend XBee/Zigbee again as it's not reliable.
The door contact and siren doesn't need an Arduino to work, but adding one will greatly improve flexibility.
I'm a fan of doing as much as possible to put things under your control, repairable, and cheaper in the long run. As suggested by @xfpd , I have been looking at Home Assistant and EspNow.
Home automation and sensing could become more important as things like climate change take hold and energy efficiency becomes a priority. If starting from scratch, I would wire the whole house with data cabling whether I used it or not. I wired CAT5e throughout with a network switch, purely for computers, TV etc. Cabling takes care of power requirements as well.
The XBee experiment has been useful and allows me to keep an eye on utility meters and temperatures etc., but has been expensive and reliant on Digi International who favour business customers over individuals.
Try something simple, but be prepared to change if it doesn't suit.
I'd be careful doing custom things there as you might want to sell the house one day and if your home automation system is too custom or flak, then it becomes an issue for the sale.
I recently had to redo the full system in a house and I went for KNX. "Old" stuff, proven and a huge ecosystem - a bit costly though.
Agreed, but you are allowed to live your own life.
I have been going through the house sale scenario and making sure that I have a return to as bought list of things that might be a problem.
The CAT5e wiring is discrete and I see it as an asset.
When bought new, there was nothing like an instruction manual for most of it, and you had to figure it all out. No access to WWW for advice. Coming from an industrial background, I find it staggering that there aren't details of the structure, wiring, plumbing for example. It didn't come with any sort of specification other than bathroom, bedrooms etc.
Most of the changes have been upgrades. None of the electric sockets were double pole, the heating controls were clockwork and there was no such thing as broadband access.
You might have a buyer who understands a Nest thermostat, but another might never touch it.
I would be quite willing to discuss the Sonoff water heating system if the buyer asked, or even retro fit the bimetallic thermostat.
Overall, I think the benefits, especially in thermal efficiency and heating control outweigh any downside. And every bit of it is documented.
I personally would start at the other end of your project. What siren do you have? Is it electrically powered? Is it air powered? Does it have a motor? How much power does it require? Will you try to operate it with battery power? Have you tested it? Is it loud enough to do the job, but not bring the authorities onto you?
You don't need as many pins if you use I2C sensors on I2C bus. Or you use port extenders or even shift registers. People ran 8x8x8 led cubes with Uno/Nano boards and shift regs.
You don't need as much RAM if you add SD.
What I like about Uno R3 is that the socketed MCU chip can be replaced if/when you burn a pin while learning. It has the same cpu core that the 2560 does, it's capable of running a house too.
Learn to write non-blocking code. That will take a lot of hours to get down, it allows you to write code as tasks that run concurrently without having to weave new ones into an existing spaghetti bowl.
You can go RTOS but it's a lot slower and makes bigger hex files.
Sounds like lot of wiring around your house...
If your future target is home assistant, start with esp32 from the beginning. Later you can switch from arduino to esphome without any hardware changes.
It might not be a bad idea to break this up into more than one controller. I guess my concern is going that route might make it harder to tie into some type of home automation later? I will have to think about that and keep it in the back of my mind as I move along.
In the back of my mind I had several thoughts about this topic. It would seem very expensive to run power to each sensor. So I assume you are talking about running power for things like the siren? If the sensors will also need power is there any way to run power to the sensors as part of the existing wiring without burning out the board? I wired my house with CAT6 with the plan to use POE to power cameras as well as video data.
Yes, I would like to run wires to each sensor as I bring them online. I know Wifi makes life easy, but would rather have a wire for each sensor. I would like them to have their own power and not have to worry about batteries. I have concerns based upon a previous response that I might have to run power to each device if I don't go with batteries. That could be expensive. I will keep an eye out for other posts as well as look for other options. I am hopeful I can do some type of POE to each sensor much like is possible with cameras that can manage power and data over the same wire.
I actually wired my entire house with CAT6. I have a CAT6 wire and tv wire from an attic antenna to each room for OTA TV and network connection in each room. :) I am looking at that route where wires are run for the sensors. I am not sure about windows, my windows open up and down so it would take 2 sensors so I was considering a motion sensor in the rooms so if they crawl in from a window I know it. Otherwise in some rooms I would have to put in at least 6 window sensors. A post mentioned I would have to run power to sensors? I am hoping I could do something like POE with the existing wires much like what I can do with my cameras.
Thanks for the suggestions. I'm not sure just yet on the boards, but if I have a lot of sensors I worry about the voltage load. Based upon everything I have heard so far looks like I might have to provide outside power for the sensors. I will work through that I am sure.
The code looks to be C++ or some subset of it that can run on a board. I just took a look and it not as easy as I thought regarding threads. I thought I could use some type of thread manager. Ut appears you can simulate threads using software-based approaches. Thanks for the heads up on this one. I was not expecting the extra work. I will also investigate RTOS as you suggested and see what I think.
The reason for that is I wanted to understand a few things which I included in my post. One is what sensors do people use, can I use anything out there or are there specific ones that are more reliable, etc. Two, powering these sensors which would also include the siren. It sounds like I might have to figure out how to power a lot of these sensors? I suspect not, but again I don't know much about this world. I come from a programming background and the only hardware I have played around with are routers and configuring networking.
For a project like this, I’d start simple with wired magnetic door contacts and low-voltage motion sensors. Since you already have CAT6 throughout the house, that gives you plenty of options for wiring the sensors back to a central point. I’d also plan the system around expansion from the start, so adding more sensors later doesn’t require rebuilding everything.
Then there’s the issue of electromagnetic compatibility, meaning that the whole system should be made immune to disturbances/interference that could not only cause false alarms, but also reset the microcontroller whenever a nearby light is switched on or off
When the builders built my house, they put up coving at ceiling level to cover the gash dry-walling.
Inadvertently, they provided a convenient way to run low voltage cables around the house with minimal disturbance. It proved ideal for alarm and data cables.
Access is straightforward using a drill with a hole saw and a wireman's tape. Afterwards, simply replace the cut disk and make good.