In the Internet of Things series I will explore the use of WiFi enabled microprocessors like the Arduino Yun and Digispark Oak as tools that students can use to learn how to connect devices to the Internet. The connection of devices and machines to the Internet to allow man-machine and machine-machine interaction is now embodied in the phrase "the Internet of Things". There has been an explosion of interest in industry and commercial markets as the price of WiFi technology comes down. A corresponding surge in the hobby, DIY field can be seen with an ever growing number of products and online tutorials and projects. The Yun was first released in 2013 with the same form factor and IDE as the original Arduino. Recently we saw the release of the Raspberry Pi 3 which has 802.11n and Bluetooth built in. The Digispark Oak, the Omega Onion and a host of other products aimed at the hobbiest, DIY and developer fields are becoming available.
In this post I will write about my first few experiments with the Yun. In the next few posts I will describe early experiments with the Oak and other WiFi enabled microcontroller solutions. I hope to be able to conclude with a wish list for enabling students to learn about this technology in a clean and consistent manner. My early experience with the Yun and Oak indicate that the technology is not straight forward nor for the faint of heart. I hope to finally compare and contrast all the solutions that I tried out.
The first step as it is with any of these things is to follow the Getting Started tutorial that comes with the device. I found that I could connect the Yun easily to my home network (Linksys) or my experiment router (Belkin with no Internet). At school I should be able to connect to our public network since the Yun does not require any special settings at the router. Some familiarity with ip addressing and the Linux OS helps but is not necessary.
"The Arduino Yún is a microcontroller board based on the ATmega32u4 and the Atheros AR9331. The Atheros processor supports a Linux distribution based on OpenWrt named Linino OS. The board has built-in Ethernet and WiFi support, a USB-A port, micro-SD card slot, 20 digital input/output pins (7 of them can be used as PWM outputs and 12 as analog inputs), a 16 MHz crystal oscillator, a micro USB connection, an ICSP header, and 3 reset buttons." - from the Arduino.org website.
The Atheros processor communicates with the ATmega microcontroller using a technology called Ciao Core. This technology is incorporated into the Bridge library which must be included in your sketches.
Step 2 involved using the Yun just like any other Arduino to verify the correct operation of the following devices:
1. Photoresistor in series with a fixed resistor to measure analog light levels.
Photoresistor wiring from Arduino Tutorial.
2. DHT22 to measure temperature and humidity. DHT22 wiring from Make Nation.
The sketch worked perfectly using the open source DHT22 Arduino library.
Step 3 used the Weather Station tutorial in Marco Schwartz's book the Internet of Things with the Arduino Yun. The tutorial uses a website/software stack called Temboo as a go-between a Yun and cloud apps like Google docs. You will need to have a Temboo account and a Google account.
Marco's book is 2 years old and Google has changed the way docs are accessed. Instead of good old username and password Google now uses the oAuth protocol. The Temboo website uses apps they call choreos that enable the flow of data from the Yun to be entered onto a spreadsheet. In order to set up a connection you must now run an initialization oAuth choreo and a Finalize oAuth choreo. As you go through the process you collect a client id, app id and other tokens that have to be copied into your code. You can follow the Temboo tutorial which gives you some Arduino Yun code that works. You can find my code, which integrates the original code from the book and the Temboo tutorial on Github. https://github.com/mdruiven/Yun-Weather-Station. All the account information and tokens are in a separate file called TembooAccount.h. Make sure to change them to your own codes and information.
I found that I had to use my coding skills to solve a couple of issues. I think the level of complexity was medium to hard and beyond the average high school level. That said, I believe that senior high school students could tackle problems very similar to this one by following these directions and using my code. By similar I mean write some data to a spreadsheet collected from various sensors connected to a Yun. I think this has a very high cool factor and will encourage students, and others, to continue to learn and experiment with this technology.