Magnetic Pickup of piston inside cylinder

Discussion in 'The Projects Forum' started by coffwf04, Aug 27, 2010.

  1. coffwf04

    Thread Starter New Member

    May 11, 2008
    Hi guys,

    I am an engineer, and I have been tasked with designing a circuit to interface with a PLC, which will detect the presence of a piston with a powerful magnet embedded into it, once it reaches the end of its stroke. It will do this using a sensitive hall effect sensor. So far I have designed this circuit in Eagle, made a prototype, and I want to make a PCB for it however I thought I would get you guys to check it first :)

    Any hints or suggestions would be much appreciated. I am fairly new to the analog electronics field.




  2. mik3

    Senior Member

    Feb 4, 2008
    You need to use a hall effect sensor and this circuit. A simple reed switch will do the job.
  3. SgtWookie


    Jul 17, 2007
    You do not show an 0.1uF (100nF) bypass capacitor across the power/ground terminals of the LM339. Please be aware that bypass capacitors are NOT optional, and a single 0.1uF ceramic or metal poly cap is considered a minimum requirement for most ICs; some exceptions are items like the 555 timer which requires both an 0.1uF and 1uF cap, and certain opamps amongst others.

    The LM339 is a quad comparator. You do not show the other 3 channels. Their inputs must either be grounded, or you will have big problems with oscillations.

    The LM339 is not rated for automotive use. The LM2903 dual comparator IS rated for automotive use. Alternatively, you could use an LM111 single comparator.

    You will only get about 2.7mA current through the optocouplers' emitter (the LED side). They are pretty anemic anyway. You really should get that up to around 10mA, but the LM2903 has limited current sink ability; don't expect more than about 4.5mA.

    You'll need to use something like a voltage follower to increase the current through the optocouplers' emitter.

    Optocouplers are relatively slow to respond. This means that you will have a fixed time delay (propagation delay) between when the comparator senses the Hall input, and you receive an output from the optocoupler. This means that your angle error will increase as the speed of the engine increases.

    You also need a small cap on the reference level input, or noise will be a big problem.

    Frankly, I'm rather pessimistic about obtaining any kind of accuracy with the proposed scheme. Magnets lose their strength when heated. The piston's movement at the extreme throws (TDC, BDC) of the crank becomes very small, and is difficult to resolve unless using an instrument such as a dial indicator - even then, results are prone to error. Throw thermal expansion/contraction into the mix, and your errors, like enemies, accumulate.

    Your best bet for positional accuracy would be to use the extreme radius of a flywheel to determine a point that is a number of degrees before TDC for a reference, and then count the starting gear teeth on the flywheel to determine crank speed and deduce the exact rotational position of the crank, thus the piston position.
  4. retched

    AAC Fanatic!

    Dec 5, 2009
    In agreement with SgtWookies post, I would also like to add a quip.

    You don not state what this piston is for. If it is for an on the road automobile, you will need some serious power considerations.

    If this is a water pump, the thermal issues are not as much a problem, but having dissimilar metals in the piston head can lead to issues. Separation, heating, balance..

    If you have access to the cam or another part of the structure that follows the piston, like a flywheel or shaft, you can use some of the techniques used for internal combustion engine plug firing, and use off-the-shelf parts.

    A stepped coil helps with a point the sarge brought up, and that is angle error with increasing RPM.

    The stepped coil will change output with rpm to allow for a more accurate firing.

    If this is a pump and not an engine, a few things will be different.

    Also, if the speed is set for this piston, you will not need to worry about firing delays changing. You need only to place the hall effect sensor differently along the cylinder to match the error. (propagation delay)

    A little more information on the project will help us help you.

    I am thinking this is not a combustion piston, because of the magnet in the piston.

    A heavy magnet would retain heat much longer than a standard aluminum piston head, and expansion coefficients would be different, and would lead to early failure of the piston..If the magnet was cast in place.

    Also, the magnetic piston will hold any ferrous metal fragments and will cause score marks (scratches) on the cylinder wall leading to early failure.

    Magnets in the lubrication filter (oil filter) and in the coolant tank will help collect these fragments before they enter the cylinder, but it is something that needs to be addressed.
    Last edited: Aug 28, 2010
  5. shortbus

    AAC Fanatic!

    Sep 30, 2009
    Sgt. and Retched, are you sure that this isn't for detecting the position of a hydraulic or air cylinder?

    coffwf04, there are ready made detectors for cylinder position available. They used them on some of the machines at my last job. Instead of a magnet in the piston, they measured the change of a magnetic field in the sensor when the piston approached the sensor. If I remember right companies like Bimba have them.
  6. retched

    AAC Fanatic!

    Dec 5, 2009
    Shortbus, As you may have read in the 2nd line of my post:


    So, no we dont know.

    But, the OP and any future readers of this thread will get a good amount of info covering the question the OP asked.

    Until he returns with more info, we can only offer insight on what we see and deduce from the given information.

    Hopefully it helps.
  7. coffwf04

    Thread Starter New Member

    May 11, 2008

    Thanks for all the reply's guys. Ok, to clear things up a bit. This is being used in a pump as Shortbus guessed. The piston is 'floating' and is being used to compress a fluid. The wall thickness of the cylinder is more than 100mm so there are no commercially available proximity sensors for this sort of range. This also means I cant measure the stroke via some sort of connected push rod. At the moment my biggest problem is oscillation between high and low while the sensor is outputting in the vicinity of the reference voltage. So to sum it up:

    • Completely isloated piston
    • Cylinder wall thickness = >100mm stainless steel
    • Piston has a 15min long stroke (moving very slowly)
    • Using magnet in piston and hall effect to detect
    • Current change in voltage detected = 100mV

    Because of the speed of the piston hysteresis will be required. Without it we are getting large amounts of oscillation on the output. Here is my current to do list thanks to your comments:

    • Add cap between power and ground on LM139 (its a 139 not 339)
    • Add cap to the input reference voltage to prevent noise
    • Add hysteresis resistors, will try 120K and 12K first
    • Double check the current through the opto-coupler (I thought I had that right but we all make mistakes I suppose)

    I wont get time to test all this till tomorrow at work. Ive also been thinking it might be more reliable to measure the volume of fluid and the pressure of the fluid on the input side and determine displacement from there. I want to prove that this current setup will or wont work first though.

    Again, thank you all so much.

    If there are any more suggestions I have eager ears :)