Article All the (Internet of) ThingsBy Limor "Ladyada" Fried, Founder and CEO of Adafruit Industries
Limor “Ladyada” Fried is the founder and CEO of Adafruit Industries, an open-source hardware company. A founding member of the NYC Industrial Business Advisory Council, she was named a White House Champion of Change in 2016.
The Internet of Things is all about connections — connecting your electronics design, product, or project to the wider world. We start with the idea that you have a “Thing” that you want to connect to the “Internet of.”
How do you do that? Usually you start with something you’d like to improve. Say you love fish and have a home or school aquarium. Since you’ve got some really fancy fish, they need the water temperature to stay between 20 and 30 degrees Centigrade. You could always check the water temperature, but it would be better if you had a microcontroller to help you out!
You could start with a simple temperature manager, but even better would be one that could email or text you to let you know if something went amiss and maybe the heater broke. That’s what the Internet of Things is all about: Making stuff smart!
What is Adafruit?
I design that “smart stuff” — the electronics and code for makers who make real things in the real world. We also teach them how to make their ideas come to life. Some are simple projects, like getting an alert if there is water in your basement. Others are getting real-time information like transit schedules and displaying it at home so you know when your bus is coming.
Some of our favorite IoT projects are ones that make life easier for people who need Accessibility Technology (AT). For example, a project from our friend Chris Young, who not only uses AT but designs it, for people who have the same needs he does! He has written up how to make an IoT remote control so he can use a laptop or tablet with touchscreen to turn on/off devices in his house.
What we think is the most exciting part of IoT’s future is seeing makers and coders design the devices that best suit them and their community. Instead of relying on what’s available in the store, customization and optimizations will let small-scale engineering happen by the people who will actually use it!
We made an internet of things service called “adafruit.io” that gets you started quick and easy, so your things can spend more time on the internet, not just trying to get going.
The best language for IoT
Here at Adafruit, we like using Python to program IoT devices. What, a snake? Close! The Python programming language is the fastest-growing programming language that beginners and experts alike use. Python is great for IoT for a lot of reasons.
IoT is all about getting and sending data. Maybe you want your aquarium to let you know when the temperature is too high or too low. You could code this up in Python using an
water_temp = aquarium_temperature() # read the sensorif water_temp > 30:send_text_message("Help! The water in the aquarium is too hot!")if water_temp < 20:send_text_message("Oh no! The water in the aquarium is too cold!")
Even simple examples such as the above are super powerful when you add the Internet, email, cellular and text messages so that your programming can reach outside your screen.
Why Python and IoT?
Why is Python so great for IoT? First, of course, is how popular it is—it’s available for any and all computers. It’s also really great for parsing text, in particular the “structured data in text” that the Internet runs on, often referred to as HTML, XML or JSON. Other languages may be faster in some ways, but they often struggle to do regular expressions, text parsing or moving from one data format to another.
Python has flexible memory management, so you don’t have to worry about pointers or memory. This comes at a cost to speed, but helps avoid some of the ickiest security problems that plague IoT devices. You definitely don’t want to accidentally turn your smart aquarium into a botnet!
Python also has exception handling, which is a “proper” way to handle errors compared to some languages. Whenever you expose your devices to the Internet, you’ll have inconsistent connections (e.g., “the WiFi is down!”) or unexpected data sent your way. Exceptions mean that even if you are a little lazy and forget to check a value or function output, your program will be more likely halt rather than blithely continue with incorrect instructions.
And of course, Python comes with the kitchen sink—so much is included already, so you can get started faster than ever. Not only is Python available on computers like your desktop or laptop, it also comes on embedded computers like the Raspberry Pi and on microcontrollers as CircuitPython.
Learning CircuitPython is a great way to make internet-connected things, and to share data and creativity around the world. Cuddle up to this friendly snake and continue on for more IoT projects!