mirror of https://github.com/tLDP/LDP
updated
This commit is contained in:
parent
5448d23325
commit
37f89c5bf8
|
@ -1,413 +1,447 @@
|
|||
<!DOCTYPE LINUXDOC SYSTEM>
|
||||
|
||||
<article>
|
||||
<title>COFFEE-HOWTO
|
||||
<author>Georgatos Photis, <<htmlurl
|
||||
url="mailto:gef@ceid.upatras.gr?subject=COFFEE-HOWTO"
|
||||
name="gef@ceid.upatras.gr">> &nl;
|
||||
Annie Pinder, <<htmlurl
|
||||
url="mailto:ajp@leguin.org.uk"
|
||||
name="ajp@leguin.org.uk">>
|
||||
<date>v0.6, 28 November 2000
|
||||
|
||||
<abstract>
|
||||
One of the most memorable comments about software I have ever heard,
|
||||
is whether this or that can make coffee.
|
||||
Linux DOES make coffee. And it tastes good, as well!
|
||||
</abstract>
|
||||
|
||||
<!-- Table of contents -->
|
||||
<toc>
|
||||
|
||||
<p>
|
||||
For a long time, humanity was wondering how could a computer
|
||||
make coffee...
|
||||
People need coffee wake up and stay awake
|
||||
in front of the computer for a long time.
|
||||
Everyone knows that coding is better at night...
|
||||
|
||||
<p>
|
||||
The main problem is how to manage the coffee machine with
|
||||
the computer, so that it will be controlled by software.
|
||||
This generally means an ON/OFF switch implemented
|
||||
as a circuit which controls the coffee-machine's power supply.
|
||||
|
||||
<sect>Menu
|
||||
|
||||
<sect1>French
|
||||
<p>Popular coffee among programmers because doesn't need a lot of care;
|
||||
like commercial software.
|
||||
Its exciting taste has inspired thousands of programmers
|
||||
in writing incredible software, written in the very first ours of a day.
|
||||
Windows for example was written at 5:00 o'clock in the morning,
|
||||
Due to coffee! A result is guaranteed.
|
||||
|
||||
<sect1>Nescafe
|
||||
<p> Nescafe is a rather strong coffee, made by pouring hot water
|
||||
in a mixture of coffee, sugar and some water.
|
||||
You usually take 1 spoon of coffee and 1 spoon of sugar with just
|
||||
a bit of water, to mix it. In the meantime you should have the water
|
||||
boiling. As soon as the water is hot enough, you mix them all together
|
||||
and preferably add milk.
|
||||
Although you can use something simpler than a coffee-machine to
|
||||
boil the water, I have seen this done many times...
|
||||
|
||||
<sect1>Frappe
|
||||
<p>A popular variation of the above mentioned coffee.
|
||||
Actually, it doesn't need a coffee-machine, rather a refrigerator for
|
||||
cold water and ice-cubes.
|
||||
|
||||
<sect1>Freddo
|
||||
<p>This is a difficult one, read coffee-faq (see references)
|
||||
|
||||
<sect1>Cappuccino
|
||||
(To be added)
|
||||
|
||||
<sect1>Espresso
|
||||
(To be added)
|
||||
|
||||
<sect>Electronic circuit
|
||||
<p>
|
||||
A general diagram is like this:
|
||||
|
||||
<tscreen><verb>
|
||||
--------- 0-5V --------- ~220V ----------------
|
||||
| PC |===>===|Circuit|========|Coffee-Machine|
|
||||
--------- --------- ----------------
|
||||
</verb></tscreen>
|
||||
|
||||
<p>The concept is that we take a controling voltage from the computer,
|
||||
which drives an electrically isolated circuit with a Relay or Triac.
|
||||
|
||||
<p>You must choose a Relay circuit, if you have a coffee-machine
|
||||
greater than 200W. You can use a triac-based one if your coffee machine isn't high power.
|
||||
|
||||
All circuits presented are tested, but the results are
|
||||
YOUR RESPONSIBILITY.
|
||||
If you have no experience with electronics you should NOT try
|
||||
these, otherwise you may make a mistake...
|
||||
|
||||
<p>You should be very careful while experimenting with 220V, and using an appropriate fuse is advisable.
|
||||
|
||||
<sect1>Driving voltage 0-5V from the computer
|
||||
<p>
|
||||
Here is a simple example to get a voltage 0-5V from the parallel
|
||||
port of the computer.
|
||||
|
||||
<tscreen><verb>
|
||||
Back View ----- Pin 10 - ACK
|
||||
Male DB-25 | | Pin 9 - D7
|
||||
Connector | | Pin 2 - D0
|
||||
v v v Pin 1 -
|
||||
~Strobe
|
||||
____________________________________________________________
|
||||
/ \
|
||||
\ 13 12 11 10 9 8 7 6 5 4 3 2 1 /
|
||||
\ /
|
||||
\ 25 24 23 22 21 20 19 18 17 16 15 14 /
|
||||
\______________________________________________________/
|
||||
|
||||
</verb></tscreen>
|
||||
|
||||
<p>Pin 1 is Strobe (inverse logic)
|
||||
<p>Pins 2-9 is DATA BUS's signals, exactly what was written to the
|
||||
parallel port's latches with an OUTB command.
|
||||
<p>Pin 10 is the acknowledge signal (ACK), controlled by you, so that you can
|
||||
produce an interrupt to the CPU.
|
||||
<p>Pins 18-25 are short-circuited and this is the ground (GND).
|
||||
|
||||
<p>In detail:
|
||||
<tscreen><verb>
|
||||
<= in DB25 Cent Name of Reg
|
||||
=> out pin pin Signal Bit Function Notes
|
||||
------ ---- ---- -------- --- -----------------------------
|
||||
=> 1 1 -Strobe C0- Set Low pulse >0.5 us to send
|
||||
=> 2 2 Data 0 D0 Set to least significant data
|
||||
=> 3 3 Data 1 D1 ...
|
||||
=> 4 4 Data 2 D2 ...
|
||||
=> 5 5 Data 3 D3 ...
|
||||
=> 6 6 Data 4 D4 ...
|
||||
=> 7 7 Data 5 D5 ...
|
||||
=> 8 8 Data 6 D6 ...
|
||||
=> 9 9 Data 7 D7 Set to most significant data
|
||||
<= 10 10 -Ack S6+ IRQ Low Pulse ~ 5 uS, after accept
|
||||
<= 11 11 +Busy S7- High for Busy/Offline/Error
|
||||
<= 12 12 +PaperEnd S5+ High for out of paper
|
||||
<= 13 13 +SelectIn S4+ High for printer selected
|
||||
=> 14 14 -AutoFd C1- Set Low to autofeed one line
|
||||
<= 15 32 -Error S3+ Low for Error/Offline/PaperEnd
|
||||
=> 16 31 -Init C2+ Set Low pulse > 50uS to init
|
||||
=> 17 36 -Select C3- Set Low to select printer
|
||||
== 18-25 19-30, Ground
|
||||
</verb></tscreen>
|
||||
|
||||
<sect1>Controlling with a Relay
|
||||
<p>
|
||||
|
||||
The simplest circuit that one can build is:
|
||||
<tscreen><verb>
|
||||
|
||||
Vcc
|
||||
|
|
||||
+------+
|
||||
| __|__
|
||||
Relay /^\ Diode 1N4002
|
||||
Coil /---\
|
||||
| |
|
||||
+------+
|
||||
|
|
||||
| /
|
||||
4.7K B |/ C
|
||||
parallel port >-\/\/\/\/---| NPN Transistor: BC547A or 2N2222A
|
||||
data pi |\ E
|
||||
| V
|
||||
|
|
||||
parallel port >--------------+
|
||||
ground pin |
|
||||
Ground
|
||||
</verb></tscreen>
|
||||
Connect Vcc with the same voltage as the relay type (usually 5 or 12V).
|
||||
Obviously, the relay's specifications should be scaled for your
|
||||
coffee-machine.
|
||||
<P>
|
||||
Barmen, tend to put the relay AFTER the transistor, at the
|
||||
emitter (E) pin instead of the collector (C) pin. This is bad practice
|
||||
because it biases the transistor badly, and may result in bad coffee :-).
|
||||
Diode 1N4002 is useful to protect the transistor from the relay's currents.
|
||||
If you don't use it the transistor will become dark and smelly...
|
||||
|
||||
<sect1>Controlling with TRIAC #1
|
||||
<p>
|
||||
If you only want a simple circuit, you can use Motorola's
|
||||
triac driver MOC301[012], together with a general purpose TRIAC like SC141D.
|
||||
This method has the advantage that you don't need an extra power supply.
|
||||
|
||||
<p>For non-inductive loads, this is the circuitry:
|
||||
<tscreen><verb>
|
||||
|
||||
270 1 +-------+ 6 180
|
||||
+5v -VAVAVA-----+ +----VAVAVA-----+-------------- Line Hot
|
||||
2 | MOC | |
|
||||
TTL in ---------+ 3012 +nc VA SC141D
|
||||
| | 4 / |
|
||||
nc+ +------------/ |
|
||||
+-------+ +----\/\/\/---- Line Neutral
|
||||
LOAD
|
||||
</verb></tscreen>
|
||||
<p>If you are going to work with 220V, try to obtain a 3021.
|
||||
Inductive loads should be used in conjuction with bypass capacitors,
|
||||
see <em>Motorola Application Note AN-780</em>.
|
||||
Coffee-machines are mainly resistive loads and not inductive (like a motor),
|
||||
but who knows what yours is!
|
||||
|
||||
<sect1>Controlling with TRIAC #2
|
||||
<p>
|
||||
|
||||
<tscreen><verb>
|
||||
+5VDC
|
||||
| 180 180 2.2k
|
||||
+---/\/\/\----+-----+ +----/\/\/-+--/\/\/\---+-------> 120V
|
||||
| 1| |6 | | Hot
|
||||
| +=====+ | | MT1
|
||||
| | MC | TRIAC | +-+
|
||||
| | 3032| Driver | G | | TRIAC
|
||||
| +=====+ | /| |
|
||||
\ 2| |4 | / +-+
|
||||
2N3904 |----+ | | | | MT2
|
||||
/ | +--------- | -------+ |
|
||||
V \ | | |
|
||||
| / | \ |
|
||||
| \ 43 .01u --- 10k / |
|
||||
| / 500V --- \ |
|
||||
| | | / |
|
||||
+------+ | | | Neutral
|
||||
| +--------+--+---o o--> 120V
|
||||
/ load
|
||||
>-/\/\--| 2N3904
|
||||
\
|
||||
V
|
||||
|
|
||||
---
|
||||
///
|
||||
You should change resistors accordingly for 220V.
|
||||
</verb></tscreen>
|
||||
<p>Circuit description:
|
||||
<P>The MC3032 is an optoisolator TRIAC driver.
|
||||
The 180-ohm resistor sets the current for the LED emitter in the optoisolator.
|
||||
Change the value of this resistor - if necessary - to get a reasonable current
|
||||
(e.g., 15 mA).
|
||||
<P>
|
||||
Note that you cannot test this circuit without a load.
|
||||
The TRIAC will not switch unless connected to an AC
|
||||
voltage source, so you can't test it for simple switching without applying AC
|
||||
and a load. Note the 500V rating on the .01 cap.
|
||||
|
||||
<sect>Software
|
||||
<p>
|
||||
|
||||
<sect1>Software
|
||||
<p>
|
||||
You will have to build an executable that will work like this:
|
||||
<itemize>
|
||||
<item>Get permission to use I/O address space, by calling kernel, with
|
||||
the command <bf>ioperm</bf>: eg <em>ioperm( BASE, range ,1); </em>
|
||||
<item>Perform an out request instruction, to set the 0-5V voltage to the
|
||||
parallel port, eg <em>outb( 1, BASE );</em>
|
||||
<item>Wait enough time so the coffee is made. It would be nice
|
||||
if that time is read by looking at the command line.
|
||||
<item>Then it will turn off the coffee-machine: outb( 0 , BASE );
|
||||
<item>Before ending it should give back the parallel port with a <em>ioperm( BASE, range, 0);</em>
|
||||
</itemize>
|
||||
Change BASE = 0x3bc for /dev/lp0, 0x378 for /dev/lp1, and 0x278
|
||||
for /dev/lp2, range=8.
|
||||
|
||||
<p>It would be useful if you had that program setuid,
|
||||
so that everybody can drink coffee!
|
||||
|
||||
<sect1>Device driver
|
||||
<p>
|
||||
|
||||
Just read <htmlurl
|
||||
url="http://www.redhat.com:8080/HyperNews/get/khg.html"
|
||||
name="kernel hacker's guide">,
|
||||
implement a device driver (it could even be user space I think).
|
||||
Please compile it as a module, so that we won't need a
|
||||
kernel compile in every update.
|
||||
Then write:
|
||||
|
||||
<verb>
|
||||
echo cappuccino >/dev/coffee
|
||||
</verb>
|
||||
|
||||
And you will have a hot cup of coffee in minutes!
|
||||
Remember to give the right permission to /dev/coffee,
|
||||
depending on whether you want only root making coffee or not.
|
||||
|
||||
<p>The advantage of this method is that it supports feedback
|
||||
from the coffee-machine by using the ACK of parallel port,
|
||||
so that smart coffee-machines could produce an interrupt.
|
||||
|
||||
<p>Do it as homework.
|
||||
|
||||
<sect1>Connecting with the Internet
|
||||
<p>
|
||||
If you have implemented the C program (see above),
|
||||
you just have to write a simple CGI script to turn ON and OFF
|
||||
the coffee-machine.
|
||||
You should write some nice webpages, explaining how to make coffee,
|
||||
and put them on an <bf>apache</bf> web server...
|
||||
|
||||
<sect>Overdose symptoms
|
||||
<p>
|
||||
<itemize>
|
||||
<item>excitement
|
||||
<item>nervousness
|
||||
<item>insomnia
|
||||
<item>tachycardia or cardiac arhythmia
|
||||
<item>gastrointestinal disturbance
|
||||
<item>restlessness
|
||||
</itemize>
|
||||
|
||||
<sect>Expansions
|
||||
<p>These are our ideas:
|
||||
<itemize>
|
||||
<item>All hardware and software described here, can be expanded so that
|
||||
it will support toast, beaf, applepies, etc.
|
||||
<item>Cluster with 8 coffee-machines. This will let you have coffee
|
||||
even when the one gets off. Of course there will be a perfomance hit.
|
||||
<item>Parallel vector coffee-machine will be a future release.
|
||||
<item>If you want the maximum automation you'll need more circuits and
|
||||
sensors, so that you can control water flow, temperature, coffee
|
||||
quantity etc.
|
||||
<item>In the near future we will implement SNMP features.
|
||||
<item>Serial coffee-machine at 115Kbps.
|
||||
</itemize>
|
||||
|
||||
<sect>References
|
||||
<p>
|
||||
<itemize>
|
||||
<item><htmlurl
|
||||
url="http://daisy.uwaterloo.ca/~alopez-o/caffaq.html"
|
||||
name="http://daisy.uwaterloo.ca/~alopez-o/caffaq.html">
|
||||
This is Internet's <bf>Coffee-FAQ</bf>
|
||||
<item><htmlurl
|
||||
url="http://lonestar.texas.net/~andrew/f_pc_.htm"
|
||||
name="http://lonestar.texas.net/~andrew/f_pc_.htm">
|
||||
A lot of circuits in ASCII. Some of them are for parallel port.
|
||||
<item><htmlurl
|
||||
url="http://shell.rmi.net/~hisys/parport.html"
|
||||
name="http://shell.rmi.net/~hisys/parport.html">
|
||||
Whatever you wanted to learn about a parallel port and didn't dare to ask.
|
||||
<item><htmlurl
|
||||
url="http://sunsite.unc.edu/LDP/HOWTO/mini/IO-Port-Programming"
|
||||
name="http://sunsite.unc.edu/LDP/HOWTO/mini/IO-Port-Programming">
|
||||
Programming of I/O ports under popular operating system Linux.
|
||||
<item><htmlurl
|
||||
url="http://www.redhat.com:8080/HyperNews/get/khg.html"
|
||||
name="http://www.redhat.com:8080/HyperNews/get/khg.html">
|
||||
How to write your own device drivers. Come on, do it!
|
||||
<item><htmlurl
|
||||
url="http://www.hut.fi/Misc/Electronics/circuits/parallel_output.html"
|
||||
name="http://www.hut.fi/Misc/Electronics/circuits/parallel_output.html">
|
||||
Tomi Engdahl's web page is a *must see* for everyone who likes
|
||||
electronics.
|
||||
<item><htmlurl
|
||||
url="http://www.yahoo.com/Computers_and_Internet/Internet/Entertainment/Interesting_Devices_Connected_to_the_Net/Coffee_Machines/"
|
||||
name="http://www.yahoo.com/Computers_and_Internet/Internet/
|
||||
Entertainment/Interesting_Devices_Connected_to_the_Net/Coffee_Machines/">
|
||||
Coffee-machines on-line. Unfortunatelly, there are no tests.
|
||||
<item><htmlurl
|
||||
url="http://www.cs.su.oz.au/~bob/coffee.html"
|
||||
name="http://www.cs.su.oz.au/~bob/coffee.html">
|
||||
This coffee-machine offers only cappuccino. It should be upgraded!
|
||||
<item><htmlurl
|
||||
url="http://einstein.et.tudelft.nl/~janssen/"
|
||||
name="http://einstein.et.tudelft.nl/~janssen/">
|
||||
Hot coffee from Netherlands.
|
||||
<item>http://circe.chinalake.navy.mil/cgi-bin/spion/snapit.cgi
|
||||
<item>http://www.cl.cam.ac.uk/coffee/coffee.html
|
||||
<item>http://www.menet.umn.edu/coffeecam/
|
||||
</itemize>
|
||||
|
||||
<sect>etc
|
||||
<sect1> preface
|
||||
<P>
|
||||
This document was initially written in hellenic (greek), originating from
|
||||
a small debate in the linux-greek-users list ,
|
||||
whether linux can make coffee or not.
|
||||
It has been an article in our beautiful online magazine
|
||||
about Linux called "magaz": <htmlurl
|
||||
url="http://www.linux.gr/magaz" name="http://www.linux.gr/magaz">.
|
||||
Remember, magaz is greek.
|
||||
|
||||
<sect1> Authorship and maintenance
|
||||
<P>
|
||||
My name is <htmlurl url="http://www.ceid.upatras.gr/~gef"
|
||||
name="Georgatos Photis">, still-yet-foralongmaybe student at
|
||||
Computer Engineering and Informatics department in University of Patras.
|
||||
Usually, I am pretty busy with the greek documentation and
|
||||
webpages maintainance, but I can accept submissions to this HOWTO, as long
|
||||
as you're not anxious about the changes.
|
||||
|
||||
I'm Annie Pinder and a coffee fan. I live in England. I made the language changes on this document. I'm currently in the English equivalent of High School, in my final compulsory year.
|
||||
<sect1> Copyrights
|
||||
<P>
|
||||
The casual copyright with everything you get with linux...
|
||||
To find it, you'll have to read all of them and count the most common.
|
||||
Otherwise, no, you can't copy it.
|
||||
|
||||
<sect1> Credits
|
||||
<p>
|
||||
<itemize>
|
||||
<item><htmlurl
|
||||
url="http://sunsite.unc.edu/expo/1492.exhibit/c-Columbus/columbus.html"
|
||||
name="Christofer Colombus">. His real name is Cristobal Colon.
|
||||
He was the 1st one who brought coffee from America, which was
|
||||
for first discovered (among Europeans) by him in 1492.
|
||||
<item> Kostas Lialiambis is the one who dared saying that he can't make
|
||||
coffee with his Linux box!
|
||||
<item> Panagiotis Vrionis, Yannakopoulos Haralambos, for giving me
|
||||
interesting and humorous notes.
|
||||
</itemize>
|
||||
</article>
|
||||
|
||||
<!DOCTYPE LINUXDOC SYSTEM>
|
||||
|
||||
<article>
|
||||
<title>COFFEE-HOWTO
|
||||
<author>Georgatos Photis, <<htmlurl
|
||||
url="mailto:gef@ceid.upatras.gr?subject=COFFEE-HOWTO"
|
||||
name="gef@hellug.gr">> &nl;
|
||||
Annie Pinder, <<htmlurl url="mailto:ajp@leguin.org.uk">>
|
||||
<date>v0.7, 29 November 2000
|
||||
|
||||
<abstract>
|
||||
One of the most memorable comments about software I have ever heard,
|
||||
is whether this or that can make coffee.
|
||||
Linux DOES make coffee. And it tastes good, as well!
|
||||
</abstract>
|
||||
|
||||
<!-- Table of contents -->
|
||||
<toc>
|
||||
|
||||
<p>
|
||||
For a long time, humanity was wondering how could a computer
|
||||
make coffee...
|
||||
People need coffee wake up and stay awake
|
||||
in front of the computer for a long time.
|
||||
Everyone knows that coding is better at night...
|
||||
|
||||
<p>
|
||||
The main problem is how to manage the coffee machine with
|
||||
the computer, so that it will be controlled by software.
|
||||
This generally means an ON/OFF switch implemented
|
||||
as a circuit which controls the coffee-machine's power supply.
|
||||
<p>
|
||||
<htmlurl url="http://coffee.sourceforge.net/"
|
||||
name="Cristobal Colon">, as the person who brought tobacco and chocolate!
|
||||
|
||||
|
||||
<sect>Menu
|
||||
|
||||
<sect1>French
|
||||
<p>Popular coffee among programmers because doesn't need a lot of care;
|
||||
like commercial software.
|
||||
Its exciting taste has inspired thousands of programmers
|
||||
in writing incredible software, written in the very first ours of a day.
|
||||
Windows for example was written at 5:00 o'clock in the morning,
|
||||
Due to coffee! A result is guaranteed.
|
||||
|
||||
<sect1>Nescafe
|
||||
<p> Nescafe is a rather strong coffee, made by pouring hot water
|
||||
in a mixture of coffee, sugar and some water.
|
||||
You usually take 1 spoon of coffee and 1 spoon of sugar with just
|
||||
a bit of water, to mix it. In the meantime you should have the water
|
||||
boiling. As soon as the water is hot enough, you mix them all together
|
||||
and preferably add milk.
|
||||
Although you can use something simpler than a coffee-machine to
|
||||
boil the water, I have seen this done many times...
|
||||
|
||||
<sect1>Frappe
|
||||
<p>A popular variation of the above mentioned coffee.
|
||||
Actually, it doesn't need a coffee-machine, rather a refrigerator for
|
||||
cold water and ice-cubes.
|
||||
|
||||
<sect1>Freddo
|
||||
<p>This is a difficult one, read coffee-faq (see references)
|
||||
|
||||
<sect1>Espresso
|
||||
<p>Espresso is a very strong, italian sort of coffee. You serve it in
|
||||
small cups (You ask why? See chapter: Overdose Symptomes) with on
|
||||
or to pieces of lump sugar.
|
||||
To produce a good espresso you need fresh grinded coffee beans,
|
||||
water, lump sugar und a special machine. This machines boil the water
|
||||
and press the very hot steam through the grinded coffee beans. You can
|
||||
buy a super-duper-automatic machine for a lot of money. But a low
|
||||
cost machine is useably, too.<p>
|
||||
OK., lets start. Fill water in your machine. Let it become hot. In the
|
||||
meantime fill about 1 teespoon of coffeepowder in the filterhandle of
|
||||
your machine. Press the coffeepowder down. Not too much. Now the water
|
||||
is at the right temperature. Attach the filterhandle to the machine
|
||||
and let the machine work. After about 30 seconds you can serve a
|
||||
delicate, hot espresso. It is fine after a good meal. You feel good
|
||||
and can code for another several hours.
|
||||
|
||||
|
||||
<sect1>Cappuccino
|
||||
<p>(See also chapter: Espresso)
|
||||
If you have a more profi-like machine, you can use it, to froth milk
|
||||
with it. You need this feature to make a creamy sort of coffee. It is
|
||||
easy to prepare. Put some frothed milk in a coffee pot and fill it up
|
||||
with espresso. Then decorade with some chokolade flakes. That´s it.
|
||||
|
||||
<sect>Electronic circuit
|
||||
<p>
|
||||
A general diagram is like this:
|
||||
|
||||
<tscreen><verb>
|
||||
--------- 0-5V --------- ~220V ----------------
|
||||
| PC |===>===|Circuit|========|Coffee-Machine|
|
||||
--------- --------- ----------------
|
||||
</verb></tscreen>
|
||||
|
||||
<p>The concept is that we take a controling voltage from the computer,
|
||||
which drives an electrically isolated circuit with a Relay or Triac.
|
||||
|
||||
<p>You must choose a Relay circuit, if you have a coffee-machine
|
||||
greater than 200W. You can use a triac-based one if your coffee machine isn't high power.
|
||||
|
||||
All circuits presented are tested, but the results are
|
||||
YOUR RESPONSIBILITY.
|
||||
If you have no experience with electronics you should NOT try
|
||||
these, otherwise you may get a bad one...
|
||||
|
||||
<p>You should be very careful while experimenting with 220V, and using an appropriate fuse is advisable.
|
||||
|
||||
<sect1>Driving voltage 0-5V from the computer
|
||||
<p>
|
||||
Here is a simple example to get a voltage 0-5V from the parallel
|
||||
port of the computer.
|
||||
|
||||
<tscreen><verb>
|
||||
Back View ----- Pin 10 - ACK
|
||||
Male DB-25 | | Pin 9 - D7
|
||||
Connector | | Pin 2 - D0
|
||||
v v v Pin 1 -
|
||||
~Strobe
|
||||
____________________________________________________________
|
||||
/ \
|
||||
\ 13 12 11 10 9 8 7 6 5 4 3 2 1 /
|
||||
\ /
|
||||
\ 25 24 23 22 21 20 19 18 17 16 15 14 /
|
||||
\______________________________________________________/
|
||||
|
||||
</verb></tscreen>
|
||||
|
||||
<p>Pin 1 is Strobe (inverse logic)
|
||||
<p>Pins 2-9 is DATA BUS's signals, exactly what was written to the
|
||||
parallel port's latches with an OUTB command.
|
||||
<p>Pin 10 is the acknowledge signal (ACK), controlled by you, so that you can
|
||||
produce an interrupt to the CPU.
|
||||
<p>Pins 18-25 are short-circuited and this is the ground (GND).
|
||||
|
||||
<p>In detail:
|
||||
<tscreen><verb>
|
||||
<= in DB25 Cent Name of Reg
|
||||
=> out pin pin Signal Bit Function Notes
|
||||
------ ---- ---- -------- --- -----------------------------
|
||||
=> 1 1 -Strobe C0- Set Low pulse >0.5 us to send
|
||||
=> 2 2 Data 0 D0 Set to least significant data
|
||||
=> 3 3 Data 1 D1 ...
|
||||
=> 4 4 Data 2 D2 ...
|
||||
=> 5 5 Data 3 D3 ...
|
||||
=> 6 6 Data 4 D4 ...
|
||||
=> 7 7 Data 5 D5 ...
|
||||
=> 8 8 Data 6 D6 ...
|
||||
=> 9 9 Data 7 D7 Set to most significant data
|
||||
<= 10 10 -Ack S6+ IRQ Low Pulse ~ 5 uS, after accept
|
||||
<= 11 11 +Busy S7- High for Busy/Offline/Error
|
||||
<= 12 12 +PaperEnd S5+ High for out of paper
|
||||
<= 13 13 +SelectIn S4+ High for printer selected
|
||||
=> 14 14 -AutoFd C1- Set Low to autofeed one line
|
||||
<= 15 32 -Error S3+ Low for Error/Offline/PaperEnd
|
||||
=> 16 31 -Init C2+ Set Low pulse > 50uS to init
|
||||
=> 17 36 -Select C3- Set Low to select printer
|
||||
== 18-25 19-30, Ground
|
||||
</verb></tscreen>
|
||||
|
||||
<sect1>Controlling with a Relay
|
||||
<p>
|
||||
|
||||
The simplest circuit that one can build is:
|
||||
<tscreen><verb>
|
||||
|
||||
Vcc
|
||||
|
|
||||
+------+
|
||||
| __|__
|
||||
Relay /^\ Diode 1N4002
|
||||
Coil /---\
|
||||
| |
|
||||
+------+
|
||||
|
|
||||
| /
|
||||
4.7K B |/ C
|
||||
parallel port >-\/\/\/\/---| NPN Transistor: BC547A or 2N2222A
|
||||
data pi |\ E
|
||||
| V
|
||||
|
|
||||
parallel port >--------------+
|
||||
ground pin |
|
||||
Ground
|
||||
</verb></tscreen>
|
||||
Connect Vcc with the same voltage as the relay type (usually 5 or 12V).
|
||||
Obviously, the relay's specifications should be scaled for your
|
||||
coffee-machine.
|
||||
<P>
|
||||
Barmen, tend to put the relay AFTER the transistor, at the
|
||||
emitter (E) pin instead of the collector (C) pin. This is bad practice
|
||||
because it biases the transistor badly, and may result in bad coffee :-).
|
||||
Diode 1N4002 is useful to protect the transistor from the relay's currents.
|
||||
If you don't use it the transistor will become dark and smelly...
|
||||
|
||||
<sect1>Controlling with TRIAC #1
|
||||
<p>
|
||||
If you only want a simple circuit, you can use Motorola's
|
||||
triac driver MOC301[012], together with a general purpose TRIAC like SC141D.
|
||||
This method has the advantage that you don't need an extra power supply.
|
||||
|
||||
<p>For non-inductive loads, this is the circuitry:
|
||||
<tscreen><verb>
|
||||
|
||||
270 1 +-------+ 6 180
|
||||
+5v -VAVAVA-----+ +----VAVAVA-----+-------------- Line Hot
|
||||
2 | MOC | |
|
||||
TTL in ---------+ 3012 +nc VA SC141D
|
||||
| | 4 / |
|
||||
nc+ +------------/ |
|
||||
+-------+ +----\/\/\/---- Line Neutral
|
||||
LOAD
|
||||
</verb></tscreen>
|
||||
<p>If you are going to work with 220V, try to obtain a 3021.
|
||||
Inductive loads should be used in conjuction with bypass capacitors,
|
||||
see <em>Motorola Application Note AN-780</em>.
|
||||
Coffee-machines are mainly resistive loads and not inductive (like a motor),
|
||||
but who knows what yours is!
|
||||
|
||||
<sect1>Controlling with TRIAC #2
|
||||
<p>
|
||||
|
||||
<tscreen><verb>
|
||||
+5VDC
|
||||
| 180 180 2.2k
|
||||
+---/\/\/\----+-----+ +----/\/\/-+--/\/\/\---+-------> 120V
|
||||
| 1| |6 | | Hot
|
||||
| +=====+ | | MT1
|
||||
| | MC | TRIAC | +-+
|
||||
| | 3032| Driver | G | | TRIAC
|
||||
| +=====+ | /| |
|
||||
\ 2| |4 | / +-+
|
||||
2N3904 |----+ | | | | MT2
|
||||
/ | +--------- | -------+ |
|
||||
V \ | | |
|
||||
| / | \ |
|
||||
| \ 43 .01u --- 10k / |
|
||||
| / 500V --- \ |
|
||||
| | | / |
|
||||
+------+ | | | Neutral
|
||||
| +--------+--+---o o--> 120V
|
||||
/ load
|
||||
>-/\/\--| 2N3904
|
||||
\
|
||||
V
|
||||
|
|
||||
---
|
||||
///
|
||||
You should change resistors accordingly for 220V.
|
||||
</verb></tscreen>
|
||||
<p>Circuit description:
|
||||
<P>The MC3032 is an optoisolator TRIAC driver.
|
||||
The 180-ohm resistor sets the current for the LED emitter in the optoisolator.
|
||||
Change the value of this resistor - if necessary - to get a reasonable current
|
||||
(e.g., 15 mA).
|
||||
<P>
|
||||
Note that you cannot test this circuit without a load.
|
||||
The TRIAC will not switch unless connected to an AC
|
||||
voltage source, so you can't test it for simple switching without applying AC
|
||||
and a load. Note the 500V rating on the .01 cap.
|
||||
|
||||
<sect>Software
|
||||
<p>
|
||||
|
||||
<sect1>Software
|
||||
<p>
|
||||
You will have to build an executable that will work like this:
|
||||
<itemize>
|
||||
<item>Get permission to use I/O address space, by calling kernel, with
|
||||
the command <bf>ioperm</bf>: eg <em>ioperm( BASE, range ,1); </em>
|
||||
<item>Perform an out request instruction, to set the 0-5V voltage to the
|
||||
parallel port, eg <em>outb( 1, BASE );</em>
|
||||
<item>Wait enough time so the coffee is made. It would be nice
|
||||
if that time is read by looking at the command line.
|
||||
<item>Then it will turn off the coffee-machine: outb( 0 , BASE );
|
||||
<item>Before ending it should give back the parallel port with a <em>ioperm( BASE, range, 0);</em>
|
||||
</itemize>
|
||||
Change BASE = 0x3bc for /dev/lp0, 0x378 for /dev/lp1, and 0x278
|
||||
for /dev/lp2, range=8.
|
||||
|
||||
<p>It would be useful if you had that program setuid,
|
||||
so that everybody can drink coffee!
|
||||
|
||||
<sect1>Device driver
|
||||
<p>
|
||||
|
||||
Just read <htmlurl
|
||||
url="http://www.redhat.com:8080/HyperNews/get/khg.html"
|
||||
name="kernel hacker's guide">,
|
||||
implement a device driver (it could even be user space I think).
|
||||
Please compile it as a module, so that we won't need a
|
||||
kernel compile in every update.
|
||||
Then write:
|
||||
|
||||
<verb>
|
||||
echo cappuccino >/dev/coffee
|
||||
</verb>
|
||||
|
||||
And you will have a hot cup of coffee in minutes!
|
||||
Remember to give the right permission to /dev/coffee,
|
||||
depending on whether you want only root making coffee or not.
|
||||
|
||||
<p>The advantage of this method is that it supports feedback
|
||||
from the coffee-machine by using the ACK of parallel port,
|
||||
so that smart coffee-machines could produce an interrupt.
|
||||
|
||||
<p>Do it as homework.
|
||||
|
||||
<sect1>Connecting with the Internet
|
||||
<p>
|
||||
If you have implemented the C program (see above),
|
||||
you just have to write a simple CGI script to turn ON and OFF
|
||||
the coffee-machine.
|
||||
You should write some nice webpages, explaining how to make coffee,
|
||||
and put them on an <bf>apache</bf> web server...
|
||||
|
||||
<sect>Overdose symptoms
|
||||
<p>
|
||||
<itemize>
|
||||
<item>excitement
|
||||
<item>nervousness
|
||||
<item>insomnia
|
||||
<item>tachycardia or cardiac arhythmia
|
||||
<item>restlessness
|
||||
<item>Hypersensibility to light
|
||||
<item>Annoyance in respect with various audio stimuli
|
||||
<item>gastrointestinal disturbance
|
||||
</itemize>
|
||||
|
||||
<sect>Expansions
|
||||
<p>These are our ideas:
|
||||
<itemize>
|
||||
<item>All hardware and software described here, can be expanded so that
|
||||
it will support toast, beaf, applepies, etc.
|
||||
<item>Cluster with 8 coffee-machines. This will let you have coffee
|
||||
even when the one gets off. Of course there will be a perfomance hit.
|
||||
<item>Parallel vector coffee-machine will be a future release.
|
||||
<item>If you want the maximum automation you'll need more circuits and
|
||||
sensors, so that you can control water flow, temperature, coffee
|
||||
quantity etc.
|
||||
<item>In the near future we will implement SNMP features.
|
||||
<item>Serial coffee-machine at 115Kbps.
|
||||
</itemize>
|
||||
|
||||
<sect>References
|
||||
<p>
|
||||
<itemize>
|
||||
<item><htmlurl
|
||||
url="http://www.faqs.org/rfcs/rfc2324.html"
|
||||
name="http://www.faqs.org/rfcs/rfc2324.html">
|
||||
RFC2324: Hyper Text Coffee Pot Control Protocol (HTCPCP/1.0)
|
||||
<item><htmlurl
|
||||
url="http://daisy.uwaterloo.ca/~alopez-o/caffaq.html"
|
||||
name="http://daisy.uwaterloo.ca/~alopez-o/caffaq.html">
|
||||
This is most known Internet's <bf>Coffee-FAQ</bf>
|
||||
<item><htmlurl
|
||||
url="http://www.gardfoods.com/coffee/coffee.coffee.htm"
|
||||
name="http://www.gardfoods.com/coffee/coffee.coffee.htm">
|
||||
A pretty comprehensive, if informal, history of humans' interaction
|
||||
with the coffee plant. People have been chewing coffee berries in
|
||||
Africa for 100,000 years or so. Coffee was definitely growing in
|
||||
Yemen, where it is not native (so must have been planted), in 525 AD.
|
||||
<item><htmlurl
|
||||
url="http://lonestar.texas.net/~andrew/f_pc_.htm"
|
||||
name="http://lonestar.texas.net/~andrew/f_pc_.htm">
|
||||
A lot of circuits in ASCII. Some of them are for parallel port.
|
||||
<item><htmlurl
|
||||
url="http://shell.rmi.net/~hisys/parport.html"
|
||||
name="http://shell.rmi.net/~hisys/parport.html">
|
||||
Whatever you wanted to learn about a parallel port and didn't dare to ask.
|
||||
<item><htmlurl
|
||||
url="http://sunsite.unc.edu/LDP/HOWTO/mini/IO-Port-Programming"
|
||||
name="http://sunsite.unc.edu/LDP/HOWTO/mini/IO-Port-Programming">
|
||||
Programming of I/O ports under popular operating system Linux.
|
||||
<item><htmlurl
|
||||
url="http://www.redhat.com:8080/HyperNews/get/khg.html"
|
||||
name="http://www.redhat.com:8080/HyperNews/get/khg.html">
|
||||
How to write your own device drivers. Come on, do it!
|
||||
<item><htmlurl
|
||||
url="http://www.hut.fi/Misc/Electronics/circuits/parallel_output.html"
|
||||
name="http://www.hut.fi/Misc/Electronics/circuits/parallel_output.html">
|
||||
Tomi Engdahl's web page is a *must see* for everyone who likes
|
||||
electronics.
|
||||
<item><htmlurl
|
||||
url="http://dir.yahoo.com/Computers_and_Internet/Internet/Devices_Connected_to_the_Internet/Coffee_Machines/"
|
||||
name="http://dir.yahoo.com/Computers_and_Internet/Internet/
|
||||
Devices_Connected_to_the_Internet/Coffee_Machines/">
|
||||
Coffee-machines on-line. Unfortunatelly, there are no tests.
|
||||
<item><htmlurl
|
||||
url="http://www.cs.su.oz.au/~bob/coffee.html"
|
||||
name="http://www.cs.su.oz.au/~bob/coffee.html">
|
||||
This coffee-machine offers only cappuccino. It should be upgraded!
|
||||
<item><htmlurl
|
||||
url="http://einstein.et.tudelft.nl/~janssen/"
|
||||
name="http://einstein.et.tudelft.nl/~janssen/">
|
||||
Hot coffee from Netherlands.
|
||||
<item>http://circe.chinalake.navy.mil/cgi-bin/spion/snapit.cgi
|
||||
<item>http://www.cl.cam.ac.uk/coffee/coffee.html
|
||||
<item>http://www.menet.umn.edu/coffeecam/
|
||||
</itemize>
|
||||
|
||||
<sect>etc
|
||||
<sect1> preface
|
||||
<P>
|
||||
This document was initially written in hellenic (greek), originating from
|
||||
a small debate in the linux-greek-users list ,
|
||||
whether linux can make coffee or not.
|
||||
It has been an article in our beautiful online magazine
|
||||
about Linux called "magaz": <htmlurl
|
||||
url="http://www.linux.gr/magaz" name="http://www.linux.gr/magaz">.
|
||||
Remember, magaz is greek.
|
||||
|
||||
<sect1> Authorship and maintenance
|
||||
<P>
|
||||
My name is <htmlurl url="http://www.ceid.upatras.gr/~gef" name="Fotis Georgatos">.
|
||||
I have been pretty busy with the greek documentation and webpages maintainance,
|
||||
but I can accept submissions to this HOWTO, as long as you're not anxious about the changes.
|
||||
|
||||
I'm Annie Pinder and a coffee fan. I live in England. I made the language changes on this document.
|
||||
I'm currently in the English equivalent of High School, in my final compulsory year.
|
||||
|
||||
<sect1> Copyrights
|
||||
<P>
|
||||
The casual copyright with everything you get with linux...
|
||||
To find it, you'll have to read all of HOWTOs and average the most common.
|
||||
Otherwise, no, you can't copy it.
|
||||
|
||||
<sect1> Credits
|
||||
<p>
|
||||
<itemize>
|
||||
<item>Ethiopia: The originating country of coffee.
|
||||
As many people correctly corrected, coffee did not originally come
|
||||
from America by Christofer Colombus and it was popular in the Middle East long
|
||||
before America was discovered. Still, we can remember
|
||||
<htmlurl url="http://sunsite.unc.edu/expo/1492.exhibit/c-Columbus/columbus.html"
|
||||
name="Cristobal Colon">, as the person who brought tobacco and chocolate!
|
||||
<item> Kostas Lialiambis is the one who dared saying that he can't make
|
||||
coffee with his Linux box.
|
||||
<item> Panagiotis Vrionis, Yannakopoulos Haralambos, for giving me
|
||||
interesting and humorous notes.
|
||||
<item> NUMEROUS people on the internet with additions and remarks.
|
||||
</itemize>
|
||||
</article>
|
||||
|
|
Loading…
Reference in New Issue