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