Pages

Thursday, 18 December 2014

Dehumidifer data rate.

Since slowing down the frequency of transmission from the controller in the attic, it has become apparent how many transmissions were being lost, either to the data logging receiver or the remote display. Looking back over historical data, the lost in % of expected transmission is much the same as now, just that there are now fewer!

To try and minimise the loss of transmissions, I spent a little time messing with the location of the transmitter and receivers. I also used my scanner tuned to 433.920 MHz to measure the signal strength. It appears everything is little "on the limit".

To try and improve the link margin, I dropped the data rate to a very pedestrian 75 BPS. This didn't really help much. I've got the link to the data logging PC pretty much 100% now, which is good, but the remote display is a little further away, so it does drop the odd message or two, so I've added a timer into the remote receiver sketch, so if a message falls overdue, "O/D" is written to the top right of the display instead of "On" or "off". At least I then know if the data is current or not.

Here's the sketch:

// Receiver Sketch for Dehumidifier controller project
// Written by A.G.Doswell 23 May 2014, modified 18 Dec 2014
// LCD is a Hitachi HD44780 or compatible, attached thus:
// LCD RS pin to digital pin 12
// LCD Enable pin to digital pin 11
// LCD D4 pin to digital pin 5
// LCD D5 pin to digital pin 4
// LCD D6 pin to digital pin 3
// LCD D7 pin to digital pin 2
// RW to GND
// V0 Held high (this may or may not work with your LCD, usual practice is to connect this to a 10K pot between +5 and GND)
// Receiver connected to pin 9


#include <VirtualWire.h>
#include <VirtualWire_Config.h>
#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

int TX_ID =10;
int Temp;
int Humidity;
int Dew;
boolean Output;
unsigned long timer = 0;
unsigned long timer2;



void setup() {
              lcd.begin (16, 2);
              // Virtualwire setup
              vw_set_tx_pin(10); // Even though it's not used, we'll define it so the default doesn't interfere with the LCD library.
              vw_set_rx_pin(9); // RX pin set to pin 9
              vw_setup(75); //sets virtualwire for a tx rate of 75 bits per second, nice and slow! 
              vw_rx_start();     
              }  
void loop()
{
typedef struct rxRemoteData //Defines the received data, this is the same as the TX struct
{
int    TX_ID; 
int    Temp;   
int    Humidity;
int    Dew;
boolean Output;
};

struct rxRemoteData receivedData;
uint8_t rcvdSize = sizeof(receivedData);
timer2 = millis(); // capture current time
if (timer2 > timer+200000) { //if it's more than 200 seconds since the last time a message was received write O/D to the display (overdue)
  lcd.setCursor (13,0);
       lcd.print ("O/D");
}

if (vw_get_message((uint8_t *)&receivedData, &rcvdSize)) 
{
  if (receivedData.TX_ID == 10)     { //Only if the TX_ID=10 do we process the data.
    lcd.setCursor(13,0);
    lcd.print (" Rx");
    delay (100);
    int TX_ID = receivedData.TX_ID;
    int Temp = receivedData.Temp;
    int Humidity = receivedData.Humidity;
    int Dew = receivedData.Dew;
    boolean Output = receivedData.Output;
    
        
      // writes the received data to the LCD
  lcd.clear ();
  lcd.print("Humidity:");
  lcd.print(Humidity);
  lcd.print("%");
  lcd.setCursor(0, 1);
  lcd.print(Temp);
  lcd.print((char)0xDF);
  lcd.print("C");
  lcd.setCursor(6, 1);
  lcd.print("Dew:");
  lcd.print(Dew);
  lcd.print((char)0xDF);
  lcd.print("C");
  
  if (Output == true) {
      lcd.setCursor (13,0);
      lcd.print (" On");
    
  }
     else {
       lcd.setCursor (13,0);
       lcd.print ("off");

           }
  
      } 
timer = millis(); // reset timer
  }
}

// End of file


**STOP PRESS!!!

Range has continued to be poor. So I revisited the remote receiver hardware. In my haste to get it running there was only the very minor decouling of the PSU on the Arduino pro mini board itself. I've added a 10uF cap to the power supply input to the receiver module and 100uF on the output of the 5V regulator. Range is now MUCH improved. 

No comments:

Post a Comment