I am able to control the DC motor. It works OK... But the problem is I am getting interrupt signals without pressing on buttons... It looks like some noise... There is a lot more of interrupts (that shouldnt be), when the motor is spining.
Is that drawing an accurate one?
Could it be induced noise from the motor?
What happens if you leave the code as it is, but disconnect the wires to the interrupt pins, and use serial commands to start and stop the motor.
Do you still get interrupts?
Why are you using interrupts to read the button state? Is there something that you are not showing us that is preventing the Arduino from reading the button state often enough?
Perhaps that could (should?) be addressed.
[edit]You are turning on the internal pullup resistors, while the sketch shows external resistors. Are you using both?[/edit]
If I leave the code as it is, but disconnect the wires to the interrupt pins, and use serial commands to start and stop the motor I don't get interrupts. So it's almost for sure the induced noise from the motor like you said... Is there any way to reduce the induced noise from the motor?
Answer to PaulS post:
I am ussing interrupts as I wan't to stop the motor as soon as I get interrupt from one of two bottons without executing any additional line of code.... I am sure there is no code that would prevent Arduino from reading button state often enough.....
And yes.. These are series resistors just for protection not relevant for now I think..
Thanks all of YOU for fast responses..
Grumpy_Mike - do you think de-coupling is solution?
I am ussing interrupts as I wan't to stop the motor as soon as I get interrupt from one of two bottons without executing any additional line of code....
Imagine your motor is running at 6000rpm.
Sounds fast?
That's 100 revolutions per second or 100Hz.
Your Arduino is running at 16MHz, and so is checking the state of interrupts about 16 million times a second (a bit less because some instructions take more than one cycle).
In one instruction cycle, your motor rotates 0.00225 of a degree (at 6000rpm, remember).
Do you really need that level of control, because even if you cut the power and shunt the motor, it's going to take a lot longer to actually come to a halt.
AWOL I think you are right about that... But this is not the solution for the problem I have? Isn't it? Even if I do normal digital readings I would have same problems am I right? Or should I try without interrupts?
Richard, I appreciate your help and patience.. And yes.. You are right that Fritz draws schematics too, but I didn't knew that at the time... Another thing I tried with Eagle is, that I would like to make my own PCB....
I redraw the schematic... I think it's OK now... I have just few questions more:
What should be the value of the choke on the schematics?
What about if I have let's say 2 X L293D chips, do I have to make two exactly the same circuits ?
I don't know how to make holes on the bottom layer of the PCB... I need the holes becaus I would like to make a PCB by myself, so the preapared holes on the PCB would make things easyer to drill!