Thanks for quick reply. I got lots of awesome suggestions to resolve my issue. I appreciate all of you and will try to cover what suggestions i applied and what result i got in my post
Your results tell me your magnet is either too close to the sensor or the magnet is too powerful, or both. Make some changes in distance and tell us what the results are.
My client is using industry standard magnet and stepper motor. They use same magnet and sensor for their other product without any problem. so, I think the problem is not with magnet. I also tried to change the distance between magnet and sensor which increases the fluctuations.
Does this mean that -----
Yes, The values fluctuate a lot when magnet/stepper motor is not attached to sensor. Here is the result when magnet is not attached:
238 198 114 235 123 238 99 238
I want to read sensor data at every 15 degree of stepper motor which is 360/15 = 24 positions.
As per suggestions, I made following changes to my original code , capture 10-11 sensor reading for all 24 stepper motor position and attached the result to the post.
Code changes: Instead of delay function i used millis(), replace ‘data/4’ with ‘data’.
The recommendations for the magnetic material of the magnet are important. By specifying a material and a size for the magnet, they have effectively specified the magnetic field strength.
Just any old bar magnet probably won’t work.
As I mentioned, My client is using industry standard magnet and stepper motor. They have been using it for long time and for their other products so, I think magnet is not the issue.
As with anything involving sensing magnetic fields you need to ensure that external fields, such as those leaking from the stepper motor, don’t influence the sensor readings. You need physical separation and a non-magnetic coupling to the motor.
They are using very expensive industry standard stepper motor. The whole mechanism is well designed and physically separated. I wish i could posts the pictures of mechanism here but due to agreement, I cant post them.
With proper mechanical design and selection of motor and driver, the stepper won’t skip steps.
So you know the “position”. Why the encoder?
I am new to the project and Their mechanism is way too complicated. As per my understanding, It may possible that the mechanism get heavy load and stepper motor skips some steps so they double check stepper motor position with sensor. Hope I got it right
SensorReading.txt (1.5 KB)