Friday, November 17, 2006



I've had a lot of troubles getting the Hamamatsu P5587 limits detector chip to operate reliably as a PortB input. In theory the circuit it is wired into is supposed to put out a 0v and 5v signal when it crosses an IR opaque/transparent boundary. A lot of the time it does that rather well. After it warms up, however, you'll often start getting a low voltage of 1.74v and a high at 4.95v. Those don't trigger an interrupt on PortB.

After a week of fooling around trying to make it work the obvious way I finally decided to shift the input from the chip over to one of the the analog pins and measure the voltage during the 1 ms clock cycle interrupt and see if that works better. Sure enough it worked like a champ!

It took about 30 minutes to prove out the A/D code snipped and adapted out of example off of the Oshonsoft site, replace the PortB code with it and test the thing on Tommelise. It's been running on a 50 mm work area boundary to give it a lot of cycles per minute for about 45 minutes not without so much as a single hiccough.

Here is a pic of the test underway...

...and a short video of the y-axis positioning stage making the turn.

What I do with the analog input is simple. If I get over 2.5 volts I figure that it's over an opaque surface. If it is less than that, I figure it is over a transparent surface. Super easy.

Now I can go ahead and wire in the x-axis to the 16F877A board with reasonable confidence that extending the code that I have running the y-axis is going to do the job for the x-axis.

I was counting port pins and I'm pretty sure that I can get all four gearmotors (3 axes plus the extruder) running on this board slaved to the same 1 ms clock cycle. I'm going to build up a little test board around a 16F628A this weekend along with a Tip 120 to get used to running the extruder barrel heater. There's no obstacle to putting that onto the 16F877A board, too, except that I want to test out the code in isolation first.

With a little luck I should be able to do everything I need to run Tommelise off of one 16F877A using a 20 MHz clock crystal. :-)

So far the limits detection firmware has been running constantly for over eight and a hours at a variety of stepping rates with no problems. The y-axis motor is staying very cool as well, right at 42 degrees. The 754410 driver chip is running about 40.

Humm... now I'm left scratching my head.

I guess the P5587 is at about the same level as all those simple IR diode and sensor pair gizmos I pull out of printers and such if it needs an analog port to work well...? They also are sensitive to ambient IR light. Must keep all this in mind...
If you read the data sheet they're supposed to be quite good. That's not been my experience with them, however. Whether it's a matter of the chip being not up to scratch or my use of it not being right is anybody's guess at this point.

With a bit of luck Adrian will take a look at putting the chip to use and we can get a look at how he uses it in his schematic. Then if might perform to spec. :-)

Mind, it's quite reliable when used as an analog input which is good enough for me.
Post a Comment

Links to this post:

Create a Link

<< Home

This page is powered by Blogger. Isn't yours?

Subscribe to
Posts [Atom]