Hello , it's my first post here, i am from France and just discovered Arduino lately, and i love it !
i plan to build a turn counter (to count the revolutions of a shaft) using a relay's coil and a strong magnet, w ww.instructables.com/id/EK96L5PXY3ES9J5XZ1 .
A wing nut bolted on the rotating shaft will interfere with the magnetic field and a voltage will be generated in the coil.
the relay is an Omron G6B-2114P, the coil is 720 Ohms, 12v.
the magnet is cylindrical, 5x5 mm, NdFeB grade N45 : BHmax = 45MGOe.
i don't plan to dismantle the relay , it's small and the magnet so strong that i can turn the relay on and off by sliding the magnet along one relay face.
since the relay casing isn't transparent, i don't know the coil's exact position, i will have to fiddle around to center the magnet to the iron core.
PeterTheUnGreat at Instructables got 40 volts peak to peak with no load but with only a 1 mm gap between the gear tooth and the sensor.
i will have a much larger gap, so i can expect the voltage not to be greater than 5 volts. How many volts can an input pin safely handle ?
how to connect it to an interrupt pin ?
my concern is not to damage my DFRduino Mega !
If the voltage is too large, i plan to short the coil's terminals, so the coil's own resistance (720 Ohms) will act as the load. Will it work like this ?
I don't have a scope, so it may be clever to approach the sensor close to the rotating shaft until the INT is triggered ?
Can i glue the sensor to a DC motor, so i can have a trigger per pole movement ?
i just tested the AttachInterrupt reference sketch by inserting a 510k resitor into pin 21 and it is very unstable, there is a lot of blinking even if i don't touch the resistor, then it doesn't work at all even if i touch it...
how to fix this ? ground the pin and provide a real 5v signal ?