Home > Exploring Ideas, Hardware testing > Arduino Hall Effect Sensor ( Gaussmeter )

Arduino Hall Effect Sensor ( Gaussmeter )

 

Using the SS495B Miniature Ratiometric Linear Hall Effect Sensor from Honeywell and the Arduino NANO.

 

 

Just connect the sensor  to  GND and VCC and the “Output” pin to the analog input A0.
The effect of North and South magnetic fields in the sensor are observed in the Serial Monitor.

 

 

The Sketch used:

/*
GaussPlot
27/12/2011  Arduining.com
Showing Gauss measured by the SS495B in the serial monitor.
(Miniature Radiometric Linear Hall Efect Sensor)
Sensor connected to Analog channel 0.
*/
#define XRANGE  50 
int x,gss;
void setup(){
  Serial.begin(9600);
}   
void loop(){
  int aValue =analogRead(0);
  x = map(aValue, 0, 1024, 0, XRANGE);
  gss = map(aValue, 102, 922, -640, 640);
  Serial.print("|"); 
  for (int i=0;i<x;i++){
    if(i==XRANGE/2-1)Serial.print("|");
    else Serial.print("-");
  }
  Serial.print("O");
  for (int i=x+1;i<XRANGE;i++){
    if(i==XRANGE/2-1)Serial.print("|");
    else Serial.print("-");
  }
  Serial.print("|");
  Serial.print(gss);
  Serial.println("Gauss");
  delay(100);
} 

See the YouTube presentation:

Advertisements
  1. weissa7
    February 11, 2013 at 2:35 AM

    Can you please explain why you used the map function ( twice) in your code and how you determined what parameters to use within map function??

  2. planbee
    October 12, 2014 at 4:30 AM

    Awesome! Worked first time for me. I’m using the SS495a model which seems to be the same.

  3. February 15, 2015 at 8:57 AM

    I’m having the DR5053 and when using your sketch my “0” point is -473 to -475 gauss. Is that the actual gauss or just an indication. I want to know my 0 point so I can bring to the middle point of 0-1023 bit.

    • February 15, 2015 at 8:58 AM

      DRV5053 I meant.

    • February 15, 2015 at 10:16 AM

      You need to change the following line to reflect the range of the DR5053 (0-2Volts):
      x = map(aValue, 0, 1024, 0, XRANGE); to x = map(aValue, 0, 410, 0, XRANGE);
      410 is the analogRead value when the input voltage is 2 Volts (5V as reference).

      Also the line:
      gss = map(aValue, 102, 922, -640, 640); needs to change.
      Here you need the last two letters of the DR5053 code.
      for the DR5053CA (23 mV/mT) is the same as 2,3mV/Gauss:
      gss = map(aValue, 0, 410, -435, 435);

      Remember the accuracy for this devices are low.

  4. Wen
    September 2, 2015 at 4:48 PM

    I have the SS49E, it work well with that code?

    • September 2, 2015 at 7:33 PM

      The SS49E has a different gain and range.
      To use it change the line:
      gss = map(aValue, 102, 922, -640, 640);
      Use his:
      gss = map(aValue, 205, 810, -1000, 1000);

  5. jeff
    October 30, 2015 at 1:02 PM

    hello, for gss = map(aValue, 102, 922, -640, 640);

    how did you get 102 and 922? Is this from the sensitivity of the sensor?

    Thanks!

    • October 31, 2015 at 7:21 AM

      The sensor range output voltage is 0.5-4.5V, if use a 5V as reference for the analog readings, then 5V = 1024, 0.5V = 102 and 4.5V = 922 . For better results check the VCC voltage of the Arduino and adjust.

  6. gal
    November 17, 2015 at 3:58 AM

    Hi. Like Wen, I’m also planning to use the SS49E for this. I was wondering why you said that the gss should be changed to map(aValue, 205, 810, -1000, 1000). Given the graph that you referred to (the range is 1V to 4V), shouldn’t it be gss=map(aValue, 205, 819, -1000, 1000) since 4*1024/5 is 819.2? Of course, if I misunderstood you, could you please tell me where? Thanks a lot!

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: