problème de quoi ? hardware ou software ?
Publié : 03 mai 2016, 22:59
je me présente quand même
Newbee
Gateway MySensors 2.0 bétâ serial sur Raspi jeedom 2.26
j'ai des soucis de Gateway et noeuds
*Passerelle usb amplifié" cf viewtopic.php?f=20&t=1528
Noeud temp hum sur pile DHT 22 cf http://forum.mysensors.org/topic/486/my ... ery-sensor
et voici le log que la Gateway reçoit
Pouvez-vous me donner un coup de P..d;
Non !! Désolé coup de main.
Newbee
Gateway MySensors 2.0 bétâ serial sur Raspi jeedom 2.26
j'ai des soucis de Gateway et noeuds
*Passerelle usb amplifié" cf viewtopic.php?f=20&t=1528
Noeud temp hum sur pile DHT 22 cf http://forum.mysensors.org/topic/486/my ... ery-sensor
Code : Tout sélectionner
/**
* DESCRIPTION
* This sketch provides an example how to implement a humidity/temperature
* sensor using DHT11/DHT-22
* http://www.mysensors.org/build/humidity
*/
// Enable debug prints
#define MY_DEBUG
#define MY_NODE_ID 2
// Enable and select radio type attached
#define MY_RADIO_NRF24
//#define MY_RADIO_RFM69
#include <SPI.h>
#include <MySensor.h>
#include <DHT.h>
#define VBAT_PER_BITS 0.003363075 // Calculated volts per bit from the used battery montoring voltage divider. Internal_ref=1.1V, res=10bit=2^10-1=1023, Eg for 3V (2AA): Vin/Vb=R1/(R1+R2)=470e3/(1e6+470e3), Vlim=Vb/Vin*1.1=3.44V, Volts per bit = Vlim/1023= 0.003363075
#define VMIN 1.9 // Battery monitor lower level. Vmin_radio=1.9V
#define VMAX 3.3 // " " " high level. Vmin<Vmax<=3.44
int BATTERY_SENSE_PIN = A0; // select the input pin for the battery sense point
#define CHILD_ID_HUM 0
#define CHILD_ID_TEMP 1
#define HUMIDITY_SENSOR_DIGITAL_PIN 3
unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
DHT dht;
float lastTemp;
float lastHum;
boolean metric = true;
int batteryPcnt = 0;
int batLoop = 0;
int batArray[3];
MyMessage msgHum(CHILD_ID_HUM, V_HUM);
MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
void setup()
{
// use the 1.1 V internal reference
analogReference(INTERNAL);
delay(500); // Allow time for radio if power used as reset <<<<<<<<<<<<<< Experimented with good result
dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN);
metric = getConfig().isMetric;
}
void presentation()
{
// Send the Sketch Version Information to the Gateway
sendSketchInfo("A_CUISINE", "1.0");
// Register all sensors to gw (they will be created as child devices)
present(CHILD_ID_HUM, S_HUM);
present(CHILD_ID_TEMP, S_TEMP);
}
void loop()
{
int sensorValue = analogRead(BATTERY_SENSE_PIN); // Battery monitoring reading
delay(1000);
delay(dht.getMinimumSamplingPeriod());
// Fetch temperatures from DHT sensor
float temperature = dht.getTemperature();
if (isnan(temperature)) {
Serial.println("Failed reading temperature from DHT");
} else if (temperature != lastTemp) {
lastTemp = temperature;
if (!metric) {
temperature = dht.toFahrenheit(temperature);
}
send(msgTemp.set(temperature, 1));
#ifdef MY_DEBUG
Serial.print("Temp: ");
Serial.println(temperature);
#endif
}
delay(1000);
// Fetch humidity from DHT sensor
float humidity = dht.getHumidity();
if (isnan(humidity)) {
Serial.println("Failed reading humidity from DHT");
} else if (humidity != lastHum) {
lastHum = humidity;
send(msgHum.set(humidity, 1));
#ifdef MY_DEBUG
Serial.print("Hum: ");
Serial.println(humidity);
#endif
}
delay(1000);
float Vbat = sensorValue * VBAT_PER_BITS;
int batteryPcnt = static_cast<int>(((Vbat-VMIN)/(VMAX-VMIN))*100.);
Serial.print("Battery percent: "); Serial.print(batteryPcnt); Serial.println(" %");
batArray[batLoop] = batteryPcnt;
if (batLoop > 2) {
batteryPcnt = (batArray[0] + batArray[1] + batArray[2] + batArray[3]);
batteryPcnt = batteryPcnt / 4;
Serial.print("Battery percent (Avg (4):) "); Serial.print(batteryPcnt); Serial.println(" %");
sendBatteryLevel(batteryPcnt);
batLoop = 0;
}
else
{
batLoop = batLoop + 1;
}
sleep(SLEEP_TIME); //sleep a bit
}Code : Tout sélectionner
0;255;3;0;9;Starting gateway (RNNGA-, 2.0.0-beta)
0;255;3;0;9;Radio init successful.
0;255;3;0;14;Gateway startup complete.
0;255;3;0;9;Init complete, id=0, parent=0, distance=0
0;255;3;0;9;read: 2-2-0 s=255,c=3,t=15,pt=0,l=2,sg=0:
0;255;3;0;9;send: 0-0-2-2 s=255,c=3,t=15,pt=0,l=2,sg=0,st=fail:
0;255;3;0;9;read: 2-2-0 s=255,c=0,t=17,pt=0,l=10,sg=0:2.0.0-beta
2;255;0;0;17;2.0.0-beta
0;255;3;0;9;read: 2-2-0 s=255,c=3,t=6,pt=1,l=1,sg=0:0
2;255;3;0;6;0
0;255;3;0;9;read: 2-2-0 s=255,c=3,t=11,pt=0,l=9,sg=0:A_CUISINE
2;255;3;0;11;A_CUISINE
0;255;3;0;9;read: 2-2-0 s=255,c=3,t=12,pt=0,l=3,sg=0:1.0
2;255;3;0;12;1.0
0;255;3;0;9;read: 2-2-0 s=0,c=0,t=7,pt=0,l=0,sg=0:
2;0;0;0;7;
0;255;3;0;9;read: 2-2-0 s=1,c=0,t=6,pt=0,l=0,sg=0:
2;1;0;0;6;Non !! Désolé coup de main.