In our latest My Automated home feature, Dave McLaughlin takes us through his journey developing his own smart home system. With some DIY upgrades to existing home automation hardware and some clever software integration he’s built a fascinating system…
في البداية
Having used Homeseer and a number of wired and wireless devices whilst in the UK, I switched to wireless when I moved overseas to Indonesia in 2005. As I was living in a rented apartment I need a solution that would not require any cables other than maybe Ethernet in the same room.
I decide on a Z-Wave system, later adding Wemo Lamp modules too. For Z-Wave side of things I chose the HomePro Appliance modules for sockets and Everspring Lamp modules for the lighting. Neither of these 2 modules were cheap.
I ran with this setup until the middle of 2016, but the following issues prompted a change. Firstly Z-Wave was temperamental with 2 units at the far end of ou apartment, even though I had an Appliance Module half way between it just never worked reliably. I would have continually press OFF on the Homeseer Touch based tablet to get my bed light to go off. later I would have 2 units that controlled lamps blow up and fail. one of the IC’s that was part of the power supply had split wide open.
The next headache was the Wemo lamp modules. The only way to get these to work was with IFTTT through their Homeseer and Wemo channels. As long as my internet connection was good this worked ok, albeit a bit slow at times. Not exactly a 10 on the WAF scale.
In early 2016 I came across a website run by Peter Scargill who used to run an electronics design company many years ago from Tyneside. at that time I used his AppCON wired controllers for home automation based on the little 8 bit pic microcontrollers. I had hundreds of meters of 4 core alarm cable run all over my apartment. The system was reliable but trying to hide all that cable didn’t go down well with my partner at the time.
Fast forward to 2016 and Peter was back doing home automation with the little ESP8266 based controllers.
These are based on a Cortex M4 core with built in 802.11 WiFi and come with an SDK that allows development with Eclipse as well as an Arduino IDE option.
As my HomePro units were troublesome I decided to re-engineer the internals and keep the mechanical parts. So I took out the old PCB and did all the measurements so I could make my own 2 stack PCB assembly in much the same as the old one. The lower PCB is the POWER supply and solid state RELAY.
I chose the solid state relays as they switch on the zero crossing and avoid any issues with pulling down the AC and causing the power supply to dip. This works faultlessly and I can switch up to 8 AMPS with this arrangement. more than enough for the intended use of these modules.
These images show the new board stack and the old boards within the module and finally the new boards installed into the HomePro enclosure.
There is an LED on the board to show status and I drilled a small hole to allow this to be seen from the outside. It flashes rapidly until it gets a WiFi and MQTT connection. using the button on the front you can press and hold this for around 3-5 seconds just after power up and this will activate an APN and webpage that you can use to configure the device. easier than trying to do this over the serial connection. Peter and Aiden have considered everything with this.
Now the lighting needed to be sorted. The Everspring units that I had purchased from the UK a couple of years ago used to show an annoying fault. They would on occasion started to switch off and then back on again. It was completely random. I replaced one unit with a new one and the same thing happened. then one day I spotted that the on/off fault was occurring when the voltage in the apartment was dropping below 209Vac – Indonesia is not very good when it comes to stability of the mains supply. I opened one of the units and found that they used a very cheap power supply design based on a capacitor/resistor dropper type. These are good when you have a stable power supply but they really don’t like it when the voltage input is too low.
So armed with the HomePro unit design, I set about creating a new PCB to fit the existing enclosures. The ESP12 was located on one side and the AC-DC power on the other. The solid state relay was also on the same side as the power supply. A prog and on/off button were also fitted so I could install the software initially. The web interface would be used to configure it later. You can see the ESP side of the PCB below. The slot in the PCB is to increase the separation of the AC power from the low voltage DC side. The large pads are the AC in and AC out to the lamp.
So now I had a number of upgraded appliance modules and lighting controllers but how was I going to control all of this? It was time to retire my old Homeseer 2 system. The PC was noنهاية المتاعب وكونه Windows 10 ، سيقرر أنه سيقوم بتحديث نفسه دون إذن مني. حان الوقت لاتخاذ الانتقال إلى Linux.
لذلك ، استنادًا إلى المدونة من بيتر ، قررت الخروج من Raspberry PI3 مع شاشة LCD 7 ″ و Fire Up Node-Red. Node-Red لأولئك الذين لم يروا هذا هو برنامج السحب والإسقاط لطيف للغاية ومستقر. في البداية ، كان من الصعب الإعداد ، لكن بعد حوالي أسبوع من اللعب ، بدأت أجد أنه من السهل جدًا الحصول على السيطرة عليه. إذا كان لديك أي مهارات برمجة ، فستشعر بالمنزل مع البرمجة النصية. يتم توفير جميع الوحدات النمطية كمصدر للنصوص Java وهناك مكتبة ضخمة ومتزايدة باستمرار لها على موقع Node-Red الإلكتروني.
بعد ذلك ، كنت بحاجة إلى وسيط MQTT حيث يتواصل البرنامج من Peter باستخدام هذا البروتوكول. بمجرد إعداد MQTT واستخدامها ، تدرك بسرعة مدى كفاءتها على شبكتك. ليست هناك حاجة لاستطلاع أجهزة أو حتى لمعرفة عنوان IP للأجهزة. الوسيط يعتني بهذا. أولئك الذين يعرفون XAP سوف يفهمون هذا.
باستخدام Node-Red أقوم بإعداد أجهزة ضبط الوقت المختلفة (بفضل بيتر مرة أخرى على Bigtimer) وتبديل الأضواء في الليل. باستخدام مكون إضافي WEMO ، كان لدي الآن أيضًا تحكم في مصابيح WEMO وإن كان فقط على وإيقاف تشغيله. وعد مطور المكون الإضافي بالعقدة Red تحكم في وقت ما.
حسنًا ، لذلك كان لدي إعداد Node-Red و MQTT ، لكن الآن كنت بحاجة إلى وسيلة للتحكم في الأضواء والتبديل بكل من الصوت وبعض أشكال الواجهة الميكانيكية أو اللمس. ركضت عبر بعض المفاتيح اللاسلكية من enocean على موقع Element14 ، لذا طلبت اثنين منهم مع وحدة Raspberry pi enocean التي توصل إلى دبابيس GPIO على PI وتستخدم UART للتواصل مع العقدة والأحمر والمكون الإضافي.
تحتوي المفاتيح على ميزة من حيث أنه لا توجد بطارية لتثبيت أو رعاية. يستخدمون حصاد الطاقة من خلال لفائف ومغناطيس يتم تنشيطه أثناء الضغط على الزر. إنهم للأسف لا يأتي مع أي تركيبات على الحائط ، لذا عليك تصميم خاص بك. إنها توفر ملفًا STL لزر Toggle Button الذي يمكنك الحصول على طباعته ثلاثية الأبعاد ، لذا استخدمت هذا وقمت بإنشاء تصاعد خاص بي. هذا يخدم أغراضين ، واحد لتغطية المفتاح القديم على الحائط لضمان بقائه في الموضع بحيث تكون وحدات المصباح دائمًا في وضع ضوابط في موقع مألوف.
باستخدام قابس enocean enocean العقدة ، أحصل على حمولة رسائل مع حالات الزر. عن طريق تحليل ذلك في مفتاح RED Node ، يمكنني إرسال الأمر المناسب إلى الضوء أو التبديل وما إلى ذلك. هذا مثال على الحمولة النافعة التي يتم إرسالها بواسطة مفتاح enocean. إنه مشفر بتنسيق JSON سهل التحليل. الهوية والخامس هما ما المهتمين به.
{“payload”: {“id”: “002d0932” ، “V”: “A0 Down” ، “Unit”: “” ، “Rssi: -76 ،” type “:” State “،” EEP: ” F6-02-03 “،” man “:” enocean_gmbh “،” desc “:” Rocker Switch “،” RV “:” 30 “،” Rawbyte “:” 55000707017AF630002D09323001FFFFFFFFFF4C000D “، _MSGID”: }
تعرض الصورة التالية المفتاح الذي يحتوي على 4 مخرجات بناءً على قيمة msg.payload.v في البرقية من مفتاح enocean. ثم يتم توجيه هذه إلى الجهاز المناسب. يمكنني استخدام ميزة Toggle داخل البرامج الثابتة MQTT لإيقاف تشغيل الجهاز وإيقاف تشغيله من نفس المفتاح. هذا يعني أن لدي ما يصل إلى 4 حالات تبديل من كل وحدة enocean.
الآن يبدأ الجزء الممتع لأن لديّ صدى أمازون وأردت دائمًا التحكم في منزلي بأوامر صوتية. يمكنك إلقاء اللوم على Scifi لهذا
لا يوجد دعم مباشر للصدى ، على الأقل ليس من دون وجود اتصال HTTPS بعقابك الحمراء وهذا للأسف مستحيل مع مزود خدمة الإنترنت الخاص بي ، لذلك كنت بحاجة إلى بديل. باستخدام هذا Amazon Echo Habridge من الركض على نفس Raspberry Pi3 ، لم أستطع إعداد مصابيح تنشيط الصوت وما إلى ذلك. فيما يلي مثال على جهاز يسمى مروحة الغرفة الأمامية.
من خلال نطق ما يلي في الصدى ، يمكن تشغيل المروحة. “أليكسا ، قم بتشغيل مروحة الغرفة الأمامية” أو بقول “Alexa ، قم بإيقاف تشغيل مروحة الغرفة الأمامية”
يرسل Habridge الأوامر إلى Node-Red عبر طلب HTTP ، ثم أقوم بتحليل عنوان URL للقيم. هذا نص بسيط كما هو موضح أدناه.
كيفية القيام بذلك مع وحدات منخفضة التكلفة
بعد أن صممت ثنائي الفينيل متعدد الكلور الخاص بي لاستبدال الوحدات النمطية التي كنت بحاجة إلى وسيلة لإضافة وحدات التبديل الإضافية ووحدات التحكم في الضوء.
تكلف وحدات منزلي المصنوعة حوالي 15 دولارًا أمريكيًا لصنعها مع جميع أجهزة ثنائي الفينيل متعدد الكلور والأجزاء معًا. لذلك لا تزال منخفضة التكلفة.
#
معاينة
المنتج
تقييم
السعر
1
Jane Choi Raspberry Pi 4 B Model B 8GB Starter Kit (8GB RAM) -Motherboard 64GB SD CARD ، تبريدالمعجب،…
121 مراجعة
222.99 جنيه إسترليني
شراء على الأمازون
2
Raspberry PI 400 4GB Kit Start-up STARTER ، تخطيط المملكة المتحدة
215 مراجعات
110.56 جنيه إسترليني
شراء على الأمازون
3
Freenove Ultimate Starter Kit for Raspberry Pi 4 B 3 B+ 400 ، 561 صفحة دروس مفصلة ، Python C …
2،835 مراجعات
42.95 جنيه إسترليني
شراء على الأمازون
للحصول على هذا الأمر ، صادفت Itead Studio Slampher ومفاتيح S20 الذكية. هذه حوالي 12 دولارًا أمريكيًا لكل وحدات S20 و 8.50 دولارات لوحدات تحكم الضوء أقل من أي من وحدات الموجة Z في السوق. إنها تأتي مع البرامج الثابتة الخاصة بـ Itead التي يتم التحكم فيها من تطبيق iOS أو Android ، لكنني أردت أن أكون قادرًا على استخدام رمز بيتر. كان بيتر يقوم ببعض الأبحاث في هذا ووجد أنه مع تغييرات طفيفة على رمزه ، فإنه سيبرمج في وحدات ITEAD والعمل. تحتاج إلى USB إلى UART مع إخراج 3.3V للقيام بذلك ولكن هذا بسيط بما فيه الكفاية إذا كنت تستطيع استخدام مكواة لحام. الجانب السلبي الوحيد هو أن وحدات ITEAD تأتي مع فلاش 512 كيلو بايت وللسماح لبرمجية بيتر بالقيام بتحديثات OTA ، نحتاج إلى تغيير هذا إلى 8 ميغابايت. تبلغ حوالي 3 دولارات للذاكرة لمدة 5 دولارات على موقع eBay. مسلحًا بمحطة إعادة صياغة الهواء الساخن (استعارة أصدقاء إذا لم يكن لديك وظيفة) ، فإن المهمة سريعة ولا تخاطر بالأضرار التي لحقت باللوحات. تُظهر الصورة التالية الجزء العلوي من SOIC IC بعد إزالة الصورة القديمة والمجهزة الجديدة.
تحتاج أيضًا إلى اللحام على رأس إلى صف واحد من 4 ثقوب على ثنائي الفينيل متعدد الكلور. هذا ينطبق على الطاقة على اللوحة ويسمح لك ببرمجة البرنامج الثابت MQTT المخصص. لدي مدونة مفصلة حول كيفية القيام بذلك.
تبدو وحدات S20 ذكية وحديثة للغاية. يتيح لك مفتاح الطاقة تشغيله وإيقافه محليًا. تلك الموضحة هنا هي مآخذ أوروبا ولكن Itead ستقدم خيارات الولايات المتحدة والمملكة المتحدة قريبًا جدًا.
وحدات Slampher هي وحدات تحكم المصباح المستندة إلى ES27 ، لذا فهي ليست مثالية للمملكة المتحدة في الوقت الحالي ولكنها تعمل بشكل جيد للغاية.
بالنظر إلى أنهم يقدمون وحدات التبديل كمملكة المتحدة ، أتوقع أن تأتي نسخة Bayonet قريبًا. أنا في الواقع أفضل نوع المسمار الآن لتثبيت أسهل.
من السهل فتحها وتعديلها كما كان من قبل مع خطوة إضافية بخلاف استبدال IC الفلاش وهذا هو تحريك رابط صفر أوم واحد