PWMs affects interrupt?

Hello all,
A am new to this forum. I did search on my problem but found nothing useful.

I want to use all of 6 Arduino Duemilanove PWM outputs and one interrupt 0 on pin 2 input simultaneously. But I am facing some strange problem. It seems to me that PWM output somehow affects interrupt input. If I switch all outputs to 0 or to 255 (eliminating the PWM switching) the problem disappears, but when I start using real PWM values between 0 and 255 the interrupt seems to come irregular, some interrups are lost. I have read some materials on Arduino internal timers, registers, ISRs etc, but didn’t find any useful information that could help me to understand what is going on.

Does PWM output of Arduino affect the interrupts? If yes, how it can be workarounded?

Does PWM output of Arduino affect the interrupts?

Not directly. It sounds as though you're having problems with electrical noise.

Might be an idea to post your code and schematic....

Also please tell what speed the interrupts are coming in at, it could be your ISR is taking too long.

Found the topic close to my task, but it was quite dead.

Let me clarify the task a little. I want to measure the car wheel speed using the ABS sensor. There is a little problem searching the forum on ABS word because of abs() function mentioned almost everywhere :)

I don't have a schematic file here so I'll try to explain. I use comparator with hysteresis and want to have some isolation from sensor circuit on DC because I don't want to affect the ABS module and I don't know how this sensor is connected and what is the circuit in general. All I have is AC signal of that sensor. So I passing both ends of it through two big capacitors, then use small RC filter and further on comparator with hysteresis. The output of comparator goes to Arduino pin 2 on which I count rising edges by interrupts. 6 IRF520 are controlled by Arduino PWMs regulating the power that goes to loads.

I suppose everything sounds reasonable, but something is going wrong anyway. Phantom interrupts are my headache.

I'll try to make a schematic. I understand, that it is almost impossible to give an advise without it. Anyway, if anyone know there is appropriate topic for interfacing with ABS or just inductive sensor on this forum I'll be appreciated

So I passing both ends of it through two big capacitors

That is your problem. There is no DC common signal path so things will float. The way to isolate the signal it either through a transformer or opto isolator.

Well, as I promised here is what I got

Large capacitors C1C2 on the left are for ABS system DC isolation. R1C3 is the low pass filter, VD1VD2 are for signal limiting, R4R5 sets the zero point for comparator and R2R3 enables the hysteresis. Whole thing is powered from 12V and OP1 is powered from Arduino's +5V pin. I need the loads to be permanently connected to ground so I used the trick with P-channel VT2, which is driven by N-channel VT1 and R6, allowing to switch +12V power using +5V Arduino out pin. Yesterday I\ve tested the schematic again, turning off the PWMs and using only On/Off mode for loads. Everything works fine! I can see every single ABS sensor tooth, but when I switch PWMs on the interrupt input becomes crazy. It just fires randomly.

Is there any criticism on schematic or ideas about ABS sensor interfacing, or maybe links to appropriate forum topics?

Grumpy_Mike, what do you think about the DC? Is it required in my case? I want only AC part of the ABS sensor and using R4R5 to set the zero point. Additionally safety diodes VD1VD2 connect both inputs of comparator on DC. I think it should work ok and it does work without using of PWMs

I suppose now not to use such a trick on PWM output. Can PWM modulation affect arduino power regulator and thus the comparator powered from it?

Hi Petrony,

Since I've also started a project where Im trying to get the speed of the car using the ABS-sensor I am a bit curious on how your work is coming along?

Are you, for example, still using the same schematic as posted above?

// Jonas

Before trying to solve the problem, is your schematic complete? I don't see a ground going to the Arduino board? Is the 12vdc power going to the Arduino (pin 18?) the Arduino Vin pin? Is the mosfet wired to the Arduino output pin (pin 11?) a LOGIC level mosfet? +5vdc will not fully turn on a standard mosfet.