ePaperMojo

IoT project to get weather from the web and display it on an e-paper display.

It’s powered by a Particle Photon with a Power Shield. It periodically downloads current temp, forecast high temp, and dew point and displays it on an e-paper display.

Source code is at https://github.com/powerfulmojo/WeatherMojo

FILES

FIRMWARE

The firmware uses an http client to retrieve weather conditions and forecast from weatherbit.io, then display them on a 4.3” ePaper Display. The current temp is in large numbers. Today’s forecast high temperature and dew point are in smaller numbers.

Conditions are updated every 15 minutes by default.

CONFIGURATION

Unlike the Tabletop Weather Station, this one can’t be configured by service calls. The Photon’s SLEEP_MODE_DEEP saves a lot of power, but has the side effect of discarding configuration every loop, so changes won’t stick. You have to configure the firmware to behave differently by setting these vars before flashing to the device.

  • weatherSource : set to one of

    • CALL_WEATHERBIT: make calls to api.weatherbit.io to get weather conditions

    • CALL_WEATHERMOJO: publish a weathermojo_request event when you want weather and handle a weathermojo_response event that will be published in response. This is only useful if you have more than one weather station so one can be the publisher & the rest can be subscribers.

  • cityId : city ID to get weather for. Default is 5308655 for Phoenix, AZ, USA.
    You can look up more cities here: https://www.weatherbit.io/api/meta

  • tZone : UTC offset. Default is -7 (Phoenix, AZ)

  • serviceMode : setting to 1 puts the device in service mode. Instead of going into deep sleep at the end of its loop() and rebooting after its polling interval, it stays awake and calls delay(). Uses more battery, but it’s easier to flash new firmware. Default is 0.

  • pollingInterval : the number of seconds to sleep between updating weather info.

PARTICLE VARIABLES

  • TempC The current temperature

  • DewPointC The current dew point

  • HiTempC The last updated high temperature

  • LastUpdate The time of the last temperature and high temperature update

PARTICLE FUNCTIONS

Note: These are only useful in service mode. The SLEEP_MODE_DEEP at the end of loop() discards all variables in memory. The device is configured with two buttons: one to wake it up and another to put it in service mode if you press it before it goes back to sleep.

  • int set_polling_interval(String Command
    Sets the polling interval to Command seconds. Returns 0 on success.

  • int set_city_code(String Command
    Sets the city code to use for weather conditions. A full list is at https://www.weatherbit.io/api/meta. Returns 0 on success. Setting it to an invalid value will cause the WeatherMojo to stop updating temperatures.

  • int set_api_key(String Command
    Sets the weatherbit.io API key to use for getting weather conditions. Sign up for one at https://www.weatherbit.io/account/create. Returns 0 on success. Setting it to an invalid value will cause the WeatherMojo to stop updating temperatures.

  • int set_temp(String Command)
    Sets the temperature displayed to whatever value you pass. It has to be an integer and it should be in a reasonable range or display behavior may be unpredictable.

  • int set_hi_temp(String Command)
    Sets the forecast high temperature displayed to whatever value you pass. It has to be an integer and it should be in a reasonable range or display behavior may be unpredictable.

  • int set_dew_point(String Command)
    Sets the dew point displayed to whatever value you pass. It has to be an integer and it should be in a reasonable range or display behavior may be unpredictable.

DEPNDENCIES

WeatherMojo includes these libraries:

WIRING

The WaveShare 4.3inch e-Paper UART Module has 6 wires:

  1. Red (power) to pin 24 (3V3) on the Particle Photon

  2. Black (ground) to pin 21 or 2 (GND) on the Photon

  3. White (receive) to pin 4 (RX) on the Photon

  4. Green (transmit) to pin 3 (TX) on the Photon

  5. Yellow (wake) to pin 15 (D2) on the Photon

  6. Blue (reset) is unused

I also added two buttons:

  1. Wake: a momentary switch that connects pin 24 to 5 (3V3 to WKP) when pressed.
    It wakes the Photon from sleeping and forces a refresh of weather conditions.

  2. Service: a momentary switch that connects 21 to 19 (GND to D6) when pressed.
    If pressed while the photon is not sleeping, it puts it in service mode so it won’t go to sleep until after it is restarted. This is useful for flashing updates to the board.

Schematic