muwerk mupplet Sensor Library
muwerk applets; mupplets: functional units that support specific hardware or reusable applications for sensors
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
ustd::GammaGDK101 Class Reference

mupplet-sensor temperature and pressure with GDK101 More...

#include <mup_gamma_gdk101.h>

Public Types

enum  GDKSampleMode {
  ULTRA_LOW_POWER = 1 , LOW_POWER = 2 , STANDARD = 3 , HIGH_RESOLUTION = 4 ,
  ULTRA_HIGH_RESOLUTION = 5
}
 

Public Member Functions

 GammaGDK101 (String name, FilterMode filterMode=FilterMode::FAST, uint8_t i2cAddress=0x18)
 
double getGamma10minavt ()
 
double getGamma1minavt ()
 

Detailed Description

mupplet-sensor temperature and pressure with GDK101

The mup_gamma_gdk101 mupplet measures temperature, pressure, and humity using the GDK101 sensor.

This mupplet is a fully asynchronous state-machine with no delay()s, so it never blocks.

Messages sent by gamma_gdk101 mupplet:

messages are prefixed by omu/<hostname>:

topic message body comment
<mupplet-name>/sensor/gamma10minavg gamma radiation 10 min average μSv/h Float value encoded as string, sent periodically as available
<mupplet-name>/sensor/gamma1minavg gamma radiation 1 min average μSv/h Float value encoded as string, sent periodically as available
<mupplet-name>/sensor/mode FAST, MEDIUM, or LONGTERM Integration time for sensor values, external, additional integration

Messages received by gamma_gdk101 mupplet:

Need to be prefixed by <hostname>/:

topic message body comment
<mupplet-name>/sensor/gamma10minavg/get - Causes current value to be sent.
<mupplet-name>/sensor/gamma10minavg/get - Causes current value to be sent.
<mupplet-name>/sensor/mode/get - Returns filterMode: FAST, MEDIUM, or LONGTERM
<mupplet-name>/sensor/mode/set FAST, MEDIUM, or LONGTERM Set external additional filter values

Sample code

For a complete examples see the muwerk/examples project.

#include "ustd_platform.h"
#include "scheduler.h"
#include "net.h"
#include "mqtt.h"
#include "mup_gamma_gdk101.h"
void appLoop();
ustd::Scheduler sched(10, 16, 32);
ustd::Net net(LED_BUILTIN);
ustd::Mqtt mqtt;
ustd::GammaGDK101 gdk("myGDK101");
void sensorUpdates(String topic, String msg, String originator) {
// data is in topic, msg
}
void setup() {
#ifdef USE_SERIAL_DBG
Serial.begin(115200);
#endif // USE_SERIAL_DBG
net.begin(&sched);
mqtt.begin(&sched);
ota.begin(&sched);
int tID = sched.add(appLoop, "main", 1000000);
// sensors start measuring pressure and temperature
gdk.begin(&sched);
sched.subscribe(tID, "myGDK101/sensor/gamma10minavg", sensorUpdates);
}
void appLoop() {
}
// Never add code to this loop, use appLoop() instead.
void loop() {
sched.loop();
}
mupplet-sensor temperature and pressure with GDK101
Definition: mup_gamma_gdk101.h:99

Member Enumeration Documentation

◆ GDKSampleMode

Hardware accuracy modes of GDK101, while the sensor can have different pressure- and temperature oversampling, we use same for both temp and press.

Enumerator
ULTRA_LOW_POWER 

1 samples, pressure resolution 16bit / 2.62 Pa, rec temperature oversampling: x1

LOW_POWER 

2 samples, pressure resolution 17bit / 1.31 Pa, rec temperature oversampling: x1

STANDARD 

4 samples, pressure resolution 18bit / 0.66 Pa, rec temperature oversampling: x1

HIGH_RESOLUTION 

8 samples, pressure resolution 19bit / 0.33 Pa, rec temperature oversampling: x1

ULTRA_HIGH_RESOLUTION 

16 samples, pressure resolution 20bit / 0.16 Pa, rec temperature oversampling: x2

Constructor & Destructor Documentation

◆ GammaGDK101()

ustd::GammaGDK101::GammaGDK101 ( String  name,
FilterMode  filterMode = FilterMode::FAST,
uint8_t  i2cAddress = 0x18 
)
inline

Instantiate an GDK sensor mupplet

Parameters
nameName used for pub/sub messages
filterModeFAST, MEDIUM or LONGTERM filtering of sensor values
i2cAddressShould always be 0x76 or 0x77 for GDK101, depending address config.

Member Function Documentation

◆ getGamma10minavt()

double ustd::GammaGDK101::getGamma10minavt ( )
inline

Get gamma radiation 10min avg

Returns
gamma radiation (μSv/h)

◆ getGamma1minavt()

double ustd::GammaGDK101::getGamma1minavt ( )
inline

Get gamma radiation 1min avg

Returns
gamma radiation (μSv/h)

The documentation for this class was generated from the following file: