Showing posts with label Hall Effect. Show all posts
Showing posts with label Hall Effect. Show all posts

Monday, 20 October 2014

Hand Held A1302 Hall Effect Sensor (Gaussmeter)

This is a partial write up, I will expand on this soon. I wanted to put a schematic and code up for anyone who was interested in following up the YouTube video I posted about this!
Enjoy! PLEASE NOTE: I often add captions to correct myself or elaborate in these videos, but the text is usually only visible if you watch it on the YouTube website.

A lot of this project was inspired by this page: Cool Magnet Man This is an incredibly valuable resource if you are interested in projects involving magnets and magnetism - I strongly encourage you to read through his website, I've spent a fair amount of time enjoyably reviewing his posts.

I will apologize in advance, the code isn't amazing, the design is a little short changed - but this thing went together really quickly from concept to reality. I will likely have a software revision in the near future, if you find any bugs please let me know so I can improve the next version. This is designed to run from a 9V battery.


ARDUINO CODE:
(Some of the LCD positioning is funny because I was using an odd ball LCD for the breadboard)

#define sensorPin 0
#define calibrationPin 1

//#include <Wire.h>
#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

float sensorRead;
float calibrationRead;
float sensorPinVoltage;
float calibrationPinVoltage;
float gauss;

void setup() {
  lcd.begin(16, 2);
  lcd.print("Awesome");
  lcd.setCursor(1,1);
  lcd.print("Jarret!");
  delay (2000);
}

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);
  }


Sorry about being so blunt with this. I will elaborate more in the future.
Cheers, have fun!