Post a new topicPost a reply Page 1 of 1   [ 8 posts ]
Author Message
 Post subject: Events board, Socket 8 A vs. B, how to connect sockets
PostPosted: Thu Apr 12, 2012 1:32 pm 

Joined: Fri Nov 25, 2011 2:28 pm
Posts: 62
Hello there,

I'm setting up a waspmote with an events board for hall effect and a temperature sensor.

The intended use is a unit that sleeps untill a threshold is reached - either a high temperature or a door opening.

I have two queries on how to acheive this with the events board & the standard sensors:

1. Hall effect:

I can get an interrupt when the 'door closes' i.e. when I close the circuit I can generate an interrupt - this is the opposite of what I would like.
I've read a forum post that recommended socket 8 on the events board (pull up & pull down resistances available) but I can't determine the correct setup for this functionality from the documentation.

I have socket 8's switch in the '+' or ON position, and I can generate interrupts while the jumper is on the middle and 'left' pin (socket 8A in the events board guide, left in Fig 38).
This provides a 'door close' detection admirably.

From my understanding of the text if I move the jumper to middle and 'right' pin (socket 8B in the events board guide, right in Fig 38) It should interrupt when the circuit is broken (i.e. door opens).

I have tested this and cannot generate an interrupt. Inspection of the voltages show a consistant 3.29 V when the jumper is in 8B mode, whether sensor is connected or not, and if circuit is broken or not if sensor is connected. (sensor is PLA41201)

I would like to know if I can use socket 8B (two pin) to detect a circuit breaking & generate an interrupt, and if so does it require a different treatment to the 8A circuit closing interruption I already have working.


The temperature sensor (MCP9700A) is working well I'm just wondering about it's physical stability in the socket. I've noticed that even a tiny movement of the sensor causes erroneous readings, probably breaking the contacts.
I'd see using a male connector similar to the pins used to connect the sensor boards to the waspmote (i.e. a square male of a suitable gauge) as the most robust option for wiring the sensors into the boards sockets (this applies to most sensors of course).
I'd be grateful for a brief description of how you have mounted wires / sensors into these sockets.

Thanks very much.


Top
 Profile  
 
 Post subject: Re: Events board, Socket 8 A vs. B, how to connect sockets
PostPosted: Thu Apr 12, 2012 1:40 pm 

Joined: Fri Nov 25, 2011 2:28 pm
Posts: 62
Here is the sketch I am using to test the hall effect interruption.

Quote:

float threshold = 1.5;
float value = 0;

void setup(){
  
  // setup for Serial port over USB
  USB.begin();
  USB.println("USB port started...");
  
  SensorEvent.setBoardMode(SENS_ON);
  USB.println("SENSOR BOARD ON!!");

  SensorEvent.setThreshold(SENS_SOCKET8,threshold);
  
  
}


void loop(){
     SensorEvent.attachInt();
     USB.println("Dropping off...");
     PWR.sleep(UART0_OFF | UART1_OFF | BAT_OFF);
     SensorEvent.detachInt();
     SensorEvent.loadInt();
     USB.begin();
     USB.println("...waking up...");
     
  if (SensorEvent.intFlag & SENS_SOCKET8)
  {
       intFlag &= ~(SENS_SOCKET8); 
       value = SensorEvent.readValue(SENS_SOCKET8);    //SENS_TEMPERATURE
      USB.print("HALL INTERRUPT! (SOCKET 8)");
      USB.print("value = ");
      USB.print(value);
      
   // sendSMS();
  }
  
  value = SensorEvent.readValue(SENS_SOCKET8);    //SENS_TEMPERATURE
  USB.print("value = ");
  USB.println(value);
  delay(500);
}

void sendSMS(){
  // setup for GPRS seial port
  GPRS.ON();
  USB.println("GPRS module ready...");
    
  // waiting while GPRS connects to the network
  while(!GPRS.check());
  USB.println("GPRS connected to the network");
  
  // configure SMS and Incoming Calls
  if(GPRS.setInfoIncomingCall()) USB.println("Info Incoming Call OK");
  if(GPRS.setInfoIncomingSMS()) USB.println("Info Incoming SMS OK");
  if(GPRS.setTextModeSMS()) USB.println("Text Mode SMS OK");

  if(GPRS.sendSMS("Test Message!","0877738252")) USB.println("SMS Sent OK"); // * should be replaced by the desired tlfn number
  else USB.println("Error sending sms");
  
  delay(50);
  GPRS.setMode(GPRS_HIBERNATE);
  USB.println("GPRS mode set to HIBERNATE");
}



This version interrupts when a sensor (switch) closes on socket 8 two pin.

It works when the jumper is in 8A position, in 8B it does not detect the opening / closing of the circuit, whether the circuit is initally open or closed (when ints are attached).


Top
 Profile  
 
 Post subject: Re: Events board, Socket 8 A vs. B, how to connect sockets
PostPosted: Fri Apr 13, 2012 11:30 am 

Joined: Mon Sep 28, 2009 1:06 pm
Posts: 7818
Hi LiamatTitan,

when moving the jumper of socket 8 from 'left' to 'right' position, did you take into account that you do have to move the sensor to the 'right socket' too?

Regarding the temperature sensor, yes, we have detected that with the pins used in the board temperature sensor sometimes doesn't fit very well. We usually fix it by slightly bending the sensor pins, most times it is enough to get a good contact. Even though, there are sometimes that if the connector as been forced (to necessary from use, it happens to come from factory like this) soldering a three square pin as you mentioned is the solution.

Regards.


Top
 Profile  
 
 Post subject: Re: Events board, Socket 8 A vs. B, how to connect sockets
PostPosted: Tue Apr 17, 2012 11:21 am 

Joined: Fri Nov 25, 2011 2:28 pm
Posts: 62
Thanks for the advice, I've got improved performance with my soldered pin connection between temp sensor & board socket.

With regard to socket 8, you mention moving the sensor to the 'right socket too'.
I take it this means using the 3 pin connector of socket 8? It is labeled as 8B at the top of the events board guide. will I mount the 2 pin hall effect sensor in the +3.3 & vout pins (leaving middle / Ground empty) or how can I orient the 2 pin sensor in the 3 pin slot?


Thanks very much.

P.S. I've been using the cities board with the temperature sensor. I've found it to work alright but when I set the threshold (0 - 3.3) it never interrupts.
with the events & gas boards I have used the temp = (voltage - 0.5 )*100 to set an appropriate threshold voltage. this does not occur with the cities board. I've set a threshold of 0.7 and from 17 - 25 C it will not interrupt.
Is the threshold set in the same way, i.e. using the same conversion?


Top
 Profile  
 
 Post subject: Re: Events board, Socket 8 A vs. B, how to connect sockets
PostPosted: Tue Apr 17, 2012 2:11 pm 

Joined: Mon Sep 28, 2009 1:06 pm
Posts: 7818
Hi LiamatTitan,

no, you should connect the sensor to the GND and output pins, so when the door is closed the output will be tied to ground and when it goes open the sensor will also open the circuit, connecting the output to the 3.3V through the pull up resistor.

Regarding the interruption in Smart Cities, yes, it is performed the same way as in the events board. Could you please post the code you are using?

Regards.


Top
 Profile  
 
 Post subject: Re: Events board, Socket 8 A vs. B, how to connect sockets
PostPosted: Wed Apr 18, 2012 11:36 am 

Joined: Fri Nov 25, 2011 2:28 pm
Posts: 62
Thanks for the advice, and swift reply.

I've had excellent results with the hall effect assigned to socket 8B (GND & VOUT).
This means a interesting group of sensing options become possible with the reverse switch interrupt.

I've cut the smart cities code to it's bare components (I had GPRS and other functions attached).

I basically have a cycle of 10 seconds, printing temperature readings, and a interrupt set on the temperature of .72 (which by my aforementioned formula = 22 degrees C)

I've tested several times. the temperature readings appear very stable (rise & fall as anticipated)
I've ran the test with initial temperature (ambient) of 19 degrees C to 27.7 degrees C without generating an interrupt. I observed the temperature reach & exceed the threshold on several occasions in short.

Quote:
//SENSOR CITIES BOARD TEST

float value = 0;
float threshold_temp = 0.75;

void setup(){
  USB.begin();
  USB.println("USB port started...");
  
  //Switch on the board
  SensorCities.setBoardMode(SENS_ON);
  delay(100);
  //Init RTC
  RTC.ON();  
  delay(100);
  USB.println("RTC started...");
  
  RTC.setTime("12:04:20:03:00:00:00");
  
  SensorCities.setSensorMode(SENS_ON, SENS_CITIES_TEMPERATURE);
  
  SensorEvent.setThreshold(SENS_CITIES_TEMPERATURE,threshold_temp);
  
  delay(200);
  value = SensorCities.readValue(SENS_CITIES_TEMPERATURE);  
  USB.print("value: ");
  USB.println(value);
  
  //sendSMS();

}

void loop(){
  value = SensorCities.readValue(SENS_CITIES_TEMPERATURE);  
  USB.print("value: ");
  USB.println(value);
  
  SensorCities.attachInt();
   
  //RTC.setAlarm1(0,0,0,10,RTC_ABSOLUTE,RTC_ALM1_MODE5); //every 10th second of every minute
  RTC.setAlarm1(0,0,0,10,RTC_OFFSET,RTC_ALM1_MODE4);  //every 10 seconds
  USB.println("dropping off...");
   PWR.sleep(UART0_OFF | UART1_OFF | BAT_OFF);
   //PWR.sleep(UART0_OFF | BAT_OFF);
   SensorCities.detachInt();
   SensorCities.loadInt();
   USB.begin();
   USB.println("...waking up...");
  
  if (SensorCities.intFlag & SENS_CITIES_TEMPERATURE)
  {
    SensorCities.intFlag &= ~(SENS_CITIES_TEMPERATURE);
    USB.print("TEMPERATURE INTERRUPT\t");
    value = SensorCities.readValue(SENS_CITIES_TEMPERATURE);  
    USB.print("value: ");
    USB.println(value);
  }
  
  if( intFlag & RTC_INT ){
     intFlag &= ~(RTC_INT); // Clear flag
     USB.print("RTC INTERRUPT! ");
     USB.print("Time is: ");
     USB.println(RTC.getTime());
     if(RTC.minute == 2)
     {
         USB.println("time to Report in....");
     }
     //value = SensorCities.readValue(SENS_CITIES_TEMPERATURE);
     //USB.print("value: ");
     //USB.println(value);
  } 
}



I think I am approaching the sensor board interruptions in the correct way, but I'd appreciate your help in debugging / rectifying this code. I have the board mounted and the sensor installed reliably, with responsive measurement of temperature changes.
Am I correct in saying the "SensorCities.attachInt();" will generate an interrupt from any cities sensor configured with a threshold / threshold & gain?


Top
 Profile  
 
 Post subject: Re: Events board, Socket 8 A vs. B, how to connect sockets
PostPosted: Thu Apr 19, 2012 10:06 am 

Joined: Mon Sep 28, 2009 1:06 pm
Posts: 7818
Hi LiamatTitan,

glad you finally got the hall effect sensor to work.

Regarding the temperature interruptions, you are configuring it using the SensorEvent library, correct it to use the SensorCities function and you should have it.

Regards.


Top
 Profile  
 
 Post subject: Re: Events board, Socket 8 A vs. B, how to connect sockets
PostPosted: Thu Apr 19, 2012 1:55 pm 

Joined: Fri Nov 25, 2011 2:28 pm
Posts: 62
BINGO!

Hey,

Thanks for that, a silly mistake but that's what I get for ctrl+c - ctrl+v'ing

Crazy how I missed that.

It works now, thanks to your help. :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 8 posts ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Libelium theme based on 610nm Style by Daniel St. Jules of http://www.gamexe.net


© Libelium Comunicaciones Distribuidas S.L. | Terms of use