12 December 2011
By Jon Gabay
Fame, fun and (small) fortune await!
Welcome to the first in a series of articles for design engineers, students, inventors, and hobbyists with electronic, electro-mechanical, and electro-optic systems. It teaches, demonstrates, and makes available electronic modules that can be used to perform functions.
*Limit of 1 (one) gift card per person. Offer limited to the first fifty participants who fulfill the four guidelines stated above. Offer ends March 31st 2012.
These modular functional blocks (like sensor interfaces, motor controllers, user interface, displays, embedded controllers, and more), can be combined to make more sophisticated systems. These are effectively interconnecting blocks for engineers, inventors, students, and hobbyist.
The designs are public and open source. You are free to modify, improve, or specialize them for your needs. Please share this information freely. It will encourage more people to create their own electronic systems for renewable energy, energy management, energy efficiency, alternative energy, and any other projects. Schematics, bills-of-materials, and even PCB layouts when possible, are available free for download. As this site and a community develops, video links, chat sites, topic threads, and other resources will be provided.
This first article describes how to design and build a magnetic field sensor that can be used for motor control, robotics, position feedback, security, safety, proximity detection, and more. It will describe a two-channel interface module that includes an LED indicator on each channel for visual feedback. A sensitivity adjustment is also included to allow adjustments in high noise applications.
Jon Gabay – Dr. Gizmology
The ‘Hall Effect’ comes from a voltage being induced in a material in the presence of a magnetic field. Discovered by Edwin Herbert Hall in 1879, it manifests because moving charge is deflected in the presence of a magnetic field. (See Fig. 1.) Electrons moving through a conductor will migrate to one side of the conductor in the presence of magnetism because of this effect. The resulting charge separation is induced voltage. This effect is even more profound in semiconductors, since holes are affected in addition to electrons.
In modern electronics, semiconductor-based Hall Effect devices (HEDs) sense the presence and magnitude of a magnetic field. Since signal levels are very low (typically micro- to milli-volts) from the actual HED sensor, a HED is coupled with a Schmitt trigger electronic amplifier, comparator, voltage references, and an output driver in the same package to make it easier to use for a variety of applications.
Modern HEDs can operate as omni-polar, uni-polar, or bi-polar. An omni-polar device outputs an active level when either a north or a south pole magnetic field is present. A uni-polar device will only trip in the presence of one of the poles. When the magnet goes away, the HED output level returns to an inactive state in both cases.
Bi-polar HEDs are also called 'latched.' Here, once a specific pole is detected, the output goes active and remains active until a reverse pole is applied. It then goes inactive.
Another type also exists that is a 'linear' HED. This variety will be discussed in future designs when we design a Hall Effect Interface for Magnetic Magnitude Detection (a linear function).
Blocking Out Our Design
The first step in any design is to create a block diagram of what we want to accomplish. We then move from a top-down approach with an increasing level of details, until we are ready to do our bottom-up design.
In our design, we want two channels, each with a sensitivity adjustment and indicator LEDs in a small, compact design. (See Fig. 2.) We also want this board to draw its power from one of two different ways.
If logic power is to be used, then 3.3V or 5V supplies will be passed to this board. Devices will be chosen to operate in this range. This setup also means a rail-to-rail op-amp will be needed if the output is to drive external logic or go to a microcontroller.
The other way this board can obtain power is through a 12V bus supplied to this board. By adding a small regulator, the board can operate using a typical 12V power supply. We will choose this option for two reasons.
First, if our sensor is a good distance away from our logic, we don’t want to run our logic power supply all around. If we do, any induced noise could glitch logic and microprocessor circuits. By running an unregulated power supply to our boards, a layer of protection is added to our logic.
Second, a common 12V power bus is better than lower voltage supplies since less current is needed for robot applications in order to achieve the same power–an important consideration when driving motors. This option helps keep wires and PCB traces thinner while being able to supply a good amount of current. On the PCB, we will add a regulator bypass for non-demanding lower-cost applications.
The Schematic Design
This design will use an operational amplifier (op-amp) in open-loop mode as a level detector to discriminate between inactive and active states. (See Fig. 3.) The HEDs will use an open collector transistor. This format allows the pull-up resistor to make the output operate in a purely digital fashion.
Note that we added a capacitor location in parallel with the output. This feature will take advantage of an R/C rise time and fall time. It adds a little delay to the response and will allow a slight timing adjustment. In addition, it can help discriminate against background noise and ambient stray magnetic fields. The capacitor, in combination with the pull-up resistor value, lets us adjust the delay by varying the values. (See Fig. 4.) For instant response, we can use the pull-up resistor with no capacitor. This method is how we will test.
Some HEDs have internal pull-ups. In this case, we don’t populated the capacitor. Note that there is a series resistor between the unregulated DC input and the upper limit of the trimpot. This increases the adjustment sensitivity and gives you more precision. We could eliminate this resistor, but it would decrease the sensitivity adjustment resolution; so again, it’s in there. For a logic supplied power supply, this resistor is zero-ohm.
Our LED driver is a non-inverting unity gain stage of the op-amp. By connecting the output to the non-inverting input of the op-amp, a high impedance is presented to the driving op-amp’s output. This setup lets the LED be driven without interfering with the output stage. It also protects out-signal output in case there is a fault or shorting of the indicator LED, which may be wired to a remote and visible location.
We use connectors in the inputs so that sensors can be cabled away from the board. Our outputs are also connectors, which can cable to an external input board. In this way, we can make small and buried versions of this sensor interface board that are as close to the sensed source as possible.
We want our output to either be capable of driving external logic circuitry or rise to the level of our power supply. The ability to generate 12V or 18V pulses will be useful if we want to drive power transistors directly.
We could add an opto-isolator to the outputs if we need complete galvanic isolation, but to keep this simple, we left it out. We can add it at the next stage input if needed.
Finding the Right Parts
With a block diagram and schematic in place, it is time to start searching for parts we can use. Avnet Express.com is a great place to do it all.
For prototyping, we will use through hole when possible. In kits, through hole is easier, especially for anyone learning to solder. When PC boards are made, we will try and make both through hole and tiny SMT modules. This way they can be small and compact, especially when sensors may need to fit into right angle tight spaces.
The first step is to create an online bill of materials (BOM) on the Avnet Express site. This is a great feature that helps keep track of parts and projects. By clicking on the ‘Add To BOM’ option, I was able to create a new BOM. Later, I can always select my BOM, add to it, modify it, or use it to place an order. I created a new one for this project.
Next, I was able to use the parametric search tool to narrow down the parts I want to look at and choose. A quick search on the term “Hall Effect” brings up the parametric search feature.
Selecting the In-Stock and America’s Warehouse options leads to three pages of parts that are available and in stock right away.
The first part of interest is an omni-polar three-pin through hole SIP part–the Diodes Inc. AH180 series. A link to the data sheet is a click away on the top right. This part will trip with either a north or south pole in its proximity and internally uses chopper-stabilized offset canceling technique to reliably drive the output FET. (See Fig. 5.)
The data sheet shows that this part will work from 2.5V to 5.5V. This functionality means we can use a standard 3.3V or 5V regulator for 12V operation, or, it can use a 5V or 3.3V logic power supply, if available.
The next part we will look at is the Infineon TLE4905, a uni-polar part. (See Fig. 6.) The data sheets show that the pin-outs for the three terminal devices are the same. Our goal is to be able to use omni-polar, uni-polar, or bi-polar devices without having to change jumpers or use redundant sockets.
Note the wide supply-voltage capabilities of this part. We will keep that in mind for future projects that may operate using higher voltage levels, but it fits well for this project.
For the latched flavor, I chose the Zetex AH375. Similarly, this part has the internal Schmitt trigger amplifier to help discriminate against noise. (See Fig. 7.) Note also that this part has the same pin-outs. Our board, therefore, will work for all three flavors without any modifications.
For our voltage regulator, I chose an ST Micro L7805 standard three-terminal voltage regulator. I don’t need the 1A rating for this. The TO220 package is overkill for the PCB but is good to prototype with, and the TAB hole may serve as a mount in some applications. Note, for interfacing to a 3.3V system, I would have chosen the corresponding 3.3V flavor. The Avnet Express parametric search capability makes this easy.
The next part is a 10K trimpot. For prototyping, I chose a Bourns chassis mount single turn with solder lugs. Many machine design applications may need an actual control panel to allow user adjustments. For those needs, a chassis mount trimmer is ideal.
Note that on a PCB, in order to keep this design tiny and compact, we can leave pads for fixed resistors and eliminate the trimpot. This option can be completed once we know the sensitivity levels we want to use for a specific application, and we can hardwire that level in place. The other alternative is to use a small PCB trimmer that we set and forget.
The search for the op-amp really shows how effective the parametric search is on the Avnet Express site. I decided to use two different parts–depending on how the sensor interface board will be used. The first part I searched for is a readily available quad part that can operate up to and beyond 12V. It should be available in DIP for prototyping and SMT for a PCB. It should be a stock item that is readily available and reasonably priced.
For the higher voltage part, I chose the industry workhorse, the LM324. This part is industry standard multiply sourced and is made by several manufacturers. It will operate up to 32V and is a good general purpose part.
For the version that will operate from logic power supplies, we will need a rail-to-rail op-amp so it can drive logic directly when the single-rail logic power supply is used. I would like a 2.5V minimum operation so it can be used with the Diodes Inc. AH180 part in uni-polar mode.
For low voltage, rail-to-rail, a couple of clicks on the parametric search engine led me to the Microchip MCP619. This part goes down to 2.3V, is rail-to-rail, has low offsets and noise, and is a stock item. It only operates up to 7V though, so it is not usable for our higher voltage solution.
Both DIP packages have the same pinouts, so again, our design can accommodate both options without any modifications.
Ordering the Parts
With my BOM already created online, it only took one click to begin the checkout process. I was able to enter my information on a secure link, place the order, choose shipping, and execute it right away.
I chose the two-day shipping option for an extra $15. Two days later, the part arrive packaged well and ready to use. I began to build.
In order to make this easy to build and wire together, I did a little floor planning with the component placement. This way I was able to locate connection points in a strategic manor that would make a usable and easy-to-understand front faceplate. (See Fig. 8.) I used a generic proto board and placed the connection points around the peripheral so I could make cabling that went to the input jacks, output jacks, panel mounted trimmers, LEDs, and power connector. (See Fig. 9.)
On the circuit board, I used a socket for the op-amp. I used standard through hole one-quarter watt resistors, which are fine for this prototype and all are standard values with 5% or 10% tolerances. The same with general purpose capacitors. The Avnet Express search facilities made it easy to find readily available components based on my search criteria. I was also able to add the parts I found to the BOM easily.
I decided to make all connections cabled so it is easy to assemble and disassemble. This approach may take a little more work up front, but makes it much easier to repair, modify, or correct an error. This is especially true with prototypes that connect to sensors that may require bias changes or replaced components. The LEDs are cabled to the board and brute force inserted into the plastic faceplate for this prototype. They could be right on the PC board for tight fit applications or wired to a nice panel-mount LED holder.
On the front panel, I decided to use mini stereo jacks and cables to connect to the actual sensors. This way, I could use readily available audio cables that provided me with a shielded three conductor cable that could connect to the HEDs. I decided to use a standard RCA jack for the outputs since RCA cables are also shielded and readily available in a two-conductor form. I also used banana jacks for easy connection to power. (See Fig. 10.) In addition, I placed a couple of knobs on the trimmers. With everything assembled and soldered, it was ready to test.
Testing out the Design
My test will use the LM324 and 5V regulator fed by an external 12V supply. Before inserting the op-amp, I connected the 12V power supply to make sure I didn’t have any shorts on the protoboard. I kept current-limiting on low on the power supply to limit the amount of smoke that would bellow up if I had a fault. So far, so good. There was no smoke.
With an op-amp inserted in the socket, I powered up the board again. I saw that one of the LEDs was lit. This was expected since I hadn’t adjusted the sensitivity yet.
I turned the trimpot just slightly after the point where the LED turned off. This point was the maximum sensitivity for this channel. I did the same for the other channel. Both inputs were ready to test.
I made cables for the Hall Effect sensors with socketed heads. This option will let me test out different parts without having to solder and unsolder. (See Fig. 11.) I also cut and stripped an RCA cable to test the output sections.
With the input cable plugged in, I moved a magnet to the face of the sensor. I saw the LED light. I repeated this with channel two. I reversed the polarity of the magnet and tried again. For both channels, it worked the same. I was using the Diodes Inc. omni-polar AH180.
Switching to the Infineon TLE4905 uni-polar part was as easy as turning off power, unplugging one part, plugging in another, and turning power back on. I was ready to retest in 30 seconds.
I re-adjusted the sensitivity for both channels for good measure and placed the magnet at the face of the sensor. In this case, the north pole tripped the sensor only when in proximity. The south pole had no effect. On the other side of the sensor, this reaction was reversed. In this way, you can use any uni-polar device to detect either pole by rotating the HED 180 degrees.
As a visual test, I made a crude rotating magnet test using a metallic circle cutter with magnets placed around the perimeter. (See Fig. 12.) I placed the HEDs in a clip vise that surrounded the magnet wheel and spun up the magnet wheel with a drill.
As expected, square waves appeared on the scope indicating that it was detecting the magnetic field and tripping the outputs. (See Video 1.) I could position the magnets closer or farther away from the sensors to affect the duty cycle of the waveform. All was working as expected.
I prepared a quick through hole PCB for kicks, but did not yet have a chance to fab it. (See Fig. 13.) Stay tuned to this website. As we develop more projects and make more progress, these boards and others will be available to engineers, hobbyists, and students.
We will also lay out a small SMT board that can fit on the elbow joint of a robot. Stay tuned…