Status display sketch and hardware to display various sensor data readings that are queried from the ThingSpeak IoT Platform.
The sketch is specifically designed for use with the Texas Instruments TM4C1294 Connected LaunchPad, Kentec Touch Display BoosterPack (SPI version), Futaba 162SD03 Vacuum Fluorescent Display, and SparkFun Micro OLED Breakout.
While the sketch is written for a specific hardware configuration, it can be used as an example for the following:
- TCP and UDP connections using Ethernet
- ArduinoJson library for parsing JSON strings
- Reading data using REST API for ThingsSpeak IoT platform
- Arduino Time Library
- Retrieving NTP time
- Calculate Standard Time or Daylight Saving Time based on current day/time.
- Using a simple photo resistor circuit to detect when a room light is turned on
- Character Displays
- Bit-Mapped Displays
Parts of the code are messy and could be improved. However, the sketch does what I want, so they will probably stay as they are. In particular:
- I tried to come up with a creative solution for defining x/y coordinates for the display items. My solution ended up being cumbersome and difficult to maintain if the screen layout needs to change significantly.
- The DST conversion algorithm is optimized for U.S. time zones. It is not generalized for all time zone/DST cases.
This display is located in a windowless workshop, and I only want the board querying the sensors database when I am in the workshop -- which is essentially any time the room light is on. In addition, the LCD backlight and VFD draw about 400 mA (out of a total 540 mA for the full setup), so I want to minimize power usage when I'm not in the workshop.
I constructed a simple light detection circuit using a 10K resistor and a cheap photo resistor (which probably came from an Arduino starter kit). The 10K and photo resistors are wired in series, with the 10K pulled to Vcc and the photo resistor connected to ground. Analog Pin A19 reads the voltage at the 10K/photo resistor connection (a simple voltage divider). Since it is just checking for a dark room vs. a lighted room, a threshold of half the ADC range is used.
The Futaba VFD is enabled by a power control circuit with a logic-level MOSFET along with a CD40109 tri-state buffer for the control signals to the VFD. The CLK, DATA, and RESET signals to the VFD are only active when the VFD is powered.
The SparkFun Micro OLED is used to display the atmospheric pressure history. The past 64 readings are displayed graphically to show the pressure trend to predict the weather.
A modified version of the SparkFun Micro OLED library is required to work with the Tiva controllers.
The OLED is controlled using parallel-8080 mode. While the OLED also supports SPI and I2C serial control, the Energia Tiva SPI implementation is incompatible with the SparkFun library. I was also unable to get I2C mode to work on the TM4c129 LaunchPad and decided to use parallel mode since I had enough I/O available.
The Connected LaunchPad supports Ethernet Link (LED4) and Activity (LED3) status indicators. However, I find these LEDs are bright and distracting. They are disabled by default. The code to enable them is in the sketch, but is commented out.
- ArduinoJson
- Sketch has been updated to suport the version 7 API. Earlier versions of the library are not supported
- Version 7 increased flash usage by about 1200 bytes, but this is still a small portion of the overall flash size (1 MB)
- Arduino Time Library
- The code currently requires version 1.5 of the
Time
library. Version 1.6 and later usepgm_read_ptr
instead ofpgm_read_word
, which causes a compile error with the Tiva board package
- The code currently requires version 1.5 of the
- FutabaUsVfd162S Library
- Modified SparkFun Micro OLED Library
- This modified version is required in order to support compilation with the Tiva board
- Kentec_35_SPI
- Version v2.0.0, modified from the library included with Tiva board package to support TM4C129 and this project configuration
- Texas Instruments TM4C1294 Connected LaunchPad EK-TM4C1294XL
- Kentec Touch Display BoosterPack (SPI) BOOSTXL-K350QVG-S1
- Futaba 162SD03 Vacuum Fluorescent Display
- CD40109 Buffer/Level-Shifter
- ThingsSpeak IoT platform
- ThingsSpeak REST API documentation
- Arduino Playground photo resistor tutorial
- SparkFun Micro OLED Breakout
- Interface Board containing system power, VFD power control, and ambient light sensor circuit
The software and other files in this repository are released under what is commonly called the MIT License. See the file LICENSE
in this repository.