loading

Step 3: Programming the Edison (Arduino IDE)

The LEDs

The first component we need to get working is the LED strip. In this case we are using a 1 meter strip of APA102 that has 36 individually addressable LEDs. We are using these instead of the more popular WS2811/WS2812 strips because they use separate wires for their clock and data signals. The different versions of the Intel Edison firmware have issues which make them difficult to interface with the 3 wire LED strips, so using the WS2811/WS2812 strips is problematic.

To control the LED strip we need four pins on the GPIO as shown here:

GND --> GND

DI --> PIN 11 (MOSI)

CI --> PIN 13 (SPI Clock)

5V --> 5V

The important issue here is identifying the proper pins on the Edison Arduino board. The Intel Edison Kit for Arduino Hardware Guide ( http://download.intel.com/support/edison/sb/ediso... ) identifies those pins as the ones needed for “SPI send data” (PIN 11) and “SPI clock control” (PIN 13).

Now that the proper pins are identified we have to write some code to push the LEDs. None of the existing libraries like FASTLED or NeoPixel work with the APA102s and the Edison so we’ll need some custom code. The best explanation I’ve found is in the Intel Community forums here: https://communities.intel.com/message/335874#3358... . Basically, we need to create a Buffer object and then assign the RGB color values by passing them through the Buffer. Once you have the APA102 strip connected to the pins as described, you can run the following code to test the system. Note that since we are only using a couple of LEDs at a time in the final project, we won’t be using an external power supply.

LCD

The LCD we’re using is the “Grove - LCD RGB Backlight.” It comes as part of the Grove Starter Kit Plus from SeeedStudio and is also available separately. To connect it to the Edison we’ll use the “Grove Base Shield” and one of the included four wire cables. Once it is connected you’ll need to download the “Grove_LCD_RGB_Backlight” Arduino Library from: https://github.com/Seeed-Studio/Grove_LCD_RGB_Bac... . You’ll then need to put a copy of the “libraries” directory for your Arduino IDE installation. Once you get the library files in place you should run the “fade” or “HelloWorld” example scripts as shown in the image.

Network Server

The Intel Edison comes with all of the features of an Arduino WIFI shield, so no additional hardware or shields are needed for the Arduino side of the Edison to access the WIFI systems. Now we just need to setup them up and test them. To do that, you’ll open the Arduin IDE and run the example sketch “SimpleWebServerWIFI.” If your Arduino IDE install didn’t come installed with the “wifi” sketches, you can download them from github ( https://github.com/codebendercc/arduino-library-f... ). Now you just need to customize the sketch with your network’s SSID (name) and password, and you should be good.

Putting it all together

Now we just need to write a sketch that will utilize all of the parts we’ve just setup. Here is the sketch you’ll need:

https://github.com/nam37/weathergrid/blob/master/W...

I’ve tried to comment out the sketch to answer any questions, but here is a quick overview of the sketch.

  • The first 70 or so lines define the required constants, define some needed variables, and “include” the necessary libraries.
  • The next 100 or so lines are the main “loop” of the sketch. Here the initialized webserver is waiting for incoming connections. When a connection is encountered, it tries to identify it as a weather code “WW” or as a temperature code “ZZ”. If either of those as found then the proper LED are lit and/or the proper message is displayed on the LCD.
  • The rest of the sketch consists of a collection of function used to control the LEDs and the LCD.

A note on persistence...

Some Intel Edison firmware versions have a bug which breaks Arduino sketch persistence. If you find that your Arduino scripts are not automatically being reloaded on reboot, then you’ll need to address this. There is a great thread in the Intel Edison community that addresses this here: https://communities.intel.com/thread/77945

<p>Thankyou man<br>And good luck with your new project!</p>
<p>ohh yeah and when is 2.0 coming out?</p>
<p>Honestly I'm not sure. I'm currently working on a new project (with the MediaTek LinkIt One) and then my schedule starts to get pretty tight with the holidays.</p>
<p>Heym this project is amazing.<br>I was wondering, how could i modify this so instead of just showing current weather conditions, it would show the current condition and conditions for later on in the day. An answer would be great thanks!</p>
<p>Sure... Off the top of my head you could either:<br>- have two (smaller?) separate grids or one grid and two LCDs</p><p>- have it alternate colors for current and future conditions</p><p>- have the current weather in the grid and the future weather in the LCD</p><p>Whichever way you did it, you would then just adjust the PHP script (add more querystring options), and then add the new PHP functions to the cron tab.</p>
<p>Great project and very well explained!</p>
<p>I posted a link to this project on 2 weather forums. </p>
<p>Cool thanks.</p>
<p>Nice project! I like the front plate design and weathered look.</p><p>Did you consider mounting some dividers inside to prevent unwanted images to light up?</p>
<p>&gt;&gt; Did you consider mounting some dividers inside to prevent unwanted images to light up?</p><p>Yup. That's one of the changes I'm going to add to my 2.0 build. That said, in person the bleed isn't nearly as bad as it looks in the pictures.</p>
<p>looking forward to the 2.0 version. Good luck!</p>

About This Instructable

2,421views

73favorites

License:

More by nam37:The Weather Grid (Powered By Intel Edison) 
Add instructable to: