A small sharing of experience in incorporating Zach's ZD1901 opto-endstop into a controller board...
Hooking up Zach's opto-endstop was a
trivial exercise. You provide ground, +5 v and get back a 5 v signal.
To receive the signal from the opto-endstop, I set PortB.5 to an input
by setting TrisB.5 =1. I then rewrote the test program for the y-axis
to reset the start point for the axis when it got a good signal from
the opto-endstop.
It didn't work the first time out for
reasons which caused me to include this short note. I tend to do
temporary lashups with sticky tape and the like to test things. The
thinking is that once I have everything running I can design proper
mounts and such using Tommelise 2.0 and print them out, replacing all
of the bits of wood and tape. This opto-endstop mounting was no
different.
I had, of course, to use something to
break the signal in the H21LOI. For that I cut a strip out of a piece
of red construction paper, reasoning that it was thick enough and
opaque enough to do the job. I was wrong. It wasn't.
From there I selected a much thicker piece of white paper of heavy poster quality with a heavy clay fill. No joy.
When I took a piece of carton
(cardboard) off of the back of a shrink package of 16 pin sockets from
Radio Shack and dipped that into the gap of the H21LOI I got a good
signal back. I then cut a long strip of similar carton off of the side
of a package of hack saw blades and taped it onto the y-axis. I also
taped that opto-endstop to the baseboard of Tommelise 2.0 as you will
see.
That done, the test routine performed
perfectly. The moral of this story is never underestimate the
penetrating power of the IR beam in a ZD1901. It may not look like
much, but it is nonetheless powerful.
One other thing gave me pause which I
will mention for completeness. Ordinarily, my controller boards
include a L9805CV voltage regulator that converts 12 v from my ATX
power supply to 5 v for the logic circuits on the controller board. I
don't use a heat sink on the regulator simply because the load that the
logic chips put on it is not substantial.
When I put new circuitry on a board,
however, I tap it briefly at frequent intervals to check to see if it
is heating up, that being a sure sign that I have a short somewhere on
the board. This evening I noticed that it was warmer than usual.
Without the opto-endstop the regulator was relatively cool to the
touch. With it it was warm. Not hot, but warm. I checked my wiring
additions and there were no shorts. I also tapped all of the chips
checking to see if any of them had gone bad with similar negative
results.
Being obsessive, I checked the
amperage going into the board via the 12 v input while the y-axis plus
opto-endstop was in operation and got 190 milliamps. I also checked
the 5 v supply going to the opto-endstop board and got 20 milliamps.
Finally, I used my IR thermometer to
measure the temperature of the regulator and got 36 Celsius. Room
temperature was 21 C. Apparently the drain from the endstop board is
warming the regulator up a bit, but not alarmingly.
In future, though, when designing
controller boards I will place the L7805CV somewhere else on the board
where I can slap a heat sink on it easily. A heat sink will let it happily handle loads up to 1 amp.
You could power the opto leds from 12V with a bigger resistor or connect them to the 5V output of the ATX PSU as they don't need to have an accuarate or noise free supply.
I thought you we going to power all the 5V stuff from the USB.
"I thought you we going to power all the 5V stuff from the USB."
I was. Indeed, the way my 5v bus bar is arranged that does happen now.
What's changed is that I decided that I wanted Tommelise to be able to run autonomously with the PC switched off overnight.
About your red construction paper: Because the opto endstop probably uses infrared light, I bet the red construction paper was like white paper to the device... Blue construction paper would probably have worked? :)