                                  lremote-0.3

 This program is free software; you can redistribute it and/or modify
 it under the ; (at your option) any later version.
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

 Copyright Jan Panteltje 2009-always


                 NOTE: Command line and defaults have changed for for this version!


Description:
This program, in combination with a 443.92 MHz transmitter and receiver module, can learn and send commands
as for example transmitted by the 'klik aan klik uit' Dutch home appliance wireless control system.
That system uses 433.92 MHz and sends a digital encoded sequence to control lights and other appliances.
By using this program, the PC can learn the remote control commands, and then you play these from the PC
as if they came from the real original remote control.
When used in combination with crontab you can time all those events, when accessing the PC
over the internet you can control your house appliances from all over the world.


NOTE:
 lremote must be used as root (direct I/O to par port).


To install:
make
make install


To configure:
mkdir -p /root/.lremote/commands


For help type:
lremote


To learn a command:
Connect 433.92 MHz receiver digital output to parport bit 3, 0x379, pin 15 (ERROR)

type:
nice -n -19 lremote -l
press 'aan' button command on klik_aan_klik_uit remote.

press ESCAPE
when asked, press ESCAPE again, save file as 'on'.

Do the same for the 'uit' button, save as 'off'.


To send a command:
Connect 433.92 MHz transmitter to parport bit 7 0x378 =pin 9 (d7)
type:
nice -n -19 lremote -p -s on

Or, connect the the transmitter via a diode to the RTS pin of the serial port, so the transmitter can only see a positive voltage, and type:
nice -n -19 lremote -s off
light should go on

WARNING: Make sure the polarity of the diode is correct, RTS will go negative when 'off', and I am not sure negative voltages will not damage the transmitter module.

Type
nice -n -19 lremote -s off
light should go off.


The 'nice -n 19' makes lremote running with the highest priority, so the software loops are less susceptible to interrupts by other programs.
Best is to make a loop, so the command is send a couple of times, as the tasks switch may interrupt the loop,
one of the times it will be right.
If it fails try re-recording and repeat.
Was first time right here.
Also perhaps the delays need to be changed for a faster or slower PC, this one is a 950 MHz Duron.
The example script 'mlamp' is included here.

This program can also be used to learn and replay IR remote commands, using a photo transistor and IR LED.

The commands are stored in /root/.lremote/commands/
You can look at those with the hex editor:
hexedit off.irc

It seems possible to directly supply the 433.92 MHz transmitter module from a par port pin.
For this I am using d2, pin 4 in this version, and switch both supply and modulation input at the same time.
This may not work for all parports though, I measured 10 mA current draw at 5 V for this module.
My parport pulls it up to about 3.3 V. 
I am now using the serial port, as it simply has a lot more power.


Typing:
lremote -p -z
will put pin 4 of the parport to zero, use this in an init script, so the transmitter is normally off,
and does not interfere with the normal remote or other things.
lremote -z 
will set RTS on the serial port to negative (off).
'lremote -z command_name' and 'lremote -l' will also exit with the transmitter off.


Example of using the mlamp script:
Here is an example of a crontab entry that switches on a light at 14:40 and switches it off at 14:42
40	14	*	*	*		/usr/local/sbin/mlamp on  1>/dev/zero 2>/dev/zero &
42	14	*	*	*		/usr/local/sbin/mlamp off 1>/dev/zero 2>/dev/zero &

Type:
crontab -l > /root/crtab
then add the above lines to crtab at the end, and then type:
crontab /root/crtab
to make it permanent.



The transmitter / receiver set I am using is the one from www.conrad.nl
bestelnr    130428    434 MHZ ZENDER/ONTVANGER SET    15.99 Euro

