<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Madalin Valceleanu on Medium]]></title>
        <description><![CDATA[Stories by Madalin Valceleanu on Medium]]></description>
        <link>https://medium.com/@vmadalin?source=rss-9786dbb71ef9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*CCHoGSHIPLdFyoGG8Vx13w.png</url>
            <title>Stories by Madalin Valceleanu on Medium</title>
            <link>https://medium.com/@vmadalin?source=rss-9786dbb71ef9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 19:34:41 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@vmadalin/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[ Android Components Architecture in a Modular Word]]></title>
            <link>https://proandroiddev.com/android-components-architecture-in-a-modular-word-7414a0631969?source=rss-9786dbb71ef9------2</link>
            <guid isPermaLink="false">https://medium.com/p/7414a0631969</guid>
            <category><![CDATA[androiddev]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[kotlin]]></category>
            <dc:creator><![CDATA[Madalin Valceleanu]]></dc:creator>
            <pubDate>Sun, 08 Dec 2019 20:02:50 GMT</pubDate>
            <atom:updated>2019-12-08T20:02:50.977Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jlF4aA9wYd2S0-5nbCUGqw.png" /><figcaption>Marvel kotlin sample application using android components architecture in a modular project</figcaption></figure><p>Over years Android architecture evolved to support production-quality apps on any scale focused on helping developers to design robust, testable, and maintainable apps. For that Google has promoted in the last years <a href="https://developer.android.com/kotlin">Kotlin</a> as an official Android programming language impulse via a series of community-led events like <a href="https://events.withgoogle.com/kotlin-everywhere/">Kotlin/Everywhere</a> and programmers Udacity courses <a href="https://www.udacity.com/course/kotlin-bootcamp-for-programmers--ud9011">Kotlin Bootcamp</a>. And it is not for less since the advantages are endless with respect to Java offering modern statically typed programming language that will boost your productivity and increase your developer happiness.</p><p>But first of all, if you want to check directly the project before continuing reading the introduction, you can do by accessing the following link:</p><p><a href="https://github.com/VMadalin/kotlin-sample-app">VMadalin/kotlin-sample-app</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/1*MERWNXHtP4qg0Aw9wGxsRw.png" /></figure><p>The programming paradigm in android has seen a drastic turn with the introduction of <a href="https://developer.android.com/jetpack">Android Jetpack</a> a suite of libraries, tools, and guidance to help developers write high-quality apps easier. These components help you to follow best practices, free you from writing boilerplate code, and simplify complex tasks. That has ended up giving rise to what is known today as <a href="https://android-developers.googleblog.com/2019/10/android-dev-summit-2019-keynote.html">Modern Android Development</a>.</p><p><a href="https://developer.android.com/topic/libraries/architecture">Android Architecture Components</a> are part of Jetpack and are a collection of libraries that help you design robust, testable, and maintainable apps. Start with classes for managing your UI component lifecycle and handling data persistence.</p><p><a href="https://en.wikipedia.org/wiki/Modular_programming">Modular Android App Architecture</a> presented from <a href="https://twitter.com/yigitboyar">Yigit Boyar</a> and <a href="https://twitter.com/fmuntenescu">Florina Muntenescu</a> in <a href="https://www.youtube.com/watch?v=PZBg5DIzNww">Google I/O’19</a>, is a software design technique to <strong>separate functionality into independent, interchangeable modules</strong> so that each contains everything necessary to execute a specific functionality.</p><p>The below diagram demonstrates how would an application that uses this software design technique, although if you want to see more, I recommend the following <a href="https://medium.com/androiddevelopers/a-patchwork-plaid-monolith-to-modularized-app-60235d9f212e">link</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/821/1*AgTH9s7p3eFwfp9mVcF4Jw.png" /><figcaption>Modularized app with multiple independent features what share or not the same libraries.</figcaption></figure><p>Yet when it comes to combining all architecture puzzles together into simple client application it is difficult to find open-sourced app sample to follow. For this reason, I decided to build one based, apply and strictly complies with each of the following 5 points:</p><ul><li>A single-activity architecture, using the <a href="https://developer.android.com/guide/navigation/navigation-getting-started">Navigation component</a> to manage fragment operations.</li><li><a href="https://developer.android.com/topic/libraries/architecture/">Android architecture components</a>, part of Android Jetpack forgive to project a robust design, testable and maintainable.</li><li>Pattern <a href="https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93viewmodel">Model-View-ViewModel</a> (MVVM) facilitating <a href="https://en.wikipedia.org/wiki/Separation_of_concerns">separation</a> of development of the graphical user interface.</li><li><a href="https://en.wikipedia.org/wiki/SOLID">S.O.L.I.D</a> design principles intended to make software designs more understandable, flexible and maintainable.</li><li><a href="https://proandroiddev.com/build-a-modular-android-app-architecture-25342d99de82">Modular app architecture</a> allows being developed features in isolation, independently from other features.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/1*NJFWtYYZSqRCl5t1dHBPrg.gif" /><figcaption>App interaction</figcaption></figure><p>The project presents a modern, 2019 approach to <a href="https://www.android.com/">Android</a> application development using <a href="https://kotlinlang.org/">Kotlin</a> and latest<a href="https://github.com/VMadalin/kotlin-sample-app#tech-stack"> tech-stack</a>.</p><p>The goal of the project is to demonstrate best practices, provide a set of guidelines, modular application, scalable, maintainable and testable. This application may look simple, but it has all of these small details that will set the rock-solid foundation of the larger app suitable for bigger teams and long application lifecycle management.</p><h3>Application structure</h3><p>One of the key benefits of modularization architecture is supposed to be clear navigation throughout the app and source code. Looking at the root folder of the project, the following structure becomes clear:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ex8hnZJB692-TFrp.png" /><figcaption>Project structure on root folder</figcaption></figure><h3>Interaction between modules</h3><p>Between the modules is established a dependency relationship that allows us to make an API request, access to DDBB or use a certain initialized library. Reusing the code in this way and avoiding duplicating. The below graph shows the app dependency between modules:</p><ul><li><em>:app</em> depends on <em>:core</em> and indirectly depends on <em>:features</em> by <a href="https://developer.android.com/studio/projects/dynamic-delivery">dynamic-features</a>.</li><li><em>:features</em> modules depend on <em>:commons</em>, <em>:core, :app</em> and some specific utils<em>:library</em> that will use.</li><li><em>:core</em> and <em>:commons</em> only depends on possible utils on <em>:libraries</em>.</li><li><em>:libraries</em> don’t have any dependency.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/581/0*UjMOOLbUxn2XDyfK.png" /><figcaption>Graph of dependencies between modules</figcaption></figure><h4>App module</h4><p>The <em>:app</em> module is a <a href="https://developer.android.com/studio/build/">com.android.application</a>, which is needed to create the <a href="https://developer.android.com/guide/app-bundle/">App Bundle</a>. It is also responsible for initiating the <a href="https://github.com/google/dagger">dependency graph</a>, <a href="https://developer.android.com/reference/com/google/android/play/core/release-notes">play core</a> and other project global libraries, differentiating especially between different app environments.</p><h4>Core module</h4><p>The <em>:core</em> module is a <a href="https://developer.android.com/studio/projects/android-library">com.android.library</a> for serving network requests or accessing to the DDBB. Providing the data source for the many features that require it.</p><h4>Features modules</h4><p>The <em>:features</em> module are a <a href="https://developer.android.com/studio/projects/dynamic-delivery">com.android.dynamic-feature</a> is essentially a gradle module which can be downloaded independently from the base application module. It can hold code and resources and include dependencies, just like any other gradle module.</p><h4>Commons modules</h4><p>The <em>:commons</em> modules are a <a href="https://developer.android.com/studio/projects/android-library">com.android.library</a> only contains code and resources which are shared between feature modules. Reusing this way layouts, views, and other components in the different features modules, without the need to duplicate code.</p><h4>Libraries modules</h4><p>The <em>:libraries</em> modules are a <a href="https://developer.android.com/studio/projects/android-library">com.android.library</a>, basically contains different utilities that can be used by the different modules.</p><h3>Architecture components</h3><p>Ideally, ViewModels shouldn’t know anything about Android. This improves testability, leak safety and modularity. ViewModels have different scopes than activities or fragments. While a ViewModel is alive and running, an activity can be in any of its lifecycle states. Activities and fragments can be destroyed and created again while the ViewModel is unaware.</p><p>Passing a reference of the View (activity or fragment) to the ViewModel is a serious risk. Let&#39;s assume the ViewModel requests data from the network and the data comes back sometime later. At that moment, the View reference might be destroyed or might be an old activity that is no longer visible, generating a memory leak and, possibly, a crash.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1011/0*IxX7y-pIJ-y0s7l-.png" /><figcaption>Observer pattern in the presentation and data layer</figcaption></figure><p>The communication between the different layers follows the above diagram using the reactive paradigm, observing changes on components without the need of callbacks avoiding leaks and edge cases related to them.</p><h3>Configuration files</h3><p>With App Modularization we want to gain fine-grained dependency control but we also need to make sure we don’t end up maintaining multiple configuration files.</p><p>For that we have the following common configuration files:</p><ul><li><a href="https://github.com/VMadalin/kotlin-sample-app/blob/master/buildSrc/src/main/kotlin/commons/android-dynamic-feature.gradle.kts">commons/android-dynamic-feature.gradle.kts</a></li><li><a href="https://github.com/VMadalin/kotlin-sample-app/blob/master/buildSrc/src/main/kotlin/commons/android-library.gradle.kts">commons/android-library.gradle.kts</a></li><li><a href="https://github.com/VMadalin/kotlin-sample-app/blob/master/buildSrc/src/main/kotlin/commons/kotlin-library.gradle.kts">commons/kotlin-library.gradle.kts</a></li></ul><p>The following <em>android-dynamic-feature</em><em>.gradle.kts</em> is applied to every feature module with the following line:</p><pre>plugins <strong>{<br>    </strong>id(&quot;commons.android-dynamic-feature&quot;)<br><strong>}</strong></pre><h3>Things to consider</h3><p>Of course, nothing is perfect, especially if it has recently come out. Here are some issues what I found during development:</p><ul><li>Navigation component don’t support multiple back-stack for the moment. Exist different <a href="https://github.com/android/architecture-components-samples/issues/530">workarounds</a> but not officially solution to this. (<a href="https://issuetracker.google.com/issues/127932815">issue</a>)</li><li>Robolectric isn’t compatible with <em>dynamic-features </em>modules for the moment. Test on <em>dynamic-feature</em> throws the following exception. The same test but under <em>android-library</em> , works correctly. (<a href="https://github.com/robolectric/robolectric/issues/5383">issue</a>)</li></ul><pre>java.lang.RuntimeException:java.lang.UnsupportedOperationException: libraries not supported yet</pre><ul><li>Roboelectric throw the following exception on testing apps with data-binding in module. (<a href="https://issuetracker.google.com/issues/126775542">issue</a>)</li></ul><pre>java.lang.NoClassDefFoundError:androidx/databinding/DataBinderMapperImpl</pre><ul><li><a href="https://github.com/mockk">MockK</a> with LiveData dependency throws exception when try to obtain value. (<a href="https://github.com/mockk/mockk/issues/388">issue</a>). The workaround is to use mockito for the moment.</li></ul><pre>java.lang.ClassCastException:java.lang.Object cannot be cast to java.lang.String</pre><h3>Additional Resources</h3><h4>- Projects</h4><p>This is project is a sample, to inspire you and should handle most of the common cases, but obviously not all. If you need to take a look at additional resources to find solutions for your project, visit these interesting projects:</p><ul><li><a href="https://github.com/google/iosched">iosched</a> (by <a href="https://github.com/google">google</a>) — official Android application from google IO 2019.</li><li><a href="https://github.com/android/plaid">plaid</a> (by <a href="https://github.com/android">android</a>) — app which provides design news &amp; inspiration, being an example of implementing material design.</li><li><a href="https://github.com/android/sunflower">sunflower</a> (by <a href="https://github.com/android">android</a>) — a gardening app illustrating Android development best practices with Android Jetpack.</li><li><a href="https://github.com/android/architecture-components-samples">architecture-components-samples</a> (by <a href="https://github.com/android">android</a>) — collection of samples for Android Architecture Components.</li><li><a href="https://github.com/android/architecture-samples">architecture-sample</a> (by <a href="https://github.com/android">android</a>) — collection of samples to discuss and showcase different architectural tools and patterns for Android apps.</li><li><a href="https://github.com/bufferapp/android-clean-architecture-boilerplate">android-clean-architecture-boilerplate</a> (by <a href="https://github.com/bufferapp">bufferapp</a>) — an android boilerplate project using clean architecture</li><li><a href="https://github.com/sanogueralorenzo/Android-Kotlin-Clean-Architecture">android-kotlin-clean-architecture</a> (by <a href="https://github.com/sanogueralorenzo">sanogueralorenzo</a>) — android sample Clean Architecture app written in Kotlin.</li><li><a href="https://github.com/JeroenMols/ModularizationExample">modularization-example</a> (by <a href="https://github.com/JeroenMols">JeroenMols</a>) — easy to understand real-life example of a modularized Android app.</li><li><a href="https://github.com/Eli-Fox/LEGO-Catalog">lego-catalog</a> (by <a href="https://github.com/Eli-Fox">Eli-Fox</a>) — app illustrating current Android Architecture state using Android development best practices.</li><li><a href="https://github.com/chrisbanes/tivi">tivi</a> (by <a href="https://github.com/chrisbanes">chrisbanes</a>) — an app which attempts to use the latest cutting edge libraries and tools.</li><li><a href="https://github.com/igorwojda/android-showcase">android-showcase</a> (by <a href="https://github.com/igorwojda">igorwojda</a>) — app following best practices: Kotlin, coroutines, Clean Architecture, feature modules, tests, MVVM, static analysis.</li></ul><h4>- Articles</h4><p>A collection of very interesting articles related to last android community tendencies and recommendations for starting to take in consideration for your current/next project:</p><ul><li><a href="https://medium.com/androiddevelopers/a-patchwork-plaid-monolith-to-modularized-app-60235d9f212e">Transform monolith to modularization application</a></li><li><a href="https://medium.com/swlh/using-the-navigation-component-in-a-modular-world-e7578825962">Using the Navigation Component in a Modular World</a></li><li><a href="https://medium.com/androiddevelopers/dependency-injection-in-a-multi-module-project-1a09511c14b7">Dependency injection in a multi module project</a></li><li><a href="https://medium.com/androiddevelopers/viewmodels-and-livedata-patterns-antipatterns-21efaef74a54">ViewModels and LiveData: Patterns + AntiPatterns</a></li><li><a href="https://blog.q42.nl/dynamic-feature-and-regular-modules-using-dagger2-12a7edcec1ff">Dynamic feature and regular modules using Dagger2</a></li><li><a href="https://proandroiddev.com/android-architecture-starring-kotlin-coroutines-jetpack-mvvm-room-paging-retrofit-and-dagger-7749b2bae5f7">Android Architecture starring Kotlin Coroutines, Jetpack (MVVM, Room, Paging), Retrofit and Dagger 2</a></li><li><a href="https://proandroiddev.com/gradle-dependency-management-with-kotlin-94eed4df9a28">Gradle dependency management with Kotlin (buildSrc)</a></li><li><a href="https://medium.com/mindorks/best-coding-practices-tips-and-more-for-android-4ec03c7eeb2c">Best coding practices, tips and more for Android</a></li></ul><h4>- Libraries</h4><p>The open-source community create and maintains tons of awesome libraries making your job easier, giving the opportunity to use them in your developments. Here is a very important collection of them:</p><ul><li><a href="https://github.com/wasabeef/awesome-android-ui">awesome-android-ui</a> — collection list of awesome Android UI/UX libraries.</li><li><a href="https://github.com/KotlinBy/awesome-kotlin#android-libraries">awesome-android-libraries</a> — a collection of awesome Kotlin related stuff.</li><li><a href="https://android-arsenal.com/">android-arsenal</a> — android developer portal with tools, libraries, and apps.</li></ul><h4>- Best practices</h4><p>Avoid reinventing the wheel by following these guidelines:</p><ul><li><a href="https://developer.android.com/distribute/best-practices">Google best practices</a></li><li><a href="https://github.com/futurice/android-best-practices">Android development best practices</a></li></ul><h3>Summary</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YfCCOtUUFCBvu_Rwviq--Q.png" /></figure><p>There are certain benefits in writing or migrating to Modular App and using Architecture Components with them.</p><ul><li>Faster build times.</li><li>Fine-grained dependency control.</li><li>Improve reusability across other apps.</li><li>Improves the ownership &amp; the quality of the codebase.</li><li>Stricter boundaries when compared to packages.</li><li>Encourages Open Source of the newly created libraries.</li><li>Makes Instant Apps &amp; Dynamic Features possible (improving discoverability).</li></ul><p>Remember, keeping modules <a href="https://proandroiddev.com/clean-architecture-data-flow-dependency-rule-615ffdd79e29">Clean</a> improves testability and eases future refactoring in case it needs to be shared between multiple user-facing features.</p><p>The aim of this article was to provide a brief overview of how to combining all architecture puzzles together into your current/next project. If you have any questions, improvements, recommendations about modularization and architecture components please add your response 🙂.</p><p>The full open-source code can be found on GitHub:</p><p><a href="https://github.com/VMadalin/kotlin-sample-app">VMadalin/kotlin-sample-app</a></p><figure><a href="https://www.buymeacoffee.com/vmadalin"><img alt="" src="https://cdn-images-1.medium.com/max/159/1*Acg0UYiPaHUYPSPDHF7W3Q.png" /></a></figure><p>Thanks for your time and reading.</p><p>V.Madalin</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7414a0631969" width="1" height="1" alt=""><hr><p><a href="https://proandroiddev.com/android-components-architecture-in-a-modular-word-7414a0631969">📚 Android Components Architecture in a Modular Word</a> was originally published in <a href="https://proandroiddev.com/">ProAndroidDev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My first Hackathon experience]]></title>
            <link>https://medium.com/hackernoon/my-first-hackathon-experience-4bb9a77c03d5?source=rss-9786dbb71ef9------2</link>
            <guid isPermaLink="false">https://medium.com/p/4bb9a77c03d5</guid>
            <category><![CDATA[hackathons]]></category>
            <category><![CDATA[first-hackathon]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[challenge]]></category>
            <dc:creator><![CDATA[Madalin Valceleanu]]></dc:creator>
            <pubDate>Mon, 28 Jan 2019 18:56:00 GMT</pubDate>
            <atom:updated>2019-08-04T20:01:06.587Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4EUetNS2u8OXfmHPr8RbEw.jpeg" /><figcaption>The hackathon countdown has begun</figcaption></figure><p>Discover my hacker experience during the 28 hours of the <a href="http://www.hackath2on.es/">HackatH2On 2017</a>. Although this event was a few years ago. I would like to share my experience and some details of how was organised this type of event.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*lfq3-JDgA7BBXY__EsDsOA.png" /></figure><p>The Agbar de las Aigües museum hosted 30 teams from two to six people during a weekend to work 28 consecutive hours at HackatH2On. The objective? Innovate in the relationship between citizens and water services. To get it, each team should overcome the challenge of thinking, developing and presenting a technological solution that would provide a good user experience, the promotion of the social value of water and new services to the Administration. Three prizes of €5,000, €3,000 and €2,000 were awaiting winners.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*csfLGK35CkAZp3zYKGD8kA.jpeg" /></figure><p>How do you face such a challenge? How do you get to the final proposal? How do you manage the time in this code marathon? We find out all the answers with the first-person experience of <a href="https://www.linkedin.com/in/vmadalin/">Madalin Valceleanu</a>, Mobile Programmer Analyst and <a href="https://www.opentrends.net/en">Opentrends</a> hacker.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fplayer.vimeo.com%2Fvideo%2F218498787%3Fapp_id%3D122963&amp;dntp=1&amp;url=https%3A%2F%2Fvimeo.com%2F218498787&amp;image=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F635984172_1280.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=vimeo" width="1920" height="1080" frameborder="0" scrolling="no"><a href="https://medium.com/media/70cebb17e88b22fe83abcdedc9d515a4/href">https://medium.com/media/70cebb17e88b22fe83abcdedc9d515a4/href</a></iframe><h3>Diary of a Hackathon by Madalin Valceleanu</h3><p>With fellow developers of Opentrends, we had the initiative to participate in the <a href="https://hackernoon.com/tagged/hackath2on">HackatH2On</a> 2017. I found it an interesting challenge and I accepted the proposal. Participating in these kinds of events puts our skills to the test. In addition, the competition offered me a threefold motivation: to offer solutions to problems of citizenship, to develop and to implement them.</p><p>I teamed up with the following Opentrends developers: <a href="http://www.linkedin.com/in/dtorguet">David Torguet</a> (iOS), <a href="https://www.linkedin.com/in/judithgomezlorenzo/">Judith Gomez</a> (Android), <a href="https://www.linkedin.com/in/marccabezasguzman/">Marc Cabezas</a> (Android) and <a href="https://www.linkedin.com/in/danymg/">Dani Martínez</a> (iOS).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PEktBBFsMePj8lsqMNcEUA.jpeg" /><figcaption>The members of our OTeam</figcaption></figure><p>We only had two working days to devise the HackatH2On project and the instructions were very clear: 28 hours to define a technological solution related to water services and citizenship. Oh! And at this time we also had to prepare a presentation in order to convince a jury.</p><p>The stopwatch started. The first step of the team was to decide the platform to present our project. We bet for chatbot. The reason? We were aware that this is a trendy <a href="https://hackernoon.com/tagged/technology">technology</a> and that gave us points. But, we also knew that we would not be the only ones to bet on this option.</p><p>The next challenge was to find an innovative technological solution that would offer new services to users in relation to water management.</p><p>We wanted to surprise with a disruptive project. Taking this in mind we decided to focus the ‘bot’ as a virtual assistant available 24 hours, with the aim of assuming the functions of the customer service department of Aigües de Barcelona. In this way, any type of incident (leaks, invoices, services, doubts, etc.) could be managed with a simple chat message, without needing to call or send an email. And best of all: handle it at any time and regardless of the day.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XACCpfLmPYY1q8AMoHXMBw.png" /><figcaption>Working all together on squads</figcaption></figure><p>To develop the idea, we organized the team accordingly to the technological areas to be implemented: iOS, Android and chatbot. During the early hours, the pace was rather slow. So we decided to set deadlines to reach small goals. We would only meet if we detected some common problem that would not allow us to move forward.</p><p>One of the curiosities of the HackatH2On that caught my attention was the existing competitiveness, which increased with the passage of the hours. We even compete among the members of the team to reach the goals in the shortest possible time.</p><p>The night came. That point was the hardest part of the HackatH2On. Changing my usual schedule did not let me rest and this fact was a real psychological struggle against myself. Fortunately, coinciding with the sunrise, we managed to complete the project. We just had to prepare the presentation to complete the whole project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SSySn_iYK35SfopvuRMjug.png" /><figcaption>The OTeam presents the DroppyBot in front of juries</figcaption></figure><p>After working for 28 hours it is hard to explain all your work in just 3 minutes. Without a doubt, a new challenge. After the 30 participating teams completed their presentations, we waited for deliberations …</p><p>Unfortunately, we were not the winners. Of course, I realised that the real competition had been against me: struggling against time, disorganisation and technological difficulties. And undoubtedly, I won this competition.</p><p>Without a doubt it is an unforgettable experience from all points of view. Something that I would recommend that everyone live it. Basically you put to the limit your resolutive capacity, analysis, solve problems, as well as your mind since with the passage of the hours the fatigue takes over, but the feeling of making a simple idea become a reality is the motor that will force us to continue.</p><figure><a href="https://www.buymeacoffee.com/vmadalin"><img alt="" src="https://cdn-images-1.medium.com/max/159/1*Acg0UYiPaHUYPSPDHF7W3Q.png" /></a><figcaption>Support me as a writer</figcaption></figure><p>Thank you for reading and time</p><p>V. Madalin</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2Fdde502%3Fas_embed%3Dtrue&amp;dntp=1&amp;url=https%3A%2F%2Fupscri.be%2Fhackernoon%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/3c851dac986ab6dbb2d1aaa91205a8eb/href">https://medium.com/media/3c851dac986ab6dbb2d1aaa91205a8eb/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4bb9a77c03d5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hackernoon/my-first-hackathon-experience-4bb9a77c03d5">My first Hackathon experience</a> was originally published in <a href="https://medium.com/hackernoon">HackerNoon.com</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My smart home]]></title>
            <link>https://medium.com/hackernoon/my-smart-home-2bfc9da635c1?source=rss-9786dbb71ef9------2</link>
            <guid isPermaLink="false">https://medium.com/p/2bfc9da635c1</guid>
            <category><![CDATA[raspberry-pi]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[smart-home]]></category>
            <category><![CDATA[diy]]></category>
            <dc:creator><![CDATA[Madalin Valceleanu]]></dc:creator>
            <pubDate>Sun, 06 Jan 2019 15:45:53 GMT</pubDate>
            <atom:updated>2019-08-04T20:02:32.262Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building my smart home</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AMQYr3czCOs_xWDM2TFSkA.png" /><figcaption>The mobile application and electronic circuit controlled by Raspberry Pi</figcaption></figure><p>In this article that is focused on the entire public, I will explain experiences, anecdotes about a personal project of how I turned my home into <a href="https://hackernoon.com/tagged/smart">smart</a> and how can I also control the different electronic devices, enter in home by phone with a simple gesture or open the building door using a Siri voice command.</p><p>Basically the idea was started with an Arduino kit that I had purchased and I had started to fiddle with the different modules joysticks, relays, motors, displays, etc .. So I decided to turn my home into a smart and control it from the phone. Although it could also be integrated with GoogleHome / HomePod, but for the moment I postponed it for another phase.</p><p>These have been the objectives of the project that I set before starting:</p><ul><li>Power on/off, control the intensity and program the house lights as well the plugs.</li><li>Measure the indoor and outdoor temperature to regulate it.</li><li>Opening the building door with voice commands via Siri.</li><li>Opening the home door via fingerprint and detect its closure. In addition add a button to facilitate opening from inside.</li><li>Notification system and historical records of all door activity</li><li>Installation of several security measures, to guarantee the integrity of the home.</li></ul><p>The advantage of opening the home door from the mobile device apart from providing access and control of who enters and leaves, increases security since many families don’t usually lock the door, just close it using the latch. So it makes the work of thieves more easy and we don’t want that.</p><p>To do this, I used the Rasberry Pi a small single-board computer where you would end up connecting and controlling all the devices in the home that you would like to add through the <a href="https://www.domoticz.com/">Domoticz</a> automation system.</p><p>In the market there are several options when we talk about smart devices of many brands and for all pockets. From a light bulb to cameras, thermostats, refrigerators, etc. At the end anything no matter how small, that can be connected to WiFi/bluetooth is called an IoT device.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ORDVH81A4LdbIfwa9HE85g.png" /><figcaption>IoT device types</figcaption></figure><p>However, apart from acquiring some and installing them, they can also be created by oneself depending on the needs we have. In my case I used the ESP8266 chips together with the relay module powered at 5V for example to turn on/off the electrical circuit of a mini water fountain.</p><p>Moreover for all the control home temperature, the Node MCU chip has been used for taking measurements every X time interval updating data to Domoticz, which would be able to start up the heating system if is necessary. Also I decided to add a display to visualize temperature and time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6QHbMKnxwY_1lrHurFORPw.png" /><figcaption>On the left the module ESP8266 and on the right the Node MCU</figcaption></figure><h3>Dashboard</h3><p>Once all the devices are configured, this would be the Domoticz interface, also accessible from the mobile. Basically from here we can control all connected devices, add, delete and much more. Accessing of course, only from the local network.</p><p>In addition we can program each device and add additional logic, for example when it should turn on, off, with specific intensity. Depends on our case we may be interested in one state or another.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*jNirOTIN-eyImCufJs1fig.png" /><figcaption>Desktop dashboard</figcaption></figure><p>In my case as you can see, I have relevant information about the Raspberry Pi, the temperature outside and inside the house. Also some plugs, lights from different rooms or areas of the house.</p><p>Also the possibility of enabling/disabling the door mechanism, and some other options.</p><h3>3D Modeling and Printing</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UTDdrJ6WZJAp-5SNmy3lMg.png" /></figure><p>To open the home door, a signal that arrives is not enough. That signal has to launch an action, in this case turn the key, an action that we perform daily. Although I saw some “<a href="https://august.com/">smart lock</a>” mechanisms, but none fitted with the type of my door.</p><p>Moreover who wants a battery-based system? We wouldn’t like him to run out of battery with us outside the home. So the system should be directly connected to the power and only in case of emergency be powered by an electric accumulator.</p><p>For do this, it was necessary to begin to take measures and build something from scratch that made it possible to turn the key, taking into account that it is a reinforced door.</p><p>After making the plastic structure and the handlebar, I began to design the sustenance of the servo motor. My main intention was to split the key in 2 parts to make all the support more compact, but when I couldn’t do it, I decided to leave the idea. There was also the possibility of making a gear system but taking into account the durability that this required and the turning force I decided to opt for something more simple. I started to design the 3D pieces and then print them and after some readjusting this is the final result.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NxsVLi9r0qN4GvwUfZG4uw.png" /><figcaption>Assembly of all the components, in red it would be other parts like the servo and the key</figcaption></figure><p>These components are accessible and can be downloaded from the website <a href="https://www.thingiverse.com/thing:3326691">thingiverse.com</a> (website dedicated to the sharing of user-created digital design files).</p><h3>Assemble</h3><p>The assemble may take a long time but we don’t want to see the cables hanging because apart from being unsightly can cause greater consequences such as short circuits. To ensure that doesn’t happen, we have to use a property cable holding.</p><p>This would be the result in my case, trying to make the cables barely notice even though they travel through the door frame until they reach the lock.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*68nYY2ZmlVcNbKBhvLU42A.png" /><figcaption>On the left we can see the intercom that is connected to the Raspberry Pi. And on the right the servo motor hold by the piece printed in 3D.</figcaption></figure><p>At the same time, a button can be seen halfway up the door, it is the <a href="https://www.amazon.com/Dash-Buttons/b?ie=UTF8&amp;node=10667898011">DashButton</a> he has the responsibility to open the door from inside in a very simple way.</p><h3>Electrical Circuit</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*34o8JUkwSoAh5KU1l485gg.png" /><figcaption>Diagram of connection of the different components</figcaption></figure><p>Once seen the assemble part I will explain the components that form it, as well as the connection with the Raspberry Pi. To be able to build it, I perform different proof of concept on a small scale, testing different configurations before making the final assembly.</p><p>This circuit could be perfectly soldered instead of a breadboard, although it can always be done at another step.</p><p>These are the different components used for its construction:</p><ul><li><em>1x Servo Motor:</em> Whose function is to turn the key to open and close the door.</li><li><em>1x Power supply:</em> 9V DC current supplied to the servo motor for proper operation.</li><li><em>1x Magnetic Switch: </em>Detects when the door closes and send the command to the servo to turn the key.</li><li><em>2x Relays:</em> One responsible for closing the intercom button and the other to power the servo only when it required.</li><li><em>2x Transistors NPN</em>: Solving common Raspberry Pi problem of stepping up 3.3 GPIO to 5V for power the relay.</li></ul><p>This sketch is accessible and can be downloaded from the website <a href="http://fritzing.org/projects/door-engine-circuit-smart-home">fritzing.com</a> (open-source hardware initiative that makes electronics accessible as a creative material for anyone).</p><h3>Mobile Application</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9tLpcyKBMo9uqp8tojnewQ.png" /><figcaption>The different parts of the application.</figcaption></figure><p>To maximize the security for all entire engine, I decided to create an application where all the information passed through my own server, in order to register and control all the traffic, as well the access, instead of using Domoticz for this critical part. I used React-Native framework for this development.</p><p>The application is not public and is completely for internal use, consisting of the following functionalities:</p><ul><li>Fingerprint scanner when trying to launch an action</li><li>Add Siri shortcut command only available for the building door</li><li>Notifications and alerts system</li></ul><h3>Demo</h3><p>The door opening engine has gone through several phases throughout the development from alpha versions, to the current one, paying special attention to security and giving stability to work properly. Since we don’t want the engine to stop responding or fail. So today and with all the members of the family using daily the engine has been functioning correctly for more than a month.</p><p>Here is the demo of how it works:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F_gGbyX5ESdY%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D_gGbyX5ESdY&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F_gGbyX5ESdY%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/8e25e55a7ab03791d58fe1c19847f0e1/href">https://medium.com/media/8e25e55a7ab03791d58fe1c19847f0e1/href</a></iframe><p>Basically the intercom system keeps the building door opened for a few seconds after receiving the action sended from Siri command, enough to be able to enter from the outside. This action is received by the Raspberry Pi that closes the intercom system button circuit through the relay, executing the same logic as if we had pressed it.</p><p>On the other hand, the action of opening the reinforced door can only be released by fingerprint and the door will remain open until the magnetic switch detects the closure of the door, as can be seen.</p><h3>Technologies and libraries</h3><p>In terms of technologies used in the project, the server and the Raspberry Pi running in nodeJS. Using <a href="https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events">SSE</a> (Server Send Events) for such communication, together with <a href="https://aws.amazon.com/lambda/">AWS Lambdas</a> for the execution of different actions.</p><p>Without forgetting the <a href="https://www.npmjs.com/package/pm2">PM2</a> (Process Manager2) production runtime and process manager to allow to keep applications alive forever, to reload them without downtime and facilitate common DevOps tasks.</p><p>To control the <a href="https://www.raspberrypi.org/documentation/usage/gpio/">GPIO</a> (General Purpose Input Output) have used node library <a href="https://www.npmjs.com/package/pigpio">pigpio</a>, a wrapper for the <a href="https://github.com/joan2937/pigpio">pigpio C library</a>. Although other alternatives like <a href="https://www.npmjs.com/package/johnny-five">johnny-five</a> used for IoT and Robotics programming.</p><p>The mobile application use a specific <a href="https://www.npmjs.com/">npm</a> libraries for the following features:</p><blockquote>Fingerprint scanner feature: <a href="https://www.npmjs.com/package/react-native-fingerprint-scanner">https://www.npmjs.com/package/react-native-fingerprint-scanner</a></blockquote><blockquote>Siri commands feature: <a href="https://www.npmjs.com/package/react-native-siri-shortcut">https://www.npmjs.com/package/react-native-siri-shortcut</a></blockquote><p>The driver control of the different microchips used for ESP8266 and Node MCU in the assembly, as well as the different device modules connected to them, such as the temperature and humidity sensor (DTH11), 4-digit display (TM1637), relay module and others, have used with specific libraries recommended by the manufacturer that some of them can be found <a href="https://www.arduinolibraries.info/">here</a>.</p><h3>Software</h3><p>To build the different parts of the project such as the system of monitoring and devices controller, 3D modeling and printing, the design and programming the circuit, I have been used different third-party software like:</p><blockquote><strong>Automation System</strong>: <a href="https://www.domoticz.com/">Domoticz</a></blockquote><blockquote><strong>Electronic prototyping</strong>: <a href="https://www.arduino.cc/">Arduino</a>, <a href="http://fritzing.org/home/">Fritzing</a></blockquote><blockquote><strong>3D Printing</strong>: <a href="https://ultimaker.com/en/products/ultimaker-cura-software">Ultimaker Cura</a>, <a href="https://www.simplify3d.com/">Simplify3D</a></blockquote><blockquote><strong>3D Modeling</strong>: <a href="https://www.autodesk.com/campaigns/fusion-360-for-hobbyists">Fusion360</a>, <a href="https://www.sketchup.com/">SketchUp</a></blockquote><h3>Summary</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*t2EQimUnw_jq2GMI_pe_Rw.jpeg" /></figure><p>Nowadays more and more people talking about smart home, companies are involve their efforts to conquer a growing market and makes people life easier. For this purpose they design and sell many kinds of devices and kits like sensors, controllers, lights, switches and more .. So everyone could make their own smart home and control it by their phone, voice and gestures.</p><p>Think about having the possibility of scheduling the temperature before arriving at home, being able to monitor your home through an installed security camera, controlling the different electronic devices by voice commands, lifting the blinds at the morning automatically and why not, enter in your home without keys only from mobile phone.</p><p>Although the possibilities are endless as one wants. The <a href="https://hackernoon.com/tagged/technology">technology</a> is available to be used to facilitate our lives.</p><figure><a href="https://www.buymeacoffee.com/vmadalin"><img alt="" src="https://cdn-images-1.medium.com/max/159/1*Acg0UYiPaHUYPSPDHF7W3Q.png" /></a><figcaption>Support me as a writer</figcaption></figure><p>Thanks for your time and reading.</p><p>V.Madalin</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2Fdde502%3Fas_embed%3Dtrue&amp;dntp=1&amp;url=https%3A%2F%2Fupscri.be%2Fhackernoon%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/3c851dac986ab6dbb2d1aaa91205a8eb/href">https://medium.com/media/3c851dac986ab6dbb2d1aaa91205a8eb/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2bfc9da635c1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hackernoon/my-smart-home-2bfc9da635c1">My smart home</a> was originally published in <a href="https://medium.com/hackernoon">HackerNoon.com</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mi smart home]]></title>
            <link>https://medium.com/@vmadalin/mi-smart-home-18ab1664ee65?source=rss-9786dbb71ef9------2</link>
            <guid isPermaLink="false">https://medium.com/p/18ab1664ee65</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[raspberry-pi]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[español]]></category>
            <category><![CDATA[smart-home]]></category>
            <dc:creator><![CDATA[Madalin Valceleanu]]></dc:creator>
            <pubDate>Sun, 06 Jan 2019 14:52:57 GMT</pubDate>
            <atom:updated>2019-08-04T20:03:21.192Z</atom:updated>
            <content:encoded><![CDATA[<h3>Construyendo mi smart home</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AMQYr3czCOs_xWDM2TFSkA.png" /></figure><p>En este articulo que esta enfocado a todo el publico, explicare vivencias, experiencias, anécdotas acerca de un proyecto personal de como convertí mi casa en smart y como puedo ademas de controlar los diferentes dispositivos electrónicos, entrar en casa mediante el teléfono con un simple gesto o abrir la puerta de la escalera mediante un comando de voz Siri.</p><p>Básicamente la idea comenzó con un kit de Arduino que recién había adquirido y que ya había empezado a trastear con los diferentes módulos joysticks, relés, motores, pantallas led, etc.. Por lo que decidí convertir mi hogar en una smart home y poder controlarlo desde el teléfono. Aunque también se podría integrar con GoogleHome/HomePod, aunque de momento lo he postpuesto para un fase posterior.</p><p>Estos han sido los objetivos del proyecto antes de empezar que me marqué:</p><ul><li>Poder encender y apagar, controlar la intensidad y programar las luces de casa así como los enchufes.</li><li>Medir la temperatura interior y exterior para regular la temperatura de dentro de casa.</li><li>Abertura de la puerta de la escalera con comandos de voz mediante Siri.</li><li>Abertura de la puerta de la casa mediante huella digital así como detección del cierre. Ademas de un botón para facilitar dicha abertura desde dentro.</li><li>Sistema de notificación y registro histórico de toda actividad</li><li>Instalación de varias medidas de seguridad, para garantizar la integridad de la casa.</li></ul><p>Las ventaja de la abertura de las puerta de casa desde el dispositivo mobil aparte de facilitarnos el acceso, así como el control de quien entra y sale, incrementa la seguridad ya que muchas familias no acostumbran a cerrar con llave, sino que solamente con el pestillo. Por lo que hace más difícil el trabajo de los ladrones.</p><p>Para ello utilice la Rasberry Pi una pequeña computadora donde acabaría conectando y controlando todos los dispositivos de la casa que desearía agregar mediante el sistema de automatización Domoticz.</p><p>En el mercado existen varias opciones cuando hablamos de dispositivos inteligentes de muchas marcas y para todos los bolsillos. Desde una bombilla a cameras, termostatos, neveras, etc.. Al fin y al cabo cualquier dispositivo por más pequeño que sea, que puede conectarse a la wifi se llama dispositivo IoT .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ORDVH81A4LdbIfwa9HE85g.png" /><figcaption>Variedad de dispositivo IoT</figcaption></figure><p>No obstante, aparte de haber adquirido algunos y instalarlos también se pueden crear por uno mismo dependiendo de las necesidades que tengamos. En mi caso he utilizando los chips <em>ESP8266 </em>conjuntamente con el modulo de relé alimentado a 5V para poder encender y apagar el circuito eléctrico de una pequeña fuente de agua.</p><p>Por otro lado para todo el control de temperatura de la casa y aprovechando el display para mostrar la hora, se ha utilizado el chip <em>Node MCU</em> que va tomando medidas cada X intervalo de tiempo actualizando los datos de Domoticz, que seria capaz de poner en marcha el sistema de calefacción si fuera necesario.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6QHbMKnxwY_1lrHurFORPw.png" /><figcaption>A la izquierda el modulo ESP8266 y a la derecha el Node MCU</figcaption></figure><h3>Panel de control</h3><p>Una vez configurado todos los dispositivos esta sería la interfaz de Domoticz, también accesible desde el mobil. Básicamente desde aquí podemos controlar todos los dispositivos conectados, eliminar, añadir y mucho mas. Accediendo por supuesto desde la red local de casa.</p><p>Ademas podemos programar cada dispositivo y añadir lógica adicional de cuando debería de encenderse, apagarse, con que intensidad ya que dado unas series de acontecimientos nos puede interesar un estado u otro.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*jNirOTIN-eyImCufJs1fig.png" /><figcaption>Panel de control Domoticz de escritorio</figcaption></figure><p>En mi caso tal y como se puede apreciar, tengo información relevante de la Raspberry Pi, la temperatura de afuera y de dentro de casa. También algunas plugs, luces de las diferentes habitaciones o zonas de la casa.</p><p>También la posibilidad de encender/apagar el mecanismo de la puerta entre otros.</p><h3>Modelado y Impresión 3D</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UTDdrJ6WZJAp-5SNmy3lMg.png" /></figure><p>Para poder abrir de puerta de casa no basta con una señal que nos llega. Sino que dicha señal tiene que lanzar una acción, en este caso sobre la llave para hacerla girar, una acción que nosotros realizamos a diario. Aunque vi algunos mecanismos de “<a href="https://august.com/">smart lock</a>” como este, pero ninguno encajaba con el tipo de puerta.</p><p>Ademas quién quiere un sistema basado en baterías ? No nos gustaría que se quedase sin batería con nosotros fuera de casa. Por lo que el sistema debería ir directamente conectado a la corriente y solo en caso de emergencia ser alimentado por un acumulador eléctrico.</p><p>Para ello fue necesario empezar a tomar medidas y construir algo desde cero que hiciese posible el giro de la llave desde dentro, teniendo en cuenta que se trata de una puerta blindada.</p><p>Después de hacer la estructura de plástico y el manillar me puse a diseñar el sustento del motor que haría girar la llave. Mi intención principal fue partir la llave en 2 para hacer todo el soporte mas compacto pero al no poder hacerlo decidí abordar la idea. También cabía la posibilidad de hacer un sistema de engranajes pero teniendo en cuenta la durabilidad que este requería así como la fuerza de giro decidí optar por algo mas simple. Empece a diseñar las piezas 3D para después imprimirlas y después de algún reajuste este es el resultado final.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NxsVLi9r0qN4GvwUfZG4uw.png" /><figcaption>Ensamblaje de todos los componentes, en color rojo seria otras piezas como el servo y la llave</figcaption></figure><p>Dichos componentes están accesibles y se puede descargar desde la pagina web de <a href="https://www.thingiverse.com/VMadalin/about">thingiverse</a> (sitio web dedicado a compartir archivos de diseño digital creados por los usuarios).</p><h3>Ensamblaje</h3><p>El ensamblaje y montaje puede llevar mucho tiempo pero no queremos ver los cables colgando ya que aparte de ser antiestetico puede provocar mayores consecuencias como cortocircuitos. Por lo que para ello tenemos que emplear un sujeción de cable adecuada.</p><p>Este seria el resultado en mi caso, intentando que los cables apenas se aprecien pese que recorren el marco de la puerta hasta llegar a la cerradura.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*68nYY2ZmlVcNbKBhvLU42A.png" /><figcaption>A la izquierda podemos apreciar el interfono que esta conectado a la Raspberry Pi. Y a la derecha el servo motor sujetado por la pieza imprimida en 3D.</figcaption></figure><p>A su vez puede apreciarse a media altura de la puerta un botón, se trata del “<a href="https://www.amazon.com/Dash-Buttons/b?ie=UTF8&amp;node=10667898011">DashButton</a>” que es el encargado de poder abrir la puerta desde dentro de una manera muy sencilla.</p><h3>Circuito eléctrico</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*34o8JUkwSoAh5KU1l485gg.png" /><figcaption>Esquema de conexión de los distintos componentes</figcaption></figure><p>Una vez visto el montaje vamos a ver los componentes que lo forma así como la conexión con la Raspberry Pi. Para poder construirlo realice distintas pruebas a pequeña escala probando distintas configuraciones antes de realizar el montaje definitivo.</p><p>Este circuito podría ser perfectamente soldado en lugar de un tablero de circuitos, aunque siempre se puede llevar acabo en una fase posterior.</p><p>Estos son los diferentes componentes utilizados para su construcción:</p><ul><li><em>1x Servo Motor:</em> Cuya función es girar la llave para abrir y cerrar la puerta.</li><li><em>1x Power supply:</em> 9V DC de corriente que se suministra al servo motor para el correcto funcionamiento.</li><li><em>1x Magnetic Switch: </em>Detecta cuando la puerta se cierra y manda la orden al servo para girar la llave.</li><li><em>2x Relays:</em> Uno encargado de cerrar el botón del interfono y el otro de alimentar el servo solamente cuando esté lo requiera.</li><li><em>2x Transistors NPN</em>: Resolviendo el problema común de la Raspberry Pi de acelerar 3.3 GPIO a 5V para alimentar el relé.</li></ul><p>Este esquema es accesible y se puede descargar desde la pagina web de <a href="http://fritzing.org/projects/door-engine-circuit-smart-home">fritzing</a> (web de hardware libre haciendo que la electrónica sea accesible como material creativo para cualquier persona).</p><h3>Aplicación mobil</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9tLpcyKBMo9uqp8tojnewQ.png" /><figcaption>Las diferentes pantallas de la aplicación</figcaption></figure><p>Para extremar la seguridad decidí crear una aplicación propia donde toda la información pasase por un servidor propio, para poder registrar y controlar todo el trafico, así como por supuesto el acceso, en lugar de utilizar la de Domoticz para esta parte tan critica. Para ello hice uso de React-Native para agilizar el desarrollo.</p><p>La aplicación no es publica y es de uso completamente interno, constando con las diferentes funcionalidades:</p><ul><li>Escanear la huella digital al intentar lanzar una acción.</li><li>Añadir comando de voz Siri solamente disponible para la puerta de la escalera.</li><li>Sistema de notificaciones y alertas</li></ul><h3>Demostración</h3><p>El mecanismo de abertura de las puertas ha pasado por varias fases a lo largo del desarrollo desde alphas, a la actual, dedicando especial atención a la seguridad y otorgarle una estabilidad al correcto funcionamiento. Ya que no queremos que el mecanismo deje de responder o falle. Por lo que a día de hoy y con todos lo miembros de la familia utilizando el mecanismo lleva mas de un mes funcionando correctamente.</p><p>Aquí os dejo la demo de como funciona:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F_gGbyX5ESdY%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D_gGbyX5ESdY&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F_gGbyX5ESdY%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/8e25e55a7ab03791d58fe1c19847f0e1/href">https://medium.com/media/8e25e55a7ab03791d58fe1c19847f0e1/href</a></iframe><p>Basicamente el interfono mantiene por unos segundos la puerta de la escalera abierta después de recibir la acción enviada desde el comando de voz Siri, suficientes para poder entrar desde afuera. Esta acción es recibida por la Raspberry Pi que cierra el circuito del botón mediante el relé , ejecutando la misma lógica como si lo hubiésemos pulsado.</p><p>Por lo contrario la acción de abrir la puerta reforzada solamente puede ser lanzada mediante huella digital y la puerta se mantendrá abierta hasta que el interruptor magnético detecte el cierre de la misma, tal y como se puede apreciar.</p><h3>Tecnologías y librerías</h3><p>En cuanto a tecnologías utilizadas en el proyecto tanto el servidor como la Raspberry Pi se ejecuta bajo nodeJS. Utilizando <a href="https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events">SSE</a> (Server Send Events) para dicha comunicación, conjuntamente con <a href="https://aws.amazon.com/lambda/">AWS Lambdas</a> para la ejecución de diferentes acciones.</p><p>Sin olvidar el <a href="https://www.npmjs.com/package/pm2">PM2</a> (Process Manager2) el administrador de procesos permite mantener las aplicaciones con vida para siempre, para recargarlas sin tiempo de inactividad y para facilitar las tareas comunes de DevOps</p><p>A su vez para el control de <a href="https://www.raspberrypi.org/documentation/usage/gpio/">GPIO</a> (General Purpose Input Output) se ha utilizado la librería de node <a href="https://www.npmjs.com/package/pigpio">pigpio</a>, es un wrapper for the <a href="https://github.com/joan2937/pigpio">pigpio C library</a>. Aunque pueden encontrarse otras alternativas como<a href="https://www.npmjs.com/package/johnny-five"> johnny-five</a> para usos de IoT and Robotics programming.</p><p>La aplicación mobile hace uso de librerías <a href="https://www.npmjs.com/">npm</a> especificas para las siguientes funcionalidades:</p><blockquote>Función de escáner de huellas dactilares: <a href="https://www.npmjs.com/package/react-native-fingerprint-scanner">https://www.npmjs.com/package/react-native-fingerprint-scanner</a></blockquote><blockquote>Función de comandos Siri: <a href="https://www.npmjs.com/package/react-native-siri-shortcut">https://www.npmjs.com/package/react-native-siri-shortcut</a></blockquote><p>Tanto el control de los diferentes microchips utilizados el <em>ESP8266</em> y <em>Node MCU </em>en el montaje, así<em> </em>como los distintos device modules conectados a ellos como el sensor de temperatura y humedad<em>(</em>DTH11), 4-digit display (TM1637), relay module entre otros se han usado con librerías especificas recomendadas por el fabricante que algunos de ellos pueden encontrarse <a href="https://www.arduinolibraries.info/">aqu</a>í.</p><h3>Software</h3><p>Para la realización de las distintas partes del proyecto como el sistema de monitorización y control de dispositivos, el modelado y impresión 3D, el diseño y programación del circuito se han utilizado diferentes software de terceros como:</p><blockquote><strong>Sistema de automatización</strong>: <a href="https://www.domoticz.com/">Domoticz</a></blockquote><blockquote><strong>Prototipo electrónico</strong>: <a href="https://www.arduino.cc/">Arduino</a>, <a href="http://fritzing.org/home/">Fritzing</a></blockquote><blockquote><strong>Impresión 3D</strong>: <a href="https://ultimaker.com/en/products/ultimaker-cura-software">Ultimaker Cura</a>, <a href="https://www.simplify3d.com/">Simplify3D</a></blockquote><blockquote><strong>Modelado 3D</strong>: <a href="https://www.autodesk.com/campaigns/fusion-360-for-hobbyists">Fusion360</a>, <a href="https://www.sketchup.com/">SketchUp</a></blockquote><h3>Resumen</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*t2EQimUnw_jq2GMI_pe_Rw.jpeg" /></figure><p>Hoy en día cada vez se habla más de smart home, las empresas dedican sus esfuerzos para conquistar un mercado en alza y que facilita la vida de las personas. Para ello diseñan y venden todo tipo de dispositivos y kits como sensores, controladores, luces, interruptores y mas.. Por lo que todo el mundo podría hacer que su hogar este a la vanguardia tecnológica y controlarlo mediante su teléfono, voz, gestos, etc..</p><p>Piense sino en tener la posibilidad de programar la temperatura antes de llegar a casa, poder vigilar su casa mediante una camera de video-vigilancia instalada, controlar mediante comandos de voz los diferentes dispositivos electrónicos, levantar las persianas por la mañanas de forma automática y porque no, entrar en casa sin la necesidad de llaves desde su propio teléfono.</p><p>Aunque las posibilidades son infinitas como uno quiera. Esta claro que la tecnología esta a disposición de ser utilizada para facilitar-nos nuestra vida y la de los demás.</p><figure><a href="https://www.buymeacoffee.com/vmadalin"><img alt="" src="https://cdn-images-1.medium.com/max/159/1*Acg0UYiPaHUYPSPDHF7W3Q.png" /></a><figcaption>Support me as a writer</figcaption></figure><p>Gracias por su tiempo y lectura.</p><p>V.Madalin</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=18ab1664ee65" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>