WOLFRAM LANGUAGE DEVICE CONNECTION

Tinker Forge Weather Station
This feature is not supported on the Wolfram Cloud.

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 DeviceOpening the Device

    DeviceOpen["TinkerForgeWeatherStation"]
    returns a DeviceObject representing an open connection to the Tinker Forge Weather Station.

Configuring the DeviceConfiguring 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 for the weather station specified by the DeviceObject dev.

    The possible and the associated bricklets are:

  • ambient light bricklet
    humidity bricklet
    barometer bricklet
    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 DataReading 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 , , , and .
  • The values are Quantity objects with units of Celsius, percent, millibars, and lux, respectively.

Writing DataWriting 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 CommandsExecuting Commands

Closing and Releasing ResourcesClosing and Releasing Resources

ExamplesExamplesopen allclose all

Basic Examples  (5)Basic Examples  (5)

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

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input

Read data from the weather station:

In[3]:=
Click for copyable input
Out[3]=

Close the device connection:

In[4]:=
Click for copyable input

Write weather data to the device-attached LCD:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
In[3]:=
Click for copyable input
In[4]:=
Click for copyable input

Write a string to the LCD:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
In[3]:=
Click for copyable input
Out[3]=

Clear the LCD and specify a line number and position:

In[4]:=
Click for copyable input
In[5]:=
Click for copyable input
In[6]:=
Click for copyable input

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

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
In[3]:=
Click for copyable input
Out[3]=

Remove the scheduled task and close the connection:

In[4]:=
Click for copyable input
In[5]:=
Click for copyable input

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

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
In[3]:=
Click for copyable input
Out[3]=

The values of the measured illuminance:

In[4]:=
Click for copyable input
Out[4]=

Plot the illuminance variation:

In[5]:=
Click for copyable input
Out[5]=

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

In[6]:=
Click for copyable input
Out[6]=

Close the device connection:

In[7]:=
Click for copyable input