View previous topic :: View next topic |
Author |
Message |
eng.mohamedtoumi
Joined: 13 Jan 2018 Posts: 23 Location: Tun
|
18F2550 external interrupts |
Posted: Fri May 11, 2018 6:28 pm |
|
|
hello... I've recently started a 18F2550 project consisting of a line follower robot using 18F2550.
I used 2 pull ups (as the PCM schematic with 4.7k resistor) as line sensors just for the purpose of debugging the code.
The line sensors are on external interrupts and working fine on real PCB (external interrupt is detected whenever i press the button).
Simulation works fine also.
Everything works fine on the pcb without the motors (2 motors each consuming 5v 0.8 A). I used a Bluetooth module to debug the sensors values and they were received correctly, but when i connect the motors the interrupt routine is started automatically even when i don't press the buttons.
PS: I checked the buttons and they are fine also I'm using a 5v 12A power source. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9245 Location: Greensville,Ontario
|
|
Posted: Fri May 11, 2018 8:12 pm |
|
|
Welcome to the 'fun' world of EMI ! It sounds like the motors are generating EMI (noise) and triggering the PIC.
Some possible cures are
1) adding some .1 mfd caps near the VDD/VSS pins of the PIC
2) adding flyback diodes across the motor terminals
3) add a cap across the motor terminals
4) use Google to look for 'motor supression', or similar keywords
5) increase the PCB traces for power lines
6) wiring should be
power source---motors---PCB with PIC
7) add more C to power supply, esp. .1 mfd, .01 mfd (hf filters)
just some of the things you can/need to do.
Jay |
|
|
eng.mohamedtoumi
Joined: 13 Jan 2018 Posts: 23 Location: Tun
|
|
Posted: Sat May 12, 2018 6:13 am |
|
|
Thank you for your response. I will try your solutions. I'll post the results later. |
|
|
eng.mohamedtoumi
Joined: 13 Jan 2018 Posts: 23 Location: Tun
|
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9245 Location: Greensville,Ontario
|
|
Posted: Sat May 12, 2018 9:35 am |
|
|
GREAT, happy you got it fixed !!
EMI (noise) can be very hard to locate and suppress, entire books have been written on the subject and a lot of it is a 'black art' !
You may want to add .1 mfd caps to every I/O point (external connection) just to be sure...
Cheers
Jay |
|
|
|