A small project to demonstrate Edison board and GPIO pins to weather information in a LCD display.
Parts Needed:- 1x Edison and Sparkfun block stack
- 1x Breadboard
- 1x Character LCD
- 1x 10k Potentiometer
- 16x Jumper Wires
Johnny-Five is a JavaScript framework for programming robotics. Much like MRAA, it simplifies the calls we need to make to control various pieces of hardware. At the time of this writing, MRAA did not support parallel interface character LCDs, but Johnny-Five does!
Johnny-Five has support for several boards, and the Edison is one of them. As a result, we can include Johnny-Five in our program (like any Node module), and have it handle LCD communications for us.
Yahoo WeatherThere are plenty of weather APIs out there, and all of them would likely work for getting current weather data about a particular city. However, Yahoo Weather allows us to make calls without signing up for an account and returns data in JSON format, which is easily parsed by JavaScript.
We can perform a database lookup on Yahoo’s weather servers by constructing a SQL-like string called “YQL”. In this example, we will ultimately create a program that constructs a YQL that requests weather data for a particular city and sends it to Yahoo. Yahoo then returns a JSON object that we can parse for temperature and weather conditions.
JSONJavaScript Object Notatation, or JSON, is a text format for exchanging data between computers. It has the benefit of also being easily read by humans. It consists of a collection of name and value pairs (given as “name” : “value”) within an object (as denoted by curly braces {}).
How to setup and run:- Follow the hardware hookup diagram and setup board and LCD as indicated.
- Open Intel XDK tool.
- Create a new blank template IoT application.
- Open Package.json and replace the code with the attached code.
- Open main.js and replace the code with the attached code.
- Edit the City, State string in main.js if you need weather for different city.
- Upload the code and wait for it to install node modules.
- Run the program and you will see the city and weather information in the LCD display.
Comments