Electronics Forum

Electronics Circuits & Projects discussion forum. Get help with electronics.


Help with Linear Hall Effect sensor circuit

Discuss about electronic circuits here. Request help for circuits that you couldn't find anywhere else, how a circuit works etc. Discuss anything related to electronic circuits.

Moderator: pebe

Help with Linear Hall Effect sensor circuit

Postby RanaUK » Sat Sep 06, 2014 10:31 pm

Hi everyone, I am new to this forum - so a quick introduction. My name is Rana; I am actually an old-school, i.e. the last time I worked with electric circuit was 26 years ago, and that time we all were running around with 4017 and 555 making a NightRider lights (good old days); with this huge gap, I am struggling figuring out how to do the following, and I am hoping someone can help me with it.

So with a Ratiometric Hall Effect Sensor (like SS495A), my understanding is with no magnetic field applied the output is about one-half the supply voltage, which will increase with the south magnetic pole on the face or decrease with the north magnetic pole on the face.

Suppose with a supply voltage of +5V, what I want is:
- One Pulse when it's more than 3V
- Two Pulses when it's less than 2V

so I guess I have two pots that I set to fine-tune; but any idea how I can do it easily?
A bonus would be where the pulse(s) would repeat after some time if magnet is still presence.

Thanks a lot guys; I would surely appreciate any help and feedbacks.

Rana
RanaUK
 
Posts: 7
Joined: Sat Sep 06, 2014 10:07 pm

Re: Help with Linear Hall Effect sensor circuit

Postby pebe » Sun Sep 07, 2014 3:07 pm

Best done with a micro like a PIC. But doing it with discrete components, is the component count a major consideration?

As a matter of interest, what are you making?
pebe
 
Posts: 1058
Joined: Tue Dec 09, 2003 11:12 pm
Location: Ellon, Scotland

Re: Help with Linear Hall Effect sensor circuit

Postby RanaUK » Sun Sep 07, 2014 6:28 pm

pebe wrote:Best done with a micro like a PIC. But doing it with discrete components, is the component count a major consideration?

As a matter of interest, what are you making?


Hi Pebe, well yeah, I would like to have it as small as possible. Now I have no idea about PIC, but I am guessing it's something like a PROM with some outputs; I will do a quick google read and see what I find. I would be asking you for some advice once I finish my read ; Thanks pebe.
RanaUK
 
Posts: 7
Joined: Sat Sep 06, 2014 10:07 pm

Re: Help with Linear Hall Effect sensor circuit

Postby RanaUK » Sun Sep 07, 2014 7:57 pm

pebe wrote:Best done with a micro like a PIC. But doing it with discrete components, is the component count a major consideration?

As a matter of interest, what are you making?


Did a quick read on PIC, and somewhere it says some PIC has an ADC built in; now if I understand that correctly, I can have a bit representation of input voltage (depending on ADC resolution I guess), and everything else can be done using pure code. So probably all I need is a PIC, crystal, and a transistor for output - neat. Any thoughts?
RanaUK
 
Posts: 7
Joined: Sat Sep 06, 2014 10:07 pm

Re: Help with Linear Hall Effect sensor circuit

Postby pebe » Sun Sep 07, 2014 8:12 pm

That's right. It's the simplest way to go. An 8pin PIC12F675 has an on-board 8 bit A/D converter (better than 0.5% accuracy), and an internal accurate oscillator, so you don't even need a xtal.

All you would need is just the PIC and maybe a transistor driver for the output. BitsBox sells the PIC for £1, and the transistor for peanuts. It's the cheapest way to go.

Let me know what you want to do.
pebe
 
Posts: 1058
Joined: Tue Dec 09, 2003 11:12 pm
Location: Ellon, Scotland

Re: Help with Linear Hall Effect sensor circuit

Postby RanaUK » Sun Sep 07, 2014 8:36 pm

Thanks a lot Pebe, that sounds wonderful. I guess I need some kind of hardware connected to my pc to write the PIC. What would you suggest for that?

Need to figure out at-least two things :D
1) How to not hard-code the trigger value but to pass it from POTs
2) How to limit the output to 1.5V (suppose driving a LED);
- noting the sensor runs on 4.5V to 10.5V, and PIC on 2V to 5.5V, guessing 5V is the correct stop.

back to studying... and at my age...
RanaUK
 
Posts: 7
Joined: Sat Sep 06, 2014 10:07 pm

Re: Help with Linear Hall Effect sensor circuit

Postby pebe » Mon Sep 08, 2014 7:27 am

RanaUK wrote:Thanks a lot Pebe, that sounds wonderful. I guess I need some kind of hardware connected to my pc to write the PIC. What would you suggest for that?

Microchip’s MPLAB IDE V8.86 is the screen editor I use (there is also a user guide). I has a built-in compiler to an .HEX file.

Microchip’s 33023A.pdf is a document explaining general properties of PIC chips. The data sheet on the 12F675 gives details specific to that chip. The ‘F’ in the part number indicates it is electrically erasable, and you can erase and ‘burn’ the chip with this programmer:

http://www.ebay.co.uk/itm/USB-PIC-Autom ... 43af7c0a02

Need to figure out at-least two things :D
1) How to not hard-code the trigger value but to pass it from POTs

No problem. If you want, you can record changing pot values in on-board eeprom, so you can then dispense with the pots when you have found the correct trigger values.

2) How to limit the output to 1.5V (suppose driving a LED)
If you are driving a constant current device like a LED, then you can drop the excess voltage with a resistor. If driving a constant voltage device, like a small motor, then one or more diodes in series will drop 0.7V each.

- noting the sensor runs on 4.5V to 10.5V, and PIC on 2V to 5.5V, guessing 5V is the correct stop.

Yes, the overlapping area of common voltage limits the choice of battery - especially if small size is a primary consideration. 3 dry cells would be quite large. 4 button rechargeable Ni-Mh cells would be better, but I think I would go for 2 x CR2032 cells (6V) fed through a diode to get 5.3V.

back to studying... and at my age...

No problem - believe me!
pebe
 
Posts: 1058
Joined: Tue Dec 09, 2003 11:12 pm
Location: Ellon, Scotland

Re: Help with Linear Hall Effect sensor circuit

Postby RanaUK » Mon Sep 08, 2014 9:55 pm

Hi Pebe,

that's the exact "USB PIC Automatic Programming Develop Microcontroller Programmer" from ebay that I had added to my watchlist last night :D Then I came across something called PicKit3; first I thought it's a PIC emulator (that would've been so cool)... there is no such thing, each there :roll:

Haven't reached the eeprom section yet; keeping my fingers crossed
RanaUK
 
Posts: 7
Joined: Sat Sep 06, 2014 10:07 pm

Re: Help with Linear Hall Effect sensor circuit

Postby RanaUK » Mon Sep 08, 2014 10:49 pm

Hi peter, thanks for your reply. I made a mistake of thinking it's two pots. It's actually 1 pot; I am thinking a 20K resistor + 20K pot > that would drive 0V to 2.5V to ADC which would then be used for trigger value with hall effect.

I did a quick search and found one circuit that uses EEPROM to store temperature value and a switch that is used to reset the EEPROM. This gives me an idea: how about a switch, and when it's pressed (and held down) it reads the current value of math.abs( 2.5V - current hall value); releasing it stores that value - thus getting rid of the pot altogether.
RanaUK
 
Posts: 7
Joined: Sat Sep 06, 2014 10:07 pm

Re: Help with Linear Hall Effect sensor circuit

Postby pebe » Tue Sep 09, 2014 7:15 am

Hi Rana,
I thought you wanted to pick up the values from two pots, rather than hard code the values. As I said earlier, (if you wanted to get suitable values by experiment) you could measure, in turn, and store the two values in the eeprom provided in the PIC and then dispense with the pot. You would only need one pot and you don’t need the resistor.

The PIC would then measure the hall effect voltage and compare it with the two values held in eeprom to decide whether it was outside the window between those two values and give one or two pulses, as appropriate.
pebe
 
Posts: 1058
Joined: Tue Dec 09, 2003 11:12 pm
Location: Ellon, Scotland

Re: Help with Linear Hall Effect sensor circuit

Postby RanaUK » Tue Sep 09, 2014 3:17 pm

Hi Peter,
following is some pseudo code that I was think of that works without the pot.

Assuming SW1 is a switch with Active Low to pin TICK1 (?);

Code: Select all
--- Main Routine ---

if SW1 not pressed goto routine_detection
WaitFor(500)
if SW1 not pressed goto routine_detection

// so on starting the device, switch needs to be held down for 500ms to get to this section
routine_calibrate:
   read GetAbsoluteHallDifference to some register
   if SW1 pressed goto routine_calibrate
   store register value to EEPROM
   goto routine_detection

routine_detection:
   if GetAbsoluteHallDifference is less than EEPROM goto routine_detection
   // if positive hall value then 2 pulse, else 1 pulse
   var numberOfTimes = 1 + (GetHallDifference > 0 ? 1 : 0);
   Pulse(numberOfTimes)
   
   // then don't do anything for a while
   WaitFor(2000);
   goto routine_detection



function GetHallDifference(){
   // todo: get difference between half of supply voltage - hall effect output
}

function GetAbsoluteHallDifference(){
   return Math.Abs(GetHallDifference());
}

function WaitFor(int millisecond){
   // todo: sleep for specified time
}

function Pulse(int numberOfTimes){
   // todo: loop action > set output high; WaitFor setOutputOnForMs; set output low; WaitFor cooldownMs
   const setOutputOnForMs = 1000;      // set pulse on for 1sec
   const cooldownMs = 400;
}
RanaUK
 
Posts: 7
Joined: Sat Sep 06, 2014 10:07 pm


Return to Electronic Circuits Help



Who is online

Users browsing this forum: No registered users and 18 guests



cron