Opto Isolator for P-Stop

67 views
Skip to first unread message

Jake

unread,
Jun 7, 2013, 4:07:07 PM6/7/13
to jetty-f...@googlegroups.com
I'm slowly working on the P-Stop circuit for my Rep2X.  I have the header on order to solder to the unpopulated ENDSTOPS_2, at which point I can start exploring for the P-Stop input.  (I've done some with the multimeter, so I have a good idea where to start)

I have been thinking that I'd like to opto-isolate the Mightyboard from the P-Stop input.  I have some Sharp PC817 in the drawer, so I chose that.


I am hoping some of the experts here might be able to tell me if this looks like a good idea or not.  Basically, a 1.5k pull-up resistor  to the P-stop input.  The optoisolator pulls this down to ground when activate.

As far as I can tell, this should be safe.  Worst case, if the Atmega 1280 were misconfigured accidentally and J0 was set as a LOW output, it would need to sink about 3.3mA through the resistor, which seems reasonable to me.

Under this setup you would need an external power supply to power the "external" side of the optoisolator, an added effort, but necessary to keep the Mightyboard isolated.

Anyway, just want to see if anyone has any thoughts and if I'm missing something obvious.

Robert Trescott

unread,
Jun 7, 2013, 6:03:49 PM6/7/13
to jetty-f...@googlegroups.com, Jake
Jake, that 1.5K pull-up is pretty hard to sink and likely is a lot more than you need.
4.7K - 10K for R2 is more reasonable.

Unless you have some super long leads from the P-Stop switch, you could skip the opto and drive the switch to ground with the 1.5K pullup.
I'd probably even stick a 0.1uf cap across the switch to keep noise at bay.

If you want to really stay safe, try adding a 100 ohm in series with the PSTOP JO line. That way, if the controller decides to go crazy and make JO an output, the current limiting series resistor will keep that pin from going into overload.

Opto-isolators are really good for translating ground loops and power supply potentials, but using one "just because" doesn't assure maximum protection. In most cases, simplicity yields the fewest parts to fail. IMHO... -Robert

 


--
You received this message because you are subscribed to the Google Groups "Jetty Firmware" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jetty-firmwar...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Jake

unread,
Jun 7, 2013, 6:24:05 PM6/7/13
to jetty-f...@googlegroups.com, Jake
Robert, 

Thanks for the reply.  Yeah, Jetguy also suggested I was over-thinking things, so perhaps just a resistor, a switch, and a cap is all that's needed.

I'm was a bit paranoid about the Mightyboard's fragility.  I know that the RevG is very different and better than the older Mightyboards that had ESD and voltage regulator issues.  Since I had the opto's on hand, I thought it might be a good idea to keep the "outside" of the machine opto isolated from the "inside".  If I recall, the ATMEGA has internal ESD protection so I guess zapping the microcontroller with a shock to the P-Stop line is probably not a concern.

Simple is better I guess.  I'll play with it more once the headers and housings arrive.

Right now I'm just planning a NO mushroom push-operator.  Eventually, might put some logic gates in there to hook up multiple inputs, if someone comes up with a good filament monitor or some other reason for externally triggering the P-stop.

Jetguy

unread,
Jun 8, 2013, 2:46:44 AM6/8/13
to Jetty Firmware
Just remeber what i shared with you about the P-Stop.
The pin MUST be pulled high externally, the internal pullup is
disabled on purpose by the firmware. If you do not do this external
pullup and enable P-stop via the menu system or onboard preferences
then you cannot print, the bot will pause as soon as the print begins.
This was done as a safety check to ensure a P-Stop device was actually
plugged in.

You can use an N.O. normally open switch that then grounds the sense
pin when closed, provided you also provide something like a 4.7k
pullup resistor from a 5 volt source.

To recap, the pin expects 5 volts is a non-tripped position and must
be powered that way from the 5 volt rail. Grounding the sense pin is
the trip which causes a pause.
It's only sensing the pin, after the print starts.

Normal MakerBot gen4 endstop switch do assert the sense pin high so
plugging in a normal endstop switch will work as expected. A typical 2
wire endstop switch in theory also would work, but instead, you would
use a N.C. normally closed contact from 5 volts via a 4.7k resistor
and then let the internal pulldown pull the pin low when the switch is
opened by contact or whatever.

You can also use a 2 wire N.O. switch but, it's really 3 wire at the
motherboard with the 4.7K there and then only ground and the sense pin
going to the switch.
> > <https://lh5.googleusercontent.com/-35yAYqfTgFA/UbI9M5eDFeI/AAAAAAAAAP...>
>
> >  I am hoping some of the experts here might be able to tell me if this
> > looks like a good idea or not.  Basically, a 1.5k pull-up resistor  to the
> > P-stop input.  The optoisolator pulls this down to ground when activate.
>
> >  As far as I can tell, this should be safe.  Worst case, if the Atmega
> > 1280 were misconfigured accidentally and J0 was set as a LOW output, it
> > would need to sink about 3.3mA through the resistor, which seems reasonable
> > to me.
>
> >  Under this setup you would need an external power supply to power the
> > "external" side of the optoisolator, an added effort, but necessary to keep
> > the Mightyboard isolated.
>
> >  Anyway, just want to see if anyone has any thoughts and if I'm missing
> > something obvious.
>
> >  --
> > You received this message because you are subscribed to the Google Groups
> > "Jetty Firmware" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to jetty-firmwar...@googlegroups.com <javascript:>.
> > For more options, visithttps://groups.google.com/groups/opt_out.

Jake

unread,
Jun 11, 2013, 7:05:00 PM6/11/13
to jetty-f...@googlegroups.com
I've been playing with the P-Stop on my Rep 2X.  I have some questions.

When I have P-stop enabled in the settings, the Z-axis does not work.  I can jog X and Y but not Z, and when I run a program, it acts as if X and Y are working but Z does not.  Is this normal behavior?

Second, I originally tried J0 as the P-stop input (or what I suspect is J0) but then I double checked and it should be J2.  In both cases, the pin is HIGH (5v) as if it is being pulled up.  I don't show it as floating or LOW with my fluke.  Maybe "floating" does show up as high, I don't know.  However, I am suspicious, and before I go grounding things through a resistor, I wanted to check-in here.  One note, is that with the bot off, this pin (which I suspect is J2) is NOT continuous with GND or 5V, meaning that it has to be coming from an I/O pin somewhere.

Dan Newman

unread,
Jun 11, 2013, 7:19:43 PM6/11/13
to jetty-f...@googlegroups.com

On 11 Jun 2013 , at 4:05 PM, Jake wrote:

> I've been playing with the P-Stop on my Rep 2X. I have some questions.
>
> When I have P-stop enabled in the settings, the Z-axis does not work. I
> can jog X and Y but not Z, and when I run a program, it acts as if X and Y
> are working but Z does not. Is this normal behavior?

That shouldn't happened, but you're likely the first person to try the P-Stop
on a Rep 2 or 2X.

I see what's happening. There's a cut-n-paste error in the Rep2/2X specific
Configuration.h file for the P-Stop and it's using L0 when it should be using
J2. And, L0 is the Z stepper enable…. L0 is what is used on the Rep 1 and
that's where the code was cut and pasted from. Since I wasn't willing to
poke at my Rep 2's motherboard, I wasn't able to test this myself.

I'll get you a new .hex file in a few minutes.

Dan

Dan Newman

unread,
Jun 11, 2013, 8:14:57 PM6/11/13
to jetty-f...@googlegroups.com
> Second, I originally tried J0 as the P-stop input (or what I suspect is J0)
> but then I double checked and it should be J2. In both cases, the pin is
> HIGH (5v) as if it is being pulled up. I don't show it as floating or LOW
> with my fluke. Maybe "floating" does show up as high, I don't know.
> However, I am suspicious, and before I go grounding things through a
> resistor, I wanted to check-in here. One note, is that with the bot off,
> this pin (which I suspect is J2) is NOT continuous with GND or 5V, meaning
> that it has to be coming from an I/O pin somewhere.

It is J2 and it appears to be floating high on my Rep 2, even when I've
enabled P-Stop support and the code is no longer enabling the pull up
resistor. But it could just be a side effect of the board's design that
it floats high. The Rep 2's motherboard is a more polished design than
the Rep 1 and so I would not at all be surprised if it behaves differently
in a variety of ways.

Dan

Jake

unread,
Jun 12, 2013, 7:44:19 AM6/12/13
to jetty-f...@googlegroups.com
So your new build fixes the Z-motor enable problem, but I'm guessing you know that and tested it yourself already.

Whatever is causing the pin to float high is keeping the P-stop from triggering.  I can run a program fine with the P-stop enabled and nothing connected to the J2.

I tried grounding the pin with a few different resistors and I couldn't get it to trigger. Does the P-stop poll for change or is it using an interrupt?  Just curious. I'm not keen on doing any more than just brushing pin to ground without knowing where that pull-up voltage is coming from, so if its a poll.

Also, there is a surface mount capacitor across the input pin and ground (verified with meter)  I don't know what the cap's value is, but if the pin is getting pulled up to 5v somehow, then that capacitor might need to discharge before the p-stop triggers, and a brush against ground might not be enough time to discharge/trigger

Dan Newman

unread,
Jun 12, 2013, 10:05:50 AM6/12/13
to jetty-f...@googlegroups.com
> Whatever is causing the pin to float high is keeping the P-stop from
> triggering. I can run a program fine with the P-stop enabled and nothing
> connected to the J2.

No clue offhand what could be keeping it high. Same identical code runs
fine on Rep 1s. Only problem on the Rep 2/2X was the wrong pin was used
(L0 instead of J2). It may be that something is wrong and the interupt
vector (PCINT1 which handles PCINT8 - PCINT15) isn't firing? J2 is
Pin Change Interrupt 11. At any rate, it's a classic pin change interrupt
and it should be set to trigger on either transition: low to high and high
to low. (Also works on the Thing-o-Matic.)

I'll look some more at this on Thursday.

Dan

Jake

unread,
Jun 12, 2013, 10:39:08 AM6/12/13
to jetty-f...@googlegroups.com
I'll keep poking around myself.  I was wondering if that the pull-up was turned on somewhere else in code.  Maybe I have endstop settings wrong in the configuration?  This area of the board seems pretty simple.  It appears to route the trace directly to the header, with a capacitor to ground for filtering purposes, I guess.  Though I haven't done a full trace, so I could be wrong and there could be other hardware or a tiny resistor network somewhere with a pull-up.
Reply all
Reply to author
Forward
0 new messages