Welcome! Log In Create A New Profile

Advanced

Combining Optop Endstops

Posted by ronanwarrior 
Combining Optop Endstops
August 05, 2008 02:52AM
Okay I was thinking, yes I know bad idea, about how the max and min endstops could be combined. Theoreticaly all the arudino needs is a signal that "An" endstop has been triggered. If programed right the reprap software will know that it was for example moving left and hit a stop. So now the only option is to move right. While it means more programing and tweaking, this way will mean that 3 pins can be freed up from the arudino. Well theoretically. I will have to experiment a little, or maybe someone with a bit more electronic know how than me can say for sure. The problems I can see is that beside having to get the coding right, I am not sure if simply the signal wires from the Max and Min Endstops can be simply twisted together or will a new circuit need to be designed that has two Opto gates and only one signal out. Hopefully the first option will work but some how I doubt it will be that easy.
Re: Combining Optop Endstops
August 05, 2008 03:10AM
I think that other machines do this sometimes. It is a legitimate strategy.

I'm not sure if the opto endstops currently default to open or closed, but worst case you would just need to buy a little "OR" gate transistor and wire it in with the two. Best case, you just wire them in series and it works right. If I were designing an opto endstop I would set it up this way, so people would be able to do exactly what you're describing.
Re: Combining Optop Endstops
August 05, 2008 08:14AM
If you just OR them together there is some ambiguity if any of the optos are blocked when you switch the machine on. You would have to move each axis forward in turn to find out which were already at zero. If you were unlucky the axis you tried first might be at its end position so you would get a collision. You could avoid that by limiting the travel in s/w or f/w so it never quite reaches the limit in normal use, probably a good thing anyway.

Another way to do it would be to connect them together with an R2R network which produces an analogue voltage with eight levels for three optos and feed it into an analoque pin. I can only find a Dutch wiki page, but the schematic is universal:
[nl.wikipedia.org]

Swap the ground connection for 5V in this case for open collector optos.

Edited 3 time(s). Last edit at 08/05/2008 08:18AM by nophead.


[www.hydraraptor.blogspot.com]
Re: Combining Optop Endstops
August 05, 2008 08:55AM
In normal operation (while making stuff) the software has no need to determine which end stop has been hit. If it happens during normal operation something has gone terribly wrong and the machine shuts down.

At startup it is not unreasonable to have the human operator determine which endstops are activated and correct the problem manually. Again, if the software sees the end stop signal on it shuts down.

During homing the software will be moving one axis at a time so only the end stop of interest will be activated. Move till the end stop (home) signal activates and then back odd till it de-activates.
Re: Combining Optop Endstops
August 06, 2008 07:02AM
While not saving many pins, we could get more out of those pins. If we used 4 pins as a simplified matrix keypad (8x1) we would get 2 free pins and 2 extra inputs, which I've drawn as switches. It could also be thought of as a 1 bit data bus with 3 bit addressing.

On the downside it does require several external logic chips and must be 'polled' to find the state of each device. An interrupt could probably be added but it would use one of the pins we just saved.

Here is a schematic:



IC1 74HC238 or similar 3 bit line decoder
IC2&3 74HC04 or anything that provides at least 6 two input AND gates
Thinking about it now the diodes may not be necessary in either the AND gate case or the switch gate. The AND gate should behave like a diode. The switch doesn't care which end is at what voltage and I suspect the de-mux can handle it's non-driven pins being at any voltage.

The number of inputs is 2^(N-1) where N = pins used. This makes adding a 5th pin tempting as it would increase the usefulness considerably. A 4bit address would give 16 inputs (10 after end-stops) but we would only be saving 1 pin.

Does anyone know of a non-inverting version of the 74HC154?

Zack's new Atmega644 / Arduino chimera should also provide a route to more pins, but if your just a couple of pins short of world domination the line decoder may be cheaper / simpler.
Ru
Re: Combining Optop Endstops
August 06, 2008 11:20AM
Quote

but if your just a couple of pins short of world domination...

I think you should suggest that as a marketing strapline for the Sanguino. Its a splendid little phrase winking smiley
Re: Combining Optop Endstops
August 06, 2008 12:45PM
Peter,
You can do your circuit with a single chip, 74XX151, but it only saves pins for 5 optos or more. Only 3 are really necessary so multiplexing does not help.


[www.hydraraptor.blogspot.com]
Re: Combining Optop Endstops
August 06, 2008 06:36PM
Ah, I thought there should be a single chip way of doing it but couldn't find it.

> but it only saves pins for 5 optos or more.
True, it could become worth while though if we end up with more switches either for input or safety sensors.
Re: Combining Optop Endstops
August 22, 2008 08:36PM
I like the multiplexing via hooking both switches for a given axis in series. It makes sense, prevents more crashes, and is easy to wire up.

It's also reasonable to assume that the switch that is "on" when starting up is the "min" switch. It would be very usual for the machine to stop at the max position.

It could happen though, and would result in a crash if it did. To further reduce the chance you could assume that if all three are on, you're at "zero" and if only one is on, check with the user for clarification before proceeding.

From what I know, the "zero" switches are used every layer to re-zero the CNC machine, and make up for any lost steps. The "max" switches are in contrast only useful to prevent a crash, are rarely triggered, and can be done without. Safety only kind of thing. Hooking the min/max switches in series (or parallel, depending on wiring) wouldn't interfere with the min switches function, and would allow you to still have the measure of safety provided by the max switches. I like the idea.

Doesn't matter to me as I only have three switches to play with right now anyway.
Re: Combining Optop Endstops
August 22, 2008 08:57PM
I like the multiplexing via hooking both switches for a given axis in series. It makes sense, prevents more crashes, and is easy to wire up.

It's also reasonable to assume that the switch that is "on" when starting up is the "min" switch. It would be very usual for the machine to stop at the max position. It could happen though and would result in a crash if it did. To further reduce the chance you could assume that if all three are on, you're at "zero" and if only one is on, check with the user for clarification before proceeding.

From what I know, the "zero" switches are used every layer to re-zero the CNC machine, and make up for any lost steps. The "max" switches are in contrast only useful to prevent a crash, are rarely triggered, and can be done without. Safety only kind of thing. Hooking the min/max switches in series (or parallel, depending on wiring) wouldn't interfere with the min switches function, and would allow you to still have the measure of safety provided by the max switches. I like the idea.

Doesn't matter to me as I only have three switches to play with right now anyway.
Re: Combining Optop Endstops
August 23, 2008 09:28AM
dup!

Edited 1 time(s). Last edit at 08/23/2008 09:29AM by jgilmore.
emt
Re: Combining Optop Endstops
August 24, 2008 09:33AM
The extra pins on the Sanguino may eliminate the need to combine pins.


Regards

Ian
Anonymous User
Re: Combining Optop Endstops
August 27, 2008 05:51AM
emt Wrote:
-------------------------------------------------------
> The extra pins on the Sanguino may eliminate the
> need to combine pins.

But only for this week, don't forget for the world domination plans, all those laser turrets will need a pin or two! smiling smiley

On a serious note, conservative use of the pins will still be sensible, as additions are made, so pins get used. A second head's control mechanism for example will add a few pins.

RepRap's software will expand to fill the computing power available to run it and RepRap's hardware requirements will expand to use the pins available to run it. smiling smiley Either that, or a lot of buffers/I2C enabled sub-controllers and hence costs are going to get added to the mix.

Chris.
mccoyn
Re: Combining Optop Endstops
August 31, 2008 07:23PM
How about you use the direction signal to decide which endstop to look at. So you have something like

LIMIT = (MIN and DIR) OR (MAX and not DIR)

(perhaps I have the dir signal backwards.)

This way, when the system is moving, it will always get the proper crash signal, but when the system starts up, the software can switch the direction back and forth to check both endstops before moving the motor.
Re: Combining Optop Endstops
September 01, 2008 08:30AM
I like that a lot; it's a very clever re-use of a signal that is already there.

> LIMIT = (MIN and DIR) OR (MAX and not DIR)

I was looking at the logic and how it could be implemented, when I realized that this is actually a 2 input multiplexer. Min and Max are the inputs, Dir is the select line and limit is the output. The 74157 contains 4 2:1 multiplexor's and so should only require a single additional chip, which is much better than I'd managed going down the logic route.
Re: Combining Optop Endstops
September 01, 2008 09:00AM
Yes a nice neat solution if you do need both endstops. On a machine like Darwin where hitting the end does not do any damage (other than possibly breaking the opto tab!) then I would just limit the travel in software. That saves the cost of three endstops and three pins or a chip.

If it really matters that you never hit the endstop, such as on a heavy CNC machine, then the limit switch should cut the drive in hardware as you cannot rely on firmware. If the firmware is trying to go past the end then presumably it is buggy, so you can't rely on it to read the opto and act on it anyway.

The only other way it would hit is if the stepper skips in one direction but then the machine is useless if it does than anyway.

Edited 1 time(s). Last edit at 09/01/2008 09:47AM by nophead.


[www.hydraraptor.blogspot.com]
Re: Combining Optop Endstops
September 01, 2008 07:35PM
On darwin what happens when the carriage tries to travel past the ends e.g. does the belt skip, the stepper stall, the motor coupler slip?

I expect it is axis dependent with the X & Y being faster but less forceful than the Z axis.
Re: Combining Optop Endstops
September 01, 2008 09:30PM
From personal experience:
X axis: belt skips
Y axis: either both belts skip or one does, skewing the X axis
Z axis: head crashes
mccoyn
Re: Combining Optop Endstops
September 03, 2008 03:02PM
When my x-axis endstop failed to function correctly, it skipped for a while and then broke the belt before I shut everything off.
Re: Combining Optop Endstops
September 03, 2008 04:08PM
Which endstop did it break against? X Max or X Min?


--
I'm building it with Baling Wire
sid
Re: Combining Optop Endstops
September 03, 2008 05:50PM
does that make any difference?
other than the side it hit against?

'sid
Re: Combining Optop Endstops
September 03, 2008 08:04PM
Yes, possibly. I have a theory that the min switches are MUCH more likely to cause a crash if they're broken.

I had that happen just this last monday - went to demo it for a dinner guest and it did fine till about halfway through writing "hello world!" and then crashed. A wire had come loose. I'm going to wire them all up in reverse as soon as I get a chance so that "switch open" (or wire loose) means stop.


--
I'm building it with Baling Wire
Re: Combining Optop Endstops
September 03, 2008 09:14PM
I think I must be using far less current on my Darwin than you guys. I am using 1A in parallel mode, which is the same torque as 0.5A serial. Nothing bad happens when I hit an endstop, the motor just stalls, but I can still move at 120mm/s with no acceleration.


[www.hydraraptor.blogspot.com]
mccoyn
Re: Combining Optop Endstops
September 04, 2008 09:21AM
It was the x-min endstop that broke. I haven't gotten any of my max endstops working and it doesn't seem to matter anyways.

This happened before I adjusted the current on my motor controllers, so it was likely running full-out. Once I got the new belt in place the first thing I did was adjust the current.
Re: Combining Optop Endstops
September 04, 2008 09:33AM
nophead Wrote:
-------------------------------------------------------
>
> I am using 1A in parallel
> mode, which is the same torque as 0.5A serial.
> Nothing bad happens when I hit an endstop, the
> motor just stalls.
>
Yes, the whole vexed question of how to determine where the work surface is went away for me when I discovered that my linear steppers just stalled without doing any damage to either the work surface or themselves when the toolhead hit the work surface. Once I reset the z-axis back to the opto-endstop and counted the steps, I knew exactly where the work surface was. smileys with beer
Sorry, only registered users may post in this forum.

Click here to login