Sunday, October 28, 2018

Letting Out the Magic Smoke

Some of you understand that perfectly - so skip to the next paragraph.  "Letting out the magic smoke" is one of those jokes that I think everyone in electronics shares.  The standard form is that while they teach a lot of theory for technicians, all electronics is actually operating on magic smoke, not "transistors" and all the other made-up parts they talk about.  You can verify this because if you ever let the magic smoke out of the package, the circuit will never work again.  *

When I talked about moving threading onto my CNC Sherline lathe, I neglected to talk about the whole effort relying on a circuit I built back around the end of 2008, and that I was trying to understand how to make that work again.  After studying everything I could dig up to resurrect the the box and how it interfaced to my CNC controller, I decided it was time to hook it up and look for signs of life.  When power was applied, the magic smoke came out and I'm sure it will never work again.  (By the way, magic smoke stinks with a bitter, acrid smell.  A small source fills a room.)

Let me back up a minute.  When threading manually on a lathe, what those gear combinations do for you is to set the pitch of the screw in the spindle.  That is, they're setting how far the cutter moves along the screw in one revolution.  A 32 turns per inch screw moves the cutter 1/32 inch per turn; a 40 tpi screw moves it 1/40 inch and so on.  A side benefit of "locking" the movement of the cutter to the rotation of the screw is that the cutter always starts a thread at the same point on the screw's circumference.  Under manual threading like this, I'll start the cutter at some point on the screw, advance it along the screw toward the head, and stop when I reach a mark I've cut into the shaft.  Then I'll back the cutter out of the thread (a few thousandths of an inch is fine) and turn the shaft the other direction, so that the cutter goes back past the end of the screw and start of the thread.  Finally, I'll advance the cutter farther into the work by a small amount and cut another pass along the thread.  This process is repeated until the thread is cut.

If there are no gears connecting the spindle and tool (which is what I'm moving toward), how does the system synchronize the cutter and the screw being cut?  The CNC software will do that, but needs to know the position of the shaft of the screw.  That's done with something that tells the software where in a rotation the top is.  Years ago (the end of 2008), I made this little circuit box and, after some experimenting, got threading to work.  Here it is while I was getting it to work the first time:
The red oval is around the part that blew up (a Schmidt trigger for the curious, 74LS14).  What went wrong?  I simply misread a spot on the 10 year old diagram for the control board I was hooking the wiring up to.  I read VBB as VCC.  No excuse.  As a result, I put 20V on this part, which ordinarily runs on 5V.  Ooops.

On the right, four wires (orange, green, blue and white) are visible, the last three in big loops.  These are connections for the heart of the box, an optical sensor.  This part, barely visible at the right wall of the box, shines an infrared LED onto the reflective shaft of the motor, and then senses the reflection.  A small strip of black tape breaks up the reflection, which creates a pulse going to the computer when that tape passes under the optical sensor.

Part of getting this approach working is ensure you can cut a spiral groove on a blank. This was my first successful attempt at that from early 2009.
The barfed looking left half of that: not really threaded, not really not threaded, was another experiment that went bad and led to doing the scratch test.

I started looking for the parts to build another optical detector like the one I had, and found the transistor I used is obsolete and hard to get.  Looking around, I found that CNC4PC has a slightly different optical sensor for not much more than I'd pay for one of those transistors (Mouser.com had the transistors for about $18 each).  The major difference is that while mine worked by reflection, this one works on transmission.  The sensor has two arms with the LED on one side and the phototransistor on the other.  A common use would put a disk with a hole through it onto the spindle and let the disk spin in that slot between the two arms, so that when the hole lines up, the software knows the index position just happened. 

So now what?  Now I figure out how to build the disk with the hole or slot in it, and how to mount both the disk and the sensor.  My little box goes away and the new little board goes inside the CNC controller box. 



* I imagine that like all specialized fields, electronics has its own jokes, legends and lore.  I didn't hear about the smoke theory until I was in the field for quite a while, maybe a decade.  Before that, the joke was that microprocessors ran on IBM theory.  Itty Bitty Men inside the components did everything.


10 comments:

  1. I use a cheap opamp to condtion the signal.

    I am also looking at using a Cyprus PSOC with programmable analog front end as an improvement.

    ReplyDelete
    Replies
    1. That would work well. A Schmidt trigger is like a comparator with a window on the input to add some hysteresis. I didn't remember what was in the box until I opened it, but I probably used the Schmidt trigger because it would have been simpler to wire.

      I haven't looked at any of the PSOC options, so any info would be welcomed!

      Delete
  2. Does your setup give one pulse per revolution, or multiple pulses? I've seen people adapt Hall Effect devices, and glue a magnet on the shaft to count them. More pulses/revolution is easy to do with a "star wheel" on the end of the shaft.

    Of course if you're putting a star wheel on the end, you might as well use the photo-interrupter.

    Oh, well...never mind....

    ReplyDelete
  3. The Magic Smoke extends to automotive electronics as well:

    http://www3.telus.net/bc_triumph_registry/smoke.htm

    ReplyDelete
  4. http://www.cypress.com/products/32-bit-arm-cortex-m3-psoc-5lp

    Has a programmable analog front end in addition to a digital one. It's like having a mini-FPGA for analog and digital front end processing. The ARM core then allows you to write C code to update displays, network, etc.

    ReplyDelete
    Replies
    1. I test benched it with the Analog Discovery II. For $279 you have a test bench in your pocket. It's also a signal generator, function generator, spectrum scope, in addition to logic analyzer and oscilloscope. I also used it to play with GNU radio generating AM + FM modulated signals as RF input and then looking at their spectrum output.


      https://store.digilentinc.com/analog-discovery-2-100msps-usb-oscilloscope-logic-analyzer-and-variable-power-supply/

      Delete
    2. Interesting input - thanks.

      I've always been skeptical of those System On a Chip solutions because of they imply pretty serious signal integrity issues. I'm sure they had to have gotten better since the first ones, and I know the industry has invested tons of money in making them work. Still, putting a sensitive analog circuit on a die within thousandths of an inch of logic levels is risky.

      It's way overcomplicated for this task, so it's hard to see using it. It might have its place somewhere, though.

      Delete
  5. Send me the spec for the transistor you are having a hard time finding, I have a basement full of transistors (power and signal) from the 1970's and 1980's, anything from flat plastic pack to black cased to TO cans and a few germanium which I guard for historical purposes.

    ReplyDelete
    Replies
    1. Thanks but I don’t need any transistors. It was a logic part that blew, and I’m just replacing the module.

      Delete