Hall sensor problems

Hi,
I have a project I put together awhile ago and have been using it regularly without any problems until a couple weeks ago.
I have a couple stepper motors running back and forth between some hall sensors and another sensor counting turns on another stepper.

My problem is with the counting hall sensor, every once in awhile the stepper will get jammed and sit there and vibrate trying to make the next step but it can't so I have turned the power off and then back on and everything would reset and I would start using it again. That has worked fine but now when that happens the hall sensor just seems to get dropped by the arduino due, it doesn't register any counting in my serial window, and since everything is waiting for the count to hit a certain number everything else will just run continuously waiting for the number.

Today when it happened I turned the power off and on but then I hit the reset button on the Due and the counting sensor worked as programmed where as if it was just a power down/up it wouldn't work.

Long story short the hall sensor has a note on the data sheet about adding a capacitor for transient suppression and was wondering if anyone could clue me in on wether I was barking up the wrong tree or if that would be the next logical step before looking elsewhere.

Heres the hall sensor 551003H02A

As you are using a Due that is a 3V3 system. The data sheet says the minimum operating voltage is 3V8 or 3V75 depending on the sort of sensor.

How are you wiring this up? I would say that this sensor is not suitable to be used with the Due.

Grumpy_Mike:
As you are using a Due that is a 3V3 system. The data sheet says the minimum operating voltage is 3V8 or 3V75 depending on the sort of sensor.

How are you wiring this up? I would say that this sensor is not suitable to be used with the Due.

Hi Mike,
I have a logic level shifter (this one) between the hall sensors and the due and have also added a resistor to VDD and Output per the data sheet before going into the shifter.

Never seen that one before. So are you saying you are running the hall sensor at 5V?
A wiring diagram would be good to see. Showing all the power supplies and stuff.

Yes capacitors can make a difference, a 0.1uF ceramic across the supply of the hall sensor and a big 1000 uF or bigger across the stepping motor supply.

What sort of stepping motor driver do you have? I once burned out one by not having a big capacitor across the power supply.

Grumpy_Mike:
Never seen that one before. So are you saying you are running the hall sensor at 5V?
A wiring diagram would be good to see. Showing all the power supplies and stuff.

Yes capacitors can make a difference, a 0.1uF ceramic across the supply of the hall sensor and a big 1000 uF or bigger across the stepping motor supply.

What sort of stepping motor driver do you have? I once burned out one by not having a big capacitor across the power supply.

I will work on a wiring diagram, have added a few things since the last one.

I'm using a gecko203V(here) with a 960oz motor pulling 7A that has worked pretty well for me.

On a side note why do you suppose a reset on the Due isn't the same thing as turning the power off and on?

On a side note why do you suppose a reset on the Due isn't the same thing as turning the power off and on?

On many processors there is a difference between a reset and a power up reset. Often what gets reset is different for each type so there is no surprise that something could respond to one and not the other.

Confused,

Are you certain your stepper driver is not causing all these issues?

If everything works right until the stepper motor goes into a seizure, solve that first is my suggestion.

I finally was able to get a diagram of my project, let me know where I can improve.

let me know where I can improve.

By labelling the pin numbers and signal names on all parts.

You also only seem to have one decoupling capacitor for the whole design. Note you need 0.1uF ceramic capacitors on every chip you use.

Also do not use signal level converters for generating power supplies, that is just asking for trouble.

You also seem to have a 330R resistor across the power and ground of the hall sensors, why? It does absolutely nothing.

Grumpy_Mike:
By labelling the pin numbers and signal names on all parts.

You also only seem to have one decoupling capacitor for the whole design. Note you need 0.1uF ceramic capacitors on every chip you use.

Also do not use signal level converters for generating power supplies, that is just asking for trouble.

You also seem to have a 330R resistor across the power and ground of the hall sensors, why? It does absolutely nothing.

Hi Mike,
I'm working to label everything better, struggling with new program.

I didn't have and caps on the Hall sensor originally, the spec sheet said I might have to add for transient suppression if required so I added one on the sensor that was giving me a problem. I also had it represented wrong on the diagram as the cap is on the power and GND of the hall sensor and the Resistor is connected between the power and signal wire on the sensor.

I had to add the resistor to make the sensor function properly when I first started using it but as stated above it is connected between the signal and power wires not the GND.

I had to use the Logic level shifter because in the middle of my project I switched from using a Mega to a Due for faster speeds on motors and couldn't find any suitable 3v signal hall sensors and using the Shifter seemed the quickest and easiest solution since everything was soldered in place already.![](http://)

I had to use the Logic level shifter because in the middle of my project I switched from using a Mega to a Due for faster speeds on motors and couldn't find any suitable 3v signal hall sensors and using the Shifter seemed the quickest and easiest solution since everything was soldered in place already.

But the hall sensor you have already is suitable for a 3V3 output.

The data sheet says it has an "• Open Drain Output". This means you just carry on powering them with 5V and connect the outputs directly to your Due with the pull up resistor ( the one connected between signal and 5V ) connected to 3V3 instead.

You are still trying to use the level shifter as a power source. Don't do it.

You also only seem to have one decoupling capacitor for the whole design. Note you need 0.1uF ceramic capacitors on every chip you use. In addition you will need a big capacitor on the stepping motor supply say 1000uF or bigger. This is probably why things are jamming up when the motor moves. Slumpert's advice is very sound.

Grumpy_Mike:
But the hall sensor you have already is suitable for a 3V3 output.

The data sheet says it has an "• Open Drain Output". This means you just carry on powering them with 5V and connect the outputs directly to your Due with the pull up resistor ( the one connected between signal and 5V ) connected to 3V3 instead.

You are still trying to use the level shifter as a power source. Don't do it.

You also only seem to have one decoupling capacitor for the whole design. Note you need 0.1uF ceramic capacitors on every chip you use. In addition you will need a big capacitor on the stepping motor supply say 1000uF or bigger. This is probably why things are jamming up when the motor moves. Slumpert's advice is very sound.

I didn't realize the resistor would drop the signal to 3v3 and not damage the input pin of the Due with 5V coming from the sensor, I'm pretty new to electronics if you couldn't tell.

I thought the Level shifter was just stepping down the signal from 5V to 3V3, I didn't think it was powering the sensor since I have 5V going directly to the sensors, I have 5V going to the Level shifter because that is how the spec sheet had me wire it up.

I didn't use any caps on the original design because they were working without them and the spec sheet said I would only need them if I had problems with transient suppression. I have been using it this way for the past year and then I started having the problems with the one sensor so I added the Cap to see if it would help. I will add caps to the other sensors as well.

For the large cap on the motor would I install that where the wires connect on the PSU, where the PSU wires connect to the Gecko 203V Driver or where the wires go into the motor?

I appreciate your help.

Large capacitor on stepper supply. Not the motor, read carefully! Decoupling is always between supply and ground.

I didn't realize the resistor would drop the signal to 3v3

No it doesn't drop the signal to anything. An open drain means there is / or is not a connection from the output to ground depending on the output state. There is no voltage signal out of an open drain ( or open collector ) output at all. It is like a switch to ground. The only way to get an output is to have a pull up resistor from that output to the voltage you want to have. I would have tended to use 4K7or 10K as the pull up to save on current.

This is a full explanation.

As MarkT says the large capacitor does not go in the motor. If you try and do this then the capacitor is likely to explode in flames, because it is being connected up the wrong way round half the time.

MarkT:
Large capacitor on stepper supply. Not the motor, read carefully! Decoupling is always between supply and ground.

I can read carefully but when most is going over my head the only stupid question is the one not asked, trying to learn as I go along.
Thanks for the help.

Grumpy_Mike:
No it doesn't drop the signal to anything. An open drain means there is / or is not a connection from the output to ground depending on the output state. There is no voltage signal out of an open drain ( or open collector ) output at all. It is like a switch to ground. The only way to get an output is to have a pull up resistor from that output to the voltage you want to have. I would have tended to use 4K7or 10K as the pull up to save on current.

This is a full explanation.
What does "open drain" mean? - Discrete Semiconductor Products - Electronic Component and Engineering Solution Forum - TechForum │ Digi-Key

As MarkT says the large capacitor does not go in the motor. If you try and do this then the capacitor is likely to explode in flames, because it is being connected up the wrong way round half the time.

https://www.youtube.com/watch?v=VknpLq7DkSM

Thanks for the links Mike,

If I follow what the links and you are saying I should have connected the resistor to the 3v3 instead of the 5v supply and then no harm would come to the Due input pins and no requirement for the Logic shifter.

Reading the spec sheet the hall sensor requires +3.8 to +24Vdc supply which is why I thought the signal would be 5v since I couldn't power it with the 3v3 output of the Due, without knowing any better about the open drain concept from the links.

Could the internal pullup-resistor on the Due be used on the output signal even though it is much larger than the 10K you state then the output would be using 3v3, correct?

If I follow what the links and you are saying I should have connected the resistor to the 3v3 instead of the 5v supply and then no harm would come to the Due input pins and no requirement for the Logic shifter.

Yes that is correct.

Could the internal pullup-resistor on the Due be used on the output signal even though it is much larger than the 10K you state then the output would be using 3v3, correct?

Yes in theory then you could use the internal pull up resistors. They would be fine if the sensors were close to the Due. However, if they are a long way off, and in electronics context this is longer than 12", the high value makes them more prone to pick up interference that will disrupt your signal, so a lot depends on context.

I can read carefully but when most is going over my head the only stupid question is the one not asked, trying to learn as I go along.

That is exactly why we are here, to answer the "stupid questions", but we don't consider them to be stupid, but just as a part of the learning process. I have taken 50 years to know what I know now, you never stop learning.

Grumpy_Mike:
I have taken 50 years to know what I know now, you never stop learning.

Amen to that.
Thanks Mike

Well I worked on trying to change my wiring using everyone's suggestions but I seem to have hit a snag.

I started with removing the Logic shifter and then took a wire from the 3V3 to the end of a 10k resistor and then connect the signal wire from the hall sensor to the 3v3 and resistor, I then just stuck the other end of the resistor into the Due input pin but now the hall sensor doesn't seem to register anything. When I pass a magnet over the sensor it doesn't count as it should per uploaded code.

I'm using test code that I used previously to verify they were working correctly.

int Sensorcounter = 0;
int SensorcurrentState = 0;
int SensorpreviousState = 0;
int Sensor = 47;

void setup() {
  pinMode(Sensor, INPUT);
  Serial.begin(115200);
}

void loop() {
  SensorcurrentState = digitalRead(Sensor);     //used to time all events
  if (SensorcurrentState != SensorpreviousState) {    //check the count and add 1
    if (SensorcurrentState == 1) {
      Sensorcounter = Sensorcounter + 1;
      Serial.println(Sensorcounter);
    }
  }
  SensorpreviousState = SensorcurrentState;
}

Is the way I wired it not correct?

Is the way I wired it not correct?

Correct.

Take the wire from the sensor and connect it to the Due input. Then take the same Due input and connect a 10K resistor from it to 3V3.