Photon Weather Shield Hookup Guide

This Tutorial is Retired!

This tutorial covers concepts or technologies that are no longer current. It's still here for you to read and enjoy, but may not be as useful as our newest tutorials.

Note: V11 of the Photon Weather Shield utilizes the Si7021 for humidity and temperature sensing as opposed to the HTU21D.

View the updated tutorial: Photon Weather Shield Hookup Guide V11

Pages
Contributors: Joel_E_B
Favorited Favorite 7

Introduction

Have you ever wanted to have your own weather station? Or how about your own thermostat capable of controlling your home climate from the Web? Using the Photon from Particle coupled with the Photon Weather shield from SparkFun, you can now connect your weather related project to the Internet of Things!

SparkFun Photon Weather Shield

DEV-13630
6 Retired
Please Note: All SparkFun shields for the Photon are also compatible with the Core from Particle. The WKP, DAC and VBT pins on the Photon will be labeled A7, A6 and 3V3*, respectively, on the Core, but will not alter the functionality of any of the Shields.

Covered in this Tutorial

This tutorial will cover all the hardware features on the board, all the libraries and firmware you need to communicate with the sensors, how to communicate with said sensors, and how to add additional sensors and parts to create a fully-functional, Internet-connected weather station.

Suggested Materials

If you are looking to just measure Temperature, Humidity, and/or Barometric Pressure or Altitude, you can integrate the Photon Weather Shield into your project right out of the box! No soldering necessary!

The Weather Shield also has numerous optional ports on which other sensors or other devices, such as Bluetooth or XBees, can be added. If you wish to follow along with the numerous examples in this tutorial, you can find most of the parts used in the wish list below.

We really wanted to create a customizable shield for numerous weather project applications. You can add or omit any of the sensors you see throughout this tutorial as well as adding parts not mentioned here.

Suggested Reading

The following are suggestions for other resources to read before getting started with your Photon Weather Shield.

  • If you have never worked with the Photon or the Core before, we highly recommend visiting the getting started documentation available on the Particle site.

  • We have also written a Photon Development Guide that goes over three different methods for developing code for the Photon.

  • If you are interested in collecting and storing weather data, our Getting started with Phant tutorial is a great place to start.

  • The Photon Weather Shield borrowed heavily from the Arduino Weather Shield design while also taking customer feedback into consideration to create a more versatile product. There's lots to be learned from the Hookup Guide for that shield as well.

  • Our WIMP Weather Station tutorial has lots of great information on how to create a truly weather-proof weather station that can withstand the elements (including wind!). This is a must read if you intend to house your project outdoors.

Check out the Hookup Guides for each of the sensors located on the shield for more information specific to that sensor.

If you are unfamiliar with any of the concepts below, we suggest checking out those tutorials as well.

Hardware Overview & Assembly

The Photon Weather Shield has a lot of functionality packed into one tiny package. Let's go over each section of the shield.

Photon Footprint

Both the Core and the Photon fit right onto the shield. Copper pours underneath the antenna were restricted so as not to interfere with wireless connections. Each pin is also broken out to the sides of the Photon for accessibility. When attaching a Photon, be sure to line up the beveled end of the Photon with the beveled silkscreen on the PCB.

Photon Footprint

Power

The simplest way to power the shield is to attach a Photon, and then power the Photon through the micro USB connector. This will power the Photon as well as all the components on the shield.

normal power scheme

The downside to that power scheme is that micro USB connectors tend to be fragile when put under a lot of mechanical stress, and they can rip right off the PCB if pulled too hard. Thus, we provided a few other options for power connectors. On the underside of the shield, you'll find a footprint for both an SMD Barrel Jack and a 2-pin, 3.5mm screw terminal. Either of these can be soldered to the PCB and used for alternate power inputs. The maximum voltage supplied on these alternate connectors should not exceed 12V. For a detailed explanation, read on.

alt text

Powered through the Barrel Jack.

For the screw terminal, you can solder it to either side of the shield, since it fits underneath the Photon. Be sure to keep track of which pin is (+) and which is (-).

alt text

Powered through the Screw Terminal.

On-Board 3.3V Regulator & Power Solder Jumpers

There is also a 3.3V regulator on the shield. If you are powering the Photon through the micro USB connector, this regulator is bypassed. Powering through one of the alternative power connectors mentioned above routes power through the shield's 3.3V regulator, which is then tied to the 3.3V rail on the Photon, powering it as well.

3.3V Regulator

On-board 3.3V regulator and accompanying circuitry.

The main benefit to using the on-board regulator is that is has a higher maximum voltage rating than the regulator located on the Photon. As stated in the Photon datasheet, if power is supplied directly to the VIN pin on the Photon , the voltage should be regulated between 3.6VDC and 5.5VDC. In contrast, the MIC5205 regulator is rated for 2.5VDC to 11.5VDC, as per its datasheet.

However, if you would rather have the alternative power source route power through the regulator on the Photon (for lower current consumption during sleep perhaps), simply cut the trace on the Power Select jumper (between the VREG and RAW pads), and add a blob of solder between RAW and P_VIN (Photon VIN) pads. Just be sure to not exceed voltages of 5.5-6V once this alteration has been made.

power solder jumpers

Warning! Never power the Photon/Shield through both the micro USB connector and the barrel jack or screw terminal at the same time! If you need both connected for whatever reason (programming in DFU mode over USB while powered via the barrel jack, for example), you'll need to cut the trace on the **3.3V Disable** jumper, pictured below. Only cut this trace is you **have not** altered the Power Select jumper

3.3V Disable jumper

On-Board Sensors

The weather shield comes with two on-board sensors. Together, these two sensors can give you a lot of information about the environmental conditions around you or your project.

HTU21D Humidity & Temperature Sensor

The HTU21D is a low-cost, highly accurate, digital humidity and temperature sensor. This sensor communicates over I2C and comes connected to the Photon's I2C bus by default, making development a breeze. The PCB around this sensor is milled out and copper pour is restricted in that area to reduce the amount of parasitic heat coming from other components on the shield, including the Photon itself, that may affect your temperature readings.

HTU21D

Si7021-A10 Humidity & Temperature Sensor

There are two versions of the Weather Shield, one containing the HTU21D and one containing the Si7021-A10. Shortages of the HTU21D IC resulted in the two versions existing, and it is likely that a future revision of this board will switch to the Si7021 or a similar variant. The Si7021 is functionally identical to the HTU21D, and it in fact shares the same register addresses and command codes as its counterpart. A quick tour of the datasheets makes it clear that one of the senor manufacturers borrowed heavily from the other. To make it easier on you, the end user, we have written a library to automatically detect which sensor you have without the need for you to have to figure it out and pick a corresponding library. More on that later.

MPL3115A2 Barometric Pressure

The MPL3115A2 is a MEMS pressure sensor that provides Altitude data to within 30cm. The sensor outputs are digitized by a high resolution 24-bit ADC and transmitted over I2C. Pressure output can be resolved with output in fractions of a Pascal, and Altitude can be resolved in fractions of a meter. It provides 12-bit temperature measurements in degrees Celsius. This sensor also communicates over I2C and comes connected to the Photon's I2C bus by default.

MPL3115A2

More information on how to use these sensors can be found in the Libraries and IDE section of this tutorial.

RJ-11 Weather Meter Connectors

If you would like to place your Weather Shield outdoors and create a fully-functional weather station, you can grab a set of Weather Meters and connect them to the RJ-11 connectors located on the Weather Shield. With these meters attached, you can measure wind speed, wind direction and rainfall.

meter connectors

Soil Moisture & Soil/Water Temperature

For those who want to keep track of their houseplant conditions or for those who want to know topsoil conditions in their gardens, the weather shield has an optional port for a Soil Moisture Sensor.

alt text

Leaving the soil moisture sensor powered all the time leads to corrosion of the probes. To account for this, this port breaks out Digital Pin D5 as the power pin for the sensor, allowing the Photon to power the sensor, take a reading, and then disable power, giving the probes a longer lifespan. The moisture level can be read on Analog Pin A1.

Soil Mositure Port

In addition to soil moisture, you can also add a waterproof temperature senor. Whether you have a pond you'd like to monitor near your weather station or you want to know if the ground is still frozen or not, this can be a great addition to any weather station. The waterproof version of the DS18B20 temperature senor is a go-to option for many users looking to sense the temperature of various environments that may not be so kind to electronics. A port for this senors is broken out along with the necessary 4.7K pull-up resistor located between the Vcc and Signal lines. The Signal line is connected to Digital Pin D4. Communicate with this sensor using the OneWire and Dallas Temperature libraries.

Soil Temp

Assembly

The waterproof temp sensor comes with plenty of cable length and pre-stripped, pre-soldered wires on the end, making assembly straightforward. For the Soil Moisture sensor, you'll have to get a little more creative. You could always just use some hookup wire. We've found that retired cables, such as USB cables, can be sacrificed to make cables for such projects. A black USB cable with the green wire snipped matches the look of the DS18B20 cable quite well.

alt text

The snipped USB cable (right) and the DS18B20 cable (left), both secured to standoffs with zip ties.

I2C Port

I2C is becoming increasingly popular as a means by which to communicate with sensors. Thus, it made sense to add an I2C port to allow users to add other sensors to their project. One great example would be adding an external light sensor. Since most weather stations need to be enclosed in a weather proof housing, having a light sensor on-board didn't make much sense. However, adding the I2C port allows one to connect sensors such as the TSL2561 Luminosity Sensor or the ISL29125 RGB Light Sensor along with a whole slew of other I2C sensors.

I2C Port

I2C Pull-ups

Many SparkFun I2C Breakouts have solder jumpers for disabling the pull-up resistors necessary on most I2C designs. The Photon Weather Shield is no different. If you already have a sensor that has pull-ups, you can disable them on the shield by cutting the traces with a hobby knife. Or, if you would rather leave the shield as is, you can disable the pull-ups on every I2C you add to the bus. The important thing to remember is that only one device on the bus needs to have its pull-ups active. All others should be disabled.

I2C Pullups

Serial 1 Port

Last but not least, there is another port broken out, this time for the USART Serial 1 port on the Photon. Serial ports are great for debugging. They also allow for various other wireless technologies to be attached for mesh networking or for user feedback via an LCD or other display. Let's say you wanted additional sensors around you home, well beyond the range of your WiFi signal. You could attach an Xbee Explorer to the Serial 1 port on the Weather shield and have your other node (consisting of a stand-alone XBee or an XBee Arduino combo, for example) out in the field, feeding data back to the Photon, which then sends the collective data to the web.

Serial Port

Another use case is wanting to have your weather station outside while still receiving data on a display indoors somewhere. This could easily be accomplished by attaching a BlueSMiRF Bluetooth module to the Serial 1 port and having another BlueSMiRF attached to a Serial Graphic LCD display installed in your home. We'll show you how to do exactly that later in this tutorial, amongst many other examples.

alt text

A SparkFun BlueSMiRF Silver connected to the Serial 1 Port using a 6-pin, right angle female header with the outermost pins removed.

The pins on the shield match up with any of our BlueSMiRF modules. For other wireless solutions, you may have to wire each pin manually as they may not match up exactly.

Particle Libraries and the Particle IDE

The Particle team has created both an online and a desktop version of their programming IDE. The online version is referred to as Particle Build. The desktop version is referred to as Particle Dev. It can be downloaded here. Documentation on how to use Particle Dev can be found here. The libraries and example sketches presented throughout this tutorial will work in both versions, however, the means by which each is accomplished will vary slightly.

When dealing with many libraries, you may find it easier to use the Particle Dev desktop IDE as it is easier to add entire project folders. However, if you prefer to use the online IDE or are using a Linux computer, which does not have a desktop version of the IDE at this time, you can still follow along.

Once you have the IDE of your choice setup, visit GitHub, and download the SparkFun Photon Weather Shield Repository. You can also download the .zip file by clicking the link below.

Once the download is complete, open the folder, and navigate to the Firmware folder. Each example uses a variety of different libraries. There are too many to go over in detail here. However, they are all linked below if you would like to learn more about a given library.

Each project folder in the repository contains the corresponding library files needed to compile that sketch. It's redundant as far as storage is concerned, but it makes importing each project folder into Particle Dev much easier.

Adding Projects to Particle Dev

To add a project folder to Particle Dev, simply click File -> Add Project Folder, and select the project of your choice.

adding a project to particle dev

You can learn more about this process in our Photon Development Guide.

Adding Projects to Particle Build

Unfortunately, there is no way to import project folders into the online IDE at this time, so each library will need to be added individually. Adding a library in Particle Build requires you to search for that library in their library manager. Once found, you can click the Include In App button to add that library to your project.

add library in particle build

Each example will state which libraries are needed for it to work.

You can learn more about this process in our Photon Development Guide.


Now that you know how to work within the Particle IDE, lets upload some code!

Example 1: Getting Started & Reading the On-Board Sensors

For this first example, we're going to keep it simple. This code will get data from the two on-board sensors and print that information to the Serial port. Your Photon will need to be plugged into a USB port on your computer in order to read the input in a Serial Terminal. You'll need a Micro USB cable, which you should have if you bought a Photon kit.

This first example will detail how to use each version of the Particle IDE. Each example after this will assume you know how to navigate each.

Particle Dev

Open Particle Dev. Click File -> Add Project Folder. Navigate to where you downloaded the SparkFun Photon Weather Shield repo, and select the 'SparkFun_Photon_Weather_Basic' folder. Click open, and the folder will be added to the left hand sidebar. You can also drag and drop folders into the IDE. The .ino file along with the library files will be available here. Double-click the SparkFun_Photon_Weather_Basic.ino file to see the sketch.

Explore the sketch. Read the comments. Make any changes you want. Once you're ready to upload, you'll need to first select your target device. Click the crosshair looking symbol on the left hand menu to select your device.

select target

Note: You may be required to sign in to your Particle Cloud account (created for free at Particle.io), if you have not done so before. While this IDE is available offline, programming still happens over a WiFi connection. Thus, an Internet connection is still necessary to use Particle Dev.

You'll be presented with a list of all your Particle devices. Select the correct target. Click the circle with a check mark to compile your code and check for any errors.

alt text

If everything compiles without error, click the lightning bolt symbol to upload you code.

alt text

Heads up! Particle Dev does not check to see if any changes were made before you upload. Thus, any changes made to a sketch must be saved manually before the will take affect and get uploaded. Changes made without saving will not be uploaded.

Particle Build

Create a new App by typing a name in the 'Current App' field and pressing 'Enter'.

alt text

When using Particle Build, you'll need to add each library individually. Search for 'weather' in the "Libraries" tab to find the SparkFun Photon Weather Shield Library. Once found, click on the library.

alt text

Select INCLUDE IN APP, and add it to your desired application.

alt text

Any sketch using the external libraries needs to have the library "included" first.

What You Should See

Once everything has uploaded correctly, open your favorite Serial Terminal program at 9600-8-N-1-NONE. Select the serial port your Photon has showed up as, and click connect. You should see something like the following print out in the window.

basic serial print

Placing a finger over the sensors results in the temp and humidity rising.

As mentioned in the comments of this example sketch, you must choose whether you want the MPL3115A2 sensor to be in Barometric mode or in Altimeter mode. It cannot be in both modes at the same time.

Also worth noting is the output of the MPL3115A2 sensor. The pressure from this sensor is outputted in Pascals. However, many weather station report local pressure using hectopascals (hPa) or millibars (mb). Thus, to have the Photon Weather shield give you a reading that more closely resembles what you would see from an online weather report, we take the reading in Pascals and divide by 100 to get a reading in hPa or mb. For more information on pressure sensor data, visit this section of the MPL3115A2 tutorial.

Example 2: Adding External Sensors

This example will show you how to control any and all external senors attached to the Weather Shield including the Soil Moisture Sensor, Waterproof Temperature Sensor, and the Weather Meters.

To start, we'll just add control of both the Soil sensors to our code, then we'll add the Weather Meter code.

Soil Sensors Example

I2C Scanner

Before uploading this second sketch, you must first retrieve your Soil Temp Sensor address(es). You'll need to upload the I2C Scanner code (found in the same folder as all the examples in the github repo) to find the address of any and all DS18B20 temp sensors hooked up to the Photon. The Soil Temp port is connected to pin D4, by default. If you add any additional DS18B20s, you'll need to account for their pin connections in your code.

Upload the scanner code, open a serial terminal, and you should see something like this:

scanner output

Take note of that address. Any numbers that are single digit may need to have a 0 placed before them. For example, the 0x6 in the image above would become 0x06.

Particle Dev

Open Particle Dev. Click File -> Add Project Folder. Navigate to where you downloaded the SparkFun Photon Weather Shield repo, and select the 'SparkFun_Photon_Weather_Basic_Soil' folder. Click open, and the folder will be added to the left hand sidebar. The .ino file along with the library files will be avaialble here. Double-click the SparkFun_Photon_Weather_Basic_Soil.ino file to see the sketch.

There's only one variable you'll need to change before uploading the code, the address of the temp sensor that was retrieved in the previous step. Scroll until you see this line:

address

Select your target device, compile and upload the sketch.

Particle Build

Create a new App by typing a name in the 'Current App' field and pressing 'Enter'.

app

Search for 'onewire' in the "Libraries" tab to find the OneWire Particle Library. Once found, click on the library.

search app

Select INCLUDE IN APP, and add it to your desired code file.

include app

Any sketch using the external libraries needs to have the library "included" first.

Heads up! If you are receiving errors while compiling with the OneWire library, you may want to try the [OneWire-Particle library](https://github.com/balbano/OneWire-Particle). Both are actively being developed at the time of this writing. If one is not working for you, try the other.

Repeat the same process for the Dallas Temperature Particle Library, as well as the SparkFun Photon Weather Shield Library used in the previous example. You should have three libraries total for this example.

alt text

What You Should See

Once everything has uploaded correctly, open your favorite Serial Terminal program at 9600-8-N-1-NONE. Select the serial port your Photon has showed up as, and click connect. You should see something like the following print out in the window:

serial print

Click for a larger view.

Weather Meters

Building off the last two examples, we can complete the package by adding the weather meter code. The meters do not require any external libraries. However, if you are using the on-board sensors as well as the soil sensors, which is assumed in the example sketch, then you will need the three previous libraries we have used so far: OneWire, DallasTemperature, and the SparkFun Photon Weather Shield libraries.

Particle Dev

Open Particle Dev. Click File -> Add Project Folder. Navigate to where you downloaded the SparkFun Photon Weather Shield repo, and select the 'SparkFun_Photon_Weather_Basic_Soil_Meters' folder. Click open, and the folder will be added to the left hand sidebar. The .ino file along with the library files will be available here. Double-click the SparkFun_Photon_Weather_Basic_Soil_Meters.ino file to see the sketch.

Select your target device, compile and upload the sketch.

Particle Build

The easiest way to go about this would be to use the app you made for the soil sensors and copy and paste this example of the previous sketch. Otherwise you'll have to create a new app and add all the libraries again.

What You Should See

Once again, open your favorite Serial Terminal program at 9600-8-N-1-NONE. Select the serial port your Photon has showed up as, and click connect. You should see something like the following print out in the window:

serial print

Click for a larger view.

Wind Vane

If your wind vane is printing No_Wind, it is recommended that you use analogRead() on pin A0 to see what analog values your wind vane is outputting. Upload the code below to see if your wind vane values match those found in the example sketch.

language:c
int analogPin = A0;//Wind Vane Pin on Weather Shield 
int val = 0;// variable to store the read value

void setup()
{
  Serial.begin(9600);
}

void loop()
{
  Serial.println(analogRead(analogPin));  // read the input pin and print it
  delay(100);
}

Example 3: Collecting Weather Data Online

Phant is No Longer in Operation

Unfortunately Phant, our data-streaming service, is no longer in service. The system has reached capacity and, like a less-adventurous Cassini, has plunged conclusively into a fiery and permanent retirement. There are several other maker-friendly, data-streaming services and/or IoT platforms available as alternatives. The three we recommend are Blynk, ThingSpeak, and Cayenne. You can read our blog post on the topic for an overview and helpful links for each platform. The code in this tutorial will need to be adjusted to work with the other data streams.

Printing to the Serial Terminal is fun and all, but let's get this thing on the Internet! One of the most common things you'll want to do with the weather data you're collecting is to store it some place. You're in luck! With our data.sparkfun.com service, aka Phant, you can store all the weather data on the cloud, for free! You can then pull that data into a multitude of programs and websites to manipulate and visualize your weather data however you like.

This example will show you how to store your weather data on data Phant using the SparkFun Phant Particle Library.

Pushing Data to data.sparkfun.com (Phant)

This example builds off the previous two. You should have the previous three libraries added to your app, as well as a new, fourth library, the SparkFun Phant Particle Library.

alt text

If you're using Particle Dev, there is a project folder labeled SparkFun_Photon_Weather_Phant. Add it to Dev to quickly get started with this example. Open the SparkFun_Photon_Weather_Phant.ino example sketch.

Note: For those who wish to post data to Phant WITHOUT adding the extra sensors to the Weather Shield, there is an alternate skecth in the repository named SparkFun_Photon_Weather_Phant_SIMPLE. This skecth posts just the data from the on-board sensors and does not incorporate the soil moisture or temp sensors, the rain sensor, or the wind sensors.

You'll need to create a data.sparkfun.com stream if you have not done so already. Details on how to do that can be found in our tutorial. Keep track our your** public and private keys** as well as the Field labels you choose.

With that info in hand, open the sketch and find the Phant variables. You'll need to change these to match your stream's keys.

alt text

You'll also need to add each of the Fields you added when you created your stream. Make sure these match exactly.

Phant Fields

Here's what things should look like on your stream's fields.

alt text

What You Should See

With your stream created and the sketch edited accordingly, you can now upload to the Photon. Once complete, you should begin to see data populate on your stream.

Phant Data

Click for a larger view. Your data may vary depending on what Fields you chose to include.

You can now pull that data into any other device or service to organize however you see fit.

Troubleshooting

If you're having issues posting to data.sparkfun.com, we've created a demo stream to help you troubleshoot. Copy the following public and private key, and paste them in the example sketch mentioned at the beginning of this section.

  • Public Key: DJLWNrvxR0tDx190GJbg
  • Private Key: P4AlK0d51DceyBVW1m59
Please do not alter this stream in anyway. It is here to serve as a known good working example.

Upload the edited sketch to your Photon.

Now, click the button below to be taken to the test stream.

You should see fresh data coming in from your Photon and Photon Weather Shield. You should also be receiving data over the serial port as well. If things are moving too slow to troubleshoot, lower the count number that triggers the functions found in loop().

Pushing Weather Data to Wunderground

GitHub user Dan Fein wrote an example for the Photon Weather Shield that pushes the weather data to Wunderground. You can find this example in the Weather Shield Repository. It should have been included if you downloaded the entire repo as well. More information on his project can be found over on hackster.io.

Wunderground Graph

Wunderground Plot courtesy of Dan Fein.

For more information on how to setup a Wunderground account and information on what data must look like when pushed to Wunderground, you can follow along with the WIMP Weather Station tutorial.

Example 4: Internet-connected Weather Station

All we've learned so far has been to help prepare us for the challenging yet rewarding task of creating your own weather station connect to the Web. This example will build off all the previous examples. We'll also be adding a Serial Graphic LCD connected to the Weather Shield via a Bluetooth connection so you can collect data online as well as having a monitor indoors that prints live weather data.

Required Materials

To follow along with this example, you'll need a few more components. There are few different options for creating such a connection.

SparkFun Bluetooth Modem - BlueSMiRF Silver

SparkFun Bluetooth Modem - BlueSMiRF Silver

WRL-12577
$27.95
12
SparkFun Bluetooth Modem - BlueSMiRF Gold

SparkFun Bluetooth Modem - BlueSMiRF Gold

WRL-12582
$36.95
8
SparkFun Graphic LCD Serial Backpack

SparkFun Graphic LCD Serial Backpack

LCD-09352
$20.95
3

SparkFun Serial Graphic LCD 160x128

LCD-08884
6 Retired

SparkFun Serial Graphic LCD 128x64

LCD-09351
3 Retired

Configure the BlueSMiRFs to connect to one another automatically at 115200 baud. If you need help, we have a BlueSMiRF tutorial that covers that information. Connect one Bluetooth module to the Serial Graphic LCD Backpack, and connect the other to the Weather Shield. The LCD should also be set to 115200 baud.

alt text

A BlueSMiRF connected to the Serial 1 Port using a 6-pin, right angle female header with the outermost pins removed.

alt text

The Serial Graphic LCD Backpack connected to one of our discontinued BlueSMiRF modules with RP-SMA. Fortunately, the range on the BlueSMiRF Gold with Chip Antenna is very powerful.

If you're using Particle Build, grab all the previous libraries plus a new one, the SparkFun Serial Graphic LCD Particle Library.

alt text

If you're using Particle Dev, there is a project folder labeled SparkFun_Photon_Weather_Phant_and_LCD. Add it to Dev to quickly get started with this example. Open the SparkFun_Photon_Weather_Phant_and_LCD.ino example sketch.

What You Should See

If everything works out, you should see weather data print out on the LCD as well as post to Phant.

alt text

You now have a Internet-connected weather station! Once you have weather-proofed the electronics, as per our WIMP Weather Station tutorial, place it outside, and take it for a spin.

alt text

Troubleshooting

Communicating over Bluetooth

To configure the master and slave devices, connect your terminal emulator on the host to the devices via the COM port using the settings 115200 baud, 8 bits, no parity, 1 stop bit, and no flow control. This works well using Hyperterminal on the PC. Note: Both BT modules are slaves by default.

A.) Setting Up Your Slave Device

On the device you want to be the slave device (the LCD), issue the following commands:

  1. Put the device in command mode by sending the $$$ command. The device returns CMD to indicate it is in command mode.

  2. Send SM,0 to put the device into slave mode.

  3. Verify that the device is in slave mode by issuing the D action command. Look for the MODE =Slav message.

  4. Reboot the device using the R,1 command. The changes do not take effect until the device is rebooted.

B.) Setting Up Your Master Device

On the master device (the Photon), issue the following commands:

  1. Put the device in command mode by sending the $$$ command. The device returns CMD to indicate it is in command mode.

  2. Send SM,3 to put the device into auto mode.

  3. Verify that the device is in auto mode by issuing the D action command. Look for the MODE =Auto message.

  4. Ensure that the slave device is turned on, and send the I inquire command.

  5. Locate the slave's (remote side) Bluetooth address (BTA) in the results of the inquiry command. The BTA is a 6-byte (12 hex-characters) value.

    1. Store the remote BTA using the SR,

<

address> command. For example, if the remote BTA is 000666037083, enter the command SR,000666037083 to store the remote address. The D command should show the slave's address under "Rem=".

  1. Reboot the device using the R,1 command. The changes do not take effect until the device is rebooted. The master device restarts and connects with the remote slave device. A solid green LED indicates that the devices are connected."

Resources and Going Further

Here are a few links that should help with any further questions you may have about the Photon Weather Shield:


  • Particle Documentation Pages -- go here to set up and configure your Photon (or other Particle devices)

  • Particle Community Forum -- anything that you couldn't find in the docs should be easily found in the community forum. If you are having trouble, search this forum first, as many of the answers are there already.

  • If you would like to use the Photon and the Weather shield with Microsoft's cloud service, Azure, check out this great tutorial by Paul DeCarlo.

  • There is a great tutorial on Hackster.io from Dan Fein that goes over how to completely enclose your weather shield and send your data to Wunderground.com.


Using some additional stackable headers, the Weather Shield pairs very well with any of our other Photon Shields. Check out our hookup guides for those shields:

Photon Battery Shield Hookup Guide

The Photon Battery Shield has everything your Photon needs to run off, charge, and monitor a LiPo battery. Read through this hookup guide to get started using it.

Photon OLED Shield Hookup Guide

The Photon OLED Shield has everything you need to add a small yet crisp OLED screen to your Photon projects. This hookup guide will show you how to get started.

Photon IMU Shield Hookup Guide

Learn how to use the SparkFun Photon IMU Shield for your Photon device which houses an on-board LSM9DS1 system-in-a-chip that houses a 3-axis accelerometer, 3-axis gyroscope, and 3-axis magnetometer.