So I have made an electromagnet levitation circuit using analogue components (comparator) and now I am trying to recreate using an arduino.
I have the circuit and code working just like the beginnings of my analogue circuit but I need to be able to filter my digitalWrite OUTPUT that turns my TIP122 transistor switch on and off.
When taking the first steps in the analogue levitation circuit (using IR sensors) I simply turned the electromagnet on and off when an IR beam was broken and this causes flutter, or oscillation of the object under levitation. To solve this a high pass filter of frequency 3.386Hz was used on the input to the TIP122 to turn it on and off 'smoothly' (470kohm and 100nF compensation network). On multisim this switching voltage is about 1.5V just for reference.
I have been looking for a digital equivalent and haven't been able to find/understand any solutions so far.
Could anyone help?