I'm currently building the "hardware" of the hat, so before posting a complete update, let's talk a little about the mind of the hat...
One of the most common complaints of Arduinos is their lack of connectivity. You build these cool hardware hacks, but then you can’t make them apart of the Internet of Things (IoT) unless you plug in a bulky Arduino WiFi shield.
The Arduino Yun solves that problem. The Yun is an Arduino with WiFi built in. Additionally, the Yun has a second microprocessor that runs a lightweight version of Linux and comes with Python preinstalled. However you can install Ruby, Node or PHP...
Overview of Arduino Yun
The Yun’s primary components are:
- Atmel ATmega32U4 – this is the “Arduino chip” that controls the pins and lets you do all the hardware hacking that you associate with Arduinos. When you send a sketch (Arduino code) to the Yun via the Arduino IDE, it’s running on this chip.
- Atheros AR9331 – This is the “Linux and WiFi chip.” It runs OpenWRT, “a Linux distribution for embedded devices.”
- Three ports: a standard USB, a micro USB, and an ethernet port
- Three buttons: WiFi reset, “Arduino chip” reset, and “Linux chip” reset. You’ll use the WiFi reset most often.
- A microSD slot for external storage
Note: If you hold down the Arduino’s WiFi reset button for more than 30 seconds, your Yun will reset to factory conditions! (Though, if you’ve upgraded OpenWRT, the new version will remain.) If you hold the WiFi button for more than 5 seconds but less than 30, it will reset the WiFi networking settings.
Your Yun ships with a lightweight version of Linux called OpenWRT-Yun. In the time that has passed since your Yun shipped off the factory line, a newer and better version of OpenWRT-Yun has been released.
You’re going to save yourself a lot of headache if you upgrade to the latest version of OpenWRT-Yun now. (If you want to know all the details of why, check out the OpenWRT release notes). This process will take less than ten minutes.
- Visit the Arduino Software page
- Scroll halfway down the page
- Click the link for the OpenWRT-Yun upgrade image
- Drag the zip file onto the root of the SD card (you do not need to extract it)
- Eject the SD card, remove it from your computer, and plug it into the Yun
- Now we’ve got an OpenWRT image lying in wait on our SD card. Let’s fire up the Yun.
Connect to the Ardunio Yun over Wifi
If you have not previously connected your Yun to WiFi, it will create its own WiFi hotspot. You’ll connect your computer directly to the Arudino’s WiFi, open up the control panel in a browser, configure the Yun to connect to the wireless network of your choosing, then meet it back on that network.
- Plug the small end of the micro USB cable into your Yun and the other end into your computer
- Wait about 60 seconds for the Yun to boot up. When the Yun’s ready to go, you’ll see the white USB LED turn on.
- On your laptop, check the available WiFi Networks for a new one called something like: ARDUINO-YUN90XXXXXX.
- Once you’ve connected to your Arduino’s WiFi, open a browser and visit arduino.local. If that doesn’t work, visit 192.168.240.1 (I’m not sure why, but I found the former to be flakey). When asked for a password, enter “arduino”
Connect your Arduino WiFi
Once your Arduino Yun reboots:
- ensure you’re still connected to the Arduino YUN-09XXXX WiFi network
- revisit arduino.local or 192.168.240.1
- click the Configure Button in the top right. Here you can:
Change the name of your Arduino Yun
Change the password
Connect your Arduino to a WiFi network.
- Select your WiFi network from the dropdown and carefully enter your password. If you get the password wrong you will not get an error message. If your Arduino reboots but you still see its Arduino Yun-902XXXX as an available option, there’s a good chance you typed in the wrong WiFi password.
When all the settings are to your liking, click Configure and Restart. While you’re waiting, switch your laptop over to the WiFi network you just punched in to your Arduino Yun and wait for it to join you there.
Install the Arduino IDE
The last bit of setup is to install the Arduino IDE on our computer. This will let us write Arduino programs that will interact with the pins on the board so that we can do the kind of things that you associate with a traditional Arduino.
Make sure you have either Java 6 or Java 7 installed on your machine. If you don’t, download and install Java 7. (Java is currently at version 8, though the Arduino IDE seems to only support 6 or 7.)
Visit the Arduino software page and download the latest Arduino IDE.
This file is about 150 MB. After it downloads, install it, then open the Arduino IDE. Then we need to do two things to set up the IDE to work with your Yun:
First, click Tools -> Board and select Arduino Yun.
Second, click Tools -> Port and select the option with the IP address (it’s probably the last one).
From now on, you can build and download applications as on any other Arduino board!