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!

4 comments:

  1. This was very helpful for me as an arduino novice trying to solve the same problem. I do think you're solution is a bit overcomplicated, rather than using a calibration pot, that at least for me never got to 0 properly (using the starter kit pots so not very gradual), I went with measuring the sensor voltage in absence of field and and used that as calibration, since the component seems to be very stable that way. If you think this may vary with temperature you could always measure it in setup. Your enclosure is actually pretty good, I do have access to a 3d printer and a lasercutter, but that would entail a design effort that would take longer than putting the actual device together.

    Thanks again for the guide I found it really useful.

    ReplyDelete
    Replies
    1. Hi,
      Thanks for your feedback. The hardware on this project went together in a weekend, so I'll be the first to admit it does need revision. I wanted to do more testing on the hall effect sensor to determine a better calibration method - to make reaching zero easier on the calibration, I would suggest trading out the resistors on either side of the calibration pot with something larger (It's just a voltage divider). I've received a lot of messages about this project, I plan to revisit it in the future with something a little more polished.
      Thanks again!

      Delete
  2. Hi,
    I want to make gaussmeter with hall effect sensor A314x. Can this work?

    ReplyDelete
  3. I want to make Gauss meter with hall effect sensor 49E, is same program work for it.... This program is complicated.... Can I get easier one

    ReplyDelete