Tinker Forge Weather Station

The Tinker Forge Weather Station measures temperature, humidity, air pressure, and illumination.

The Wolfram Language supports communication with the Tinker Forge Weather Station through USB. Support is currently available on Macintosh, Windows, Linux, and Raspberry Pi.

The Tinker Forge Weather Station uses a Mini USB connector.

Opening the Device

    DeviceOpen["TinkerForgeWeatherStation"]

    returns a DeviceObject representing an open connection to the Tinker Forge Weather Station.

Configuring the Device

    Configuration is required for reading, writing, or executing commands on the Tinker Forge Weather Station. The weather station is configured by specifying the individual bricklet UIDs attached to the device.

    DeviceConfigure[dev,{uid1 val1,uid2 val2,}]

    assigns the UID of the i^(th) bricklet to value vali for the weather station specified by the DeviceObject dev.

    The possible uidi and the associated bricklets are:

  • "AmbientLightBricklet"ambient light bricklet
    "HumidityBricklet"humidity bricklet
    "BarometerBricklet"barometer bricklet
    "LCDBricklet"20×4 LCD bricklet
  • On Windows, Macintosh, and Linux desktop systems, the bricklet UIDs can be read from the Tinker Forge Brick Viewer interface.
  • DeviceConfigure[dev,uidval] sets the UID of the specified bricklet only, with the other bricklets assuming default UIDs.

Reading Data

    DeviceRead[dev]

    reads current data from the weather station specified by device object dev, returning a list of rules for all available parameters.

    DeviceRead[dev,param]

    reads the parameter param.

    DeviceReadTimeSeries[dev,{t,dt}]

    generates a time series based on reading data at time interval dt, for total time t.

    DeviceReadTimeSeries[dev,{t,dt},param]

    repeatedly reads the parameter param.

  • DeviceRead[dev] returns a list of rules: "Temperature"->temp, "Humidity"->hum, "Pressure"->press, "Illuminance"->illum.
  • Possible parameters are "Temperature", "Humidity", "Pressure", and "Illuminance".
  • The values are Quantity objects with units of Celsius, percent, millibars, and lux, respectively.

Writing Data

    DeviceWrite[dev,{n,p,"string"}]

    writes the specified string starting at line number n and position p to the weather station for display on its built-in LCD screen.

    DeviceWrite[dev,"string"]

    writes the specified string to the weather station.

  • The line number and position must be integers in the range 03 and 019, respectively.
  • DeviceWrite[dev,"string"] is equivalent to DeviceWrite[dev,{0,0,"string"}].

Executing Commands

Closing and Releasing Resources

Examples

Basic Examples  (5)

Open a connection to the Tinker Forge Weather Station and configure the device:

Read data from the weather station:

Close the device connection:

Write weather data to the device-attached LCD:

Write a string to the LCD:

Clear the LCD and specify a line number and position:

Schedule a DeviceRead once every 0.1 seconds up to 10 times, and display the data dynamically:

Remove the scheduled task and close the connection:

Generate a TimeSeries by reading data every 0.1 second for 5 seconds, continuously changing the device orientation during the read:

The values of the measured illuminance:

Plot the illuminance variation:

Compute the mean, minimum, and maximum values of the illuminance samples:

Close the device connection: