Home > Other >Special Application Circuits > How to Design a Solar Cellular Weather Station Using Particle Boron

How to Design a Solar Cellular Weather Station Using Particle Boron

Source: InternetPublisher:天天都吃好吃的 Keywords: Solar energy weather station IoT node Updated: 2024/12/19

    This project uses ThingSpeak, Particle, and Sentient Things IoT nodes to measure wind, rain, temperature, humidity, and light at a remote location.

    The weather station provides the following features:

    Optional solar power for locations without electricity

    Easily repeatable and maintainable packaging and electronics based on Sentient Things IoT nodes

    Updateable firmware with micro SD card data logging, data storage and forwarding to overcome communication interruptions, and optional automatic ThingSpeak channel creation

    Step 1 - Plug the Weather and Level Adapter and Boron into the IoT Node

    The first step in the project is to plug the Sentient Things Weather and Level Adapter and Particle Boron LTE (or similar Feather-based devices) into the Adafruit Feather-compatible header on the Sentient Things IoT node, like this:

poYBAGLnhvuAHbi9AARHoLKCg3Y622.png

    The Sentient Things IoT Node is a general purpose board with Adafruit compatible headers designed to be the basis for a wide range of IoT projects. It comes with a hinged waterproof enclosure and the board includes the following features:

    An expandable header that is a superset of the Adafruit Feather header

    Solar or mains power with Li-Po battery charger

    Optional 3AA/A secondary battery

    Real-time clock and calendar with supercapacitor backup

    Real-time clock power switching capability - i.e. the clock can shut down electronics similar to deep sleep mode, but with lower power consumption

Analog Watchdog Timer

    256kbit FRAM memory

    Micro SD card slot

    Three I/O headers that expose GPIO, serial, and I2C (more can be added via add-on adapters)

    Best of all, to keep your options open, it doesn't include a microcontroller. Just about any microcontroller that's compatible with the Feather footprint will work. This project uses a Particle Boron LTE, but a variety of alternative devices can also be used, such as the Adafruit HUZZAH32. If you happen to have a Particle Photon or Electron, you can also use those with an adapter that converts to a Feather footprint.

    Step 2 - Mount the Temperature and Humidity Sensor in the Solar Radiation Shield

    Assemble the Sentient Things AM2315 temperature and humidity sensor into the solar radiation shield. Note that if you already have an AM2315 sensor, you can use it and add your own RJ45 connector following the pinout described below:

pYYBAGLnhvqAI_xbAAFyWnQcnYk407.png

The recommended solar radiation shield is a good fit for the AM2315 sensor and is shown below, but other shields may also work.

pYYBAGLnhuyARAJfAALVoij8EpE291.png

    Step 3 - Plug the sensor into the IoT node

    Plug the Rain and Wind Weather Meter, AM2315 Temperature and Humidity Sensor, and TSL2591 Outdoor Light Sensor into the Sentient Things IoT Node and Weather and Level Adapter connectors. The AM2315 can be plugged into either I/O connector as they all contain an I2C bus. The Wind and Rain RJ11 connectors are labeled on the Weather and Level Adapter and the Voltaic Systems 6V Solar Panel with extension cable plugs into the 6V connector. The 6V Solar polarity is labeled on the board. Also remember to plug a FAT formatted micro SD card into the micro SD slot on the board so that weather data can also be saved locally. Thread the cables through the cable gland as shown.

    NOTE: The Weather and Level Adapter includes a MPL3115A2 Pressure and Altitude Sensor, so do not completely seal the gland to allow the pressure inside the enclosure to equalize with the outside pressure. When finally attaching the enclosure to the outside, make sure the gland is facing down to prevent water from leaking into the enclosure.

poYBAGLnhu2AEnteAAYZmpBm1oE801.png

    Step 4 - Create ThingSpeak and Particle accounts and register your device

    If you don't already have one, create a ThingSpeak and a Particle account. ThingSpeak offers free accounts for non-commercial use, and Particle also offers a free tier of service.

    ThingSpeak will be used to collect, display, and analyze weather data in the cloud, and Particle provides device hardware, firmware, and device connectivity. Particle also provides Webhooks cloud services (described below) to minimize data traffic.

    Follow the Particle Quick Start Guide to set up your Particle device (link it to your Particle account and set up WiFi if applicable). Particle provides a handy Android or iOS app for device setup. If you're using a cellular device like the Boron LTE, you'll also need to follow Particle's instructions to register your SIM card.

    Step 5 - Add Webhooks to your Particle account

    ThingSpeak provides REST and MQTT APIs to send data to ThingSpeak. ThingSpeak also provides a Particle/Arduino compatible library to facilitate the use of the API. This library is an excellent choice for devices that are connected via WiFi or Ethernet and do not incur data charges. However, in the case of cellular networks, it is best not to use REST directly, thereby minimizing data traffic. One of the best approaches is to use Particle's (low overhead) COAP protocol to send data to a Particle server, and have the Particle server relay the data to ThingSpeak via REST (http). This is done using Particle Webhooks.

    The Sentient Things firmware uses the Particle webhooks listed in the code section below. Log in to your Particle account console and create three webhooks under Integrations by pasting the JSON code below into the custom template and saving it.

poYBAGLnhuWAAz0sAAFa8CbpZfo645.png

    Note: For webhooks that create and update ThingSpeak channels, you need to replace XXXXXXXXXXXXXXXX with your 16-character ThingSpeak User API Key listed under your account profile on ThingSpeak.

    Step 6: Program and Test Your Particle Device

    The Weather firmware listed below is used to program your Particle device. This can be done using the Particle Web IDE or using Particle Workbench if you are familiar with a Visual Studio Code based desktop development environment. You can copy and paste the following code into a new project on the Particle Web IDE, or simply follow this link to get a shareable version of the firmware.

    You can program or flash your device wirelessly (at the expense of using data), or you can follow Particle's instructions to connect locally to your computer to avoid cellular data charges.

    Plug your device into the IoT Node (if not already done) and turn the POWER switch on the IoT Node to FBAT to supply power to the Particle device. When your firmware is first run with the Particle device plugged into the IoT Node, it will detect that this is the first time it has been run (by looking for the "magic number" in the FRAM) and create a new ThingSpeak channel using the Particle Webhooks you created earlier. When you visit ThingSpeak, you should see a newly created channel, like this:

poYBAGLnhtyAH2E_AAE69M2k-p4514.png

    The firmware saves the channel number and channel read and write keys sent back from ThingSpeak in FRAM for future writing to the created channel.

    As the firmware runs, you should see weather data being published to ThingSpeak every minute.

    The firmware prints serial debug messages, so if you are having problems, the first step is to connect the Particle device's USB output to your computer and monitor the serial output. If you have the Particle CLI installed on your computer, you will see the Particle device as a COM port. Particle CLI commands:

    particle serial monitor --follow

    A convenient way to connect to and view the serial debug output of a Particle device.

    Note the following snippet near the top of the code:

    //********CHANGE BELOW AS NEEDED**************

    // Set to true and enter TS channel ID and keys AND change firstRunTest to use an existing TS channel

    // Set to false if you wish to create a new TS channel the first time the code runs

    bool useManualTSChannel = false;

    const char *manualTSWriteKey = "XXXXXXXXXXXXXXXX";

    const char *manualTSReadKey = "XXXXXXXXXXXXXXXX";

    const int manualTSChannel = 895141;

    // Change this value to force hard reset and clearing of FRAM when Flashing

    // You have to change this value (if you have flashed before) for the TS channel to change

    const int firstRunTest = 1122124;

    //********CHANGE ABOVE AS NEEDED**************

    You can change

    bool useManualTSChannel = false;

    to

    bool useManualTSChannel = true;

    And add your own ThingSpeak key and channel number to use an existing channel.

    Note: You also need to change the "magic number"

    const int firstRunTest = 1122124;

    Set to a different value so the firmware detects that it is running for the first time to create a new channel or use an existing channel.

    Step 7: Install your weather station and analyze the data

    Weather station anemometers are best mounted away from buildings that are high above the ground. Options include building your own mast or using a tripod to mount the meter and the rest of the sensors on a roof.

    ThingSpeak does a great job of displaying your weather data in real-time charts on the web. You can also use MATLAB to analyze and display your data.

    Visit MathWorks' ThingSpeak Weather Station for a live demo:

pYYBAGLnhtiAZFboAAIqxO39I3U304.png

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号