CNC Breakout Board as First Project

Discussion in 'The Projects Forum' started by ttjarrett, Apr 27, 2011.

  1. ttjarrett

    Thread Starter New Member

    Apr 12, 2011
    Hi All,

    I am new to the forum and almost a complete electronics novice. I have been interested in electronics for a while now, and decided the best way to learn is by jumping in and getting my hands dirty.:)

    The first major project I am trying to design and build is a breakout board for my CNC router. This board is to provide buffered outputs and non-buffered inputs to/from my computer through the Parallel Port (DB25) to communicate with stepper motor controllers, proximity sensors, etc. I have been using a purchased board on my CNC for around 6 months, but would like some different features. I'm definitely reinventing the wheel with this project, but hopefully I can learn a lot along the way!:D

    The first part of the design I am tackling is isolating the proximity sensors I want to use from the rest of the board using optocouplers. These sensors will be used as home and limit switches for the machine, require 12-24vdc, and are NC. I have attached a schematic of how I understand the basic circuit of this opto-isolation should work, and would appreciate some critique.

    In the schematic, Pin 13 relates to Pin 13 of the Parallel Port and SW1 and SW2 represent two NC proximity sensors in series. In my understanding, R1 should be acting as a pull-down resistor for Pin 13, R2 as a current limiting resistor to Pin 13, and R3 as a current limiter to the optocoupler. Am I correct?

    Opto: Data Sheet

    PRT08-2DC Sensors: Data Sheet

    Any comments would be much appreciated. I am fully expecting to make a lot of obvious and grievous errors during this project, so please do not hesitate to point these out.


  2. Rbeckett


    Sep 3, 2010
    Toby, welcome to the forum and I am sure you will get all the help you need. You have started off well by including the data sheets and circuit diagrams. Those items will assist the others in assisting you in the most expeditious manner. Good luck and let us know how your project comes out. I have a CNC Plaz so I know a little about what your trying to do but lack the electronics experience to help.
  3. SgtWookie


    Jul 17, 2007
    How much current did you plan on sending through the IR emitter side of the optocoupler?
    1.2k for R3 will give you around 20mA current, but you'll need to use resistors rated for 1 Watt (~22.7v*0.02A = 454mW, *1.6 for reliability = ~727mW, closest standard wattage is 1W)
    You might consider using 2.2k instead, and 1/2 Watt resistors.

    By the way, conventions for schematic drawings have more positive voltages near the top, more negative towards the bottom, and inputs from the left, outputs towards the right. If you rotate your schematic 180°, it'll be much closer to that standard.
  4. ttjarrett

    Thread Starter New Member

    Apr 12, 2011
    Bob, thank you for your welcome. I hope I can learn a lot here, and maybe even add to the knowledge if I can (big if)!

    SjtWookie, thank you for your help. I indented to send 20mA through the IR emitter side of the optocoupler, but didn't factor the power rating of the resistor. If my reading of your calculations are correct, are you attributing 1.3v to voltage drop across the optocoupler IR emitter (i.e. 24v - 1.3V = 22.7v)?

    To expand your advice (because I understand best by doing), if I limit the current to the opto IR emitter with a 2.2k resistor, I should see ~10mA to the IR emitter. The power over this resistor should then be 22.7v*0.01 = 227mW, *1.6 = ~363mW. Well within 1/2W. Is this correct?

    I have attached a second schematic and would appreciate any feedback. All GND points are now facing downwards and the optocoupler has been rotated to have the output to Pin 11 on the right of the schematic. I have also attached a LED to the emitter side of the schematic that will be illuminated when both switches are closed.

    Two questions I have for everyone are:

    1. Is R4 properly placed to act as a pull-down resistor for Pin 11 (Parallel Port input)?

    2. The data sheet of the optocoupler I have chosen states a CRT of min 100% to max 600%. If the IR emitter side of the opto is receiving 10mA, does this mean I should expect a current of between 10Ma to 60mA to be flowing to Pin 11 through the phototransistor of the opto? If so, does R3 need to exist?


  5. shortbus

    AAC Fanatic!

    Sep 30, 2009
    I know this doesn't answer questions for your design, but here is a CNC-BOB that you can see how they handle the problem;

    A lot of the CNC-BOB's don't even use opto-couplers now days. The stepper drivers themselves have opto-couplers built into them. And the BOB uses the 5V supply from the PC so no real reason to need the extra opto's.

    Is there a reason why you are using 24V for the limit switches? Most home made CNC's use the 5V from the breakout board to the limits.

    Do you know about A lot of knowledge from all over the world there. Mostly on home built and home converted machines.