Hello,
for a project I have to determine the polarity of a rotor with permanent magnets by using Hall effect sensors. (PIC H501) The magnets are placed on the rotor. I must be sure that the magnets are properly placed (north, south, north, south etc.) There a 3 rotors with different sizes. The largest one has 36 magnets, the middle one has 28 and the smallest one has 20. I made a 3D printed tool where the sensors fit in perfectly and they are facing towards the magnets of the rotor. (See attachment) Normally, a Hall effect sensor detects a South pole with the front side of the sensor. This means that other side of the sensor will detect a North pole. This means that the sensors will be placed alternately in the tool.
I made a schematic for the Hall effect sensors (See attachtment) Every single sensor must detect a magnetic field in order to give an output signal. If a magnet is accidentally placed wrong on the rotor, the sensor won't detect a magnetic field because the front of the sensor is facing towards the North pole of the magnet.(Or the back side of the sensor is facing towards to South pole of the magnet)
I tested the schematic with 4 sensors. The sensors were powered by 5V from an Arduino UNO. I connected a LED to the output of the last sensor via a 220 Ohm resistor. This worked perfect. The LED lighted up when there were no magnets close to sensors and the output voltage was 5V. When the magnets were placed close to the sensors, the LED went off and the voltage was brought down to 0V. Everything as i had expected.
Now comes the problem. I tested the same schematic with 20 sensors (The smallest rotor has 20 magnets) When the rotor was placed in the tool and the magnets were facing towards the sensors, the LED didn't went off completely but lighted up slightly softer. This is a problem because when you connect the output of the last sensor into an input pin of the Arduino, (instead of connecting it to an LED) the Arduino will see its input always as "HIGH"
Does anyone know what the problem could be? I've tested it with 5V from the Arduino and with 12V from an AC/DC converter. Same problem. Am I using to much sensors? Or is my electrical diagram wrong?
I have the opportunity to use a Logic AND with 3 inputs and 1 output. This means i can split the sensors in groups of 3. This means for the largest rotor: 36:3 = 12 sensors. I want to have a PCB made but i must be sure that my electrical diagram is correct.
You can find the datasheet here for the Hall effect sensors that I am using: http://www.produktinfo.conrad.com/datenblaetter/175000-199999/185120-da-01-de-UNIPOLARER_HALLSCHALTER_H501.pdf
I hope that someone can help me to figure it out.
Lars
supportplate (1).PDF (49.6 KB)
Hall effect sensors schematic .pdf (289 KB)
I think that the daisy chaining of the output grounding when the output is pulled low when the magnet is present is the problem. It's not providing a sufficient ground level to pull the last output low
I like the idea of working digitally with the AND gates. If you are going to bring the output of multiple AND gates to the Arduino you should bring them to input pins on the same port and read them all at once with direct port manipulation..
Alternatively, you can cascade the gates so there is only one output to the Arduino.
I think i understand that daisy chaining of grounding the output is not providing a sufficient ground level to pull the last output low. But what is the maximum of daisy chaining the sensors to pull the last output low?
I am not really familiar with direct port manipulation. Furthermore, I already have all my I/O pins in use for my project so that will not be an option. To cascade the gates looks like a good idea to me. This means that the output of one AND gate, serves as an input for another, right?
Lars
To cascade the gates looks like a good idea to me. This means that the output of one AND gate, serves as an input for another, right?
Yes. If you only have one input pin available you will have to do that.
But what is the maximum of daisy chaining the sensors to pull the last output low?
More than 4 and less than 20. 
I'm sure there is a way to analyse the sensor, but I don't know how to do that.
You get about 0.7V across a switched on transistor, so four transistor's in seriese will drop the voltage to 2.8V which might just look like a logic zero. Forget chaining and wire the outputs in parallel. They are open collector outputs so one common pull up will give you a wired or configuration.
Forget chaining and wire the outputs in parallel. They are open collector outputs so one common pull up will give you a wired or configuration.
I think the OP is making a jig to verify the correct placement and orientation of the magnets on the rotor. He is looking for a wired and configuration.
He is looking for a wired and configuration.
No he is not. He wants to detect if any sensor sees a magnetic filed, that is a wired OR. A wired and ( if such a thing exists which it doesn't) would detect if all sensors were detecting a filed.
My apologies that I might not have explained clearly.
cattledog:
I think the OP is making a jig to verify the correct placement and orientation of the magnets on the rotor. He is looking for a wired and configuration.
Cattledog is right. It is to test whether all magnets are correctly placed on the rotor. This means that all the sensors must detect a magnetic field to give a HIGH signal.
There might be an option to wire the outputs in parallel. If i deliberately place the sensors wrong. This means that the sensors won't detect a magnetic field, so the all the outputs will be LOW. If a magnet is placed wrong on the rotor, the sensor facing towards that magnet will see a magnetic field so it will give a HIGH signal. In this way i know that the magnet is placed wrong. Should this be a good option?
Lars
Should this be a good option?
Sounds good to me. The alternative is to use lots of TTL gates.
Maybe a few 4066 quad
switches ?
Bad idea stay digital. With a 4066 you have do do all the switching and recording the results in software and then doing the logic in software as well.
I agree with Grumpy_Mike. I will test both circuits on a breadboard. As well as in parallel and in series with lots of AND gates. I don't know if wiring the outputs in parallel is a good idea because i have not yet tested it.
I have some 3 input AND gates in IC package (see attachment) Is it possible to use it as a multi-input AND gate? So the output of one serves as an input for another on the same IC.
Lars

Yes you can use gates in a package in series. Don't forget a 0.1uF on the VCC pin. Tie any unused inputs HIGH on AND gates, LOW on OR gates.
Is it possible to use it as a multi-input AND gate? So the output of one serves as an input for another on the same IC.
Yes that is how logic chips work. Don't forget to put the 0.1uF ceramic caps on each gate.
Is just one 0,1uF decoupling capacitor between VCC and GND on a single IC enough? Or do i need more of them?
Lars
One 0.1uF cap on the VCC pin of every device. If a device has multiple VCC/AVCC pins, put a cap on each one.
larsouderengerink:
Is just one 0,1uF decoupling capacitor between VCC and GND on a single IC enough? Or do i need more of them?
You never know, if you did then electronics would be a hell of a lot simpler. Even the pros can only guess.
Okay i get it. Thanks for your help!
Lars
Grumpy_Mike:
Bad idea stay digital. With a 4066 you have do do all the switching and recording the results in software and then doing the logic in software as well.
Don't see where using the 4066 is a bad idea.
Link was just to give an example of the use.
Idea was drive one input each from the hall switches, series up all the x-y's and drive an LED.
Don't need an Arduino for that.
Don't see where using the 4066 is a bad idea.
Sorry that is your problem not mine.