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
-
"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.
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 bricklet to value vali for the weather station specified by the DeviceObject dev.
The possible uidi and the associated bricklets are:
Reading Data
- 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.
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.
Writing Data
- The line number and position must be integers in the range 0–3 and 0–19, respectively.
- DeviceWrite[dev,"string"] is equivalent to DeviceWrite[dev,{0,0,"string"}].
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.
Closing and Releasing Resources
DeviceClose[dev]
closes the connection to the weather station specified by the DeviceObject dev.
Examples
Basic Examples (5)
Open a connection to the Tinker Forge Weather Station and configure the device:
Read data from the weather station:
Write weather data to the device-attached 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: