📜 ⬆️ ⬇️

Lamp control via the Internet

image
Those interested in the details of the manufacture of the device in the picture - please under the cat.

For the sake of interest, I tried to connect the lamp to a computer and “steer” it programmatically. Since I did not want to bother much about this back in 2007, I decided to connect the whole thing through an old lpt. The necessary parts at that moment quickly get it seemed possible only for him.

So, the unit consists of hardware and software parts.

Part 1. Hardware
')
We will need the following details:
1. table lamp 220 V (in the main role);
image

2. lpt-extension cable (in my case it was not possible to quickly find it and I had to assemble myself from two lpt-forks and a piece of wire);
image

3. base of the board;
4. angled lpt-connector on the board;
5. relay 12 VDC;
6. 4.7 K resistor;
7. NPN KT3117A;
8. diode IN4007;
9. soldering iron;
10. a lot of wiring;
11. Power splitter in PC

Analogs: http://trimirys.narod.ru/analogs.txt

The scheme of the device is as simple as possible to assemble:
image
Gray rectangle on top - relay.
If we feed a pin D unit, voltage will appear on it and eventually the relay will switch, turning on the lamp.

According to the above diagram, we solder something like this:
image

image

We solder the board into the open circuit of our lamp; connect via lpt-extension cable to the corresponding port of the PC; connect to the PC power supply via power splitter 11; Well, the lamp itself is 220 V.

Part two. Software

To revive our lamp, we will write a program in Delphi (the first thing that came to hand is not difficult to rewrite to C, there are literally 3 lines of code in the program)

Source: http://trimirys.narod.ru/lamp_1.0.rar (this program can only turn the lamp on and off by pressing the button).

image

Having a little modernized the program, we get the second source: http://trimirys.narod.ru/lamp_2.0.rar (this program keeps track of the file that can be changed by the php script lamp2.php on the local web server).

image

Now we can turn on our favorite lamp from anywhere in the world where there is Internet.

image

Source: https://habr.com/ru/post/92655/


All Articles