Okay... Perhaps My Dumbest Question Ever In The Forums
idbruce
Posts: 6,197
As I was sitting here designing a layout for a Proto Board, I reached a point where I got stuck. In my defense, I don't believe I have done this type of hookup before, and if I have, I certainly don't remember
Anyhow here goes...... Please hold the laughter
In another thread, there was a somewhat lengthy discussion about limit switches for various axes, and the best way to wire it up. The best scheme I heard was to wire all limit switches (normally closed) in series and run it to a single pin. Sounded great! That was until I started to design the wiring. Normally open switches are no problem for me, but I don't believe I have ever wired up a normally closed switch to the Propeller. Additionally, I was reading something Peter said about taking VDD off the board for switches, where it could possibly pick up noise or lead to shorts, and I agree. I would prefer to detect if VSS becomes open.
Could someone please provide a schematic for a normally closed switch connected to an IO pin that detects an open ground? Resistor values would also be helpful. Any help will be gratefully appreciated.
Sorry to ask such a stupid question
Anyhow here goes...... Please hold the laughter
In another thread, there was a somewhat lengthy discussion about limit switches for various axes, and the best way to wire it up. The best scheme I heard was to wire all limit switches (normally closed) in series and run it to a single pin. Sounded great! That was until I started to design the wiring. Normally open switches are no problem for me, but I don't believe I have ever wired up a normally closed switch to the Propeller. Additionally, I was reading something Peter said about taking VDD off the board for switches, where it could possibly pick up noise or lead to shorts, and I agree. I would prefer to detect if VSS becomes open.
Could someone please provide a schematic for a normally closed switch connected to an IO pin that detects an open ground? Resistor values would also be helpful. Any help will be gratefully appreciated.
Sorry to ask such a stupid question
Comments
daisy chain all the normally closed switches, one end of the chan to GND, the other to the propeller pin (that was pulled high above)
done
if you are really paranoid, and worried you might program the pin high, add a resistor - say 4k7 - between the daisy chain and the prop pin.
That tolerates an external short to (almost) anything and reduces antenna effects.
Values might be 2k2 , 2k2 and 22k, or 3k3, 3k3 and 47k
Thank you guys so much for such a descriptive answer. Hopefully, I will get it right, but sometimes I can be a numbskull. Okay I think this is the circuitry you both described.
In the top diaram, move the pullup to the other side of the 4k7 resistor
sorry, posting from a linux box without eagle on it.
Thanks again Bill
prop ----100k
connector
switch
switch
ground
+V
2K2
|
0.1uf
ground
Wetting current is a good idea, but a cap directly across a switch is not a good idea, as the high peaks can damage the contacts.
A Cap + resistor to limit to say 10mA peak (330 Ohms) is a good idea.
If you provide a resistance ladder, any switch closure could pull to ground and just one ADC pin might handle telling you exactly which limit switch has been triggered.
The advantages with this are..
1. Hall effect switches are open collector... so they naturally pull to ground
2. An all clear is a Highest voltage state, which will only occur if the system is right.
3. Frees up Propeller i/o pins for other things.
The disadvantage might be...
1. Using the ADC via SPI is a bit slower in responding to actual events than a pure logic High/Low.. more code has to be run to evaluate the condition.
+++++++++++++++++++++++
Putting all limit switches in a series that breaks the circuit, won't tell you which limit was hit.
You can similarly aggregate all open collector sensors, but they won't tell which limit was hit.. either.
So it is a question of the value of detailed information that decides the approach.
Using the ADC input and a resistor ladder will provide you all the detail without individual i/o pins or providing another chip (such as an 8 to 3 multiplexer or a parallel to serial shift register).
That circuit will be disabled if any of the switch wire inadvertently becomes grounded. Better to send the signal through all the switches and then back to the sense pin. A low at the sense pin will indicate an open switch, a broken sense wire or a grounded sense wire. Use a 100k pull down at the sense pin.
Sandy
It seems that another a variable has been thrown into the mix.... The connector(s).
I suppose it would have been wise to include an image and describe my plan a little more in detail. So without further delay, I am now including an image, along with the plan. It is as follows:
- Each axis will have a normally closed switch, with two wires going back to the Proto Board, and connected to a two pin header.
- Altogether, there will be three limit switches utilized for X, Y, and Z axes.
- Additionally, a normally closed E-Stop switch will also be wired in series with the three forementioned limit switches, which also has two wires going back to the Proto Board, and connected to a two pin header.
- Making a total of four normally closed switches, all connected to the Proto Board, by two pin headers.
- The length of the harness for each of these switches could range anywhere between (at least for my machine) 18 - 36 inches. However, I will be providing all the details for my plan as open source, so if anyone follows my lead, their harnesses may be much longer or shorter.
After reading the information provided by Peter Jakacki in another thread, as well as the information provided in the contactor thread, with problems pertaining to glitches, I am certainly concerned about antenna effects and shorts, both for me and anyone that may follow my lead.In the image below, you will notice five headers, (1) 13 pin header and (4) 2 pin headers. The 13 pin header is for a Propeller Memory Card, and of course the remaining (4) 2 pin headers are for connecting the three limit swithes and the E-Stop.
As far as knowing which limit switch was tripped, for small machines, I think this should be readily apparent or at least can be easily determined from examining the machine after a shut down. However, I do want the open circuit to be realized as quickly as possible, so this series of switches will be tied directly to an input pin and monitored by a cog.
Okay, so now you all know my full intentions, and I apologize for not initially describing my plan in more detail.
Anyhow, I thank you all so much for your time and input.
Bruce
All the printers I have had experience with have independent limit switches. This allows for "precision" homing for each axis with out the "bump the switch and backoff to home" irregularities. This approach will not work for the Z axis: if you home the Z axis (printer head) then backoff say a few mills above the print deck so the other axis can bump their switches to home themselves (each backing off in turn to close the daisy chain) then as soon as you home the Z axis again to start printing its limit switch is open. Sure you could code the firmware around this but what a mess. I think the MCP23X08/17 GPIO Expanders proposed above will save your design the needed pins so you could have a pin dedicated to each limit switch. Now I only have two years experience with 3 hand build printers and 3 different firmwares so I may be wrong but none of these setups have daisy chained limit switches.
Replicate/learn/adapt/share from what has been done, get it working, then optimize is my approach.
Happy to help when the coding in FORTH begins
The layout I am working on, pertains to standard CNC, as well as 3D printing. The limit switches refered to in this post pertain to over-travel protection devices and will not be used for homing any axis. The layout will also have provisions for (4) normally open switches to be used for homing the axes, with each homing switch going to a seperate channel of an ADC.
In the illustration below, I have added more circuitry to the previously discussed circuitry. My question is, with the added circuitry, will the pressing of the tact switch act as an open ground to the Propeller, or is this illustration just garbage?
When the switch is closed, the IOpin is at about 90% of VDD.
The whole point of a E-stop is that when it fails it stops so there is no advantage in taking an N.O. switch and wiring it to VDD instead of ground in an overly complicated way. Now put a cap across the switch to ground so you can at least detect that there is a connection there so that you e-stop when there is no RC charge time or stop when the input is low.
I/O
R
to switch and cap in parallel
> gnd
Or even just pulse it high long enough to fully charge it then a very short pulse low just before you read it while do the trick.
I did not convey my situation properly. I have one pin assigned to monitor four limit switches, which are normally closed, and one E-Stop, but I want the E-Stop to be a tact switch, which is normally open.
The following schematic should give you a better idea of what I am attempting to achieve, but I am sure it is not correct.
It seems wrong, so without the diagram or taking restrictions into account what is it you that really want to do?
In the meantime I will see if I can glean your intent from your postings.
I see, you need to override the limit switches, then perhaps the circuit will do. NO, why have a pull up that doesn't result in a clear high/low?
How about:
I/O
10K
N1
1K
limit----limit
limit----limit----gnd
N1
10K----VDD
N1----estop---VDD
EDIT: the 10K can be pretty much any limit value so the one you have is fine and the pullup you have is fine too, same as N1---10K.
I will need to study your notes, but here is another illustration to show my predicament
But as I mentioned you can leave your 2 resistors as they are and the limit switches pull the pin to ground through a 1K resistor while the estop pulls the pin up to VDD directly. So you only need a 1K which is to limit the estop condition current, that's all.
EDIT: I can't see how your configuration would be set in stone as you say, even on a pcb it wouldn't really be, less so on a proto board.
I would assume N1 means Net 1.
Anyhow Peter, thank you very much for taking the time to help me.
Not possible since S1 is connected to Vdd. It would always have an open ground.
With S1 open and and S2-S5 closed you would have about 52% of Vdd on the input pin. If any one of the S2-S5 switches were open it would be 100% of Vdd.
With S2 closed you would have 100% of Vdd on the pin. All 5 have to be in series to detect an open from any one of them.
What are you trying to accomplish?
I am setting up a CNC controller.
The limit switches would detect an overtravel condition and make the machine stop. NC switches
The E-stop switch would detect an emergency situation and make the machine stop. NO tact switch, part of the user interface.
If I could find a NC through hole tact switch, this would not be a problem.
A. detect a switch change condition
B. detect an open ground condition
Is that right?
I suppose that you could use a normally closed switch.
Have the circuit be grounded at startup through the switch, and when either the switch opens or the ground is broken, the Propeller pin cold go high with a pull-up resistor.
It seems like using the normally open switch is getting in your way. You could even have all five switches in Paralllel (not series) if you wanted to just use one Propeller i/o pin for all of them.
I didn't think there was a problem at all with what you asked for with 4 NC limit switches in series to ground and the NO E-stop to VDD but if you need a real schematic rather than a description then here it is:
The limit switches will normally pull the I/O to ground or to 1/11 of VDD (same diff) but E-stop when it is pressed will always force the I/O to VDD as will any limit switch that opens because of R2 pullup.
@kwinn
To me, the most important thing is to stop the machine, and the cause can later be determined by examining the machine.
@Loopy Byteloose
Yes, the NO switch was getting in the way.