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:
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??
Awesome! Worked first time for me. I’m using the SS495a model which seems to be the same.
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.
DRV5053 I meant.
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.
I have the SS49E, it work well with that code?
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);
How can I know the gain and range of the sensor?
Check this Quick_Reference:
https://arduining.com/testpage/
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!
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.
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!
How can I use Allegro A1104 hall sensor to measure Gauss value? (connection and code) Can you help
perdon , no consigo el ss495 b , cual lo puede reemplazar , saludos
sorry, I can not get the ss495 b, which can replace it, greetings
Check the comments, there are other devices you can use. SS39E from Honeywell is one of them.
Hi, would this code work with an arduino uno ? or would i need to change something ?
Hi, i need to display the Gauss value on an LCD display, the code please!
Using a UGN3503UA hall effect sensor.
I see that you formulated the correct parameters above for a DR5053
How did you come to the numbers for the
gss = map(aValue, 0, 410, -435, 435);
and
x = map(aValue, 0, 1024, 0, XRANGE); to x = map(aValue, 0, 410, 0, XRANGE);
I would like try this with the sensor I have … but would like to know how the values get calculated.
Link to sensor data
https://www.digchip.com/datasheets/parts/datasheet/029/UGN3503U-pdf.php
If you would be so kind as to direct me to how to get the appropriate values for this sensor.
Thanx
Hi Cris, try this an give feedback…
/*GaussPlot_3503.ino Arduining 04 APR 2018
Reviewing the code GaussPlot.pde 27/12/2011 Arduining.com
A more general approach based in the question on the Arduining blog:
Cris Mar 16, 2018
Plotting the Allegro 3503 RATIOMETRIC LINEAR HALL-EFFECT SENSORS.
3503 characteristics (from the manual):
Operating Voltage: 4.5-6
Quiescent Output Voltage: 2.5V typ.
Sensitivity: 1.03 millivolts/Gauss
Output Range: 0 to ±900 Gauss
*/
#define ANALOGIN 0 // Analog pin
#define XRANGE 50 // Number of character per line to represent the analog value.
#define ANALOG_REF 5000 // Arduino UNO AREF, The ADC returns 1023 when see this voltage (millivolts)
//#define ANALOG_REF 4750 // Arduino NANO AREF, The ADC returns 1023 when see this voltage (millivolts)
// AREF can be as low as 4.62V in the NANO (MBR0520 diode after USB power).
#define VOLTGAUS_RATE 1.03 // Volts/Gauss (millivolts)
#define ZEROGAUSS 2500 // Quiescent Output Voltage (millivolts)
#define HIRANGE 900 // Output max value.
#define LORANGE -900 // Output min value.
int avalue, mvout;
float gauss;
int plotvalue;
void setup(){
Serial.begin(9600);
}
void loop(){
avalue= analogRead(ANALOGIN);
mvout = map(avalue,0,1024,0,4750); //millivolts out of the sensor
gauss= (mvout-ZEROGAUSS)/VOLTGAUS_RATE;
plotvalue= map(gauss, LORANGE, HIRANGE, 0, XRANGE); //map gauss in the plot range
Serial.print(“|”);
for (int i=0;i<plotvalue;i++){
if(i==XRANGE/2-1)Serial.print("|");
else Serial.print("-");
}
Serial.print("O");
for (int i=plotrange+1;i<XRANGE;i++){
if(i==XRANGE/2-1)Serial.print("|");
else Serial.print("-");
}
Serial.print("|");
Serial.print(gauss);
Serial.println("Gauss");
delay(100);
}
With no magnet near sensor it outputs -148gauss all the time.
Shouldn’t it be closer to zero?
When magnet applied I get positive 1400 and negative 1150
————-O—|————————-|-148.54Gauss
|——————–O—|————————-|-148.54Gauss
|———————O–|————————-|-144.66Gauss
|——————–O—|————————-|-148.54Gauss
|——————–O—|————————-|-148.54Gauss
|——————–O—|————————-|-148.54Gauss
|———————O–|————————-|-144.66Gauss
|——————–O—|————————-|-148.54Gauss
|——————–O—|————————-|-148.54Gauss
|——————–O—|————————-|-148.54Gauss
|———————O–|————————-|-144.66Gauss
Thanx
Are you using Arduino UNO or NANO?
Currently using a Leonardo board..
Because the 3503’s Quiescent Output Voltage (2.5V typical) can range from 2.25 to 2.75 Volts the zero Gauss can range from -325 to +325. Measure the output voltage of the sensor far from magnetic fields and correct the ZEROGAUSS definition in the sketch accordingly. Also measure the Vcc of the Leonardo and correct the ANALOG_REF definition.
Good luck…
Hey can u please explain me how i can use a3144 to get the output and i want to how u got these values for other sensors
Can u please explain me how to get the values for a3144 please its urgent
I hav an another sensor also 72x 0h10
Can u pls let me know how to calculate the value for this
Hi i have SS496A1 ? It is the same map? If not can you please provide? Thanks in advance