Author Topic: Can I cable a GRBL Arduino to the parallel connector of my CNC controller?  (Read 20820 times)

Offline vtsteam

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6675
  • Country: us
  • Republic of Vermont
For the electronics experts out there -- I recently lost the second of my two ancient parallel ported laptops, used for LinuxCNC. No more parallel port computers suitable for the small space and very occasional CNC use.

So I decided to go to GRBL since I have a bunch of Arduino UNOs. I flashed one with GRBL, and then opened up the existing CNC controller, which consists of the usual breakout board, plus individual stepper drivers, and a power supply.

I first thought I'd replace the breakout board with the arduino, but rather than disturbing the existing wiring and parallel port setup, I am now wondering if I can just feed the Arduino's signals through the existing parallel port by using an existing parallel cable, cutting it, wiring to the Arduino, and plugging it into the existing controller?

I do know the pinouts for both the GRBL'ed Arduino, and the Centronics connector on the controller (ie, step direction, limit switch, etc.). I'm just wondering if the signal levels and isolation are compatible. I'm guessing (you would know better) that there are isolators on the breakout board in the controller already.

Well pictures are worth a thousand words they say, so here are a couple of the whole works, and the breakout board/parallel port:

(Thanks in advance for help!)

 


 
 

 


I love it when a Plan B comes together!
Steve
https://www.youtube.com/watch?v=4sDubB0-REg

Offline BillTodd

  • Hero Member
  • *****
  • Posts: 1160
  • Country: 00
  • Colchester Essex (where the lathes were made)
 Are the arduios 3v  or 5v ?  Are the optoisolators compatible with the  Arduino I/O?
Bill

Offline vtsteam

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6675
  • Country: us
  • Republic of Vermont
Hi Bill, the Arduino is a bog standard Arduino UNO, which as far as I know runs on any power supply between 7 and 12V, and can supply 5V as a source.

In GRBL setup mode, as far as I know, it can be direct connected to stepper drivers like the 3 boxes in my control unit without any opto isolators.

I've just taken a flashlight and a magnifying glass to the parallel port breakout circuit board and all the opto-isolators are a type 817S.

 
I love it when a Plan B comes together!
Steve
https://www.youtube.com/watch?v=4sDubB0-REg

Offline vtsteam

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6675
  • Country: us
  • Republic of Vermont
Well I'm going to rush in and tread where.... um I'm impatient....  :zap:

Okay so the first question is, are the opto-isolators going to be overdriven by the Arduino's outputs?

Let's say the Arduino is putting out 5V -- the 817 optoisolator can handle anywhere from about 5ma to 50 ma.

So I could hook up a variable power supply to one of the step or direction pins and slowly crank up the voltage from zero and see what the current draw is as I go, not to exceed 50ma. If I reach 5v, then I should be good to go on the step and direction pins. those are inputs

The switch pins are outputs and those are TTL level. I'll have to figure that out later. Right now I just want to get the steppers moving.
I love it when a Plan B comes together!
Steve
https://www.youtube.com/watch?v=4sDubB0-REg

Offline BillTodd

  • Hero Member
  • *****
  • Posts: 1160
  • Country: 00
  • Colchester Essex (where the lathes were made)
OK according to wiki Arduino UNOs are 5v so that's good .

Looking at the break-out board there appear to be resisters inline with the opto-isolators so , again , good.


The opto outputs (back to the arduino will probably need some pull-up current which should be supplied by the pin or a resister on the BO board.

Wooden legs are cheap.... so go for it
Bill

Offline vtsteam

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6675
  • Country: us
  • Republic of Vermont
 :lol: I like that expression, Bill! I have to remember that. Today I finally got my old hot wire foam cutter going again with an ancient program on an equally ancient laptop running windows XP. With that out of the way, I'm going to throw the switch tomorrow on the GRBL/Arduino parallel cable experiment and see whether I'll be in the market for a wooden leg. Actually, just, at worst, a spare arduino out of the box of them I have. Fingers crossed!  :zap:
I love it when a Plan B comes together!
Steve
https://www.youtube.com/watch?v=4sDubB0-REg

Offline BillTodd

  • Hero Member
  • *****
  • Posts: 1160
  • Country: 00
  • Colchester Essex (where the lathes were made)
That was one of Dave's (Dave Bickers)  favourite sayings, I thought it would have made a good title for his biography.

Bill

Offline AdeV

  • Madmodder Committee
  • Hero Member
  • *****
  • Posts: 2448
  • Country: gb
The max input voltage for the 817 opto isolators is 1.4v (with 1.2v typical)... however, an inline (series) resistor of ~370ohm will drop 5v to around that level. If you've got the eyesight & the dexterity - if you can get a multimeter onto one of the series resistors, you should be able to determine whether it wants 3.3v, 5v - with 5v the most likely.

The issue with the opto isolators only tolerating such a low voltage is you'll burn them out long before the Arduino lets out the magic smoke: But... given a standard parallel port can be expected to be 5v, I think you'll be safe enough.
Cheers!
Ade.
--
Location: Wallasey, Merseyside. A long way from anywhere.
Occasionally: Zhengzhou, China. An even longer way from anywhere...

Offline vtsteam

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6675
  • Country: us
  • Republic of Vermont
Thanks Ade! :beer: I didn't have the magnifying glass this afternoon, but spent a lot of time with a multimeter probing the parallel cable I have. It originally had a Centronics 36 pin connector at one end, and a DB25 at the other.

I chopped off the 36 pin end and will use the DB25 end. It was a really well made cable BTW. Heavy woven shield, then foil, then multicolored twisted pairs - 18 of pairs and a bare ground wire.

The pin assignments and colors worked out to:

Pairs:

white   17
white blk   25
   
pink brn   23
grey brn   15
   
purple brn 24
blue brn   13
   
orange brn 8
green brn    22
   
green   10
green blk   24
   
brown    3
grey red   19
   
yellow brn 20
red brn    5
   
yellow blk 10
yellow   9
   
brown         1
brown blk     18
   
blue      12
blue blk   13
   
yellow wht   21
orange wht   7
   
orange      6
orange blk   21
   
grey wht          25
purple wht   16
   
green wht   11
blue wht           23
   
red           4
red blk   3
   
red wht         19
brown wht   2
   
purple     14
purple blk  25
   
pink           N/C
pink blk   N/C

phew!  :coffee:
   
I love it when a Plan B comes together!
Steve
https://www.youtube.com/watch?v=4sDubB0-REg

Offline AdeV

  • Madmodder Committee
  • Hero Member
  • *****
  • Posts: 2448
  • Country: gb
Quote
white blk   25
grey wht          25
purple blk  25

Seems odd? Although I guess if it's got Centronics on the other end, that does make some sene, IIRC the Centronics connector was a 36 pin...
Cheers!
Ade.
--
Location: Wallasey, Merseyside. A long way from anywhere.
Occasionally: Zhengzhou, China. An even longer way from anywhere...

Offline vtsteam

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6675
  • Country: us
  • Republic of Vermont
I agree, Ade. There are also duplicates for 21, 23, etc. plus the two N/C wires. Well, 36 wires into a 25 pin connector are gonna yield 11 extras. I think there's multiple grounds on a DB25 parallel setup, too. 

Anyway, we're just going to use 12 of them. I tagged the necessary wires this morning with their functions, and trimmed the others back.

 
I love it when a Plan B comes together!
Steve
https://www.youtube.com/watch?v=4sDubB0-REg

Offline vtsteam

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6675
  • Country: us
  • Republic of Vermont
Well this was the temporary setup today, taped to the top of the CNC controller box and plugged into the parallel port.

 


I'd like to say it worked but, nope. Not a stepper motor peep out of it when everything was powered up, and I sent a jog command. None of the axes responded. No smoke either.

I suppose it could be that the limit switches aren't set right. I did check the Emergency Stop button. There is no wired "Enable" line on this CNC controller. Guess it was not considered necessary.

No detectable magic smoke was released during the test. Nothing happened at all.

Back to the drawing board. :(
I love it when a Plan B comes together!
Steve
https://www.youtube.com/watch?v=4sDubB0-REg

Offline vtsteam

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6675
  • Country: us
  • Republic of Vermont
Double checked wiring and it followed this pinout diagram, except no Enable/Disable, no spindle speed, and the Emergency Stop was connected to Reset/Abort pin -- the rest of those switches on the left side were omitted:

 
I love it when a Plan B comes together!
Steve
https://www.youtube.com/watch?v=4sDubB0-REg

Offline RussellT

  • Hero Member
  • *****
  • Posts: 535
  • Country: gb
Hi Steve

When you say there is no wired enable line on the controller, what do you mean?  If the stepper drivers have an enable pin as in the diagram you posted does that need to be pulled up?

If I were doing it I think the next step would be to check the outputs to your parallel port are doing what I would expect.

Good luck.

Russell
Common sense is unfortunately not as common as its name suggests.

Offline vtsteam

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6675
  • Country: us
  • Republic of Vermont
Hi Russell. :beer:

The stepper drivers are Keling k-4030 (no longer made) and as wired in the big controller box, there is no connection to any of them on the ENA+ and ENA- inputs. In other words, no wires to those terminals.

I boght this whole unit new many years ago. This CNC mill/router worked for me in the past, so I figure, the enable signals must not be needed.

Yesterday I got impatient and removed the parallel cable from the arduino, and removed the parallel breakout board from the controller. I soldered pins to all of the disconnected lines and plugged them into the arduino directly. I tried 3 kinds of software GRBL interfaces to try to get the mill going. The only one that worked was Universal Gcode Sender (UGS). Candle and GRB Panel, also tried, did not  . Unfortunately only the X axis was operational.

I did try changing the stepper lines to the controller box and established that the stepper motors for all 3 axes worked properly when connected to the X axis driver.

So troubleshooting is now focused on wiring the two Keling k4030 drivers alternately to the X axis output of the arduino -- if both then work I'll start looking at the arduino itself -- or maybe the power supply for it. I was feeding it 5 volts, but maybe that's not enough to generate a +5V signal on its outputs. Arduinos have a wide operational voltage range, but I think they might drop the signal lower than 5V if powered by 5v. I'll try a 9V power supply.

We'll get to the bottom of this. I bet when I do, it will turn out that the parallel cable would have worked, and it was other problems that prevented it.   :bang:
I love it when a Plan B comes together!
Steve
https://www.youtube.com/watch?v=4sDubB0-REg

Offline vtsteam

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6675
  • Country: us
  • Republic of Vermont
I added a 9 V power supply for the arduino. Upshot of testing this afternoon: motors and gantry all work, but two of the stepper drivers are bad.  :doh:

Time to order new ones. Presently the system has a 24V power supply w/ 8.3 amp output. The drivers are set at 2.7 amps each, 8 microsteps on 200 steps/rev nominal. So I have to find drivers that fit those specs.
I love it when a Plan B comes together!
Steve
https://www.youtube.com/watch?v=4sDubB0-REg

Offline vtsteam

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6675
  • Country: us
  • Republic of Vermont
Drivers ordered. Should be here Tuesday.
I love it when a Plan B comes together!
Steve
https://www.youtube.com/watch?v=4sDubB0-REg

Offline vtsteam

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6675
  • Country: us
  • Republic of Vermont
Well, ironic possible end to this story (maybe not): NO the motor drivers were not bad.

The impetus for this GRBL project was the loss of the old Thinkpad600e laptop I used to run the CNC mill.

Since I last wrote here, I was able to get the software off of the old Thinkpad's hard drive, and image that onto the hard drive of a Thinkpad T43 laptop. And then to get that laptop's latency down via a kernel patch, to be able to run the old LinuxCNC version I had always run with this CNC mill. The T43 has a parallel port.

I therefore removed the GRBL Arduino, replaced the old parallel port breakout board that I had removed, connected up the Thinkpad, and......surprise, surprise, everything just worked! No problem with two of the drivers -- they all worked. And happily cut aluminum as commanded.

Soooooo.....something was obviously wrong with the whole GRBL scheme. I don't know why it was so flakey, and worked with only one axis. I'm wondering if it was a timing thing? Step and direction pulse width? I know you could adjust those in at least one of the CNC programs I tried. Maybe it was set too short? I don't know. I've never successfully been able to get an arduino w/GRBL going consistently.

By comparison, the LinuxCNC seems completely stable and usable.

I don't have a pressing need for the GRBL conversion now, but I get curious about this kind of stuff. I still wonder if the adapted cable would have worked, if indeed the only problem was a pulse width setting, and not the conversion itself?

Hard to let that go, even though I don't need to find out any more....

ps. I now have 4 additional brand new stepper drivers that I don't absolutely need.  :bang:

I love it when a Plan B comes together!
Steve
https://www.youtube.com/watch?v=4sDubB0-REg