initialization

If you have a question about the software please ask it here.

Re: initialization

Postby Sailor » Fri Nov 03, 2017 6:23 am

I have decided to cause a delay in the powering of the circuits that are connected to my BOB which is totally unisolated but will be feeding the c83 board which has optoisolators and buffers in it. The C83 will also have its UC100 side power delayed as well. The BOB I have, as I mentioned previously, is basically a straight through connector DB25 to DB25 with some filtering and some pull-up resistors for the inputs as well as a 5VDC connection. I will parallel this 5 volts to the 5 volts on the C83 BOB side. I will provide a separate 5 volts to the BOBs UC100 side. Both of these supplies will be delayed by some length of time in order for the UC100 to connect and initialize with the PC. I think that happens when the PC is powered up and before log on. If so then I will only need to sense the USB power and delay a second or two before enabling the other two 5VDC sources. I can toy around with the delay to see what works. This configuration should eliminate any potential ground loops as well as preventing the circuitry from back powering the UC100.

We get spoiled when for the most part we plug something in and it works and works. This problem reminded me of how much I just expect things to function as I expect them too and how quick I was to jump on the MC being the problem when it really appears to be a timing of the power sources coming online.

I really appreciate all the suggestions and insights each of you provided to help resolve this problem.
Sailor
 
Posts: 27
Joined: Thu Oct 26, 2017 4:10 pm

Re: initialization

Postby Sailor » Sat Nov 04, 2017 9:46 pm

Robertspark wrote:Sailor

Which bob are you using do you have a webpage link?

Rob, I purchased my drive and BOB from Xylotex http://xylotex.netfirms.com/OSCommerce/ ... cts_id=111. The box shown is similar to the one I got from them 3 + years ago, mine only has one DB25F connector. If you go to the site and scroll down, you will see the BOB I have, they no longer offer that board. It essentially is a straight through board with the typical CNC connections connected to a terminal strip. Additionally, it provides some pull up resistors a connector for 5VDC and some anti-bounce capacitors on the inputs as well. Pins on terminal strip are 1,10,11,12,13,14,15,16,17 and ground.
I put this board on the BOB side of the C83 board and connected the MC to the other side, nothing worked, could not get the Mach 3 out of E-Stop. I am going to reverse the active low to active high to see if that resolves the problem. I am powering the MC side of the C83 from a USB connection and the BOB side from a 5 VDC 1 Amp Power Supply. Will try to get inputs working first as I can test all them in E-Stop. The C83 should provide all the isolation I need and the BOB such as it is should A) allow the switches to be recognized and utilized in their proper mode and B) allow the stepper controller to function with the correct inputs.
Sailor
 
Posts: 27
Joined: Thu Oct 26, 2017 4:10 pm

Re: initialization

Postby Sailor » Sat Nov 04, 2017 10:20 pm

Interesting, I made the E-Stop active high from active low in the input config for ports and pins. That bypassed the problem with not coming out of e-stop. (not a permanent fix) The LEDs on the C83 for the inputs all respond to switch transitions they go on and off as the input dictates, however, the Mach-3 is not seeing the transitions and is staying in the same state. Testing of Steppers. I tested the movement of all axises and all moved properly, output LEDs changed based on the commanded direction so it appears the output portion of the system is working. If I remove the C83 everything works, (just have to reset the E-Stop active level). The input circuitry is so simple, I will just have to trace out and do some measurements. Halfway there I guess.
Sailor
 
Posts: 27
Joined: Thu Oct 26, 2017 4:10 pm

Re: initialization

Postby Sailor » Sun Nov 05, 2017 12:04 am

In checking, on the motion controller side, I only get a change from .2 volts to about 1.16-1.20 volts when activating a limit switch. I was only getting about .2 to about .58 volts when using a separate USB connection, so I switched to a 5 VDC Power supply with 700 ma of source current capability. I checked the 5VDC and it was rock solid, I guess I better check the same pin on the breakout board side to make sure that it is going low enough to fully drive the output. It is going from about 3.3 VDC to .01VDC, so it is working just fine. I am using just one channel, I think it is pin 4 on the ribbon cable connector, could be pin 3, in either case it is switching just fine with the X axis LS closing and opening, however, the corresponding pin on the output of the optical isolator is only transitioning to about 1.2 volts from about .2 VDC, need at least 2 VDC or better to be active high. Not sure what I can do about that at this point.

Ken
Sailor
 
Posts: 27
Joined: Thu Oct 26, 2017 4:10 pm

Re: initialization

Postby Sailor » Sat Dec 02, 2017 8:00 pm

Sorry for the long delay in responding as well as the long response as well. I was afraid to run the machine with my old BOB because CNC4PC said there was a good chance that the replacement Motion Controller would blow because of a "probable ground loop". I did use it on very limited occasions but it took me a month to come up with the below solution.

I actually changed the entire setup. I purchased the C-83 isolating board and installed it. It uses two separate power supplies, one for the motion controller side and one for the machine Side. The steppers all worked just fine, but none of the inputs worked, inputs were pulled up to 5VDC and grounded when activated. The input on the motion controller side would not go below 1 volt when activated. I tried everything I could, found that on one input if I paralleled the output of the optocoupler to the ground with a 1K resistor, it would work, but that solution did not work for the other 4 inputs. After hours of working on this, I created a similar circuit using 817C isolators and I got the same result, the output of the isolators would not go low enough to signal a low active level (<.8V). I thought about it quite a bit and decided that the goal was to not have the input switches common to the stepper motor's common , I was told to prevent ground loops, so I powered the switches from the motion controller side 5VDC source and ground, thus isolating the input switches, and then removed the 5 optocouplers, one quad isolator, and one single isolator chip from the circuit board. I directly connected the switches inputs to the respective pins on the IDC 26 connector and everything worked as it should have. Pin 14 which is an output for the spindle needed to be externally connected as well to pin 2 of the IDC 26 on the stepper motor side.

CNC4PC told me that the concern was a ground loop between the steppers the motion controller and the BOB I had. Unless an isolating transformer is used, a ground loop is possible in any similar system as the PC is connected to the 110VAC bus and ground as well as the stepper motor power supply with the motion Controller connected to the PC ground which is connected to the Steppers ground. Possible pulses on the stepper motor ground could be felt on the motion controller as well. The 5VDC supplies I am using are in fact isolated from ground so the common, or negative lead, is not common the other 5VDC supply.

Lastly, I installed a NANO microcontroller circuit to delay powering the isolators 5VDC circuits for 5 seconds to give the Motion Controller time to initialize with the PC when powering on. A pair of relays connects the hot leads for each supply when activated. I could have done this many different ways but wanted to experiment with the UNO.

The machine is fully operational now and I feel reasonably confident that the "possible ground loop problem" does not exist in this configuration, not that I think it ever did, but just to be safe I went ahead and did this.
Sailor
 
Posts: 27
Joined: Thu Oct 26, 2017 4:10 pm

Re: initialization

Postby cncdrive » Sun Dec 03, 2017 5:23 pm

I see 2 possibilities why an output of the optoisolator would not go down enough, close to 0Volts.
1.) The output (collector) of the optocoupler is pulled up too strong.
2.) The input LED of the optocoupler is driven too weak.

An optocupler like the 817C is basicly a transistor with a photo-sensitive base. The current driven into the LED creating light and that drives the photo sensitive base of the receiver NPN transistor.
The higher current you driving the optocoupler LED with the higher current can flow into the base of the transistor and so the higher current can flow through the NPN junction.

The minimum guaranteed CTR (Current Transfer Ratio) of the particular 817C optocoupler is 50% at 5mA LED current.
This means that only 50% current of the LED is guaranteed to be able to flow through the NPN junction of the output transistor.
So, if you driving the LED with 5mA then it is guaranteed that at least 2.5mA of current can flow through the NPN junction.
And so, if you pulling the collector up too strong, if the pullup resistor is as low as that the transistor would require to drive more current through the NPN than the mentioned 2.5mA (in this example) then the transistor will be unable to pull the output fully to the 0Volts and the collector voltage will be higher than 0Volts.

I would try to not use any external pullups on the 817C, because the UC controllers internally have 4700 Ohms pullups on the inputs to 5Volts and would try to drive the LED with about 5-10mAmps.
Take into account when placing the series resistor for the LED, that the max. forward voltage of this optocoupler's LED is 1.4Volts.
So, if calculating and selecting the series resistor for the LED then calculate with the driving voltage minus 1.4Volts.

The situation and calculations are even a bit more complex than how I described, but I could probably write full a few A4 pages if I wanted to describe the working of an optocoupler in full details, but since I'm not here to give electric engineering lectures I will stop the description keeping it as simplified as possible. :) I think I wrote down the most important things which are required for you to make the optocoupler circuit work.


A "ground loop" is a general term for having more than one return path for the electric current.
A ground loop will be not created for the UC100 if the BOB is fully isolated and for the UC100 side only the same USB power is used which comes via the UC100 cable.
If forexample you trying to use a circuit which using an external power supply with a commoned ground point with the UC100 ground then that can create a ground loop,
because the electric current can return throguh the ground wire of the UC100 USB cable and the other path is the ground wire of the external PSU.
So, a ground loop can be avoided to be done for the UC100 with not connecting a common grounded PSU to it externally, but use a BOB which do the isolation without an external power source.

Ofcourse the BOB has to have an external power source on the isolated side and for that do not use USB power from the same computer, because however that will not create a ground loop for the UC100, but could possibly bring noise into your computer and it could create ground loops for the computer if the BOB or it's wires gets grounded somewhere else, e.g. into the machine frame, control box, which is PE grounded...
cncdrive
Site Admin
 
Posts: 4695
Joined: Tue Aug 12, 2014 11:17 pm

Re: initialization

Postby Sailor » Sun Dec 03, 2017 7:48 pm

I really appreciate your input, it helps me to better understand what needs to be looked at.

Then, are you suggesting (for the grounding), that I use the USB as the source for my UC and the MC side of the isolator board? That would power the invertors that feed the optoisolators for the steppers and the spindle drive. Although, I will be using the spindle output to an input on my Arduino Nano which will delay the spindle enable for 5 minutes after power-up of the PC. I have my spindle, router, starting for a second or less, two times during the boot-up of the PC and initial log on. I also delay powering the isolator board for 5 seconds to allow the UC to initialize. I was having a problem sometimes when the UC would not initialize and it was suggested that I not power the inputs until after the UC initialized.

With this UC, I haven't seen that problem, but with the first one which was defective, I did see it often.

Although I am not using optoisolators for my inputs, the power to the switches will be the same supply that powers the UC, including the ground. I like that better than the two independent 5VDC sources I currently have configured.

The input circuit for the LED on the isolators on the isolator board has 330 ohms on the anode side of the LED and the cathode then either went to ground directly by a switch or through another 330-ohm resistor and LED(display) to ground, that fed the transistor which had a 1K pull-up resistor on the output. I would have thought that the 330-ohm resistor then the photo-diode being connected to ground would have had enough current to drive the transistor. The 330-ohm LED combination plus the 330-ohm resistor on the anode side probably easily limited the current to keep the transistor off.
Sailor
 
Posts: 27
Joined: Thu Oct 26, 2017 4:10 pm

Re: initialization

Postby cncdrive » Sun Dec 03, 2017 8:36 pm

Then, are you suggesting (for the grounding), that I use the USB as the source for my UC and the MC side of the isolator board? That would power the invertors that feed the optoisolators for the steppers and the spindle drive. Although, I will be using the spindle output to an input on my Arduino Nano which will delay the spindle enable for 5 minutes after power-up of the PC. I have my spindle, router, starting for a second or less, two times during the boot-up of the PC and initial log on. I also delay powering the isolator board for 5 seconds to allow the UC to initialize. I was having a problem sometimes when the UC would not initialize and it was suggested that I not power the inputs until after the UC initialized.


If you using optocouplers like I described with not using any external power source on the UC side then it is not even possible that you powering the inputs of the UC before the UC gets it's power, because the power which connects to the inputs also comes from the same source which is the USB cable of the UC100.
So, you do not have to delay anything, because the scenario you described is not possible if you follow my advice in my previous post.
Please realise that you do not need an active 5V power source on the UC side, because the inputs are internally pulled up (same way as with an LPT port) and the outputs are push-pull (totem-pole) driven all getting their 5V power via the USB cable.

Although I am not using optoisolators for my inputs, the power to the switches will be the same supply that powers the UC, including the ground. I like that better than the two independent 5VDC sources I currently have configured.


I strongly recommend not doing this.
First of all because you don't want the long cables in the noisy environment to pick up noise and carry them back to the UC.
Second in case of an accidental cable cut or ESD charge of components connecting to the wires, if the cables get a high voltage shock could possibly cause a damage to your UC and to even your computer.

The input circuit for the LED on the isolators on the isolator board has 330 ohms on the anode side of the LED and the cathode then either went to ground directly by a switch or through another 330-ohm resistor and LED(display) to ground, that fed the transistor which had a 1K pull-up resistor on the output. I would have thought that the 330-ohm resistor then the photo-diode being connected to ground would have had enough current to drive the transistor. The 330-ohm LED combination plus the 330-ohm resistor on the anode side probably easily limited the current to keep the transistor off.


If you used 5Volts to drive the LED (I mean this info was missing) then that drives your opto LED with about 11mAmps. Calculating with a 50% CTR it will be avout 5.5mAmps max current on the output transistor.
Using a 1k pullup resistor on the collector of the output transistor together with the 4.7k resistor inside the UC, the sum of resistance is about 824 Ohm which pulls the output to 5Volts with about 6mAmps of current.
So, these values are on the edge of the working/not working stage.
If you used 330R in series with the anode and also one in series with the cathode then the situation is much worse.

I advice to try one 330R series resistor to drive the LED (anode or cathode connected does not matters, but use only one resistor) and connect the output transistor collector to the UC input without adding any external pullup resistors, the internal 4.7k pullup inside the UC will do it's job.
cncdrive
Site Admin
 
Posts: 4695
Joined: Tue Aug 12, 2014 11:17 pm

Re: initialization

Postby Sailor » Mon Dec 04, 2017 2:05 am

Sailor wrote:I advice to try one 330R series resistor to drive the LED (anode or cathode connected does not matters, but use only one resistor) and connect the output transistor collector to the UC input without adding any external pullup resistors, the internal 4.7k pullup inside the UC will do it's job.

The isolator board that I received from CNC4PC uses the circuit I described for input to the UC. If you draw the circuit out you will see that the switch when activated connects the cathode of the isolator to ground and essentially shorts out the display LED and 330-ohm resistor. The Led is lit only when the switch is open and it is then pulled up to +5VDC via the opto led and the 330-ohm resistor tied to + 5VDC.
The output transistor collector is wired to the 1K resistor on the board.

Sailor wrote:Please realise that you do not need an active 5V power source on the UC side, because the inputs are internally pulled up (same way as with an LPT port) and the outputs are push-pull (totem-pole) driven all getting their 5V power via the USB cable.

The 5VDC is needed on the UC side of the isolator board because the outputs of the UC feed the Schmidt Trigger invertors (74HC04) that then feed the LED of the optoisolators. Thus that side needs to be powered and it is plugged directly into the UC. Unfortunately, that is the design of the C83 isolator board and it states that two power sources are needed. The normal setup of this is that the other side of the board goes to a breakout board but mine goes directly into the stepper motor controller via the second DB25 connection.

UC -->> ISOLATOR BOARD -->> STEPPER CONTROLLER I did have it as UC -->> ISOLATOR BOARD -->> BOB -->> STEPPER CONTROLLER, with the switch connections on the BOB, but as I said earlier I could not get the optoisolators to go to a logic 0. I will try your suggestions on a test board and see if it all comes together if so I have the means to make it better. Since I removed the optoisolators on the C85 anyway, I can build a board with the 5 isolators on it, only have one pull-up or pull-down resistor on the input of the isolator and skip the display led and not have any pull-up resistors on the transistor's output. I would use the UC to source the output side of the isolators.
Perhaps I should use a 220-ohm instead of a 330-ohm resistor to ensure saturating the diode and transistor with enough current?
Sailor
 
Posts: 27
Joined: Thu Oct 26, 2017 4:10 pm

Re: initialization

Postby Sailor » Sat Dec 09, 2017 6:26 am

Been out of town, and now my daughters in the floor (cement) heating line has developed a leak, that takes priority in testing the optoisolator circuit change suggested earlier.
Sailor
 
Posts: 27
Joined: Thu Oct 26, 2017 4:10 pm

Previous

Return to Ask a question from support here

Who is online

Users browsing this forum: No registered users and 3 guests