There’s two halves to every service online - the Back End, where data is handled, and the Front End, where you use a web browser to interact. For most Internet services you use on a day-to-day basis, you don’t deal with the Back End at all - it doesn’t matter how that restaurant got all their dishes listed on the website, as long as you can order them for delivery.
On Adafruit IO, you’ll be dealing with both halves.
The back end is where you’ll be sending your sensor data to and from our server, it’s literally named Adafruit IO (very easy to remember). You can do send/receive data in a two ways, with REST or MQTT. Which one you use will depend a lot on your hardware, bandwidth, and language needs. We covered these extensively in previous videos so go watch those if you haven’t yet. We recommend REST for your first project, it’s easier to understand and debug.
Either way, once you’ve picked your hardware and transport, check how you want to program it and choose one of our provided libraries. We’ve got code and examples for Arduino C/C++, Python, node.js and even Golang!
Once you’re logged in, you can retrieve your API key.
Click View AIO Key on the sidebar, then copy the
This key is important, it unlocks access to Adafruit IO. You’ll be programming it and your username into every one of your projects. If your key is lost or compromised, you can always generate a new key, but you’ll have to update all your existing projects. Don’t share your key with others!
Now let’s check out the way we store data in Adafruit IO - after all that’s what we’re here for! Data on IO is kept in time-series databases called feeds. Each feed contains time-stamped data points. The data points don’t have to be numbers, they can be any type of data.
For example, you can store numbers - say for environmental data like temperature or humidity.
Numbers can also be used for controlling hardware, like a robot’s motor throttle.
Human-readable ASCII strings are also common, often displayed either on a dashboard or on the device’s display. Finally, binary data can be saved as well - we strongly recommend encoding it in base64 so you can store/retrieve it with REST and JSON. For example, JPG encoded photos could be base64 encoded, then uploaded. Or if you have a firmware OTA update, you could store it as ASCII Intel HEX or base64 encoded data.
In addition to the main storage data chunk, you can also attach metadata - the first and most obvious metadata is the Time that the data was entered into Adafruit IO - this is handled for you when you post data to the feed. The second 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 geotagging service at this time, but if you have GPS module or use a geo-IP service, you can add it on every post. Location addition is only possible via the REST API, you can see the JSON formatting for adding it here.