Hello, I will try to make it short and simple. I have an Iduino MEGA board and new in the Arduino wold. My objective is to control a pulse motor.
The interface of the MEGA to my breadboard is as follow:
Pin 2 set as in INput and reads a Hall sensor, type latch, on ISR.
Pin 3 set as in INput and reads a Hall sensor, type omnipolar, on ISR.
Pin A03 set as in ANAalog INput and reads an ratiometric (linear) a Hall sensor, also served with an ISR.
Pin 13 set as in OUTput and turns on red LED, on ISR (north pole).
Pin 12 set as in OUTput and turns on a green LED, on ISR (South pole).
Pin 11 set as in OUTput and reads a Hall sensor, type omnipolar, on ISR, (shows the detection, the presence of magnetic flux).
All LEDs are connected in series with a 330-ohm resistor like many examples from different users. Everything is running just fine... Until!
So, the first pulse motor is a simple rotor with 3 PMs, north magnetic poles only facing the omnipolar hall sensor. I use a 4n35 to interface with an IFR520 MOSFET to drive a high resistance coil. Pin 11 is used to drive the 4n35 optocoupler. A 12V battery use and NEG lead is connected to the ground of the MEGA.
However, it's not working! The problem is that pin 11 drops down to 2.5V! Checking pins 12 and 13, they drop also but only at 4.74V!
I have tried to use only pin 11 and commented out all other INputs and OUTput not required. No change, Pin 11 is still at 2.5V !?!
So I thought that I shorted something and I check all my wiring! Again, no problem. Since I have a MEGA, no problem, I have more outputs. So I change from pins 11,12 and 13 to pins 24, 25 and 26 and updated the sketch! Uploaded the new sketch, exact same situation. 2 pins drop at 4.72 V and the other one at 2.5 V!
Loaded the second sketch with only 1 pin driving an LED, it drops down to 2.5V!?
I have attached the sketch in question that drives 3 LEDs.
I'm starting to think that my ISR for the analogread function of pin A0 might be the cause of the problem since I do have a 2.5V (half of 5V) drop and that the linear hall sensor, when not sensing any magnetic flux will be at 2.5V!
I have been troubleshooting this issue for the last passe 2 days, hope that someone can help before I modify my sketch for the analogread function.
Thanks for your help
HallSensor_digital_analogue_rev_B.ino (6.52 KB)