Free up to 1MM monthly messages. No credit card required.
In our series on building an Arduino-controlled smart home with PubNub, I’ve gone into more detail on many of the roadblocks I faced while constructing the home automation model. In a previous blog post, I explained how I was able to connect my Arduino Uno and Ethernet Shield to the PubNub Data Stream Network.
Near completion, I decided to make his house wireless and replaced the Arduino Uno with the Arduino Yun. In addition to a WiFi chip, Yun has a second processor that runs Linux. This blog post walks through how to get Arduino Yun up and running on the PubNub Data Stream Network.
The Arduino Yun is Arduino’s flagship IoT chip. It includes onboard WiFi, USB power, and two processors; one of which is used to run Linux. The Arduino Yun is a microcontroller board based on the ATmega32u4 (datasheet) and the Atheros AR9331.
The Atheros processor supports a Linux distribution based on OpenWrt named OpenWrt-Yun. The board has built-in Ethernet and WiFi support, a USB-A port, micro-SD card slot, 20 digital input/output pins (of which 7 can be used as PWM outputs and 12 as analog inputs), a 16 MHz crystal oscillator, a micro USB connection, an ICSP header, and a 3 reset buttons. Unfortunately we didn’t have a PubNub library specifically for the Yun. So I wrote one.
We like to say “if it can connect to the Internet, it can connect to PubNub.” The fact is that basic publish, subscribe, and history calls with PubNub can all be completed with our HTTP REST Push API.
The following is a short snippet demonstrating how to use the HttpClient. We’ll also have a full featured library available as part of the Arduino PubNub SDK soon.
The Arduino starts by making a request to the PubNub subscribe endpoint (on the linux processor). When data is received, it’s streamed to the Arduino sketch.
I opened the PubNub developer console and started sending messages like this:
Once I figured out how to parse the JSON payloads, I simply matched keys to functions and values to parameters.
Now I was able to trigger functions in Arduino through the PubNub developer console!
That’s it! Below are the other Arduino-controlled smart home resources:
A Notice of Privacy Practices (NPP) is one of the requirements of HIPAA and helps patients understand their personal data rights.
HIPAA violations can be financially expensive and devastating to a brand. Examine some examples of HIPAA violations, and learn...
HIPAA covered entities must follow the five technical safeguards to achieve HIPAA compliance and prevent data corruption.