Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Limit stwitches with Hall effect sensors

Status
Not open for further replies.

AlainB

Member
Hi,

I want to put back the 4 limit switches on my small CNC machine. The switches are Hall Effect Sensors. There is no part numbers on them but I figured out how they work and also that they can work at 5 volts. Red is 5 volts, black is ground and blue is the state of the sensor, 5 volts when not energised, 0 volts when energised by a magnet.

I want to use a single pin of the parallel port to input a change of state of any one of these sensors.

The schematic is the circuit I builded on a breadboard and it is working fine. The diodes must be there otherwise it is not working. The pull down resistor is also needed because there is a small voltage (leaking voltage??) at the cathode side of the diodes, around 0,02 volt and just touching with a finger is enough to trigger the output. I tested many values from 1K to 1 Meg and they all work well. I settle for a 100K resistor.

As I said, it is working fine but I would appreciate your opinion about this circuit. Would there be an easier way to do it, or a better part to use.

Putting the sensors in serie does not work unfortunately. It would have been a nice way of doing it.

Here is my little machine in action:

https://www.youtube.com/watch?v=OwjynFhSbWk

Alain
 

Attachments

  • Hall Effect Sensor.jpg
    Hall Effect Sensor.jpg
    14.7 KB · Views: 379
  • Hall Effect Sensor Schematic.jpg
    Hall Effect Sensor Schematic.jpg
    44 KB · Views: 745
Last edited:
There is nothing wrong with your circuit. It uses one IC and you aren't going to do better than that.

You could have just one inverter. If you bypass all four input inverters, and one of the output ones, reverse all the diodes and make the resistor a pull up by connecting one end to +ve not -ve, the circuit would be simpler.

You could use a single 4 input nand gate, that would do the whole lot in one go.
 
hi,
Look at this option.
 

Attachments

  • esp01 Apr. 18.gif
    esp01 Apr. 18.gif
    5.8 KB · Views: 329
eric,

Would it be an appropriate to add a resistor from base to emitter, to hold the base at ground when D5 is reversed biased, for noise immunity?

Ken
 
I'll be darned!! It is very clever (to me!) to invert the diodes. :)

I decided it would be better to send a normal high to the port. Using only the reversed diodes with a 1K pull up resistor it give me a 5 volts high and a 0,68 volt low. This 0,68 volt would be inside the limits for the Input low level voltage of the computer port but not by much. Would there be a way to reduce this voltage to 0 or very near 0.

Until this morning, I did not know that there was such a thing as a 4 input nand gate. Yesterday I went to the store to and got a quad 2 input nand gate. I wired it like in the drawing but I cannot get change of state from the 2 output gates. From the 2 inputs gates, I get change of state all right. Is it possible to use a quad 2 input gate that way??

Anyways, since I decided to send a normal high to the port, I suppose a 4 input AND gate would be the best choice. How about this one (a 4082):

https://www.standardics.nxp.com/products/hef/datasheet/hef4082b.pdf

I learned a lot with this post, thanks!

Alain
 

Attachments

  • Hall Effect Nand Gate.jpg
    Hall Effect Nand Gate.jpg
    37.2 KB · Views: 299
Last edited:
I'll be darned!! It is very clever (to me!) to invert the diodes. :)

I decided it would be better to send a normal high to the port. Using only the reversed diodes with a 1K pull up resistor it give me a 5 volts high and a 0,68 volt low. This 0,68 volt would be inside the limits for the Input low level voltage of the computer port but not by much. Would there be a way to reduce this voltage to 0 or very near 0.

Alain

Alain,
This statement about 0.68V for a low is not correct.
Why do you think it will be 0.68V and not about 0.2V.???
 
Hi Eric,

I assumed my statement from this graph:

Logic Voltage Thresholds for TTL, CMOS, LVCMOS, and GTLP IC's

But I could very well be wrong!

Alain

Alain,
Its the transistor collector thats outputting the signal and it will swing from about 0.1V thru to about +4V.
The parallel port on your PC has internal pullup resistors, the transistor will give the required logic level changes.

Do you have a datasheet for the hall effect devices, you did say the outputs are 0V and +5V.?
 
Eric,

Here is what I was talking about in the diodes paragraph of my post. I was not referring to your circuit.

I do not have the datasheet for the sensor not knowing the part number. But it is working at 5 volts. It would probably work at other voltage too, I suppose. But what I know is that it is sending 0 volts when energized.

Alain
 

Attachments

  • Hall Effect Diodes.jpg
    Hall Effect Diodes.jpg
    34.1 KB · Views: 325
Eric,

Here is what I was talking about in the diodes paragraph of my post. I was not referring to your circuit.

I do not have the datasheet for the sensor not knowing the part number. But it is working at 5 volts. It would probably work at other voltage too, I suppose. But what I know is that it is sending 0 volts when energized.

Alain

Alain,
The circuit with just the diodes will not work.
With the diode/transistor circuit I posted it will.:)

EDIT:
Looking at your NAND gate circuit, when will the middle NAND get BOTH inputs HIGH.?
 
Last edited:
Hi,

The circuit with just diodes and a pull up resistor as in my last post is working. I used an old laptop computer, a 486 25Megahertz and it consider that 0,68 volt from an imput pin from the parallel port to be a logic low. I just tested it.

Remember that I changed my plan and now want to send a normal high to the port and a low when one of the sensor is energized. But nevertheless, I will not use this circuit. I am just curious, for my education if you will, to know how, if possible, to lower this 0,68 voltage to a near 0 volt. Changing the resistor value for a 1 Meg would reduce the voltage a bit but not much, maybe 0,1 volt.

Tomorrow, I will experiment with a 4 input AND gate. As I understand it, the output pin stay high as long as the four inputs stay high. If any one of the input goes low, then the output will get low too.

I see the error in the NAND gate circuit. Thanks Eric!

Alain
 
Last edited:
Use Schottky diodes like BAT85 or 1N5711. This will bring it down to between 0.2v and 0.4V.

Ken
 
Thanks Ken,

Your post made me realized that this 0,68 volt is the result of the voltage drop of the particular diode I was using combine with the pull up resistor. It was not clear in my mind where was that voltage comming from.

The 1N5711 being so expensive around here I bought some 1N5819 instead, about half price and with a voltage drop even a little bit better than the 1N5711.

Now with this diode and a 10K pull up resistor the voltage is only 0,12 volt. Really perfect!:)

Alain

(Edited: Well, let's say below 0,20, my 2 multimeters disagree on that. I need new batteries)
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top