Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'kscholte'@'localhost' (using password: YES) in /data/webroot/hosting/kscholte/linuxguru.be/httpdocs/php/opendb.php on line 3

Warning: mysql_select_db() [function.mysql-select-db]: Access denied for user 'www-data'@'localhost' (using password: NO) in /data/webroot/hosting/kscholte/linuxguru.be/httpdocs/php/opendb.php on line 4

Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in /data/webroot/hosting/kscholte/linuxguru.be/httpdocs/php/opendb.php on line 4

Error encountered... Please try again.

Project LinuxGURU - An Open Source Home Automation System
Tutorials
  Lights
  Switches
  Temp Meters
  Lights Meters
  Infra Red
  Voice Feedback
  Light Dimmer
  Alarm
  Motion Detect
  LCD's


Forum
  Software
  Hardware
  Circuits
  Components
  Ideas
  General


Software
  Light on/off/sw
  Wake-up
  Sleep-mode
  Alarm
  Wall Switch
  LIRC examples
  WinAmp Control


Personal
  Preferences
  Inbox
  Add diary event
  Add news event


Thanks to i-Vision
for the free hosting
SiteMeter


Warning: include() [function.include]: URL file-access is disabled in the server configuration in /data/webroot/hosting/kscholte/linuxguru.be/httpdocs/index.php on line 31

Warning: include(http://www.linuxguru.be/banners/banner.php) [function.include]: failed to open stream: no suitable wrapper could be found in /data/webroot/hosting/kscholte/linuxguru.be/httpdocs/index.php on line 31

Warning: include() [function.include]: Failed opening 'http://www.linuxguru.be/banners/banner.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /data/webroot/hosting/kscholte/linuxguru.be/httpdocs/index.php on line 31

 

Controlling Lights

Intro

Controlling a light is probably the most known action a domotica system can do. And it makes life easier, so here's a tutor that tells how to do it.

This tutor assumes that you don't need a normal light-switch anymore, so you'd better take a look at the switches tutor if you want to control the light with the old switch.


A normal relay.

Add-ons

Take a look at the following tutors that can extend the functionalities:


Parts

  • Relay (normal elec.mech.) or Solid State Relay
  • Soldering Iron

    When using normal electromechanical relays:
  • 2x 1k ohm resistors
  • NPN Transistor
  • Diode - 1N4004

Schema & Hardware

Parallel port with data, control and status pins marked:

Light Schematics

The circuit:

Light Schematics

When using a Solid State Relay, you can connect it directly to the parallel port (GND and one of the data pins)


Software

Take a look in the Software section for the program "position".

You will probably need to adjust the source code to match the adress of your ports.

The program works like this, you have 8 outputs, and 9 is all of them... with the s parameter you set a pin and with the c you clear it, with x you switch it. like this:

position c1 s3 x5

This will set pin 1 off, pin 3 on and switch pin 5 (actually these are pins 2, 4 and 6 on the parallel port) at the same time.

Now there are more parameters, like P, wich will pause a given number of seconds and p wich will work the same but in microseconds, eg:

position s1 P3 c5 p500000 s5

This will set pin 1, wait 3 seconds, clear pin 5, wait 0.5 seconds and then sets pin 5.

And then there is the loop parameter L wich loops everything that follows for a given numer of times or forever if the number is 0. eg.

position L0 x1 p50000

If this is connected to your lighting this will give you a headache, it just keeps switching it on and off every 50000µs


Some technical information

The NPN transistor and the external power supply are used to have enough power to drive the relay. The parallel port itself can be used to drive one or two relays, but when using more you'll be forced to use this method. When using SSR though, there's enough power so you don't need the external supply.

If you like to control the light with your old light-switch, you'll need to buy a relay with a 3-way switch, and if needed replace your current light-switch (1-way to 3-way or 3-way to 4-way)

Light Schematics

We discourage this circuit because the computer doens't know when the light is on or off without a sensor or something. You only can switch the light using the computer, but you aren't sure if you've turned on or off the light.


Login
Login:
Pass:
New user   Lost password


News

Warning: mysql_query() [function.mysql-query]: Access denied for user 'www-data'@'localhost' (using password: NO) in /data/webroot/hosting/kscholte/linuxguru.be/httpdocs/inc/news_menu.php on line 11

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /data/webroot/hosting/kscholte/linuxguru.be/httpdocs/inc/news_menu.php on line 11

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /data/webroot/hosting/kscholte/linuxguru.be/httpdocs/inc/news_menu.php on line 14




Diary

Warning: mysql_query() [function.mysql-query]: Access denied for user 'www-data'@'localhost' (using password: NO) in /data/webroot/hosting/kscholte/linuxguru.be/httpdocs/inc/diary_menu.php on line 10

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /data/webroot/hosting/kscholte/linuxguru.be/httpdocs/inc/diary_menu.php on line 10

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /data/webroot/hosting/kscholte/linuxguru.be/httpdocs/inc/diary_menu.php on line 13