Marc's Public Blog - Linux Home Automation


All | Aquariums | Arduino | Btrfs | Cars | Cats | Clubbing | Computers | Dining | Diving | Electronics | Exercising | Festivals | Flying | Halloween | Hiking | Linux | Linuxha | Monuments | Museums | Outings | Public | Rc | Sciencemuseums | Solar | Tfsf | Trips



Table of Content for linuxha:

More pages: March 2023 July 2014 December 2013 November 2013 January 2013 November 2011 August 2011 July 2011 March 2011 August 2010 June 2010 March 2010 February 2010 December 2009 November 2009 August 2009 May 2009 March 2009 March 2004



2010/06/25 Rfxcom, W800, and MR26a on misterhouse, X10Sec Garage and Mailbox Setup
π 2010-06-25 00:00 in Computers, Linuxha
I spent a long time reading and writing documentation on how to use those RF interfaces with misterhouse, and how to use XPL in general.

Instead of pasting the information here, here is the link with all the goods: https://web.archive.org/web/20120423061924/http://misterhouse.wikispaces.com/X10RFX10SecRFXCOM
or
https://github.com/hollie/misterhouse/wiki/X10RFX10SecRFXCOM (up to date, but formatting a bit broken).

I did also learn about RF and antenna design in the process. Here is the quarter wave antenna I built and that I'm now using on my MR26a:




And the simpler, but actually more effective dipole antenna I made and that I use for the W800RF32:




The serial W800RF32 is easier to extend with a long serial cable
The serial W800RF32 is easier to extend with a long serial cable

One of my first applications was to read an X10Sec module in my mailbox to know when said mailbox was opened:



Although, after 6 years of usage, I got tired of replacing the batteries on that DS10A, and I also lost a couple to water damage (it's been hard to waterproof it without killing the radio signals coming out of it). Also, on occasion I would lose a state change due to RF loss. I ended up bringing power and ethernet to my mailbox for IP cams, so I ended up adding an insteon iolinc to read the mailbox open status and at the same time control a flood light to illuminate the mailbox if it gets opened at night:

iolinc has a 2nd relay in parallel with its own relay in put to act as an OR gate and leave the output on even if the input (mailbox) has gone back down
iolinc has a 2nd relay in parallel with its own relay in put to act as an OR gate and leave the output on even if the input (mailbox) has gone back down

got a weather proof box this time, tight fit
got a weather proof box this time, tight fit

lots of wires going to the mailbox now, but I've always prefered wired to wireless
lots of wires going to the mailbox now, but I've always prefered wired to wireless

The next one was to know when my garage doors were opened or closed.
The first thing was to move the door sensors to be at the bumper level, which included drilling holes in the gardrail, no small feat without diamond tip drills which I didn't have. After several hours of making new holes and adjusting the sensors, they are now set to detect the car's bumper as opposed to looking for the car's tires which made it easy to close the door on top of the hood ...


Next, I installed X10Sec sensors on each door so that I know when they get opened or closed.



Technical notes:

  • X10Sec modules send their code 4 times, but if you miss it because the RF band was noisy or the antenna a bit out of reach (even though I tried hard with a dipole antenna put in the attic), then you have no way of querying the state.
  • X10Sec modules are however nice enough to rebroadcast their state every hour or so in case you missed the previous state update.
  • Here is the code I wrote for misterhouse:

    #08/05/2010 11:34:22 State Garage2 is alertbattlowmin #08/05/2010 11:34:22 State Garage2 is normalbattlowmin

    my %x10rfstate; #noloop

    foreach my $dev (["x10sec_garage1", "Main Garage Door"], ["x10sec_garage2", "Small Garage Door"], ["x10sec_mailbox", "Mailbox"]) { my $obj = $dev->[0]; my $name = $dev->[1];

    $obj = &::get_object_by_name($obj); $x10rfstate{$obj} = $obj->state if (not defined $x10rfstate{$obj});

    if ($obj->state_now) { my $oldstate = $x10rfstate{$obj}; my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(); $year += 1900; $mon++;

    print_log "X10SEC: $name is ".$obj->state." (was $oldstate)";

    open(LOG, ">>/var/log/x10sec"); printf LOG ("%.4d/%.2d/%.2d %.2d:%.2d:%.2d $name: ".$obj->state." (was $oldstate)\n", $year,$mon,$mday,$hour,$min,$sec); close(LOG);

    if ($obj->state ne $oldstate) { if ($obj->state =~ /alert/) { system('date | Mail -s "'.$name.' Just Opened" EMAIL'); } elsif ($obj->state =~ /normal/) { system('date | Mail -s "'.$name.' Just Closed" EMAIL'); } else { system('date | Mail -s "'.$name.' UNKNOWN STATE" EMAIL'); } $x10rfstate{$obj} = $obj->state; } } }

    # vim:sts=4:sw=4

    2010/06/18 Powering UPSes with Marine or AGM batteries
    π 2010-06-18 00:00 in Computers, Electronics, Linuxha, Solar
    So, isn't it a bit ironic that if I have solar panels that power my entire house and then some during the day, if PG&E power goes off, my inverter has no choice but to shut off too, likely both because it uses PG&E as a phase offset source, and because it would likely be bad to feed power on a down PG&E line (or at least would make it harder for PG&E to diagnose, not counting the fact that the power grid acts as a regulator in case there is too much or not enough power).

    Anyway, I wanted to have power a bit longer than 10mn when PG&E power went out, so I looked into UPS solutions while powering from a Marine or a AGM (Absorbed Glass Material) battery, both being better options than a car battery (car batteries are not meant to be deep cycled or use for extended periods of time and they do put out hydrogen when you charge them, which is undesireable inside a house).

    Interesting bits I found out:

  • This page http://www.type2.com/library/electrip/battbas.htm has decent battery info, and this one gives a bit more about AGM batteries http://www.windsun.com/Batteries/Battery_FAQ.htm . Yet, even marine or AGM batteries are not meant to be discharged at high rate. If you do, they may not even put out half their rated capacity.
  • UPSes aren't meant to be used as inverters for long time power off situations. Some will actually use more than one battery (increases voltage, decreases amps, which is good for lowering draw, but makes it a pain when you need multiple big matching marine batteries).
  • Drawing 1400VA from an APC UPS at 24V is about 60A! That's about 3-4 times what the average copper wire going to your house outlet is supposed to carry. These pages: http://en.wikipedia.org/wiki/American_wire_gauge and http://www.powerstream.com/Wire_Size.htm give some guidelines, but long story short, you need a very thick wire to carry that many amps over more than 10cm without heating up your wires (never good) and wasting a lot of power through resistive loss.
    I first quadrupled up my initial wire but then realized that it only took me from 18 gauge to 12 gauge, which was a bit low, so doubled that up with a cable I cut off from a jumpstart cable (that one was plenty thick, it was more an issue to solder it to the rest due to how massive it was and how underpowered my soldering iron was for the job).
  • In the end, I got a couple of mostly matching AGM batteries and went ahead with those for my 24V APC 1400 SmartUPS. I know my runtime wouldn't be fantastic but good enough considering (at least until I can find another free marine battery :) ).

    At 400W of actual use, that was 40% of the load for the APC 1400 inverter and a self test estimated that I would get about 1H of runtime, which gave 16Ah usable for my AGM batteries instead of about 55Ah at a lower draw (when new, and they were not new). It's a bit disappointing on one side, but on the other side, 1H of runtime for my computer gear ain't too bad, especially for AGM batteries that cost $20 a pieces (cheaper than the stock 7Ah batteries).


    first I quadrupled the wire.
    first I quadrupled the wire.

    this is a big ass gauge jumper cable
    this is a big ass gauge jumper cable

    what it looks like connected
    what it looks like connected


    Anyway, even if this isn't quite the runtime I was hoping for, and it seems hard to find any UPS with a good VA rating by using a single 12V battery (not too surprising due to the amp problem I pointed out), this is still pretty cool.

    2010/06/17 Dealing with many USB to Serial Port Converters on linux and device naming
    π 2010-06-17 01:01 in Linux, Linuxha
    So, if you have more than one USB to serial adapter, you might have issues with which order they load in, causing the serial port numbers (/dev/ttyUSB0 .. x) to change pseudo randomly at boot, it's pretty annoying.

    In my case, I picked up an 8 port ftdi usb to serial converter for only $15 on Ebay (woot!) but even its ports may not come up in sequence at boot time if other modules are loaded at the same time (a race condition can cause the pl2303 port to be in between one of the 8 ports from the ftdi hub).

    Turns out there is a solution to this problem with udev, iff your usb to serial adapters have serial numbers (my ftdi ones did, but my pl2303 ones did not), or if you only have one serial adapter of each brand (like ftdi, pl2303, keyspan).

    In my case, I have (don't laugh), 11 serial devices on my server:

  • Server serial console
  • 1-wire serial adapter
  • Insteon PLM
  • APC ups
  • W800 X10RF and X10sec gateway
  • X10 MR26a X10RF gateway
  • First ECM 1240 power meter
  • Second ECM 1240 power meter
  • Brand One Meter serial adapter
  • HAI thermostats (2 on one line)
  • Rfxcom 433.92Mhz (433.92Mhz RF gateway for Oregon Scientific Weather Sensors)
  • This is what you do with udev:

    gargamel:~# cat /etc/udev/rules.d/50-local-usb-serial.rules 
    # /etc/udev/rules.d/50-local-usb-serial.rules
    

    # http://www.reactivated.net/writing_udev_rules.html#udevinfo # was udevinfo -a -p /class/tty/ttyUSB0 # now udevadm info --attribute-walk -p /class/tty/ttyUSB0

    SUBSYSTEMS=="usb", ATTRS{product}=="FT232R USB UART", ATTRS{serial}=="A7006gvN", SYMLINK+="usb-serial-ftdi-8_1" SUBSYSTEMS=="usb", ATTRS{product}=="FT232R USB UART", ATTRS{serial}=="A7006gvO", SYMLINK+="usb-serial-ftdi-8_2" SUBSYSTEMS=="usb", ATTRS{product}=="FT232R USB UART", ATTRS{serial}=="A7006gvP", SYMLINK+="usb-serial-ftdi-8_3" SUBSYSTEMS=="usb", ATTRS{product}=="FT232R USB UART", ATTRS{serial}=="A7006gvR", SYMLINK+="usb-serial-ftdi-8_4" SUBSYSTEMS=="usb", ATTRS{product}=="FT232R USB UART", ATTRS{serial}=="A7006gvQ", SYMLINK+="usb-serial-ftdi-8_5" SUBSYSTEMS=="usb", ATTRS{product}=="FT232R USB UART", ATTRS{serial}=="A7006gvS", SYMLINK+="usb-serial-ftdi-8_6" SUBSYSTEMS=="usb", ATTRS{product}=="FT232R USB UART", ATTRS{serial}=="A7006gvT", SYMLINK+="usb-serial-ftdi-8_7" SUBSYSTEMS=="usb", ATTRS{product}=="FT232R USB UART", ATTRS{serial}=="A7006gvU", SYMLINK+="usb-serial-ftdi-8_8"

    SUBSYSTEMS=="usb", ATTRS{product}=="FT232R USB UART", ATTRS{serial}=="A800dMFk", SYMLINK+="rfxcom"

    SUBSYSTEMS=="usb", ATTRS{product}=="USB-Serial Controller", ATTRS{manufacturer}=="Prolific Technology Inc.", SYMLINK+="usb-serial-pl2303"

    After making a change udevadm trigger will update symlinks.


    More pages: March 2023 July 2014 December 2013 November 2013 January 2013 November 2011 August 2011 July 2011 March 2011 August 2010 June 2010 March 2010 February 2010 December 2009 November 2009 August 2009 May 2009 March 2009 March 2004

    Contact Email