Off-The-Shelf Hacker: Get to Know the Arduino IDE
Have you looked at the Arduino IDE lately?
The current 1.6.7 version is a great tool. Not only can you develop for all the Arduino boards, you can also write and upload code for the ESP8266 series of WiFi enabled microcontroller “chips.” Even though they are tiny, minimum-component circuit boards, I like to call them chips.
Speaking of the 8266, readers have probably noticed that it has flooded the micro-controller scene, with it’s 32-bit processor, full 802.11n WiFi stack and quite attractive $3 to $8 price. There are about a dozen models, too, from the simple two input/output (I/O) pin ’01’ model to the multi-I/O ’07’ model. Want longer range? The ’07’ also has a socket so you can hook up optional external, or even directional, antennas.
Pairing the IDE with the 8266 takes the physical computing stack in a new direction. The community has stepped up and made it easy to add sophisticated WiFi capabilities to existing devices, as well as being able to build useful, small-footprint Internet of Things, from scratch.
To get an idea of how far we’ve come, take a look at the example programs.
Key features of the Arduino IDE are it’s exceedingly comprehensive and easy to use examples. Go to ‘File’ and click on ‘Examples’ to bring up a new menu. Depending on the installed libraries, there might be dozens of example programs from which to choose.
There’s everything from basic LED blink and fade programs, all the way up to something like configuring an ESP8266 WiFi-enabled device on a new network through your smartphone.
The latter program called “AutoConnectWithFeedback” starts up the 8266 device and if it has used the network before, simply connects and runs whatever Arduino code you’ve programmed into the chip.
If the chip has never connected to the local network before, it starts up in “access point” mode, then initializes a Web server and simple text app, then waits for user-supplied local network information.
Local network configuration data is entered by pointing your smartphone WiFi connection at the standalone 8266 access point (typically with an IP of 192.168.4.1) and it’s built-in Web page.
Once the local data is entered, the 8266 restarts, connects to the local network and then continues on it’s merry way.
Can you imagine that kind of capability, from a ½” X 1″ chip, just a year or two ago?
The Library Manager
Pushing the physical computing stack model even further is the Arduino IDE Library Manager. Before version 1.6.2, you’d have to scrounge around and then load new libraries in the proper directory. With the Library Manager, there are a ton of library ‘packages’ you can select, while staying inside the Arduino IDE.
Click “Sketch,” then “Include Library” and finally “Manage Libraries” to bring up a menu window. There you’ll find libraries to build an “Audio Frequency Meter,” control a “Servo” or use “TFT” displays. Type “8266” into the search box, at the top of the screen and a dozen different libraries, will pop up, supporting various functions on the 8266 chips.
Want to run a little Web server? Use the “ESP8266WebServer” library. How about setting up a WiFi mesh network? Just install the “ESP8266WiFiMesh” library.
Speaking of installing, although the libraries show up in the Library Manager, they all aren’t installed by default. The text “Installed” and a version number next to the library name indicates that it’s loaded and ready to use. Otherwise, just click on the library title and an “Install” button will appear on the lower right. Click the button and the Library Manager will go out to the net, download the latest code and install it in the IDE.
Go back to the examples and you’ll see sample programs you can use, in the list. Click on a program to bring it up in the edit window and marvel at the code you can use. I usually open several example programs and cut/paste together the features I need. Don’t forget to save the file to a new name in the sketchbook.
The Arduino IDE and ESP8266 together are a potent combination. And, don’t forget that the 8266 chips sell for as little as $3.13, sometimes even with shipping. The Arduino IDE is always free to download.
The barriers to fielding cool new network-enabled projects, products and services continue to fall away.
Now is the time to jump on the physical computing stack and join the fun.