how to make gauss meter using hall effect sensor module

in #technology6 years ago

Introduction

This tutorial is an open source arduino project that teaches how to make a Gauss meter using KY-003 hall effect sensor and 16X2 lcd display, the possible main purpose of this project is you can make an diy gausmeter experimental using hall effect sensor, good for school and indoor activity I built a hand-held Gaussmeter for measuring the polarity and strength of a magnetic field using this components.

20180222_150946.jpg

What Will I Learn?
  • how to make a Gauss meter using KY-003
  • how to display  actual data measurements using LCD
  • how to program a code on arduino Desktop IDE
  • how to connect all the components connection using diagram
  • HARDWARE

    • Step 1: Gather all the Requirements

    Requirements

    20180222_151155.jpg

  • 16X2 LCD with IIC backpack
  • KY-003 Hall effect sensor
  • Magnet (speaker magnet.etc)
  • Breadboard (optional)
  • jumper wires
  • Type B usb cable
  • Potentiometer
  • Arduino UNO R3 board
  • PC
  • Difficulty

    Either choose between the following options:

    • Basic Arduino Project

    Tutorial Contents

    • Information about the 3 main components

    20180222_151235.jpg

    The KY-003 Hall Magnetic Sensor consists of a 3144EUA-S sensitive Hall-effect switch for high-temperature operation, a 680Ω resistor and a LED buit in pcb. this sensor is a switch that will turn on/off in the presence of a magnetic field. placing the magnet near the sensor the led will autmatically turn on, The polarity of the magnetic field is of influence to the switching action.

    20180222_151322.jpg

    The 16x 2 LCD with I2C module you will be able to connect the LCD with Arduino board with only two Data cables! The i2c module has a built in potentiometer bakpack for contrast adjustment. The 16x2 display is the set up LCD number of columns and rows ( 16 columns, 2 rows Display ).

    20180222_151336.jpg

    The arduino UNO R3

    has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz quartz crystal, a USB connection, a power jack, an ICSP header and a reset button. 32k Flash Memory, 
    source

    codes and programs can be uploaded on to it from the easy Arduino computer program. which makes it a very easy way to get started working with embedded electronics. The name R3 is the third, and latest version of Arduino Uno Board

    Experimental Procedures

    • Step 2: Build the circuit

    A3144-Hall-effect-Sensor-Pinout.jpg

    source

    The Hall effect sensor has a build in 680Ω resistor and a LED in the board, The front side of the sensor needs the opposite polarity as the back of the sensor to switch on. it has 3 pin output the (1) VCC pin it is normally +5V meaning the devices VCC input is connected to +5V or 3.3V as the main power input pin, (2) GND GND the zero or common pin it help to complete the current flow of the circuit in path lower then vcc. (3) S or the sensor this is the data pin that can connect to any of the Digital pin outputs of the arduino board.

    • Connecting to the Arduino

    hall.png

    • Pin - = GND, connect to GND of the Arduino
    • Pin (middle pin) +5 v, connect to Arduino +5
    • Pin S signal, connect to Arduino pin 10

    The 16X2 LCD display interfaces has 4 build in backpack pins (1) VCC it refers to the power signal of the LCD typically connected to 5volts, (2)GND or sometimes zero voltage, It is also the common connection of the LCD must connect to in one way or another path in order to complete the circuit. (3) SDA and (4) SCL is the i2c serial bus pin it is used to synchronize all data transfers over the I2C bus from the 16 pin of the normal LCD, Both SCL and SDA are connected to analog pin ouputs of the arduino beacasue i2c lines are open drain drivers, means is that the chip can drive its output low.

    • Connecting to the Arduino

    U5dtqsMcFweBEB4pxkKhQ8g7Vs1gJBs_1680x8400.png

    • VCC - 5V
    • GND - GND
    • SCL - A4
    • SDA -A5

    • Step 3: Connect all components in one circuit with potentiometer for magnetometer calibration

    image.png

    SOFTWARE

    • Step 4: Dowload the Software and Libraries

    If you’re ready to get started, click on the link below then select the version with your operating system.
    Dowload the arduino Desktop IDE: https://www.arduino.cc/en/Main/Software
    When the download is finished, un-zip it and open up the Arduino folder to confirm that click yes, there are some files and sub-folders inside. The file structure is important so don’t be moving any files around unless you really know what you’re doing.

    Download the liquidcrystal LCD library : https://github.com/fdebrabander/Arduino-LiquidCrystal-I2C-library This library is a modified version of the H. Mario LiquidCrystal_I2C V.2.0 lib.

    • Step 5: Include libraries to arduino IDE

    Once installed the Arduino desktop IDE. open the software then locate the SKETCH tab at the top of the software, navigate ADD ZIP LIBRARY >> then look for the downloaded libraries in the download folder. SELECT the zip file then wait for the process. include all the libraries fo liquidcrystal display.

    add zip.png

    • Step 6: Programming

    Add Libraries at the first line of the code define the components library for the liquidcrytal i2c library, the wire h file is build in config on the IDE.

    #include <Wire.h>
    #include <LiquidCrystal_I2C.h>

    include the type of LCD for 16X2 LCD with i2c backpack address is 0x27;

    LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);

    Define the pin output of the components sensor pin to arduino

    #define sensorPin 10
    #define calibrationPin 1

    At the void setup() function write the command that starts serial connection this method is ran once at the just after the Arduino is powered up. The lcd.begin(16,2) command set up the LCD number of columns and rows. For example, if you have an LCD with 20 columns and 4 rows (20x4) you will have to change this to lcd.begin(20,4).

    void setup() {
      lcd.begin(16, 2);
      lcd.print("Hall effect");
      lcd.setCursor(1,1);
      lcd.print("Gauss!");
      delay (500);
    }

    At the he void loop() function this method you want to run the code over and over again. The lcd.print("--message--") command print a message to first column and row of lcd display. The lcd.setCursor(0,1) command will set cursor to first column of second row, change delay time of counter to (1000) equal to 1 second, the 1023 is the resolution of the ADC, The 1.3 is just a constant needed to change from input voltage to gauss.

    void loop() {
        sensorRead = analogRead(sensorPin);
        calibrationRead = analogRead(calibrationPin);
        if (sensorRead >= 1020 || sensorRead <= 3){
          lcd.clear();
          lcd.print ("INTENSIT"),
          lcd.setCursor(1,1);
          lcd.print("Y ERROR!");
        }
        else{
          sensorPinVoltage = ((5 * sensorRead) / 1023);
          calibrationPinVoltage = ((5 * calibrationRead) / 1023);
          gauss = ((1000 * (calibrationPinVoltage - sensorPinVoltage)) / 1.3);
          lcd.clear();
          lcd.print (gauss, DEC),
          lcd.setCursor(1,1);
          lcd.print("gauss");
        }
        delay(500);
      }

    A hall effect sensor that can measure at least 1500 gauss N or S, if you want to get accurately to within a few gauss then need to buy a calibrated certified device for that accuracy.

    • Step 7: Upload the code to arduino board

    Connect the arduino board to type B usb cable on your computer make sure you choose the correct port and board type on the tools section of the software.

    SOURCE CODE

    #include <Wire.h&gt
    #include <LiquidCrystal_I2C.h>
    LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
    #define sensorPin 10
    #define calibrationPin 1
    float sensorRead;
    float calibrationRead;
    float sensorPinVoltage;
    float calibrationPinVoltage;
    float gauss;
    void setup() {
      lcd.begin(16, 2);
      lcd.print("Hall effect");
      lcd.setCursor(1,1);
      lcd.print("Gauss!");
      delay (500);
    }
    void loop() {
        sensorRead = analogRead(sensorPin);
        calibrationRead = analogRead(calibrationPin);    
        if (sensorRead >= 1020 || sensorRead <= 3){
          lcd.clear();
          lcd.print ("INTENSIT"),
          lcd.setCursor(1,1);
          lcd.print("Y ERROR!");
        }
        else{
          sensorPinVoltage = ((5 * sensorRead) / 1023);
          calibrationPinVoltage = ((5 * calibrationRead) / 1023);
          gauss = ((1000 * (calibrationPinVoltage - sensorPinVoltage)) / 1.3);
          lcd.clear();
          lcd.print (gauss, DEC),
          lcd.setCursor(1,1);
          lcd.print("gauss");
        }
        delay(500);
      }
    • Now, you can see the value of current gauss meter using LCD and KY-003 hall effect sensor.

    20180222_150718.jpg

    I hope this Tutorial might help you on your future activity, if you want t buy arduino components ansd learn how to use it, this website might help all images in this post is mine, i appreciate your time reading my post. if you have questions about this tutorial you can drop it below in the comment. thanks you. 22/02/2018

    Sort:  

    Hello, how can you get a variable output from a switch?

    Hello , can you fritzing circuit file because when I try to do, it not show components that are showed by you so can you please give it.

    Coin Marketplace

    STEEM 0.30
    TRX 0.11
    JST 0.033
    BTC 64223.84
    ETH 3158.34
    USDT 1.00
    SBD 4.29