Connecting a SEN-08942 Weather Meter to Arduino

hi,my name is Diego, im from Spain, so sorry for my bad English.

Im going to do a electronic proyect, which it consist in do a weather station, and i have a few questions.

1-Can i use SEN-08942 with arduino uno? (only this two things, without any aditional board)

2-What type of signal give the SEN-08942?(analogic or digital)

3-Is there any arduino program which works with SEN-08942?

Thanks a lot i hope the answer

1: It seems so. You may need to find a different way to reliably connect it to the arduino though. The connectors it has won’t fit on an Arduino (uno) board.

2: Have you read the datasheet link on the product page? It’s a digital on/off pulse for the rain drip gauge and anemometer, and a analog voltage ratio for the wind direction vane. No other sensors are part of the product.

3: The first comment on the product page has a link.

hi again, i bought this device, but i didnt realize that it have rj11 conectors, so im gona cut the extrem, and conect each wire to arduino uno board, but i dont know what wire are each one. So i have conect the rj11 of the anemometer to the rj11 conector of the wind direction vane, so , i have to conect 4 wires of the rj11 of the wind direction vane, and 2 wires of the rj 11 conector of the rain drip gauge.

Then i need to know where i should connect the 6 wires on arduino board.

its somethiing like this http://air.imag.fr/index.php/File:MontageWeather.JPG

But i can see it well, so if someone help in what pins i have to conect the 6 wires of the rj11 conectors,

I’ll be very greatful.

ProyectoGrupo1:
hi again, i bought this device, but i didnt realize that it have rj11 conectors, so im gona cut the extrem, and conect each wire to arduino uno board, but i dont know what wire are each one. So i have conect the rj11 of the anemometer to the rj11 conector of the wind direction vane, so , i have to conect 4 wires of the rj11 of the wind direction vane, and 2 wires of the rj 11 conector of the rain drip gauge.

Then i need to know where i should connect the 6 wires on arduino board.

Isn’t the pin connection clear from the drawings in the datasheet found on the product page? You should be able to see the colors of the wires in the Rj11 transparent connector. Or at the very least use a multimeter with resistance/continuity mode to figure out which wire color goes to which pin on the connector.

You should get something like [these rather than vandalising the sensor cables.

Chances are, those sensors are constructed the same as [these. If so, i can help you with some suitable code for reading them.

Paul](http://www.philpot.me/weatherinsider.html)](http://www.gravitech.us/rjbrbo1.html)

Hi i solved the problem of rj11, but now i have another one xD.

My weather meter have the 3 sensor of the SEN-08942 and a DHT11 for temperature and humidity. I did a code and it read fine the date, but now i have to send it via RF with a Lora module https://www.cooking-hacks.com/documenta … el-galileo

So i have to do a program for arduino that send via RF the sensor data to a receptor Lora usb, that dont need to be programed, so i just have to do a code but i have problem with the code. The data sensor of DHT11 is recived fine but, the data of the 3 another sensors no…

Here is a photo of my weather station:

http://subefotos.com/ver/?7c33e3559f232 … 39eedo.jpg

And Here a photo of my code(as you can see, im very bad programing, sorry…):

http://subefotos.com/ver/?c5c80aaf72f1c … 535cfo.png

http://subefotos.com/ver/?5423fa2fefcf4 … 7eaffo.png

Well i hope you can help, my problem i think that i cant send float values …

Thanks Diego

I dont expecified the problem, in terminal it shows wrong values, i.e. wind speed: 67993 and it have to be like wind speed:32.

I hope u understand me , and so sorry for my horrible english.

Diego

Please copy/paste the code into a code-window in your next reply. Looking at a screendump of it is very hard to read. Especially if it is spread over 2 files, and some of the lines are clipped. I definitely can’t put that in my favourite text/code editor or compile it if I wished.

To easily make the code windows in your reply, go to the full message editor and press the code button at the top. This inserts the text [code ][ /code] into the text box where you can paste your code between the ][.

#include <SX1272.h>
#include <SPI.h>
#include <DHT11.h>
#define uint  unsigned int
#define ulong unsigned long
#define PIN_ANEMOMETER  2     
#define PIN_RAINGAUGE  3     
#define PIN_VANE        5     
#define MSECS_CALC_WIND_SPEED 1000
#define MSECS_CALC_WIND_DIR   1000
#define MSECS_CALC_RAIN_FALL  1000
#define NUMDIRS 8

int err;
float temp, hum, vol, val;
char x, iSpeed;
int pin=4;
DHT11 dht11(pin); 
int e;
char mensaje [60];
char temperatura[6];
char humedad [6];
char direccion [2];
char velocidad[6];
char lluvia [6];
ulong   adc[NUMDIRS] = {26, 45, 77, 118, 161, 196, 220, 256};
char *strVals[NUMDIRS] = {"W","NW","N","SW","NE","S","SE","E"};
byte dirOffset=0;

volatile int numRevsAnemometer = 0; // Incremented in the interrupt
volatile int numDropsRainGauge = 0; // Incremented in the interrupt
ulong nextCalcSpeed;                // When we next calc the wind speed
ulong nextCalcDir;                  // When we next calc the direction
ulong nextCalcRain;                  // When we next calc the rain drop
ulong time;                         // Millis() at each start of loop().

//=======================================================
// Interrupt handler for anemometer. Called each time the reed
// switch triggers (one revolution).
//=======================================================
void countAnemometer() {
   numRevsAnemometer++;
}

//=======================================================
// Interrupt handler for rain gauge. Called each time the reed
// switch triggers (one drop).
//=======================================================
void countRainGauge() {
   numDropsRainGauge++;
}


//=======================================================
// Direccion del viento

void calcWindDir() {
  int PIN_DIRECCION=5; 
  int val;
   byte x, reading;

   val = analogRead(PIN_DIRECCION);
   val >>=2;                        // Shift to 255 range
   reading = val;

   // Look the reading up in directions table. Find the first value
   // that's >= to what we got.
   for (x=0; x<NUMDIRS; x++) {
      if (adc[x] >= reading)
         break;
   }
   //Serial.println(reading, DEC);
   x = (x + dirOffset) % 8;   // Adjust for orientation
  
   Serial.print("  Dir: ");
   Serial.println(strVals[x]);
   
}


//=======================================================
// Velocidad del viento
void calcWindSpeed() {
   int x, iSpeed;
   // This will produce kph * 10
   // (didn't calc right when done as one statement)
   long speed = 24011;
   speed *= numRevsAnemometer;
   speed /= MSECS_CALC_WIND_SPEED;
   iSpeed = speed;         // Need this for formatting below

   Serial.print("Wind speed: ");
   x = iSpeed / 10;
   Serial.print(speed);
   Serial.print('.');
   x = iSpeed % 10;
   Serial.print(x);
   Serial.println();
   numRevsAnemometer = 0;        // Reset counter
}

//=======================================================
// Lluvia
void calcRainFall() {
   int x, iVol;
   // This will produce mm * 10000
   // (didn't calc right when done as one statement)
   long vol = 2794; // 0.2794 mm
   vol *= numDropsRainGauge;
   vol /= MSECS_CALC_RAIN_FALL;
   iVol = vol;         // Need this for formatting below

   Serial.print("Rain fall: ");
   x = iVol / 10000;
   Serial.print(x);
   Serial.print('.');
   x = iVol % 10000;
   Serial.print(x);
   Serial.println();
   
   numDropsRainGauge = 0;        // Reset counter
}
//===========================================
//Sensor temperatura y humedad

void temperaturahumedad()
{ 
  
  if((err=dht11.read(hum, temp))==0)
  {
    Serial.print("Temperatura: ");
    Serial.print(temp);
    Serial.print(" Humedad: ");
    Serial.print(hum);
    Serial.println();
  }
  else
  {
    Serial.println();
    Serial.print("Error Num :");
    Serial.print(err);
    Serial.println();    
  }
  	
}
//=======================================================
// Inicio

void setup() {
   Serial.begin(38400);
   pinMode(PIN_ANEMOMETER, INPUT);
   digitalWrite(PIN_ANEMOMETER, HIGH);
   digitalWrite(PIN_RAINGAUGE, HIGH);
   attachInterrupt(0, countAnemometer, FALLING);
   attachInterrupt(1, countRainGauge, FALLING);
   nextCalcRain = millis() + MSECS_CALC_RAIN_FALL;
   nextCalcSpeed = millis() + MSECS_CALC_WIND_SPEED;
   nextCalcDir   = millis() + MSECS_CALC_WIND_DIR;
  
  // Modulo a ON
  sx1272.ON();
  
  // Modo de transmisión
  e = sx1272.setMode(1);
  Serial.println(F("Configurado modo: Estado "));
  Serial.println(e, DEC);
  
  // Seleccionamos frecuencia del canal
  e = sx1272.setChannel(CH_13_868);
  Serial.println(F("Configurado canal: Estado "));
  Serial.println(e, DEC);
  
  // Seleccionamos nivel de potencia
  e = sx1272.setPower('M');
  Serial.println(F("Configurada potencia: Estado "));
  Serial.println(e, DEC);
  
  // Seleccionamos dirección del nodo
  e = sx1272.setNodeAddress(2);
  Serial.println(F("Configurada dirección del nodo: Estado "));
  Serial.println(e, DEC);
  
  // Imprimimos mensaje
  Serial.println(F("SX1272 configurado satisfactoriamente"));
}

//=======================================================
// Bucle principal

void loop() {
   time = millis();
   temperaturahumedad();
   if (time >= nextCalcSpeed) {
      calcWindSpeed();
      nextCalcSpeed = time + MSECS_CALC_WIND_SPEED;
   }
   if (time >= nextCalcDir) {
      calcWindDir();
      nextCalcDir = time + MSECS_CALC_WIND_DIR;
   }
   if (time >= nextCalcRain) {
      calcRainFall();
      nextCalcRain = time + MSECS_CALC_RAIN_FALL;
      
     dht11.read(hum, temp);//Leemos valor temperatura y humedad
  e = sx1272.sendPacketTimeout(3, mensaje);//Selección dirección y mensaje a enviar
  dtostrf (temp, 3, 2, temperatura);//Pasamos valor flotante a string
  dtostrf (hum, 3, 2, humedad);//Pasamos valor flotante a string
  dtostrf (val, 3, 2, direccion);//Pasamos valor flotante a string
  //dtostrf (y, 3, 2, velocidad);//Pasamos valor flotante a string
  //dtostrf (x, 2, lluvia);//Pasamos valor flotante a string
  //Enviamos mensaje por canal 13 al dispositivo 3
  sprintf(mensaje,"temperatura: %s , humedad: %s , velocidad: %i ,direccion %s , lluvia %s \r",temperatura, humedad,velocidad, direccion, lluvia);
     }

}

sorry Im new in this electronic world:(

Ty

ProyectoGrupo1:
I dont expecified the problem, in terminal it shows wrong values, i.e. wind speed: 67993 and it have to be like wind speed:32.

Sorry, I don’t understand. What is that 67993 and 32.? The weather sensor datasheet speaks of the reed switch being closed once every second at a windspeed of 2.4 km/h (or 1.492 miles per hour). I don’t know how to relate your numbers to a speed of the anemometer. Do you get about 68 pulses per second as it turns? Or more importantly, how fast was it turning? Measure the pulse frequency of the anemometer first with some kind of RPM/tachometer, to be sure it is working correctly. Then you can use a pulse generator (could be another Arduino) to supply the Arduino program with a fixed pulse frequency to check if it calculates the numbers correctly. If that works, only then should you worry about conversion to imperial or metric units in your code.

I explained bad as i suspected XD

These numbers are just example, what I mean is that in my code without Lora program, just for read sensors, this program work perfect, the values are corrects, but when i merged the sensor´program with the Lora´program, it send diferent values much higer, negative sign, etc.(Temperature and humidity with DHT11 send correctly, sensors of SEN-08942 send mistakenly)

So i think my problem is in the Lora program code, i think lora only can send character values, and my values are float, and i use a conversion function to change float to char but dont work.

I hope u understande me now xD

Thanks

Ok, now I understand. Then why not first start with making test programs that only use the Lora hardware and the arduino. Leave the weatherstation and it’s code aside. First make a small test program that sends any kind of numbers over the wireless link. You don’t need to measure them. Just make something up. And see if they arrive correctly.

ok i will try tomorrow, and i will say you what i get, thank you

dht11.read(hum, temp);//Leemos valor temperatura y humedad
```Are you sure you can read the temperature and humidity that way? Or which library are you using for this? Because the library I've seen requires a pin number as parameter for the class-method read. I want to know what type of variable hum and temp are. In your code you declare them as floats. But what if they are not? What sort of number does the dht11 deliver?

Second, I cannot figure out what commands in your code printed that number you describe as 67993. Was it in the calcWindSpeed() function, or at the end of loop().

There is something odd there too. First you send a packet containing the mensaja string. And after that you assemble it together from various variables. First converting variables temp, hum,val to string with dtostr. And then concatenate them with sprintf. Which will only be sent during the next pass through loop(). Why not prepare the packet first and then send it in the same loop passage. And to compare how the Lora module corrupts your data, make sure you send the string over the serial port to the PC first.

ProyectoGrupo1:
its somethiing like this http://air.imag.fr/index.php/File:MontageWeather.JPG

But i can see it well, so if someone help in what pins i have to conect the 6 wires of the rj11 conectors,

I’ll be very greatful.

Can somebody please confirm with some diagram the connections showing in the image? I read the datasheet and it says yellow is for Vdd and in the image is shown to use it for digital input… I am kind of confused…

Regards!

I don’t know what datasheet you are reading, but this one linked on the product page doesn’t mention any colors:

https://www.sparkfun.com/datasheets/Sen … embly…pdf

It does however shows which wires in the connectors go where in the circuit. I wouldn’t rely on the colors of the wires, but instead measure the resistances and match that with the circuit.

That above linked image is a bit of a jumble of wires. I can’t makes sense of that left side of the breadbord.