Sunday, January 13, 2019


Measurement of B.
        
      We will measure B with the Help of Arduino. Arduino is an open-source electronics platform based on easy-to-use hardware and software. Arduino boards are able to read inputs - light on a sensor, a finger on a button, or a Twitter message - and turn it into an output - activating a motor, turning on an LED, publishing something online. You can tell your board what to do by sending a set of instructions to the microcontroller on the board. To do so you use the Arduino programming language (based on Wiring), and the Arduino Software (IDE), based on Processing.
       Here we will programme the Arduino to read the output of a magnetic field sensor. In order to built a small gauss meter we will need the following material.
      
Materials

1.     Arduino Uno R3
2.     Connecting wires
3.     16×2 LCD
4.      220ohm resistance
5.     3k resistance
6.     Arduino cable and Arduino software
7.      Linear hall sensor (UGN3503U)
8.     Battery or Arduino Power Supply
9.     A small magnet   

Circuit Diagram

Tips.

   Here, the capacitors can be ignored.
  The positive and ground terminals will be connected with the Arduino 5V and GND slots.
   Use a 3k Ohm resistance to pin 3 of LCD and then ground it.  If screen is not showing good result change the resistance and use exact 2800 ohm or you can also use a variable resistor for adjustment of screen contrast. 
   The circuit is showing only 14 connections of the LCD but we have to use the remaining 2 pins of LCD. Connect Pin 15 of LCD to positive terminal through a 220ohm resistance and Pin 16 directly to GND.

Software.
    Now before going toward the software part make sure you have installed Arduino software. Arduino software will be used to give command to the Arduino board. The link is given below (https://www.arduino.cc/en/Main/Software)
   After instalment of the software follow these steps.
i.                   Open the Arduino software.
ii.                 Connect Arduino to the computer or Laptop.
iii.              Go to the upper right side and look for “Tools”.

iv.               Then select the PORT.
v.                 I used Arduino UNO R3. So make sure if you are using UNO Arduino you are connected to this.


vi.               All done now we are ready to go. Clear the front page.  

vii.            Now paste the following code in the Arduino and click the upload button.

 CODE.

       #include <LiquidCrystal.h>


// initialize the library with the numbers of the interface pins

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);/// REGISTER SELECT PIN,ENABLE PIN,D4 PIN,D5 PIN, D6 PIN, D7 PIN

char ADCSHOW[5];//initializing a character of size 5 for showing the ADC result

void setup()

{

  // set up the LCD's number of columns and rows:

lcd.begin(16, 2);

}



void loop()

{

             lcd.print("FluxDensity");//showing name

                lcd.setCursor(0, 1);//move to second line

                lcd.print("(in Gauss):");// showing units

                String ADCVALUE = String((analogRead(A0)-515)/8);

 /* Now since the default reference if 5V and resolution is 10bit so for every 5/1024 = 5mV, we get one increment is count, The sensor provides increment voltage of 1.3V for every 1Gauss increment if field.

So we need to divide ADC value by 3.76 for getting the gauss value, now the 0 gauss output of sensor is 2.5V so we need to subtract that first. To hold a 0V read at 0Gauss field. */

                // Convert the reading to a char array

                ADCVALUE.toCharArray(ADCSHOW, 5);

                lcd.print(ADCSHOW);//showing the field strength value

                lcd.print("G   ");

                lcd.setCursor(0, 0);// set the cursor to column 0, line 0

}

  

           
         Now put a magnet near the Sensor. The magnetic flux will be shown on the LCD.
Measure the distance between the magnet and the magnetic sensor. (Note. At a particular distance, move the magnetic up and down to get the maximum value of B.)