@ -27,8 +27,6 @@ extern "C" {
# include <SDS011.h>
const char * server = " ingress.opensensemap.org " ;
//const char* ssid = "Freifunk";
//const char* password = "";
# define MQTT_MAX_PACKET_SIZE 512
const char * mqttserver = " home.xd0.de " ;
@ -38,6 +36,8 @@ const char* mqttpassword = "password4";
constexpr unsigned int postingInterval = 60000 ; //Uploadintervall in Millisekunden
constexpr unsigned int dhcp_interval = 60 * 60 * 1000 ;
# define EXTERNAL_POWER 1
//senseBox ID
# define SENSEBOX_ID "5a9e9e38f55bff001a494877"
@ -73,7 +73,9 @@ static constexpr uint8_t GEIGER_PIN = D6;
static constexpr float CONV_FACTOR = 0.008120 ;
static constexpr float OWN_BACKGROUND_CPS = 0 ; // documentation says 0.2 (make sure value doesn't get negative if subtracting!)
# ifndef EXTERNAL_POWER
ADC_MODE ( ADC_VCC ) ;
# endif
ESP8266WiFiMulti wifiMulti ;
@ -147,7 +149,11 @@ void ICACHE_FLASH_ATTR sendValues() {
sd . pressure / = 100 ;
bmp . getTemperature ( & ( sd . temp2 ) ) ;
# ifndef EXTERNAL_POWER
sd . voltage = ESP . getVcc ( ) / 1024.0 ;
# else
sd . voltage = analogRead ( A0 ) * 0.04285078 - 0.05942125 ; // by linear regression for my(!) voltage divider. else: sd.voltage = analogRead(A0)*3.3*(R1+R2)/(R2*1024)
# endif
int sds_error = sds . read ( & ( sd . p25 ) , & ( sd . p10 ) ) ;
if ( ! sds_error ) {
@ -170,6 +176,7 @@ void ICACHE_FLASH_ATTR sendValues() {
if ( ! sds_error ) Serial . printf ( " Particles 10 : %6.2fµg/m³ (SDS011) \n " , sd . p10 ) ;
if ( ! sds_error ) Serial . printf ( " Particles 2.5: %6.2fµg/m³ (SDS011) \n " , sd . p25 ) ;
if ( sd . cpm > 0 ) Serial . printf ( " Radiation : %6.2fµSv/h (J305) \n " , sd . radioactivity ) ;
Serial . printf ( " Voltage : %6.2fV (ESP8266) \n " , sd . voltage ) ;
DynamicJsonBuffer jsonBuffer ;
JsonArray & array = jsonBuffer . createArray ( ) ;