I am using an Arduino nano for this project, and I am trying to imitate some old RPM sensors for my electric motor that are no longer produced.
The motor controller, which needs motor RPM via a signal wire (this is a 12V system of a car) this signal line must be pulled low four times per revolution with approximately a 50% duty cycle. On my motor shaft, there is a small ring which has 4 magnets around it, which will give me my four pulses per revolution. (motor will exceed 5000 RPM in some cases)
I have got the hall effect sensor to work with my arduino, and this sensor pulls low when triggered via a magnet, and I have a simple setup where an n channel mosfet controls an led.
My main problem is that when this hall effect sensor detects the magnet, I need it to send out exactly one cycle at 50% duty cycle of that makes sense.
So what do you all recommend I do? Do i have it wrong by trying to even use pwm to begin with? These magnets on the motor shaft are evenly spaced, so should I just set my arduino to trigger the mosfet only when it detects the magnet?
Should I only tell the arduino to signal the mosfet when it detects the magnet then immediately following on the next line turn the mosfet off? Or add a delay of a few milliseconds?
Please let me know of your thoughts and suggestions! I am sorry if this all sounds confusing, I am still working my way around arduino.