All the Internet of Things — Episode 4 — Adafruit IO: An IoT Service for Everyone @digikey #adafruit

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello and welcome to episode 4 of Adafruit and digit keys all the internet-of-things a six-part series that covers everything you need to know about IOT in the previous episode we discussed services services are what you use to route events to and from your IOT devices coordinate real-time communication between multiple devices and record process and visualize the data that your things are producing we also talked about some of the large cloud services such as Amazon AWS IOT Google cloud IOT and microsoft azure IOT suite now you might find that although these services provide robust security and sophisticated deployment tools and getting started with using their comprehensive technology is intimidating if only there was some coyote service that proved easy to understand and implement maybe one with high quality documentation with examples learning guides and community support and maybe just maybe an IOT service that provides open source solutions with a low to no cost point of entry well on today's episode I'm happy to do a formal introduction to just that our very own Adafruit IO [Music] here at Adafruit we manufacture support and sell all of these amazing sensors LEDs and robotics so naturally we wanted a good way to interact with them over the internet now we've covered a bunch of great services for data logging and communicating with your microcontrollers over the web but we wanted a service that fits the need of the prototyping and maker community and was designed for engineers of all skill levels so we decided to build our own system and that's how Adafruit i/o got started like many of the services we've introduced we maintain both MQTT and REST API s which is how you'll be communicating with Adafruit I over the Internet but you don't have to be an expert programmer we've built robust client libraries with lots of examples so you can probably start with some ready to go code once you've got your device connected you can control and monitor using configurable dashboards the web dashboards come with a dozen widgets that love for easy two-way interaction with your devices you'll get buttons gauges maps sliders and more and outside of the dashboard you can create triggers to say email you when your water sensor value goes above 9000 we are really happy with the way Adafruit i/o is coming along it's available and free for anyone with an Adafruit account for the vast number of people starting out with IOT the basic account will do everything they need and crew members can get some nifty extras and more bandwidth this video and guide will go over all things Adafruit IO including how to get started and use it for i/o to make the most out of your project and now that you know to expect using Adafruit i/o let's focus on how to get started some services lock you into using just their hardware or transport but Adafruit IO is agnostic about what it is connecting to in theory anything that can send messages over the end it will work but we do have some recommendations the Adafruit feather line and microcontrollers are low-cost have built in networking and battery charging and are easy to program with our example Arduino libraries if you're planning to use Wi-Fi the feather huzzah esp8266 is a common choice for ultra-low cost but has few GPIO for more power while still keeping that built-in Wi-Fi the feather ESP 32 is an upgrade with more pins and a beefier chip the feather m0 Wi-Fi board gives you a 70 21 arm cortex-m zero with a separate Wi-Fi module good if you need native USB or have existing arm code to run and you don't want to use a different core chipset these will all be programmed in C C++ or do we know if battery life and portability isn't as important the Raspberry Pi computers and other single board computers are also a great choice these tend to have Ethernet as well as Wi-Fi built in and the Linux operating system will take care of all your networking for you so it's incredibly easy to get started and you can use Python which is higher level and easier to use than C or C++ and of course you can also use Bluetooth Low Energy and Ted are using our bluefruit Connect app for that week recommend our NR 52 832 or NRF 52 840 blue fruit feathers and of course you'll also need an iOS or Android phone that will stay on all the time perform the data transfer there's two halves to every service online the backend or data is handled and the front-end were use a web browser to interact for most Internet services you use on a day-to-day basis you don't deal with the backend at all it doesn't matter how that restaurant girl the dish is listed on their website as long as you can order them for delivery the backend is where you'll be sending your sensor data to and from our server it's literally named Adafruit il so it's pretty easy to remember you can with send or receive data in two ways with the rest or mqtt which one you use will depend a lot on your hardware bandwidth and language needs we covered this extensively in previous videos so go back and watch those if you haven't yet we recommend rest for your first project it's easy to understand and debug either way once you've picked your hardware and transport check how you want to program it and then choose one of our provided libraries we've got coding examples for Arduino C C++ Python nodejs and even going get started by registering for an account on adafruit.com once you're logged into your account you can view your Adafruit ioki if your key is ever lost or compromised you can always generate a new key however you will need to reach up date all of your existing projects so don't share your key okay let's check out the way we store data in Adafruit il after all that's what we're here for data on io is kept in time-series databases called feeds each feed contains timestamp data points now those data points don't have to be just numbers they can be any type of data but for example you could store numbers say for environmental data like temperature humidity and numbers can also be used for controlling hardware say robot motors throttle or speed human readable ASCII strings are also common often displayed either on a dashboard or in the device is display finally binary data can be saved as well now we strongly recommend encoding it in base64 so you can store or retrieve it with the rest of Jason not just mqtt for example jpg encoded photos could be base64 encoded and then uploaded or if you have a firmer over-the-air update you could store it as an ascii Intel hex file or likewise base64 encode in addition to the main storage data chunk you want to keep you can also attach metadata the first and most obvious metadata is that time the data was entered into a deferred il and this is handled for you when you post data to the feed we timestamp in the second metadata is location where you can set where on earth the data came from that metadata is something you have to add yourself we don't provide a geo tagging service at this time but if you have a GPS module or you can use a geo IP service you can add that on every post location addition is only possible via the REST API you can see the JSON format for adding it here let's create a new feed to demonstrate how that works from your Adafruit I out count select feeds now in actions you can create a new feed let's create one called temperature if it is created now let's show how to add some data select the feed and under actions you can add data for example let's add the temperature 25 degrees Celsius that's it once you've added the data manually you'll see the value as well as the timestamp in this case it's in human readable format created at the bottom of the feed now let's see what happens if we enter incorrect data under actions will add data but this time instead of a number we'll add a string notice that Adafruit i/o does not do any type checking it will let you enter any kind of data you like so you can take advantage of that or you can make sure that your code filters out any incorrect data we can remove the incorrect data where the action remove selected data while I'm here I'd like to show you that if you ever want to download all the data from your feed select download all day you can get it as a structured JSON file or as a CSV txt file of course now that we've got that feed setup we'll want to automatically send data from our thing to it let's show how to do that with both a Raspberry Pi and Python as well as a feather ESP and C++ Arduino let's start with a Raspberry Pi with Python we've already set up the PI's operating system in Wi-Fi we'll wire up the sensor over I squared C and then we run this python script for our sensor will use the ADT 74 10 from analog devices which is a high precision temperature sensor with I squared C interface this is the code we have running on our Raspberry Pi written in Python as you can tell it's pretty simple we're going to be using the Adafruit IO restclient we set up our i/o key and the user name that's how we authenticate then we connect to the service set up our feed add a little bit of circuit Python library code to talk to that ADT 7410 sensor and then finally in a while loop we simply read the temperature and then send it to a deferred i/o wait a few seconds and then repeat as you can tell it's pretty simple and works quite well once you've got your hardware set up go to your Adafruit i/o account and visit the monitor page this is what you can see lime data streaming in as it's written to Adafruit IO you can see the timestamp the feed as well as the data being written this is great for debugging your project because you can see data coming in live and if there's any errors or typos they may appear in the live error section likewise here's an example using the esp8266 feather with an OLED on top and an analog devices ADT 7410 wired up on a breadboard with the ESP feather or stuck with a my controller rather than a full computer so we don't use python instead we'll stick to or do we know C++ the trade-off is we have much lower power usage so we can run off a battery and faster boot but we always have to be more careful with memory and link management here's the Arduino code for the feather-like the Python code it's pretty simple we still need our Adafruit io username and he this time because we don't have an operating system to manage the internet we'll also need to put in the SSID and password after that we initialize the sensor and also the Adafruit IO feed object in the setup we connect to the sensor connect to Adafruit i/o and then wait to make sure that we've connected once we're connected in the loop we have an i/o run procedure that takes care of background tasks reads the temperature and then saves it to Adafruit IL afterwards we just wait and then run the loop again and as we can see on the OLED it's also printing out the temperature and sending data successfully over an Adafruit i/o go back to the monitor and you'll be able to see the huzzah temperature data come in just like you did with the Raspberry Pi once you've got your huzzah or Raspberry Pi sending temperature data to a deferred i/o you can visit the feed page here you can see every single value with the timestamp of when it was received as well as view a plot of historical data of your entire feed now that your feed is running let's see what else we can do when you select the feed you'll have a bunch of options running down the side let's go to the first one feed info this is pretty much what you expect you've got the human readable name and then the key the key is what you are using with MQTT arrest so you don't want to change this unless you want to update your code as well we also have the quick URLs and end points for MQTT this is handy you can just copy and paste them into your code and finally the description that's for you to keep track of what's going on in your feed next is privacy now by default all of your feeds are going to be private that means only you can read and write to them and only if you're logged in if you set your feet to be public then you'll be able to get the URL from the feed info and anybody can see the data in your feed however they won't be able to write to it they can only view it now you might think that the privacy is pretty extreme either it's completely private or it's completely public so we have another option called sharing you can share read or read right versions of your feet to other Adafruit IO members now they have to be logged in and they have to have an account to do so but this allows you to have more control if you have a friend who you want to also write to one of your feeds they can do that if you give them permission you'll have to invite them by username and select whether you want them to be read or read/write only permission next up is feed history by default feed history is on that means you're going to have all the historical data that you've pushed the feed available for you to download or plot or download later however you might want to turn your history off if you do so you'll only have one data point per feed however the data can be a lot larger up to 100 kilobytes so if you want to store images or binary data or over their firmware you'll need to turn the history off if you're using more than one kilobyte next is notifications now notifications is a really neat service that Adafruit IO has and a lot of IOT services don't this will tell you when something goes wrong with your feed so for example if I want to be notified if my feed goes down and no data is coming in for 1030 up to 7 days I can set that up and when I create it I will be notified by email if the feed goes 30 minutes without an update here's an example of an email that a deferred IO sent me when my huzzah temperature feed went down for over 10 minutes let's skip webhooks and go straight to disable feed unless you have an Adafruit IO Plus account there is a limit of how many feeds you can have instead of just deleting the feed you can disable it however once it's disabled you can't reactivate it however a disabled feed will allow you to download the data before you delete it finally there's licensing now if you have your feed with public data you may want to select a license that tells people how you expect that data will be used we have a variety of Creative Commons licenses available if you're interested in what these mean go visit Creative Commons org they've got great tutorials on all the different Creative Commons licenses available ok finally lets them back to webhooks as i mentioned in earlier videos nearly every website and service on the internet has ways to communicate with other sites now while rest is coming again you can only pull data over rest which makes it a high traffic protocol when you're constantly pulling for new data web hooks are how REST API supporting sites support data pushing for example let's say you wanted to get a user's latest Twitter message instead of constantly connecting to the Twitter API every minute to check if a new message has been posted you can ask Twitter to update a web hook URL on each post that means Twitter will contact you and your server when there's new data but as you can imagine you need that web server to listen for that posting in this case Adafruit IO can act as that web hook destination for you let's show an example a deferred IO only supports receiving data at this time we need a service that will publish data into a feed now select web hooks you can create a new web hook URL for your feed we have some expiration and data rate limits we'll use the default you'll get the web hook URL at the bottom now if you happen to be able to control the JSON data being pushed and you can make sure that the value you want is in the JSON structure under value you can use this URL as is otherwise you can add /ro to the end to get the entire contents of the web hook event or if you just want to be notified that a web hook got pushed you can add slash notify either way copy and paste this URL and we'll add it to the web hook sender now we need something to push to that web hook we're going to use github which has some amazing web hook integration on your account go to web hooks and add a web hook here we're gonna paste that URL we had from before and then because we want the full data we add raw at the end make sure your content type is Jason we don't have a secret and we'll select a specific event in this case instead of push notification we want to be notified when someone stars or watches our repository then add the web hook that's it back at your Adafruit IO page you'll see the live data come in from github about two kilobytes of data there a nice web hook provider they'll always push an initial hook just to let you know that it's still working and now if anyone ever stars at one of our a 2-foot github repos you'll see that action come in with that full payload of about 7.5 kilobytes you'll see new entries come in immediately it's way faster than trying to pull github now I've got here a Raspberry Pi connect it to Adafruit IO that is watching that feed and it's also wired up to this star so whenever a new message arrives it lights up these LEDs to let me know that someone start an Adafruit github repository like so one of the big benefits of web hooks is when you have services that don't update that often but you want quick updates when they do also most web services require an API or authentication key which can be really annoying to manage the web hooks are often free with services no API or key required so they can easily provide that glue that integrates with Adafruit io and other sites with little fuss okay now we've got data streaming into feeds on a deferred i/o and little the cool tricks you can do with those feeds now the projects data can be viewed and analyzed in real time if you want to interface with the feed data you can always query and fetch that data on any computer device using the rest or MQTT api and we've got plenty of libraries for every language to do so ultimately almost every internet-of-things project will it some level need to provide a way for the things to deal with the humans user interface considerations can range from a mobile app that allows a user to turn lights on and off maybe adjust the volume on a music player to output features such as status monitors analytics and data visualization dashboards however making a custom app with a user interface can be a ton of work you can create a quick and simple UI using the built in dashboard capability in Alfred il from your account select dashboards and you can create a new dashboard a dashboard is just an edible graphical interface web page click the plus button to create a new block or element we have a wide range of really great looking elements that you can add to your dashboard of course you should start with making all your feeds and getting them working well with all that data once that's done you can then visit the dashboard section of the Adafruit IO site free accounts can have up to five dashboards and each dashboard can have as many elements as you like one thing to note about elements as we go through them is that some of them pull from feed data and some push to your feeds and some do both we'll explain as we go through them note that since all the elements read from the underlying feeds they can also affect each other which can be great for adding quick visual feedback let's add the first block to our dashboard we'll go in a line chart and let's plot that temperature data that we've been saving to our feed you can select any history amount for your temperature data let's do the last four hours and it'll show a line graph sort of like you see on your feed overview page after you create the block refresh your page and you'll see the historical temperature data you can overlay with your mouse to see the data and the timestamp the line graph is great for historical data but if you want instantaneous data the gage block might be pretty handy again we're going to display our huzzah temperature and add that to our web page this time we show the instantaneous value as it's received and you can see there's a gauge going from 0 to 100 once you've added some blocks you can edit your dashboard and rearrange it resizing and moving around the blocks as desired once you've got your block set up you can also edit them so for example on this gauge block we can change the feed we can change the min and Max values as well to be something a little bit more realistic and then we can have a preview over here that shows us what it looks like at different values you can also set low warning and high value warning so if you want to know if the temperature goes below or above a different value now you've seen our gauge block has been updated you've seen two read-only elements now let's add a block that writes data to a feed let's start with the momentary push-button it's pretty much what it sounds like when you press the button with your mouse it'll send one value to a feed and when you release it'll send another value and of course you can change your color now that I've got the button and the feed down at the bottom of the screen you'll see when I click the button the on value is written and when I release the button the off value is written so I can tell when I pressed and release the button on my dashboard with non numeric data like this button generates on and off you can't use the plot or gauge element so instead if we want to view that data let's use a text element instead when added it will show the instantaneous value of the feed that it's attached to so when I press the button it says on and when I release I say off this is a great way to debug data in your feeds the text block will show you the instantaneous value of a feed if you want more data sort of like the monitor check out the stream block when attached to a feed this block will show you all the data about that feed including time stamps the last data written and a historical list of all data so as I press the button you can see data coming into the stream block data updating in my feed below and the text block all updating automatically you can see here that the feed is written two by one element and read from two different elements okay so we've seen some elements that can write to feed an elements that can green from feeds but what about elements that do both well let's check out the toggle switch the toggle switch is kind of a mix of the button and the text element you can set it on or off but it will both read and write from a feed let's show this off now when I click the toggle button it will send the on or off signal to our feed and you can see that over on the text and monitor elements but also if I press the reset button you'll see it updates the toggle button at the same time so this one will always reflect what's in the feed and I can write to it or read from it here we have a feather huzzah connected to a servo and led the feathers connected to a deferred i/o and sync to a feed called servo which will tell us where to move the servo and a feed called LED for that the LED is on or off we've also got a dashboard that we've made with a slider element connected to the servo and a toggle switch kick to the LED now when I click the toggle you'll see the LED turns on and off almost instantly and likewise with the slider I can change the slider value and that angle is sent to the huzzah which moves the servo as you can see this is very powerful for making interactive IOT projects we've demoed a lot of these element blocks but we're not going to get to demo all of them so let's just talk about the few remaining there's the image block if you've got a feed with base64 encoded image data this block will actually decode the image and show it on your dashboard great for a webcam the color picker is a read and write element you can use this to send a color you can select the color from the web browser and we'll send a web hex value to your feed or it'll read a feed and display the current value the map element uses OpenStreetMaps to plot the geolocation data attached to your feed if you need more buttons than the momentary button or toggle element check out the remote control and number pad these have 21 and 12 buttons respectively so a lot more buttons that you can sense your device and the indicator this is something kind of in-between the color picker and the gauge it will only show one or two colors depending on the value of your feed good for you no green is good red means stop lastly we've got the icon block which is kind of an interesting block now this allows you to set the icon based on text in the feed so for example you want to display a percent or an arrow or paper plane you can do so by setting the feed text to the static icon value and you know from within the Edit block you can change the color you can't change the color from within the feed only the icon if you'd like to see what icons are available check out our icons fact we've got a wide variety available for you and you can display any of them in your dashboard while you can build just about any kind of IOT device or project with the feeds and dashboards we've demonstrated we can add a little bit more logic integration using triggers and services triggers are a way to do something when a certain situation occurs there's two kinds of triggers support at this time scheduled and reactive to setup triggers visit the trigger page from your i/o account now there's two types of triggers that you can set up for now you can schedule them or you can have a reactive trigger the scheduled ones are the easiest to understand basically you can set up the feed to email you every 30 minutes up to one week all you have to do is select the feed that you want to have emailed and create now you'll get an email every half an hour with the value of the pie temperature feed automatically sent to you by Adafruit i/o you can also set up reactive triggers the reactive triggers are a little bit more complicated first select the feed you want to react to for example the pie temperature then you can select a comparison these are for numeric values only now if the pie temperature is less than either a feed value or a numeric value you can have it email you if you have a two for IO plus send a webhook message to a URL or publish a message to a different feed when paired with feed notification you can easily keep track of the health of your feed and also when something's gone wrong notifications and triggers are handy for keeping tabs on your feeds and the webmail capabilities give you a lot of integration options but you may want to integrate into more services besides emails and web hooks and sometimes the web hook data is not forbidden in the exact right way starts integration in Adafruit i/o lets you supercharge your feeds both if this than that and zapier are cross linking services that are popular and wide-ranging they basically take data and shuffle it between online services we have integration with both of these services and best of all they're free once you sign up you can create triggers much like the ones that are built into a for IO but with much more control and possibilities once you've made an account on if this and that you can create your own new applet an applet is the if this then that that the service provides first you have to select the miss click and type in Adafruit to bring up the Adafruit app you can then monitor a feed on Adafruit IO or you can have any new data trigger something that occurs for example if you want to monitor a feed you could check if a temperature is below or above a certain value but let's go with any new data is posted then we can select any of our feeds they'll automatically appear in the drop-down let's say the huzzah temperature and then we select the vet now you can do almost anything from post to Twitter send an SMS or email make a phone call post a WordPress there is hundreds of different services that are tied through if this and that so check them out and see if any of them are useful to you we'll start by posting to Twitter now you can do a couple different ways of posting but let's just post a simple tweet you can change the tweet text if you'd like and then it will automatically put in the feed name and value from with an eighty-foot il create the action and then review it if any new data from the huzzah temperature feed is posted then we post a tweet to at a 400 test once you're good to go click finish to save it we've done this Adafruit IO test account and you can see that the huzzah temperature is tweeting about every 15 minutes into this feed again this is the easiest way possible to get data from your feed onto Twitter or other social media services that there is similar to if this than that so we won't demo both but they do have some differences in integration capabilities so we recommend signing up for both of them and seeing which one gives you the connection you're looking for one thing to note is that both if this than that end zapier have some delay to them and limitations so you won't have messages to come and go instantly the way web hooks do and sometimes there can be up to a 15 minute delay or even drop messages or limited number of messages so you'll want to do plenty of experimentation to figure out whether it makes sense to use Adafruit IO triggers notifications web hooks zapier or if this than that some integrations are available for IO plus members only for example we have a weather service that hooks up to dark sky a premier weather forecasting service once you start building IOT projects you'll notice that getting weather data on demand isn't easy almost everywhere their service requires authentication and most require payment but with IO plus and our dark sky integration it's quite easy to get weather data whenever you like which means that you can make projects that we act to current conditions in the local area forecasts or really anywhere around the world once you've upgraded to a deferred io plus visit the services page from a deferred IO and click on get started with weather you'll have to add a location that's where you're going to get the weather and forecast data from we'll put in Thief River Falls Minnesota once you set the location you can run our Python demo code to query the weather and forecast and as you can see it's pretty chilly over in Thief River Falls we've gone over just about all the amazing features that Adafruit io provides and we're constantly adding more in fact there's probably more services and features that we've added since recording this video you can always get updates on the latest news by checking out the Adafruit blog and the most recent documentation is available at the URL below you should now have a good sense of what you can do with a deferred il how feeds dashboard and services all work together to get your data stored plotted and interacting compared to many IOT services there's a lot you can do for free so who is Adafruit i/o for the short answer is everyone beta fruit IL can be used by entry-level makers who want to make a remote-control lamp to advanced engineers who want to automate their entire Factory scientists could use Adafruit i/o to log experiment data in real-time and then download or organize gathered data home Automator can connect sensors an HVAC system to minimize power usage roboticists can control and monitor their mechatronics remotely from around the world students can build interactive art creations that tie with social media services and light up whenever their posts get a like with the powerful single board computers and low-cost microcontroller boards available even a first project or custom one-off product can now be connected and controlled over the internet we've designed a deferred io to be simple and quick to start for experimenters and makers of all sorts sending data in the cloud is easy to implement with our libraries so existing projects can be converted easily to an IOT project with Adafruit IO you can control projects from the internet with ease add internet connectivity to household appliances wearables or installations whatever you like but behind this simplicity we have made Erfurt IO robust enough to handle the demands of industrial level engineering without the complexity of enterprise services we have pre-built api's to have code communicate with a deferred i/o their logging web hooks and service integration so you can easily prototype an IOT product before taking the next step in scaling it for production it's a great place to put together prototypes and build customized projects for small businesses well note that it's not aimed at building and commercializing business to customer or business to business IOT projects so check our previous services videos for some suggestions on enterprise level IOT services those will be a big step up in complexity and more have the same friendly integrations so they're a good step up once you've got your I owe project going if you're curious about what people are using Adafruit io4 and maybe get some inspiration or validation for your ideas check out our discord channel at pound inferred IO our aid for IO forum the Adafruit blog and of course the Adafruit learning system where we've got dozens of IOT projects with code and wiring diagrams from the basics of a button to how to automate an entire house now you're probably really excited to get started with a deferred il maybe even have some ideas of your first IOT build the good news is getting started with Adafruit IO is easy and free that's right the introductory account that can do just about everything we've shown in this video is free with your Adafruit account beta for iOS basic service gives you 30 data points per minute 30 days of data storage 10 feeds 5 dashboards notifications triggers and most service integrations after you've gotten comfortable with our basic service and got a chance to try out the API and services you may want more and you're ready to power up you can upgrade to iOS 460 data points per minute 60 days of data storage unlimited dashboards unlimited feeds and improved integrations including email triggers and dark skies weather service you can subscribe monthly for $10 and if you'd like to save some money we've even got a yearly pass card available for $99 um did you keep calm they'll give you a full year of i/o plus each purchase gets you all the goodies we've mentioned any new service and integrations we'll be adding and help support and improve effort io I hope that after watching this video you have a better understanding of what Adafruit IO can do for your upcoming IOT project feel free to check out some examples of our Adafruit I own learning guys at learning fruit calm and of course check out the Adafruit blog for updates then visit Adafruit IO and start building your own Internet of Things project today join us next time when we will be discussing IOT security
Info
Channel: Adafruit Industries
Views: 6,593
Rating: undefined out of 5
Keywords: adafruit, electronics, diy, arduino, hardware, opensource, projects, raspberry, pi, computer, raspberrypi, microcontrollers, limor, limorfried, ladyada, STEAM, STEM, python, microbit, circuitpython, neopixel, neopixels, raspberry pi, circuitplaygound, nyc, make, makers, micro:bit, adafrit, adafruit promo code, ada fruit, adafruit coupons, raspberry pi zero, micropython, digikey, digi-key, allthethings, all the internet of things, adafruit io
Id: yRqazWCtSgI
Channel Id: undefined
Length: 38min 6sec (2286 seconds)
Published: Thu Mar 07 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.