DEV Community

Cover image for Flutter + PubNub + NodeRED + Arduino + Raspberry + IoT + Smart House (Parte 1)
Ricardo da Silva Ogliari
Ricardo da Silva Ogliari

Posted on • Updated on

Flutter + PubNub + NodeRED + Arduino + Raspberry + IoT + Smart House (Parte 1)

Olá pessoal. Hey guys.

Nesta série de artigos vou explicar detalhadamente um estudo de caso que implementei para mostrar aos meus alunos da graduação e MBA na IMED e FIAP, respectivamente. In this series of articles I will explain in detail a case study that I implemented to show to my students in IMED and FIAP.

A Idéia. The Idea.
Uma aplicação mobile com uma opção de tocar e parar uma música específica. Essa ação de início e paralisação do som causará uma ação de ligar e desligar uma lâmpada física na "casa inteligente". A mobile application with an option to play and stop a specific song. This action of starting and stopping the sound will cause an action to turn on or turn off a physical lamp in the "smart home".

O que usei no mobile?. What did I use in the mobile?
A aplicação no mobile foi criada com o Flutter. Além dos pacotes padrões que já vem com o SDK da plataforma, usei também um pacote específico para interagir com o PubNub (link aqui). he mobile application was created with Flutter. In addition to the standard packages that come with the platform SDK, I also used a specific package to interact with PubNub.

Além disso, a parte de integração com a mídia e as ações de tocar e parar o arquivo mp3, foi fortemente baseada no artigo A Comprehensive Guide to Playing Local mp3 Files (With Seek Functionality) in Flutter. The part of integration with the media and the actions of playing and stopping the mp3 file, was strongly based on the article [A complete guide to playing local mp3 files (with search functionality) on Flutter.

O que usei no Cloud? What did I use in the Cloud?
Foi necessário um ponto central para integrar o aplicativo mobile com o Node-RED rodando no Raspberry Pi. A solução encontrada foi usar o PubNub. O PubNub é um serviço de mensageria com suporte para mais de 70 SDK´s. Incluindo suporte para DART e nodes para o Node-RED. Ou seja, perfeito para meu objetivo. A central point was needed to integrate the mobile application with Node-RED running on the Raspberry Pi. The solution was found using PubNub. PubNub is a messaging service with support for more than 70 SDKs. Including support for DART and nodes for Node-RED. That is, perfect for my goal.

Você falou Node-RED? Did you say Node-RED?
Sim, correto! Usei o Node-RED para uma prototipagem rápida e upload do serviço no Raspberry Pi. Yes correct! I used Node-RED for quick prototyping and uploading the service to the Raspberry Pi.

E no Hardware, o que foi usado? And no hardware, what was used?
Foi usado um Raspberry Pi 3 Model B conectado via porta serial a um Arduino Uno. No Uno, por sua vez, liguei um relê de apenas um canal que liga ou desliga a lâmpada. A Raspberry Pi 3 Model B connected via serial port on an Arduino Uno was used. In Uno, I connected a relay that turn on or turn off the lamp.

E agora? And Now?
Nos próximos artigos desta série vamos reconstruir passo a passo o desenvolvimento do caso de uso. In the next articles in this series we will reconstruct the use case development step by step.

Aguardem.... :)

Top comments (0)