SMJ PT2262 remote sockets

Pop your questions regarding Home automation Domotica hardware here.....
Post Reply
Stevexyz
Member
Member
Posts: 87
Joined: Fri Dec 14, 2007 1:45 am
Location: United Kingdom
Contact:

SMJ PT2262 remote sockets

Post by Stevexyz »

I have a few devices which are powered by an APC UPS which stops X10 signals and I wanted to be able to turn them on and off. Lots of resellers offer remote switched sockets from SMJ in the UK (though I suspect they are just rebadged). The remote you get can control three at a time, but since you can change a setting from A-D you can have 12 within range.

They are 433MHz AM and use a variant of the Princeton PT2262 chip for encoding. The PT2262 has 12 three-state inputs, each of which is either tied to Vcc, to 0v or just left floating. The patterns for encoding turned out to be very straightforward, [A-D] and [1-3] affect one single pin each and on or off is A11. The other pins are just left floating.

I have them working very nicely now with my very simple on-off USB RF transmitter. If anyone's interested then drop me a note and I'll send you the C code.

Cheers, Steve
Darrenw
Starting Member
Starting Member
Posts: 7
Joined: Thu Nov 12, 2009 4:21 pm
Location: United Kingdom

SMJ PT2262 remote sockets

Post by Darrenw »

Hi Steve

I am brand new to the whole home automation thing but would love to learn about it. At the moment I don't know a thing. Firstly I would like to do basic things like switching lights on off automatically possibly using the computer to automate things. I have half a dozen of the SMJ plugs from Maplins and was wondering if anything can be done with them, if so what? Whenever looking at the whole HA thing X10 seems to be the thing everyone is using but unless I am missing something the seem really expensive and limited to what we can buy in the UK. I have heard mention of some Home easy stuff from B&Q which looks good and cheap and apparently you can interface it to your PC by using an RFXCOM sender/reciever but these again cost a fortune. Some people say they have made a pc interface using some cheap parts but thats a bit too complex for me.
My apologies for whittering on. I suppose my main questions are: where is the best place to start, what to buy and any other advice? Once I get into it I would like to do everything possible from security to home entertainment.
P.s can I do anything with the SMJ plugs?

Darren
Stevexyz
Member
Member
Posts: 87
Joined: Fri Dec 14, 2007 1:45 am
Location: United Kingdom
Contact:

SMJ PT2262 remote sockets

Post by Stevexyz »

X10 is probably the cheapest to start with, but sometimes it's not very reliable. Here's a good UK supplier: http://www.simplyautomate.co.uk/ You could get a CM12 module (which comes with basic software for Windows) and a light or appliance module then experiment. I'm sure other people will have other suggestions.

Meanwhile, yes you can do something with the SMJ switches, but you will need to be able to solder. You can either emulate the PT2262 in software or you can use a real PT2262 chip (I can send you one) and control its inputs from (say) the parallel port to turn the SMJ switches on and off via a little RF transmitter.

Cheers, Steve
Darrenw
Starting Member
Starting Member
Posts: 7
Joined: Thu Nov 12, 2009 4:21 pm
Location: United Kingdom

SMJ PT2262 remote sockets

Post by Darrenw »

Thanks for the prompt reply. As I say at the moment I know absolutely nothing I am hoping to pick things up as I go along. Without sounding too ignorant what is a PT2262? And how do I do this? It sounds like a good way to start off but any chance of going into detail?

Thanks again!
Stevexyz
Member
Member
Posts: 87
Joined: Fri Dec 14, 2007 1:45 am
Location: United Kingdom
Contact:

SMJ PT2262 remote sockets

Post by Stevexyz »

The PT2262 modulates the RF into a serial code indicating which button you pressed on the transmitter and whether you want it on or off. Inside the SMJ plugs, there's a PT2272 which decodes the RF. If the decoded pattern matches the setting on the plug then the device is turned on or off.

So all we do is use an RF transmitter attached to a computer which pretends to be a PT2262 encoder just like in the remote control. It's effectively the same as getting the computer to press one of the buttons.
Cheers, Steve
Darrenw
Starting Member
Starting Member
Posts: 7
Joined: Thu Nov 12, 2009 4:21 pm
Location: United Kingdom

SMJ PT2262 remote sockets

Post by Darrenw »

Sounds good do you have a wiring diagram and details of how to operate it through the pc? Also what parts do I need to buy and can I get them from the likes of maplins? I have 3 or 4 spare remotes can they act as the transmitter?
Stevexyz
Member
Member
Posts: 87
Joined: Fri Dec 14, 2007 1:45 am
Location: United Kingdom
Contact:

SMJ PT2262 remote sockets

Post by Stevexyz »

Yes they could, but that might be a little bit untidy. I can do a wiring diagram for you with some C code.
One issue though - are you using Windows? My stuff works for Linux, not Windows.

Cheers, Steve
Darrenw
Starting Member
Starting Member
Posts: 7
Joined: Thu Nov 12, 2009 4:21 pm
Location: United Kingdom

SMJ PT2262 remote sockets

Post by Darrenw »

My day to day pc is on windows but I do have an eee 701 pc running linux would it work on that?
Stevexyz
Member
Member
Posts: 87
Joined: Fri Dec 14, 2007 1:45 am
Location: United Kingdom
Contact:

SMJ PT2262 remote sockets

Post by Stevexyz »

Yes, that will be fine. Give me a couple of days and I'll see what I've got here.

Cheers, Steve
Stevexyz
Member
Member
Posts: 87
Joined: Fri Dec 14, 2007 1:45 am
Location: United Kingdom
Contact:

SMJ PT2262 remote sockets

Post by Stevexyz »

Hi there,

RFXCOM http://www.rfxcom.com/ make a USB transmitter which can send many different RF protocols. I don't know if it can accept a raw binary on off sequence but it might be worth checking first. Meanwhile...

Hardware:
A FTDI http://www.ftdichip.com/ UM245R USB->parallel FIFO (perhaps from Farnell) modulates a 433MHz AM transmitter (perhaps from RF solutions http://www.rfsolutions.co.uk/acatalog/4 ... dules.html)
Both are powered from the USB bus. I have extra circuitry to receive too, but that is no longer in use as the RFXCOM receiver does this job far better.

Software:
The pattern you want to send (so far I send X10, X10 Ninja and PT2262 codes) is first built up in RAM then transferred to the UM245R device running in bitbang mode, where the byte you send appears on the eight outputs. This does use quite a bit of RAM temporarily, but it frees the user application from having to perform critical timings. You will need to be able to compile C code (gcc is fine) and link it in with libusb http://sourceforge.net/projects/libusb/ ... ibusb-1.0/ I'm not using libftdi as it was in flux back then, but it would probably be a good idea to do so now.

Code: Select all

/*
  Princeton PT2262
  A00    1      18 VCC          A0-A11 may be '1', '0' or 'f'
  A01    2      17 DOUT         - 0 high  4, low 12, high  4, low 12
  A02    3      16 OSC2         - 1 high 12, low  4, high 12, low  4
  A03    4      15 OSC1         - f high  4, low 12, high 12, low  4
  A04    5      14 /TE          - sync high for 4 then low for (128-4)
  A05    6      13 A11/D0       - code word is 12 bits then sync, A0 out first
  A06/D5 7      12 A10/D1       - code frame is 4 x code words
  A07/D4 8      11 A09/D2
  Vss    9      10 A08/D3

  Data is presented: 76 54 32 10|76  54  32  10|76  54  32  10|76  54  32  10
                     xx xx xx xx|A0  A1  A2  A3|A4  A5  A6  A7|A8  A9 A10 A11
  For each bit pair: 00 - 0 01 - 1
                     10 - f 11 - invalid
   <----- pulse cycle 0 (16U) -----> <----- pulse cycle 1 (16U) -------->
*/

static int bits[3][8] =
{
  {FTDI_BBTX, 0,         0,         0, FTDI_BBTX, 0,         0,         0},
  {FTDI_BBTX, FTDI_BBTX, FTDI_BBTX, 0, FTDI_BBTX, FTDI_BBTX, FTDI_BBTX, 0},
  {FTDI_BBTX, 0,         0,         0, FTDI_BBTX, FTDI_BBTX, FTDI_BBTX, 0}
};

enum
{
  PT2262_4U                                     = 6500 / RF_UDELAY,
  PT2262_FRAME                                  = 4,
  PT2262_REPEAT                                 = 1,
  PT2262_SYNC                                   = 32 * PT2262_4U
};

/* h is a handle to the FTDI device */
static je_t pt2262rf_write(void *h, const uint8_t *s, unsigned l, unsigned *c)
{
  int aa, n;
  unsigned i, j, k, m;
  uint32_t a;
  uint8_t b[FTDI_BBBUFF];
  je_t r;

  r = 0;
  for ( i = 0; !r && i < PT2262_REPEAT; i++ )
  {
    a = 0;
    for ( j = 0; !r && j < PT2262_FRAME; j++ )
    {
      for ( k = 1; !r && k < l; k++ )
      {
        for ( n = 6; !r && n >= 0; n -= 2)
        {
          for ( m = 0; !r && m < 8; m++ )
          {
            if ( (aa = ((s[k] >> n) & 0x03)) < 3 )
            {
              memset(b + a, bits[aa][m], PT2262_4U);
              a += PT2262_4U;
            }
            else
              r = E_ARGUMENTS;
          }
        }
      }
      memset(b + a, FTDI_BBTX, PT2262_4U);
      a += PT2262_4U;
      memset(b + a, 0, PT2262_SYNC - PT2262_4U);
      a += (PT2262_SYNC - PT2262_4U);
    }
    if ( !r )
      r = writeftdi(h, b, a);
  }
  if ( c )
    *c = l;
  return(r);
}
Hope this is some use!

Cheers, Steve
Darrenw
Starting Member
Starting Member
Posts: 7
Joined: Thu Nov 12, 2009 4:21 pm
Location: United Kingdom

SMJ PT2262 remote sockets

Post by Darrenw »

thanks Steve! just looking at this it doesn't make a lot of sense to me at the moment but I'm sure with a bit of googling this may make things clearer. Would the same thing work with the HOMEEASY things from B&Q?
bartzy
Starting Member
Starting Member
Posts: 1
Joined: Sun Feb 07, 2010 3:47 am

Re: SMJ PT2262 remote sockets

Post by bartzy »

Please can anyone advise me where to buy PT2262, as they dont seem to be on the lists from the usual places I use, and I tried a few different internet searches but was still none the wiser. (my interest is i have a remote system that alredy uses PT2262 / pt2272 but I want to add some additional custom controllers).
Thanks
steve2xyz
Starting Member
Starting Member
Posts: 34
Joined: Mon Feb 08, 2010 8:46 am

Re: SMJ PT2262 remote sockets

Post by steve2xyz »

I think I got my encoders from http://www.mark5.co.uk/ but it was some time ago.

I have a couple spare if you want them.

Cheers, Steve
Post Reply

Return to “Questions & Discussions Forum”