can CRAMPS X_STEP/X_DIR,... drive 4N26 optoIsolator

54 views
Skip to first unread message

Doug LaRue

unread,
Jun 30, 2019, 1:38:18 PM6/30/19
to Machinekit
I have a 3040T 4 axis CNC and currently have grbl on an Arduino Nano connected to the DB25.  

I was wondering if anyone has tried Machinekit on a CRAMPS board driving the DB25 directly instead of going inside the control box and replacing things.  The DB25 has opto isolators on the DB25 inputs. 
Probably more of a question for Charles unless someone else is familiar with the drive capabilities of the BBB and input bufffering of CRAMPS. 


DB25P wirings:
From Vide CNC LPT Pinout
db25 Pin Description
 1   A Enable
 2   X Step
 3   X Direction
 4   Y Step
 5   Y Direction
 6   Z Step
 7   Z Direction
 8   A Step **
 9   A Direction **
10  Reset / Abort / E-Stop
11  Z limit( Mach 3 video =X)
12  Y limit( Mach 3 video =Y)
13  X limit( Mach 3 video =Z)
14  X Enable
15  Probe
16  Y Enable( Mach 3 vidoe =Output1)
17  Z Enable
18 - 25 Ground 



GRBL_Arduino_Nano_DB25_CNC_1.jpg


Charles Steinkuehler

unread,
Jun 30, 2019, 3:46:29 PM6/30/19
to machi...@googlegroups.com
You should be able to hook to the DB25 directly vs. digging into the
control box, but you'll likely need some buffering. The BBB I/O pins
are only rated for 3.3V with 3-6 mA drive (depending on the pin),
which isn't really enough to directly drive an opto.

The CRAMPS board doesn't really help a lot, since it doesn't buffer
the step/dir lines (the small Pololu stepper drivers don't present
much load on the step/dir pins).

I'd recommend one of two options:

* Create your own DB25 cape for the BBB using a prototype cape and a
generic buffer like a 74HCT245 or something. There aren't a lot of
wires so it shouldn't be much harder than the "flying wire" adapter
you made for the Nano. :)

* Create a small Pololu sized buffer board that drives the step/dir
signals onto the 4-pin stepper motor header. This would let you use
the CRAMPS board (or any other board that used the Pololu style
drivers). I've thought this would be a good open-source project, and
would be useful for *anything* that uses the Pololu style drives (not
just BBB based capes) and would allow safely driving larger stepper
motor drivers.

Good luck!
--
Charles Steinkuehler
cha...@steinkuehler.net

Doug LaRue

unread,
Jun 30, 2019, 5:34:48 PM6/30/19
to Machinekit
On Sunday, June 30, 2019 at 12:46:29 PM UTC-7, Charles Steinkuehler wrote:
You should be able to hook to the DB25 directly vs. digging into the
control box, but you'll likely need some buffering.  The BBB I/O pins
are only rated for 3.3V with 3-6 mA drive (depending on the pin),
which isn't really enough to directly drive an opto.

So very much like the ESP32/Grbl-esp32 which got me started down this path.  3.3V GPIO little drive capability
 

The CRAMPS board doesn't really help a lot, since it doesn't buffer
the step/dir lines (the small Pololu stepper drivers don't present
much load on the step/dir pins).

I'd recommend one of two options:

* Create your own DB25 cape for the BBB using a prototype cape and a
generic buffer like a 74HCT245 or something.  There aren't a lot of
wires so it shouldn't be much harder than the "flying wire" adapter
you made for the Nano.  :)

That might not be a bad idea and I think I have a BBB prototyping Cape 
somewhere.  But the 4n26 opto isolators are rated at 60mA and selecting
the level shifter or line driver is where I'm stuck right now.

I have some TXS108E bi-directional level shifters with 50ma drive capabilities
but was told the pull-up instead of drive-up could be problematic.

I might have some 74HCT245's here so can test the ~20mA drive capability
with respect to the opto-isolators.

And I might build a more generic board onto an DB25P so I can swap in/out 
the Nano, ESP32 and BBB. It might take those imported CNC machines through
3 levels of capabilities with BBB/Machinekit the ultimate.
 

* Create a small Pololu sized buffer board that drives the step/dir
signals onto the 4-pin stepper motor header.  This would let you use
the CRAMPS board (or any other board that used the Pololu style
drivers).  I've thought this would be a good open-source project, and
would be useful for *anything* that uses the Pololu style drives (not
just BBB based capes) and would allow safely driving larger stepper
motor drivers.

I wish there were 5V on that driver pinout.. I suppose there could be a
jump on the Vcc pin to bring in something other than 3.3V. With only 3
lines a small quad channel shifter would do the trick. Still need to find
what the 4N26 requires to turn on though.  Interesting.

Thanks for the feedback and ideas.

Charles Steinkuehler

unread,
Jun 30, 2019, 6:05:29 PM6/30/19
to machi...@googlegroups.com
The 60 mA is an *Absolute Maximum Rating*, not what you should be
driving them with consistently! A typical drive current for the LED
when "on" would be 10 mA, and most 4N26 data sheets specify transfer
curves with 5, 10, and 20 mA forward current through the LED.

> And I might build a more generic board onto an DB25P so I can swap in/out
> the Nano, ESP32 and BBB. It might take those imported CNC machines through
> 3 levels of capabilities with BBB/Machinekit the ultimate.

Sounds like a great idea!

>> * Create a small Pololu sized buffer board that drives the step/dir
>> signals onto the 4-pin stepper motor header. This would let you use
>> the CRAMPS board (or any other board that used the Pololu style
>> drivers). I've thought this would be a good open-source project, and
>> would be useful for *anything* that uses the Pololu style drives (not
>> just BBB based capes) and would allow safely driving larger stepper
>> motor drivers.
>>
>
> I wish there were 5V on that driver pinout.. I suppose there could be a
> jump on the Vcc pin to bring in something other than 3.3V. With only 3
> lines a small quad channel shifter would do the trick. Still need to find
> what the 4N26 requires to turn on though. Interesting.

I'd just set the motor power to 5V.

Or you could put a small 5V regulator on the board...a 78L05 is pretty
inexpensive. :)

...but yeah, it would be nice if there was an available 5V supply in
the Pololu pinout, but oh-well. :-/

--
Charles Steinkuehler
cha...@steinkuehler.net

Doug LaRue

unread,
Jun 30, 2019, 6:26:53 PM6/30/19
to Machinekit

The 60 mA is an *Absolute Maximum Rating*, not what you should be
driving them with consistently!  A typical drive current for the LED
when "on" would be 10 mA, and most 4N26 data sheets specify transfer
curves with 5, 10, and 20 mA forward current through the LED.

You nailed it.  I just found this nice write-up on the 4N26 and it looks like
6-10mA is the sweet spot and lots of level shifters and drivers will do that.
 
I'd just set the motor power to 5V.

Perfect!  The boards will have those inputs already and since we're talking about not using onboard drivers, this could work.
I see the only problem being where there might be 3 local pololu drivers used and the 4th needs the offboard driver.
 

Or you could put a small 5V regulator on the board...a 78L05 is pretty
inexpensive.  :)

and wouldn't be dumping much waste heat since this is all low current stuff.

Doug LaRue

unread,
Jul 1, 2019, 11:10:12 AM7/1/19
to Machinekit
Hmm, I wired up the TXS0108E level shifters to a 3.3V Arduino Pro Mini and while it shifted to 5V correctly, 
when connected to the DB25 it could not pull the pins low.  Eliminated that part it would seem.

Charles Steinkuehler

unread,
Jul 1, 2019, 11:34:59 AM7/1/19
to machi...@googlegroups.com
Those parts are FET based pass transistor level converters. They use
the series FET and gate bias logic to protect against high voltage,
but they do not provide actual buffering or additional pull-down
current capability.

Go with a generic 'HCT part and you should have plenty of drive
capability to turn on the opto.
--
Charles Steinkuehler
cha...@steinkuehler.net

justin White

unread,
Jul 1, 2019, 11:35:53 AM7/1/19
to Machinekit
Are you pulling the OE pin of the tsx0108 to ground with a suitable pull down resistor? If this pin floats the output pins are likely to float as well when not driven high. Are you using the ground pins of the db25 to tie the commons together with your Arduino or whatever?

Jeff Pollard

unread,
Jul 1, 2019, 12:15:57 PM7/1/19
to Machinekit

Hi,

  I have an a simple interface board that outputs signals on a DB25 connector that plugs in to the BBB header.
  They are buffered by LVC series chips and work well for driving optos such as 6N137.
  If interested, you can get more info here:


Jeff

Doug LaRue

unread,
Jul 1, 2019, 1:48:58 PM7/1/19
to Machinekit
On Monday, July 1, 2019 at 8:35:53 AM UTC-7, justin White wrote:
Are you pulling the OE pin of the tsx0108 to ground with a suitable pull down resistor? If this pin floats the output pins are likely to float as well when not driven high. Are you using the ground pins of the db25 to tie the commons together with your Arduino or whatever?

Yes, I pulled both TSX0108 chips OE to ground( but not through a pull down ).
I've also tied the DB25 gnds to the Arduino in 2 places and tied those grounds to the ground of the 5V supply.  Everything should know where/what ground is. 
Charles, explained it being the design of the part which does not provide pull down capabilities.

I was about to order a few 74HCT245 parts.  Still might just to have onhand. I ordered one of Jeff's boards.

Doug LaRue

unread,
Jul 1, 2019, 1:53:41 PM7/1/19
to Machinekit
You got me Jeff!  I have one 74LVC245 pulled out and was ready to prototype and was about to order a few 74HCT245's to try and have on hand.
I checked the pinout and it looks perfect!

I'm looking forward to trying it out.

Doug
Reply all
Reply to author
Forward
0 new messages