Hall switch.

shamu

Member
I have for some time been trying to get an 18M2 to respond to the A1120EUA-T Hall effect switch with no success.
I have tried using count and pulsin to measure the frequency on the device but couldn't get this to work.
My latest attempt below reads the port directly but doesn't work either.
Any help would be greatly appreciated
Code:
main:
let dirsB = 255

SYMBOL Delay = b1
SYMBOL Rotation = b2

Delay =20 

start:

'c.0,100,Rotation

if pin c.0 = 1 then 
  let outpinsB = %00000001  
  pause Delay

  let outpinsB = %00000010
  pause Delay

  let outpinsB = %00000100
  pause Delay

  let outpinsB = %00001000
  pause Delay

  let outpinsB = %00010000
  pause Delay

  let outpinsB = %00100000
  pause Delay

  let outpinsB = %01000000
  pause Delay

  let outpinsB = %10000000
  pause Delay

end if
goto start
Thanks in anticipation.
 
Last edited by a moderator:

SAborn

Senior Member
Is your sensor actually working, and what are you using to trigger the hall sensor.
Do you have a south facing magnet passing the sensor, as to quote from the data sheet have you read/done this.

For the A1120 and A1121, a south pole of sufficient strength
turns the output on. Removal of the magnetic field turns the
output off. The A1125 is complementary, in that for these
devices, a south pole turns the A1125 output off, and removal
of the magnetic field turns the output on.
 

shamu

Member
Yes the sensor is working, I have tested it on bread board and can get it to light an LED.
Getting the 18M2 to register it switching is the problem.
Thanks.
 

hippy

Technical Support
Staff member
Try some simpler code to check the input is being detected ...

Code:
Do
  If pinX.Y=1 Then
    High LED
  Else
    Low LED
  End If
Loop
Or something similar. Check you're connecting it to the correct PICAXE pin, and if it still won't work post your circuit diagram and/or photos of your set-up.
 

rob235

New Member
Do you have a pull up resistor on the output of the hall sensor?

If not, try around 10k between the + supply and the output pin. The output will then go low when the sensor is on.
 

Goeytex

Senior Member
Attached is a diagram showing how to connect the Hall to the Picaxe.

For testing write a simple program that treats the Picaxe input as if a push button switch is connected.
 

Attachments

shamu

Member
Treating the Hall switch as a push button type with a pull up resistor worked.
Thanks for all the help and suggestions.
 
Top