Home › Forums › TinyG › TinyG Support › High resistivity switch
- This topic has 5 replies, 2 voices, and was last updated 3 years, 8 months ago by cmcgrath5035.
-
AuthorPosts
-
February 17, 2021 at 5:56 pm #11949gertaParticipant
I’m adapting the TinyG to an off-beat application in a research lab. For one of the homing limits, rather than using a contact switch, I’d like to detect contact of a probe with a gel. My goal is to have a normally open circuit that closes by running the current through the gel once contact is made.
As a first attempt, I wired the probe (the bare end of a 22ga wire) to the Amin switch input and ran another wire from the gel to the limit switch ground; the ground connection through the gel is always made, so contact between the probe and the gel should close the circuit. With the TinyG configured for normally open switching, this works as expected if I touch the probe and ground wires directly, but it does nothing if I try using the gel to bridge them. I’m fairly sure the problem is the extremely high resistance of my gel (I measure ~500kΩ). Testing with resistors between the wires instead of the gel, it seems the maximum resistance manageable is something like 2kΩ, which perhaps makes sense since it looks like there’s a 2.1kΩ pull-up resistor on the TinyG for the Amin circuit?
Can anyone suggest a solution? I don’t think there’s a feasible way to reduce resistance anywhere near what’s needed with the current configuration (it’s already a saline gel). Are there other configurations that might work despite the high resistance in the closed state?
Thanks for any suggestions.
February 17, 2021 at 7:05 pm #11950cmcgrath5035ModeratorTinyG is a 3.3v logic device, the Amin lead is an input port with a 2.7Kohm pullup to 3.3V an 0.22uf cap to ground for some noise immunity.
You need a good, clean 3.3v to ground transition for the port to respond properly.
A properly biased FET or differential line receiver might work., but make sure the logic level into the port is limited to 3.3VFebruary 19, 2021 at 6:43 pm #11951gertaParticipantThis worked by wiring the gel probe between the 3.3V supply on the switch block and the base pin on a NPN transistor, with the transistor collector and emitter pins wired to Amin and switch block ground. So the idea was right on, thanks!
I does seem this configuration is problematic if the resistance is too low to the base pin; if I complete the circuit bypassing the gel, the TinyG actually resets completely rather than going into the locked state normally triggered by the limit switch. I have very limited electronics background, so I’m not sure exactly what’s happening there, but adding a 1kΩ resistor in the path between the probe and the base pin solved the problem — whether completing the circuit with or without the gel in the path, the TinyG locks as it should without the complete reset.
February 20, 2021 at 6:27 am #11952cmcgrath5035ModeratorI am having to make a lot of assumptions about your description and tinyG settings.
On the tinyG Gcode and settings, I assume you are using a Homing cycle on A axis to move the probe. Is Amin set as both homing and limit?
“Completing the circuit” as you describe above when homing cycle not running would look like a limit switch operation, if Amin is set as both homing and limit. A limit switch operating would cause tinyG to reset.
But grounding out the 3.3V supply would cause a reset as well, and from your description that is another possibility.On the electronics side, i suggested using an FET because they are high impedance devices and the switch action you are attempting to sense is either an open circuit(no contact with gel) or a 500K ohm conductor.
I have no idea what you might have access to.
In my junk box I have 2n7000 MOSFETs.
I would connect the Source to ground, the Drain to Amin and pull the Gate high thru a 10Megohm resistor. The connect the gel probe between Gate and ground.
When gel probe is open, the gate voltage would be 3.3V, the FET would be on, the Amin would be low.
when the gel probe is closed, the gate voltage would be 3.3*(500/(10500)) = .15v, the FET would be off thus the Amin would be high.
The 2N7000 operates as a high impedance inverting switch.See https://github.com/cmcgrath5035/G2core-DUE-External-Interfaces/blob/master/G2core%20DUE%20External%20Interfaces.pdf
As a use exampleUsing bipolar transistors is also possible but not as simple when dealing with high impedance elements such as your gel
- This reply was modified 3 years, 8 months ago by cmcgrath5035.
March 19, 2021 at 4:14 pm #11956gertaParticipantThanks for the very helpful feedback on this. I don’t have a MOSFET on hand, but certainly easy enough to pick up and I’ll give it a shot.
March 19, 2021 at 8:49 pm #11957cmcgrath5035ModeratorGoogle is your friend, You can find them on multiple sites.
Good luck with your project -
AuthorPosts
- You must be logged in to reply to this topic.