Intro: Using Analog Hall-Effect From 37 Sensors Kit
So you went out and bought a kit of electrical sensors and modules for a good price called "37 Sensors" ( l ike this one here or others on Amazon), but can't find information on the modules to be able to use them? This series of Instructables will help you out with all of the modules in the 37 Sensors Kit. There are other kits that sell a different number of modules than 37, such as a 20 module kit, and a 45 module kit. These sensors/modules are also available from some online stores individually.
These kits are excellent for STEM (Science, Technology, Engineering, and Mathematics) experimentation and education.
The module from the 37 Sensors Kit called "Analog Hall-Effect" might be used in an embedded project to measure the existence, intensity, or orientation of a nearby magnetic field.
(Images and information used with permission from 37sensors.com)
Step 1: Analog Hall-Effect Description
The Analog Hall-Effect module uses a three pin sensor that outputs an analog signal based on the intensity of a magnetic field. There are two different types of this module. One module is basically just the sensor while the other module contains a power led and a threshold circuit with an adjustable potentiometer and threshold LED/output.
The module needs a ground and power connection to whatever microcontroller you might be interfacing. Voltage can be 5V or 3.3V as with the typical microcontroller.
A magnet brought toward the hall sensor on this board will cause the sensor to output a voltage signal that is related to the distance to the magnet. Also, the North/South orientation of the magnet will affect the output voltage. For the module with the additional digital threshold output, the potentiometer will adjust the point in the analog signal where the threshold output is tripped.
Step 2: Analog Hall-Effect Specification
Voltage: 3.3V to 5.0V
LED: Power (longer board)
LED: Threshold (longer board)
Size: 15mm X 20mm, 15mm X 35mm
Main component: SS49E/CYL49E linear hall CYL49E
Sensor board has a potentiometer for sensitivity adjustment. Can be used for current sensing with appropriate circuitry. Use with a magnet for positioning.
There are a number of different sources for these modules. Not every module that looks similar to the ones here behaves exactly the same. Check the specific module that you have for differences in function, voltage levels, pinout, and inactive/active states. Some modules have been found to have incorrectly labeled pins and even poorly soldered components.
The magnet's North/South orientation can be detected by this sensor.
Step 3: Analog Hall-Effect Experiment Supplies
Just to see the basics of how this module works, this experiment shows how to interface it to a simple-to-understand microcontroller board. This microcontroller board is a $12.99 kit that can be assembled easily. There is no need for a complicated development system as the 32-bit micro that is part of this board has all of the smarts built in. The board shape even allows it to be used with Arduino Shields.
Code for other microcontroller platforms would likely be in a different language/syntax, but similar in form. Here is the small list of components for this experiment:
- Analog Hall-Effect module from 37 Sensors Kit. (This experiment's source: CircuitGizmos) Kits also available at Amazon and online in many places.
- Jumper Wires, female to female "DuPont" style. (This experiment's source: CircuitGizmos) Jumpers of this type are also available online.
- Microcontroller Board. (This experiment's source: CircuitGizmos for the $12.99 kit. An assembled board of a more capable but similar device is also available.)
- Power supply. The board accepts 7-10VDC through barrel jack or 5V/3.3V through the connector.
- USB serial Interface. A USB connection to a PC and 3.3V level connection for ground, transmit, and receive for the board.
- A small magnet.
A PC with a serial terminal application is used to communicate with the board. One such free and useful program is Beagle Term.
With all of this, you can perform an experiment to test the Analog Hall-Effect module.
Step 4: Analog Hall-Effect Experiment Hookup
The assembled microcontroller board is attached to the Analog Hall-Effect module as follows:
- Ground connection on the module = ground on the microcontroller board
- +Voltage connection on the module = 3.3V on the microcontroller board
- Analog connection on the module = uM4 (microcontroller pin 4) on the microcontroller board
- Digital/threshold connection on the module = uM7 (microcontroller pin 7) on the microcontroller board
Connect the USB serial interface to the PC (USB end) and to the serial signal connection of the microcontroller board (near the green power LED). The ground connections between the serial interface and the board connect together, and the transmit signal of one goes to the receive signal of the other.
Power up the microcontroller board. I used a 12VDC supply that worked just fine.
Start Beagle Term on the PC and connect to the serial port number that is appropriate for the USB serial interface. Bitrate needs to be 38400, 8N1 with no flow control. Tap the enter key and you should get a ">" prompt.
Step 5: Analog Hall-Effect Experiment Code
With the PC connected to a powered microcontroller board, Beagle Term is the window into what is happening on that board. You can enter program code, see the printed results of that code, and even interact by typing information into a running program.
Typing EDIT at the ">" prompt will connect you to the built-in editor. It is in this editor that you will enter the program code. You can save the code that you type in with a Control-Q keystroke. You can save and immediately run the code that is in the editor with Control-W.
Control keys for the program EDIT function. (Function keys don't work right in Beagle Term)
- Control-U - Move to line home
- Control-U Control-U - Move to start of the program
- Control-K - Move to the line end
- Control-K Control-K - Move to end of the program
- Control-P - Page up
- Control-L - Page down
- Control-] - Delete
- Control-N - Insert
- Control-Q - Save the code
- Control-W - Run the code
- Control-R - Find
- Control-G - Repeat find
- Control-T - Mark text
- Control-Y - Paste text
- ESC - Exit from editor abandoning changes.
Enter this experiment's code in the editor:
SETPIN 4, AIN<br>SETPIN 7, DIN DO PAUSE 200 D = PIN(7) IF D = 1 THEN X = PIN(4) PRINT X ENDIF LOOP
This code sets the signal lines to an analog input for the hall-effect sensor output and to a digital input for the threshold.
The loop code then reads those inputs and prints the analog output to the console every 1/5th of a second if the threshold has been met (digital signal = 1).
If you run this code you will see the output sent to Beagle Term. Those outputs will change as you move the magnet around.
Step 6: Analog Hall-Effect Experiment Results
When the threshold output is = 1, the analog values are printed.
The potentiometer appears to be set to about 1.35 volts, as after a lot of magnet moving the printed values are never below that.
Step 7: Analog Hall-Effect Summary/Feedback
Most of the Analog Hall-Effect modules found in 37 Sensors Kits are very similar to the one described here.
If you have any additional information on the specifications or behavior of this type of module, please comment here and I'll include the relevant information. If you know of a module that is similar, but perhaps available singly or in a different kit of modules, please mention that.
The comments area would also be a good place to include small sample code for other microcontroller platforms if you have experimented with this module.
Thanks for reading and contributing to this collection of 37 Sensor Instructables!
Humidity and Temperature
Multicolor Flashing LED
Piezo Driver or Annunciator
Shock and Impulse