Please login or register.

Login with username, password and session length
Pages: 1 ... 6 7 [8] 9

Author Topic: Temperature/Humidity monitoring  (Read 60861 times)

dhouston

  • Advanced Member
  • Hero Member
  • ******
  • Helpful Post Rating: 37
  • Posts: 2547
    • davehouston.org
Re: Temperature/Humidity monitoring
« Reply #105 on: March 07, 2013, 05:38:20 AM »

I think a PL513/PSC04 might be the best way to go.

I'm suspicious of the Firecracker timing. A long time back I  tested the TM751 & RR501 and found both very forgiving in terms of the length of pulses/spaces in the RF bitstream (I tested to ±20% with no problems.) but I never tested the CM15A in this way - it may test the bitstream in a different way, making it more sensitive to variations.

One other factor may be the way you power the Arduino. I have never been a fan of the Arduino power scheme. I assume you are using an external power supply and not the USB connector.
Logged
This message was composed entirely from recycled letters of the alphabet using only renewable, caffeinated energy sources.
No twees, wabbits, chimps or whales died in the process.
https://www.laser.com/dhouston

bkenobi

  • PI Expert
  • Hero Member
  • ******
  • Helpful Post Rating: 24
  • Posts: 2082
Re: Temperature/Humidity monitoring
« Reply #106 on: March 07, 2013, 09:36:04 AM »

I'm not sure the problem is the firecracker at this point.  I read the documentation in the firecracker arduino library again and found that the bright command is executing as designed.  The command is only sending the command part of the signal and not the house and unit code first.  So, that's not an issue after all.

I hooked everything back up in the attic again and found that if I unplug the north attic sensor, everything works fine.  I can connect other sensors to that one's spot, so the arduino is good.  I have a long run to that sensor and it's next to other cables, so perhaps there's some interference, a bad cable, or a bad sensor.

I'm getting closer!

bkenobi

  • PI Expert
  • Hero Member
  • ******
  • Helpful Post Rating: 24
  • Posts: 2082
Re: Temperature/Humidity monitoring
« Reply #107 on: March 08, 2013, 05:22:47 PM »

In my own setup, I'm connecting the Arduino right to the TW523 port of my XTB-IIR. It works just fine for me every time. However, it isn't using RF, so there is no chance of RF reception problems.
My XTB-IIR is in the basement too far from the attic sensors unfortunately.  But, Since I already have one and it would be a reasonable test to program the arduino to use it, do you have any links or documentation on using the XTB-IIR as a TW523?  Maybe the port is exactly the same so I just need to build an adapter?
« Last Edit: March 08, 2013, 10:52:25 PM by bkenobi »
Logged

Noam

  • Community Organizer
  • Hero Member
  • ***
  • Helpful Post Rating: 51
  • Posts: 2818
Re: Temperature/Humidity monitoring
« Reply #108 on: March 11, 2013, 01:01:58 PM »

If I remember correctly, the port on the XTB-IIR *is* exactly the same as on the TW523.
However, the documentation I found for interfacing the Arduino with the TW523/PSC501 was inconsistent. Some of it had the wrong pinout.
I don't have my own notes in front of me, but I think I needed two pins on the arduino, plus +5v and gnd. There is a resistor somewhere between two of the pins, too.
My arduino is connected to the XTB-IIR with a modular phone cord (regular flat 4-wire), about 70 feet long. I haven't had any issues with it.

I am only using the TW523 port on the XTB-IIR for sending commands right now. My plans for a multiple input/output Arduino-based PowerFlash/Universal Module device are still stuck in the planning phases. I haven't figured out how to deal with momentary button pushes (since it takes longer to actually send the commands than to press the button, so I'd need to queue up the detected button pushes). It has been a very low priority for me, so I haven't spent much time on it lately.
Logged

bkenobi

  • PI Expert
  • Hero Member
  • ******
  • Helpful Post Rating: 24
  • Posts: 2082
Re: Temperature/Humidity monitoring
« Reply #109 on: March 11, 2013, 01:08:11 PM »

That sounds consistent with what I found regarding Arduino-TW523 setup.  I saw one schematic that appeared to gfound the middle 2 pins on the TW523 and another that didn't. I think the difference was whether the Arduino was just sending commands or if it was receiving them as well.

Brian H

  • Community Organizer
  • Hero Member
  • ***
  • Helpful Post Rating: 305
  • Posts: 13295
Re: Temperature/Humidity monitoring
« Reply #110 on: March 11, 2013, 02:12:33 PM »

The TW523 has one common pin {2}  for all three signals. Zero Crossing, Received Data and Transmitter control.
The PL513 has a separate common pins {2&3} for Zero Crossing and Transmit Control.
http://software.x10.com/pub/manuals/technicalnote.pdf
On a TW523 tying 2-3 would connect the received data pin #3 to common pin #2  but if you are not using it. That maybe what they wanted. As it is optoisolated and a open collector output.
« Last Edit: March 11, 2013, 02:26:54 PM by Brian H »
Logged

dhouston

  • Advanced Member
  • Hero Member
  • ******
  • Helpful Post Rating: 37
  • Posts: 2547
    • davehouston.org
Re: Temperature/Humidity monitoring
« Reply #111 on: March 11, 2013, 03:11:30 PM »

You need a 4.7K pullup resistor (i.e. to +5V) on pins 1 (ZC) and, if using it, pin 3 (X10 Receive Output).
Logged
This message was composed entirely from recycled letters of the alphabet using only renewable, caffeinated energy sources.
No twees, wabbits, chimps or whales died in the process.
https://www.laser.com/dhouston

bkenobi

  • PI Expert
  • Hero Member
  • ******
  • Helpful Post Rating: 24
  • Posts: 2082
Re: Temperature/Humidity monitoring
« Reply #112 on: March 29, 2013, 12:43:04 AM »

I have a few angles that I am working through on this project.  I don't have the time to spend one good chunk of time on this to get it knocked out at once, but I'll get there hopefully.  Since I have a XTB-IIR,  I'm going to program an arduino with a simple test.  But, I have the wireless already wired up and figured it was worth the time to debug.

What I think I found is that although the antenna setup gets really good range in one direction, it seems to have poor range in others.  Also, the short range seems very poor. Unless I put the antenna in exactly the right angle.

I have no problem moving away from wireless since it should be more reliable, but I'd like to have the wireless more reliable too. 

dave w

  • Community Organizer
  • Hero Member
  • ***
  • Helpful Post Rating: 139
  • Posts: 6116
Re: Temperature/Humidity monitoring
« Reply #113 on: March 29, 2013, 10:42:26 AM »

Also, the short range seems very poor. Unless I put the antenna in exactly the right angle.
If you are using a 1/4 wave with ground plane, or a 1/2 wave antenna, they will have a dead area directly below the antenna. I have had some luck with a 1/2 wave, no ground plane, and the 18 inch element bent 90 degrees at 9 inches. It probably cuts down my overall range, but it gives me better coverage directly below the antenna. dhoustons circular "egg beater" antenna would likely fix my coverage voids since it addresses horizontal-vertical polarization.  
« Last Edit: April 08, 2013, 06:04:44 PM by dave w »
Logged
"This aftershave makes me look fat"

bkenobi

  • PI Expert
  • Hero Member
  • ******
  • Helpful Post Rating: 24
  • Posts: 2082
Re: Temperature/Humidity monitoring
« Reply #114 on: March 29, 2013, 10:52:37 AM »

I originally bought the RS antenna since I thought the 4 elements were a tetrahedral shaped array which would provide a really nice omni range.  I checked last night and found that only the vertical wire is a receiver and the horizontal elements are the ground plane.  The vertical element is 18-19" long and there are two 4.5" short elements near the base.

The other thing I noticed was how much the rafters affect reception.  If I place the antenna on a joist such that the vertical element rests on a rafter, it appears that my short range reception is nearly zero.  That could be a fluke since rotating the whole antenna does seem to change things.

bkenobi

  • PI Expert
  • Hero Member
  • ******
  • Helpful Post Rating: 24
  • Posts: 2082
Re: Temperature/Humidity monitoring
« Reply #115 on: March 31, 2013, 03:57:27 PM »

A quick question for anyone using the PSC05 with arduino (or at least have looked at it).  I am looking at using the code written by Thomas Mittet since it compiles with Arduino 1.0 and above.  Looking at the documentation for X10 on the arduino library (http://arduino.cc/en/Tutorial/x10), it says a pullup resistor is needed on the data pin.  There are 2 data pins for the PSC05, so I would assume I'd put resistors on both (I think that's in line with what Brian H said above).  But, looking at the Mitten code, it doesn't show/say anything about pullup resistors.  I suppose having them won't damage anything should they not be required, so I guess I'll start off with them installed.  Any opinion on why it's not mentioned for this newer code (or perhaps I missed it)?

EDIT:  Never mind.  I don't see why it's not listed in the Mittet code but even the technicalnote.pdf has the pullup resistors in the schematic.
« Last Edit: April 07, 2013, 01:14:39 PM by bkenobi »
Logged

bkenobi

  • PI Expert
  • Hero Member
  • ******
  • Helpful Post Rating: 24
  • Posts: 2082
Re: Temperature/Humidity monitoring
« Reply #116 on: April 07, 2013, 01:44:18 PM »

I got my PSC04 in the mail a couple days back.  I thought I could use the Arduino code and hardware as is, but apparently the PSC05 connection doesn't make the PSC04 happy.  I simply removed the pullup resistor and added a jumper to ground and it works fine.  I simplified my code to almost nothing so as to make sure the basic transmit function works.  What I found is that the XTB-IIR does not like the PSC04 for some reason.  Perhaps someone could give some guidance?

This is my code:
Quote
#define DEBUG

#define VERSION "Attic Fan Controller TEST 20130407"

#include <dht11.h>
#include <SimpleTimer.h>

#include <X10ex.h>

#define POWER_LINE_MSG "PL:"
#define POWER_LINE_BUFFER_ERROR "PL:_ExBuffer"
#define SERIAL_DATA_MSG "SD:"
#define SERIAL_DATA_THRESHOLD 1000
#define SERIAL_DATA_TIMEOUT "SD:_ExTimOut"
#define MODULE_STATE_MSG "MS:"
#define MSG_DATA_ERROR "_ExSyntax"

// Fields used for serial and byte message reception
unsigned long sdReceived;
char bmHouse;
byte bmUnit;
byte bmCommand;
byte bmExtCommand;


// Initialize timer
SimpleTimer timer;


// X10 related values
#define Fan1_HC    'E'              // Fan_1 on house code C
#define Fan1_UC    1                // Fan_1 on unit code 1
#define Fan2_HC    'E'              // Fan_1 on house code C
#define Fan2_UC    2                // Fan_1 on unit code 1



// general constants
#define FanRunTime 2000
#define X10CommandDelay 1000         // delay after sending command to avoid collisions



// X10 Power Line Communication Library
X10ex x10ex = X10ex(
2, // Zero Cross Interrupt Number (2 = "Custom" Pin Change Interrupt)
4, // Zero Cross Interrupt Pin (Pin 4-7 can be used with interrupt 2)
5, // Power Line Transmit Pin
6, // Power Line Receive Pin
true, // Enable this to see echo of what is transmitted on the power line
powerLineEvent, // Event triggered when power line message is received
1, // Number of phases (1 = No Phase Repeat/Coupling)
60 // The power line AC frequency (e.g. 50Hz in Europe, 60Hz in North America)
);

void setup()
{
  Serial.begin(9600);
  Serial.println(VERSION);

  x10ex.begin();
  Serial.println("X10 active");
}

void loop()
{
  delay(FanRunTime);
  TurnOnFan_1();
  TurnOnFan_2();
 
  delay(FanRunTime);
 
  TurnOffFan_1();
  TurnOffFan_2();
 
  delay(FanRunTime);
}


void TurnOnFan_1()
{
  // turn fan1 on and start run timer
  Serial.println("Turn ON Fan 1");
  x10ex.sendCmd(Fan1_HC, Fan1_UC, CMD_ON, 1);
  delay(X10CommandDelay);
}

void TurnOnFan_2()
{
  // turn fan1 on and start run timer
  Serial.println("Turn ON Fan 2");
  x10ex.sendCmd(Fan2_HC, Fan2_UC, CMD_ON, 1);
  delay(X10CommandDelay);
}

void TurnOffFan_1()
{
  // turn off fan1 and start delay timer
  Serial.println("Turn OFF Fan 1");
  x10ex.sendCmd(Fan1_HC, Fan1_UC, CMD_OFF, 1);
  delay(X10CommandDelay);
}

void TurnOffFan_2()
{
  // turn off fan2 and start delay timer
  Serial.println("Turn OFF Fan 2");
  x10ex.sendCmd(Fan2_HC, Fan2_UC, CMD_OFF, 1);
  delay(X10CommandDelay);
}


//**************************************************************
// Process messages received from X10 modules over the power line
void powerLineEvent(char house, byte unit, byte command, byte extData, byte extCommand, byte remainingBits)
{
  // Display any recieved messages
  printX10Message(POWER_LINE_MSG, house, unit, command, extData, extCommand, remainingBits);
}

void printX10Message(const char type[], char house, byte unit, byte command, byte extData, byte extCommand, int remainingBits)
{
  printX10TypeHouseUnit(type, house, unit, command);
  // Ignore non X10 commands like the CMD_ADDRESS command used by the IR library
  if(command <= 0xF)
  {
    Serial.print(command, HEX);
    if(extCommand || (extData && (command == CMD_STATUS_ON || command == CMD_STATUS_OFF)))
    {
      printX10ByteAsHex(extCommand);
      printX10ByteAsHex(extCommand == EXC_PRE_SET_DIM ? extData & B111111 : extData);
    }
  }
  else
  {
    Serial.print("_");
  }
  Serial.println();
}

void printX10ByteAsHex(byte data)
{
  Serial.print("x");
  if(data <= 0xF) {
    Serial.print("0");
  }
  Serial.print(data, HEX);
}

byte charHexToDecimal(byte input)
{
  // 0123456789  =>  0-15
  if(input >= 0x30 && input <= 0x39) input -= 0x30;
  // ABCDEF  =>  10-15
  else if(input >= 0x41 && input <= 0x46) input -= 0x37;
  // Return converted byte
  return input;
}

void printX10TypeHouseUnit(const char type[], char house, byte unit, byte command)
{
  Serial.print(type);
  Serial.print(house);
  if(
  unit &&
    unit != DATA_UNKNOWN/* &&
   command != CMD_ALL_UNITS_OFF &&
   command != CMD_ALL_LIGHTS_ON &&
   command != CMD_ALL_LIGHTS_OFF &&
   command != CMD_HAIL_REQUEST*/)
  {
    Serial.print(unit - 1, HEX);
  }
  else
  {
    Serial.print("_");
  }
}

The other files required are the x10eh library found here (author Thomas Mittet):
https://code.google.com/p/arduino-x10/source/browse/trunk/Libraries/?r=66#Libraries%2FX10ex%253Fstate%253Dclosed

When viewing the signal on the XTBM, I see that 3/4 of the time the signal works fine but the rest of the time I get a collision.  If I turn off the XTB-IIR, the PSC04 transmits correctly every time.  This is sending the signal from a standard outlet remote from the XTB-IIR, but the signal from the PSC04 and XTB-IIR are both over 9.00.  I moved to a different location and tried again and with the repeater plugged in, I was getting mostly collisions and very few successful signals.

The last check was to move the setup to the XTB-IIR and plug it into the booster port on the front of it.  Using the same hardware and software, I got no collisions and all signals were received by the XTBM from a different circuit.

Does anyone have any clue why this could be happening?  I made sure to try without anything plugged into the circuit just to eliminate any signal suckers/noise generators.  I can play with the timing between signals, but the timing of the signal going to the PSC04 seems correct if it's working without the XTB-IIR connected or when plugged into the XTB-IIR booster port.

Noam

  • Community Organizer
  • Hero Member
  • ***
  • Helpful Post Rating: 51
  • Posts: 2818
Re: Temperature/Humidity monitoring
« Reply #117 on: April 08, 2013, 05:49:21 PM »

The XTB-IIR has a TW523/PSC05 emulator built into it (there is an RJ11 on the bottom of it). I am connecting my Arduino into that.
Logged

bkenobi

  • PI Expert
  • Hero Member
  • ******
  • Helpful Post Rating: 24
  • Posts: 2082
Re: Temperature/Humidity monitoring
« Reply #118 on: April 08, 2013, 06:27:09 PM »

Hen I plug the arduino into the XTB-IIR TW523 emulator port, things work great.  When I plug the PL513 into the XTB-IIR booster outlet, things work great.  When I turn off the XTB-IIR an plug the PL513 into a standard outlet, things work great.  When I keep the XTB-IIR on and plug the PL513 into a standard outlet, I get poor results.  It appears to me based on the limited equipment I have that the XTB-IIR is receiving the signal from the PL513 but thinks it's done transmitting too early and repeats before the PL513 is finished.  As a result, there is a collision.  I don't have any other device to drive the PL513, so I don't know if this is the arduino or the PL513 or the XTB-IIR.  I would lean towards the arduino library first.

dhouston

  • Advanced Member
  • Hero Member
  • ******
  • Helpful Post Rating: 37
  • Posts: 2547
    • davehouston.org
Re: Temperature/Humidity monitoring
« Reply #119 on: April 09, 2013, 05:51:31 AM »

I would lean towards the arduino library first.
Not likely. The X10 PLC Protocol calls for sending during 22 contiguous half-cycles of the powerline with no breaks. It should not repeat unless your code is calling for repeats.

However, if there is an option to send only to a single phase, you might try that. It might be that the timing for the second and third phases is off. Also, make sure you are sending for 60Hz instead of 50Hz. I vaguely recall a post from Jeff about some sort of timing issue with certain transmitters.

Also, make sure your code allows for a minimum of 3 full cycles between commands. For example A1, Pause 3 cycles, AOn.
« Last Edit: April 09, 2013, 06:21:21 AM by dhouston »
Logged
This message was composed entirely from recycled letters of the alphabet using only renewable, caffeinated energy sources.
No twees, wabbits, chimps or whales died in the process.
https://www.laser.com/dhouston
Pages: 1 ... 6 7 [8] 9
 

X10.com | About X10 | X10 Security Systems | Cameras| Package Deals
© Copyright 2014-2016 X10.com All rights reserved.