Introduction: Intel Edison Weather Advisory Sketch
We wanted to create a project that was colorful, extensible, and showed off the unique features of an Intel Edison.
- Use wifi
- Use Linux
- Use components from the Grove Starter Kit.
Additionally, I wanted to know how to pass information from the Linux side to the Arduino side of the Edison. Linux is rich in networking features. Arduino is rich in GPIO and has a color LCD and extensible sensors and devices.
The code is at:
- Please download that code.
- Use SCP to copy the Linux scripts to the Edison. Pasting them in /home/root/ is a good start.
- Move the myweatherservice.service file to
- Use the Arduino IDE to install the
WeatherAdvisorySketch.ino sketch onto the Arduino side the Edison.
- Hook a Grove Kit LCD to any of the I2C ports.
- Optionally, hook a buzzer to D2.
Step 1: Fetch the Code From GitHub.
I have posted my my code on GitHub at:
A simple way of getting the code is to visit the GitHub site and find
the "Download ZIP" button and download the code. You will then have to unzip it and "SCP" copy it to the Edison.
I used a Linux system and it's SFTP software to copy the code from Linux to the Edison. On Windows, I believe the same copying maybe done using WinSCP. When I made my first connection to the Edison using WinSCP, it gave me the "Warning - Potential Security Breach!" I accepted it because I knew I was initiating the connection to the Edison. Copy the script files in the zip over to the /home/root/ directory of the Edison. There will be instructions later on moving files around.
Step 2: Connect to the Edison and Get a Command Prompt.
The simplest method is to connect to the Edison using a USB serial port. I followed the first few steps at:
I stopped once I got the USB serial port up and running. At this point, I had a command prompt because I was using Putty on my Windows laptop to connect.
I am using the Edison with the Arduino Breakout Board because I wanted to connect a Grove Starter Kit to it.
Step 3: Move the Files to Their Correct Locations.
The following absolute filepaths are the correct locations to place the 3 Linux Scripts. There are some hard coded file paths that expect the following locations.
When the Edison is started, systemd will launch myweatherservice.service
which launches myweatherservice_wrapper.sh
which launches myweatherservice.pl script.
Step 4: Learning to Configure the WiFi on Your Edison.
I found it nice to use the SSH protocol to do the programming. The
following steps are simply things I think people should know and practice. I followed an Intel article on setting up an Edison:
I know I like using the 2 microUSB cable method because it connects
both USB devices on the Edison to the laptop. The two USB devices are the USB thumb-drive which allows you to copy over the OS image and the USB serial port. You must get a PuTTY session running and talking to the Edison over the USB serial port; that's step 3 of the Intel article. You must get the wifi setup; that's step 4 of the Intel article. Once you get this far, use the USB serial port to determine the IP address of the Edison and then use PuTTY to ssh into the Edison.
The goal of this step is to get your Edison connected to your wifi access point so it can wget webpages from weather stations.
Step 5: Add the Grove Starter Kit Stuff.
Plug in a Grove Breakout GPIO board.
Hook the RGB LCD up to any of the I2C ports on the Grove Breakout GPIO board.
Optionally, hook the buzzer up to GPIO 3.
Step 6: Reboot, Test It, and Make It Yours.
Reboot and wait 20 seconds (there are some sleep 10s in the code) for the wifi to connect and wget a weather station XML file.
If it works, it ought to display the weather for station KHIO, the weather station at the Hillsboro, OR airport.
To make it yours, the Linux script file myweatherservice.pl contains wget commands to fetch XML from the weather stations. Please figure out which stations you want to pull content from.