30 domów w 2023 roku
Deweloperzy Internetu Rzeczy (IoT) często muszą wdrożyć solidny mechanizm do lokalnego lub zdalnego zarządzania stanem urządzeń IoT. Typowym przykładem jest inteligentny grzejnik domowy, urządzenie IoT, w którym można regulować temperaturę (stan urządzenia) za pomocą wbudowanego panelu sterowania lub wyzwalać komunikaty zdalnego sterowania z aplikacji w chmurze.
Możesz szybko stworzyć taki mechanizm za pomocą usługiCień urządzenia AWS IoT. AWS IoT Device Shadow może współdzielić stan urządzenia z logiką biznesową nawet wtedy, gdy połączenie sieciowe nie działa.
Ponadto można go używać do efektywnego zarządzania cyklem życia oprogramowania urządzenia i przyspieszania zadań programistycznych.AWS IoT Greengrasswraz z jego końcowymi składnikami. AWS IoT Greengrass to środowisko uruchomieniowe typu open source i usługa w chmurze do opracowywania, wdrażania i zarządzania oprogramowaniem urządzeń. Jednym ze składników AWS IoT Greengrass jestMenedżer cieniktóry aktywuje usługę lokalną na Twoim głównym urządzeniu. Lokalna usługa cienia umożliwia komponentom korzystanie z komunikacji międzyprocesowej (IPC).interakcja z lokalnymi cieniami. Komponent Shadow Management zarządza lokalnym przechowywaniem dokumentów w tle, a także obsługuje synchronizację lokalnych stanów w tle z usługą cienia urządzenia AWS IoT.
W poniższym artykule autorzy używają razem AWS IoT Device Shadow i AWS IoT GreengrassRaspberryPii sprzętelegancki kapeluszdo symulacji inteligentnego ogrzewania domowego. Ta demonstracja używa liczby jednocyfrowej (0 - 9) do symulacji mocy wyjściowej. Ten numer to status urządzenia, którym chcemy zarządzać w dowolnym miejscu lokalnie i zdalnie. Użytkownik może zmienić ten numer za pomocą lokalnego przełącznika sprzętowego (joystick wbudowany w Sense HAT) jak i zdalnie z aplikacji w chmurze.
Raspberry Pi wyświetla liczbę na wyświetlaczu LED Sense HAT wskazującą moc grzewczą. Użytkownik może nacisnąć joystick na Sense HAT, aby zwiększyć liczbę (lub nacisnąć w dół, aby ją zmniejszyć).
Postępując zgodnie z tym artykułem, możesz szybko rozpocząć opracowywanie i testowanie rozwiązań IoT do zarządzania stanem urządzeń w dowolnym miejscu.
Warunki
Aby śledzić treść tego artykułu, użyj:
narzędzia, akcesoria
- EMRaspberryPi(To demo wykorzystuje Raspberry Pi 3B)
- Hm Raspberry Pielegancki kapelusz
Oprogramowanie
- SO Raspberry Pi (64 bity) zainstalowanybez Raspberry Pi
- Sense HAT SDKzainstalowany nie Raspberry Pi
- konto AWSoraz prawa dostępu do AWS IoT Core i AWS IoT Greengrass
Przewodnik
Etapa 1: Instalacja i konfiguracja głównego oprogramowania dla AWS IoT Greengrass bez Raspberry Pi.
Aby ustawić Raspberry Pi jako podstawowe urządzenie AWS IoT Greengrass, wykonaj kroki 1-3 w tym dokumencieWprowadzenie do AWS IoT Greengrass. Autorzy stworzyli urządzenie o następującej konfiguracji:
- nazwa urządzenia bazowego: PiWithSenseHat
- grupa rzeczy: Grupa RaspberryPi
Powinieneś teraz zobaczyć tę jednostkę w konsoli AWS.
Krok 2: Wdróż na urządzeniu gotowe komponenty AWS IoT Greengrass
Kolejnym krokiem jest wdrożenieGotowe komponenty AWS IoT Greengrassna urządzeniu. AWS IoT Greengrass dostarcza i utrzymuje zestaw gotowych komponentów, które mogą przyspieszyć rozwój. W tym demo zaimplementowano następujące komponenty:
- gram.:
- Zapewnia lokalny interfejs CLI, którego można używać na urządzeniach hosta do lokalnego wdrażania i debugowania komponentów.
- greengrass.ShadowManager
- Włącza lokalną usługę cienia na urządzeniu głównym i obsługuje synchronizację lokalnych stanów cienia z AWS IoT Device Shadow
- greengrass.LocalDebugConsole(opcjonalny)
- Zapewnia lokalny pulpit nawigacyjny, który wyświetla informacje o kluczowych urządzeniach AWS IoT Greengrass i ich komponentach
Trin:
- przejdź do konsoliAWS IoT Greengrass
- Przejdź do wdrożenia Greengrass, utwórz nowe wdrożenie
- Celem rozwoju może być RaspberryPiGroup Thing lub urządzenie Core
- Wybierz te 3 komponenty z publicznych komponentów
- aws.greengrass.ShadowManager Konfigurator komponentów
W kroku Konfiguruj komponenty wybierz aws.greengrass.ShadowManager i kliknij Konfiguruj komponent.
- Skonfiguruj wersję komponentu i plik konfiguracyjny json aws.greengrass.ShadowManager
- Wersja:3.1
- ustawienie warkocza:
JSON
{ "synchronize": { "coreThing": { "classic": true, "namedShadows": [ "NumberLEDNamedShadow" ] }, "shadowDocuments": [], "direction": "betweenDeviceAndCloud" }, "rateLimits": { " maxOutboundSyncUpdatesPerSecond": 100, "maxTotalLocalRequestsRate": 200, "maxLocalRequestsPerSecondPerThing": 20}, "shadowDocumentSizeLimitBytes": 8192}
konfiguracja json jest zsynchronizowananazwany cień, w tym przykładzie o nazwie NumberLEDNamedShadow, w obu kierunkach, między DeviceAndCloud. W swojej prawdziwej aplikacji możesz używać wielu cieni tagów i jednokierunkowej lub dwukierunkowej synchronizacji. Sprawdź szczegóły aws.greengrass.ShadowManager pod adresemTwoje dokumenty.
- Ukończ pracę kreatora instalacji, aby zakończyć wdrażanie.
Pod koniec kroku 2 Raspberry Pi jest gotowe do synchronizacji NumberLEDNamedShadow między urządzeniem a chmurą przy użyciu podstawowego oprogramowania i punktu końcowego AWS IoT Greengrass.
Krok 3: Utwórz komponenty AWS IoT Greengrass, aby symulować lokalnie sterowany inteligentny grzejnik domowy
Teraz utwórz dwa komponenty AWS IoT Greengrass, aby symulować inteligentne ogrzewanie domu ze sterowaniem lokalnym. Możesz użyćkomunikacja międzyprocesowa(IPC) do komunikacji wewnętrznej między komponentami. Jeśli nie wiesz, jak utworzyć niestandardowe składniki AWS IoT Greengrass, wykonaj krok 4 wdokument startowy. Na potrzeby tego artykułu autorzy budują je i testują lokalnie.
- Example.sensehat.joystick: Przechwytywanie zdarzeń joysticka i publikowanie ich w temacie IPC „ipc/joystick” (zdefiniowanym jako zmienna w recepturze).
- Obiekt example.sensehat.led: Subskrybuj temat IPC „ipc/joystick”, zaktualizuj lokalny moduł cieniujący Sense HAT i wyświetlacz LED.
3.1 Opret com.example.sensehat.joystick
Ten komponent publikuje osadzone zdarzenia joysticka w rdzeniu AWS IoT Greengrass IPC. Wydarzenie to:
JSON
{ "timemillis": 1669202845134, "direction": "w dół", "action": "wydany"}
Możesz znaleźćprzychódskładnik Iartefaktdepozytukod źródłowy bloga. Zamiast zakodować na stałe motyw IPC w kodzie źródłowym, tak jestpodany w przepisiejako zmienna.
3.2 Utwórz komponent com.example.sensehat.led
Teraz utwórz kolejny komponent o nazwie com.example.sensehat.led.przepisskładnik Iartefaktmożna znaleźć w repozytorium kodu źródłowego. w przepisiedefiniowaćPrawa dostępu do dokumentów IPC i shadowingu.
To składniki:
- Przechowuje numer jako status urządzenia i wyświetla go na diodzie LED
- Dołącz do wątku zdarzeń joysticka przez IPC
- Zwiększa/zmniejsza liczbę na podstawie zdarzenia otrzymanego z joysticka
- Okresowo sprawdzaj odcień. Jeśli w dokumencie w tle pojawi się nowy numer, zaktualizuj urządzenie, wprowadzając ten numer.
Demo: Kontrola stanu uruchomionego urządzenia
Teraz Raspberry Pi jako symulator jest gotowy do użycia.
Reaguje na 2 rodzaje zdarzeń:
- Nowe zdarzenie dotyczące joysticka: Steruj urządzeniem lokalnie
- Nowy dokument w chmurze: zdalne sterowanie urządzeniem
Aby zobaczyć cień urządzenia w akcji:
- przejdź do konsoliAWS IoT Greengrass
- Przejdź do Rzeczy, wybierz PiWithSenseHat
- Ccienie urządzeńmożesz znaleźć NumberLEDNamedShadow. Pamiętaj, że nie musisz ręcznie tworzyć tego cienia. Gdy urządzenie po raz pierwszy zgłosi cień, utworzy go dla Ciebie, jeśli nie istnieje.
Demo 1: Zaktualizuj urządzenie lokalnie za pomocą joysticka
- Użyj joysticka, aby zwiększyć/zmniejszyć numer lokalnie (liczba początkowa to 6. Najpierw zmniejszona do 0, a następnie zwiększona do 2).
- Zobacz aktualizację dokumentu zaplecza urządzenia w czasie rzeczywistym w konsoli AWS. Zmiana jest synchronizowana z cieniem chmury w czasie rzeczywistym.
- status zmienia się na „lokalnie zaktualizowane urządzenie”
- numer zostanie zmieniony na nową wartość lokalizacji
Demo 2: Aktualizuj urządzenie zdalnie, aktualizując dokument w tle na urządzeniu w chmurze
- Na początku tej demonstracji dioda LED urządzenia wskazywała 0
{ "status": { "żądany": { "number": 0 }, "reported": { "status": "urządzenie zaktualizowane według lokalizacji", "number": 0 } }}
- W konsoli AWS IoT Core przetwórz dokument w tle następującym Jsonem (możesz pominąć sekcję „zapytanie”), a następnie kliknij Odśwież
{ "stan": { "pożądany": { "liczba":9 } }}
- Zobacz numer aktualizacji Raspberry Pi LED. Zmiana jest wysyłana z chmury na urządzenie lokalne. Teraz urządzenie pokazuje numer 9:
- zmiany statusu na „urządzenie zaktualizowane w tle”
- liczba zmienia się od 0 do 9.
Ponieważ numer wyglądu można aktualizować za pomocą joysticka lokalnie lub zdalnie z konsoli AWS, najnowsza aktualizacja ma pierwszeństwo. Dlatego ważne jest, aby aktualizacja była wykonywana lokalniezdefiniuj "chciany"wartość z powrotem do zdalnego cienia w chmurze, aby zdalny cień znał nową „pożądaną” wartość i nie aktualizował jej w następnym cyklu synchronizacji w tle. Zobacz więcej w dokumenciepuste pola-cienia jednostki.
sprzątanie domu
Usuń/wyłącz użytkownika IAM, którego użyłeś do zainstalowania podstawowego oprogramowania układowego AWS IoT Greengrass na swoim Raspberry Pi
W konsoli AWS IoT przejdź do Greengrass Devices
W obszarze Urządzenie podstawowe wybierz urządzenie PiWithSenseHat i naciśnij Usuń w prawym górnym rogu.
W grupie rzeczy usuń RaspberryPiGroup
Usuń te dwa niestandardowe komponenty Raspberry Pi
Uruchom następujące polecenia w terminalu Raspberry Pi
sudo /greengrass/v2/bin/greengrass-cli --ggcRootPath /greengrass/v2 wyjście dziennika --værdi "com.example.sensehat.led"
sudo /greengrass/v2/bin/greengrass-cli --ggcRootPath /greengrass/v2 log output --value "com.example.sensehat.joystick"
Odinstaluj oprogramowanie AWS IoT Greengrass Core dla Raspberry Pi
Postępuj zgodnie z opisanymi krokamiw tym dokumencieAby odinstalować oprogramowanie AWS IoT Greengrass Core dla Raspberry Pi.
wnioski
Korzystając z tego artykułu, dowiedziałeś się, jak używać AWS IoT Device Shadow i AWS IoT Greengrass do tworzenia solidnego rozwiązania do zarządzania stanem urządzeń IoT, lokalnie lub zdalnie. Teraz możesz skupić się na własnej logice biznesowej i pozwolić tym dwóm usługom AWS zająć się zarządzaniem stanem urządzeń, gdziekolwiek jesteś. Obecnie te dwa niestandardowe składniki są budowane i wdrażane lokalnie na urządzeniu. Następnym krokiem może być udostępnienie ich w AWS IoT Greengrass, aby można je było wdrożyć na większej liczbie urządzeń. W tym celu możesz wykonać krok 5 i krok 6dokumentAWS IoT Greengrass.
Źródło:AWS
FAQs
What is Amazon IoT greengrass? ›
AWS IoT Greengrass is an Internet of Things (IoT) open source edge runtime and cloud service that helps you build, deploy, and manage device software. Customers use AWS IoT Greengrass for their IoT applications on millions of devices in homes, factories, vehicles, and businesses.
What is the shadow size in AWS IoT core? ›Shadow Size Limit
AWS IoT caches data corresponding to an IoT accessory (a thing) in the form of a JSON document known as a shadow. The maximum allowed size for this JSON document is 8 Kilobytes (KB). Of the 8 KB, 4 KB is for the actual state and 4 KB is for the desired state.
Greengrass allows AWS functionality like Lambda functions to run on distributed apps. Local IoT devices can then continue to function even with an unreliable connection to the cloud. Additionally, Greengrass provides pre-built, modular components for app development.
What is Amazon IoT device? ›AWS IoT Core is a managed cloud service that lets connected devices easily and securely interact with cloud applications and other devices. AWS IoT Core can support billions of devices and trillions of messages, and can process and route those messages to AWS endpoints and to other devices reliably and securely.
What is greengrass core device? ›AWS IoT Greengrass is software that extends cloud capabilities to local devices. This enables devices to collect and analyze data closer to the source of information, react autonomously to local events, and communicate securely with each other on local networks.
What is the purpose of device shadow? ›Device Shadows can make a device's state available to apps and other services whether the device is connected to AWS IoT or not. AWS IoT thing objects can have multiple named shadows so that your IoT solution has more options for connecting your devices to other apps and services.
What is a shadow IoT device? ›Shadow IoT is nothing more than an evolution of it: that is, it is IoT devices or sensors that are connected to the network without receiving formal authorization from the IT department. Thus, circumventing useful security controls prevents unwanted access to the corporate network.
What is the most important goal for IoT? ›IoT devices are not limited to computers or machinery. The Internet of Things can include anything with a sensor that is assigned a unique identifier (UID). The primary goal of the IoT is to create self-reporting devices that can communicate with each other (and users) in real time.
Is a Firestick an IoT device? ›Simply put, the firestick becomes a part of the connected devices that together let you watch your desired content with the help of just a click or a swipe. That is the power of IoT.
Is Alexa a home IoT device? ›Well-known examples of IoT devices include smart speakers like Amazon Alexa or Google Home, smartwatches like the Apple Watch, internet-connected baby monitors, video doorbells, and even toys.
What is IoT on my phone? ›
The Internet of Things—or IoT—is a catchy term for what is simply a network of Wi-Fi-enabled appliances or other devices that all connect to the internet. The goal is to create a smart home, one filled with internet-connected appliances that you can control remotely from your phone or other devices.
What is the difference between AWS IoT core and greengrass? ›IoT Core is a cloud service but Greengrass is an edge runtime, with supporting cloud service. You can build your device software on top of the Greengrass edge runtime. For devices with sufficient resources, Greengrass is a great way to compose and manage your device software.
What is SiteWise? ›SiteWise is a leading regional provider of turnkey utility infrastructure maintenance and construction services.
What is an edge device in networking? ›An edge device is one that serves as an entry point to an organization or service provider's network core. It includes routers, switches, wide-area networks (WANs), firewalls, and integrated access devices (IADs).
What is shadow in Android? ›Shadows are drawn by the parent of the elevated view, and thus subject to standard view clipping, clipped by the parent by default. Elevation is also useful to create animations where widgets temporarily rise above the view plane when performing some action.
What is shadow mode software? ›Shadow Mode is one main building block that is going to be used for the validation of highly automated driving functions. Shadowing is generally considered as the analysis of functions that are implemented in the car and simulate driving actions/decisions, but do not execute them.
What is shadow effect in remote sensing? ›Shadow is one of the major problems in remotely sensed imagery which hampers the accuracy of information extraction and change detection. In these images, shadow is generally produced by different objects, namely, cloud, mountain and urban materials.
What is the purpose of shadow in graphics? ›A Shadow is an area where the light, coming from a light source, is completely or partially obstructed by an object, the occluder. In Computer Graphics, the process of drawing shadows onto a scene on the screen of the computer is called Shadow Rendering. Rendering shadows helps to improve how realistic an image is.
What is the purpose of light and shadow? ›The importance of light and shadows in photography.
Light makes an image seem brighter while shadow can draw drama to a certain part of an image's composition. For great photos, a careful balance is needed.
According to Forescout's research team, Vedere Labs, IP cameras are the riskiest IoT devices because they're commonly exposed to the internet, often only secured with a weak or default password – if the device requires a password at all – and they can have easy-to-exploit unpatched vulnerabilities.
How do IoT devices get hacked? ›
Unsafe Network Services
One of the most popular attacks and infection vectors for IoT devices so far is brute-forcing passwords on Telnet and SSH services that are not disabled. After gaining access to these services, attackers can download malware to the device or gain access to valuable information.
IoT devices and sensors start by collecting data from the environment. This can mean gauging temperature or barometric pressure, learning information from a video lecture, or keeping track of specific operations.
What is the threat from IoT devices? ›IoT security risks that are frequently observed include
Insecure internet connections: A lack of security standards can leave IoT devices open to attack, and this can include hacker attacks as well.
IIoT is used in many industries and sectors, including robotics, manufacturing and smart cities. Another robotics manufacturer, Fanuc, is using sensors in its robotics, along with cloud-based data analytics, to predict the imminent failure of components in its robots.
What is a common IoT device in the home? ›Smart Mobiles, smart refrigerators, smartwatches, smart fire alarms, smart door locks, smart bicycles, medical sensors, fitness trackers, smart security system, etc., are few examples of IoT products.
Is a phone an IoT device? ›IoT involves extending internet connectivity beyond standard devices, such as desktops, laptops, smartphones and tablets, to any range of traditionally "dumb" or non-internet-enabled physical devices and everyday objects. Embedded with technology, these devices can communicate and interact over the internet.
What is the most common IoT device? ›- Smart mobiles.
- Payment terminals.
- Smartwatches.
- Voice-controlled virtual assistants (AI voice assistants)
- Smart wearables.
- Fitness and activity trackers.
- Remote health monitors.
- Baby monitors.
- Manufacturing. The manufacturing industry has always been at the forefront of technological innovation, and the Internet of Things (IoT) is no exception. ...
- Healthcare. ...
- Transportation. ...
- Conclusion.
The IoT is set to fundamentally change the way we drive, meaning driving will get a lot safer and less stressful. Traffic lights will be able to adjust to real-time traffic conditions such as when an ambulance or another emergency vehicle is approaching.
What are 4 benefits associated with IoT? ›Organizations are leveraging the benefits of IoT (Internet of Things) in many different ways today — such as improving efficiency and safety, monitoring remote and hard-to-access equipment, automating processes, reducing the environmental impact of operations, ensuring equipment and goods maintain regulatory compliance ...
How do you use IoT Greengrass? ›
- Create and package a Lambda function.
- Configure the Lambda function for AWS IoT Greengrass.
- Deploy cloud configurations to a core device.
- Verify the Lambda function is running on the core device.
The AWS IoT Device SDK lets you more easily and more quickly connect your hardware device or mobile application to AWS IoT Core. The AWS IoT Device SDK helps your devices connect, authenticate, and exchange messages with AWS IoT Core using the MQTT, HTTP, or WebSockets protocols.
What is the role of Amazon Kinesis in IoT applications? ›Amazon Kinesis cost-effectively processes and analyzes streaming data at any scale as a fully managed service. With Kinesis, you can ingest real-time data, such as video, audio, application logs, website clickstreams, and IoT telemetry data, for machine learning (ML), analytics, and other applications.
How Python is used in IoT? ›Python is the coding language that we can use to reduce the volume of data that we need to deal with, accessible in the cloud. Python recognizes the needs regardless of whether we create the IoT project from scratch or interact with actuators, sensors, and accessories.
How to learn IoT from scratch? ›- Build your own IoT projects using NodeMCU based on Arduino platform.
- Write programs to control your hardware.
- Connect your IoTs to cloud services to store/process/share some data.
Using the IoT technology with Raspberry Pi 3 allows you to monitor and control devices remotely, collect and exchange data and create automation systems with relative ease. Moreover, Raspberry Pi 3 can be expanded by adding different sensors and modules.
What is cloud vs edge vs IoT? ›Clouds can exist without the Internet of Things (IoT) or edge devices. IoT and edge can exist without clouds. IoT can exist without edge devices or edge computing. IoT devices may connect to an edge or a cloud.
How does greengrass work? ›Greengrass secures data with authentication and authorization at both the network- and device-level. IoT devices in a Greengrass deployment communicate with each other through local networks. A business can filter and transmit only the data it wants to the cloud, which reduces data migration and storage costs.
Do I have to use AWS IoT Greengrass OTA updates? ›You can install and run the AWS IoT Greengrass Core software on a partition that has trusted boot enabled, but OTA updates aren't supported. AWS IoT Greengrass must have read/write permissions on the partition that contains the AWS IoT Greengrass Core software.
Does Amazon use IoT? ›In today's world of hyperconnectivity, the Internet of Things (IoT) is the basis for many companies to drive their business forward. Amazon – the world's largest online retailer and a leading cloud services provider also uses IoT technology to innovate for a better customer experience.
Is Amazon Echo voice control an IoT device? ›
Devices like Amazon Echo are IoT devices powered by an internet-connected voice assistant.
Where is AWS IoT data stored? ›The unprocessed messages are stored in an Amazon Simple Storage Service (Amazon S3) bucket that you or AWS IoT Analytics manage. A pipeline consumes messages from a channel and enables you to process the messages before storing them in a data store.
Does Netflix use Amazon Kinesis? ›Netflix's Amazon Kinesis Streams-based solution has proven to be highly scalable, each day processing billions of traffic flows. Typically, about 1,000 Amazon Kinesis shards work in parallel to process the data stream.
What is an example of Kinesis? ›An example of kinesis is the movement of a cell or an organism as a result of its exposure to certain stimuli such as light, temperature, and chemical. The two main types of kineses are orthokinesis and klinokinesis.
What companies use AWS Kinesis? ›- Arity. Arity is a technology company focused on making transportation smarter, safer, and more useful. ...
- NHL. The National Hockey League is the second-oldest of the four major professional team sports leagues in North America. ...
- SOCAR. ...
- NortonLifeLock. ...
- Nextdoor. ...
- BT Group. ...
- Lightricks. ...
- Autodesk.