Author Topic: Interference on a circuit using PIC micro  (Read 6568 times)

0 Members and 1 Guest are viewing this topic.

Offline iqqyTopic starter

  • Newbie
  • Posts: 6
Interference on a circuit using PIC micro
« on: April 04, 2010, 07:02:02 pm »
I'm new here, hi everyone!

I have a problem with a circuit I'm building. I get strange interference that I can't figure out.

The circuit has 3 channel PWM to control the colour of an LED, it also has 4 logic outputs that control a 4 digit 7 segment LED display. These are controlled by a PIC16F737. It runs off 3 AA cells, using a voltage booster to get 5V.

The interference occurs on the LED display. The number 6.66 is meant to show there (for testing). When I turn it on, this number comes up, but then very slowly fades to 7.77/6.76/ variants thereon. If I move my hand near, or tap, the 4 logic outputs or the wires from the PIC, the number changes randomly and suddenly. However if I ground myself (by touching my laptops metal case) this effect does not occur at all.

The PWM functions as expected, and drives the LED perfectly.

So far I have made sure that the unused inputs on the PIC are pulled high/low, and check my connections. I can't be sure that I've done either of those things properly though since it's been a while since I worked on this project.

Any help very much appreciated! Thanks.

Edit: Here's a video of the same problem manifesting itself in a slightly different way. You can see that when I ground myself it affects the display. How can I fix this?
« Last Edit: April 04, 2010, 07:07:57 pm by iqqy »
 

Offline migsantiago

  • Frequent Contributor
  • **
  • Posts: 381
  • Country: 00
    • MigSantiago's Web Site
Re: Interference on a circuit using PIC micro
« Reply #1 on: April 04, 2010, 07:10:28 pm »
You can add some 0.1uF capacitors between Vdd and Vss, the closest you can to the PIC. Also make sure that the crystal you are using has a couple of 22pF or 15pF capacitors connected to GND.
« Last Edit: April 05, 2010, 01:08:11 am by migsantiago »
 

Offline jimmc

  • Frequent Contributor
  • **
  • Posts: 304
  • Country: gb
Re: Interference on a circuit using PIC micro
« Reply #2 on: April 04, 2010, 07:35:29 pm »
You can add some 0.1uF capacitors between Vdd and Vss, the closest you can to the PIC. Also make sure that the crystal you are using has a couple of 22uF or 15uF capacitors connected to GND.

Good advice but that should be 22pF or 15pF.

Also check for unconnected (floating) inputs, a technique that I use (don't laugh I'm serious) is to rub a plastic ruler on my sleeve and then wave it above the circuit (no closer than 1 - 2 inches).
If things change then odds on there's a floating input somewhere.
CMOS inputs are such high impedance that the static field from the ruler can change their state.

Jim
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11714
  • Country: my
  • reassessing directives...
Re: Interference on a circuit using PIC micro
« Reply #3 on: April 04, 2010, 07:44:03 pm »
sorry i'm also a newbie. but i also have similar head scratching problem like this recently (all my logic went on and off randomly). i found out that i've not commonly grounded all components at the same level. stupid mistake isnt it? but stupid question will be, have u checked all the ground wires on all of your components? i've programmed several pics and atmel projects but never got this kind of noisy problem unless i stupidly miss the common ground wires or if i got high powered (noisy) brushed motor running nearby and i dont put any those small small bypass caps.
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

alm

  • Guest
Re: Interference on a circuit using PIC micro
« Reply #4 on: April 04, 2010, 07:44:50 pm »
Also make sure that the crystal you are using has a couple of 22uF or 15uF capacitors connected to GND.

This should obviously be 22pF or 15pF, in case anyone got confused. I'd really be impressed by a crystal that's able to swing with 10uF of load capacitance. I'm sure Microchip has an appnote similar to AVR042 (AVR hardware design considerations), but couldn't find it quickly on the Microchip website, does any PIC user have a link?

You didn't post a schematic, but I'm guessing you're using some kind of display driver IC or shift registers to drive the displays? I'd also look into their power supply (is it properly decoupled?). Does the voltage booster give a stable 5V? A scope would be very useful to debug this, but I'm guessing you don't have one. If you do, I'd inspect the power supplies and the signals to the display drivers. It's quite hard to change a six into a seven on the parallel side, so I'd guess it's somewhere on the serial side (PIC or display drivers). Did you try swapping the display drivers? Do all IC's have a proper power and ground connection, or does it use the inputs for power/ground? Did you connect power/ground to all Vdd/Vss pins on the PIC?
 

Offline migsantiago

  • Frequent Contributor
  • **
  • Posts: 381
  • Country: 00
    • MigSantiago's Web Site
Re: Interference on a circuit using PIC micro
« Reply #5 on: April 05, 2010, 01:07:51 am »
Sorry! Yeah I meant 15pF or 22pF  :P

Message edited :)
 

Offline iqqyTopic starter

  • Newbie
  • Posts: 6
Re: Interference on a circuit using PIC micro
« Reply #6 on: April 05, 2010, 03:20:24 pm »
Ok thanks for all the replies, I've just tried the incredible ruler trick and that causes the same problems. It seems to only happen where I have the logic lines crossing over, I don't know if that might have some significance...I can't really see how it could though since they are simple logic signals, not high frequency or anything.

Anyway I'm going to rewire it all now, and carefully go over the connections to the PIC again to make sure I haven't left anything floating. Will report back ASAP.

EDIT: Oh I thought I should add, I'm not using a crystal I'm using the internal oscillator instead.

The displays are driven by display driver ICs, yes. The problem seems to be in the lines from the PIC to these drivers. The interference only seems to occur near these wires. I haven't tried swapping them, that's a good idea, although there are three and they all have the same problem.

The circuit's in a breadboard at the moment, will that affect the effectiveness of the ground connections? I was toying with the idea of wiring ground on my circuit to actual ground, like my computer case to see if that made a difference.

I have checked all the connections and they seem to be correct, but like I said I'm going to rewire that part of the circuit and see if it helps.

And no, I don't have a scope, just a very cheap and crappy multimeter unfortunately. I hope to get all of that good stuff one day, maybe have a workshop setup like Dave has.
« Last Edit: April 05, 2010, 04:33:44 pm by iqqy »
 

Offline Zad

  • Super Contributor
  • ***
  • Posts: 1013
  • Country: gb
    • Digital Wizardry, Analogue Alchemy, Software Sorcery
Re: Interference on a circuit using PIC micro
« Reply #7 on: April 06, 2010, 10:59:10 pm »
It sounds like the signal you are sending to the driver ICs is not high/low (0 or 5v) but high / high impedance or low / high impedance. If you are sending high impedance at any point, the driver ICs will pick up any stray signal on the input and try to work out what do do with it. You might like to try using a 10k or so pull up (or pull down) resistor on the lines from the PIC to the driver chips. Check your code to make sure that one or more ports are not set to tri-state or input at any time, this would turn the 0/5v drive current off.

Offline iqqyTopic starter

  • Newbie
  • Posts: 6
Re: Interference on a circuit using PIC micro
« Reply #8 on: April 07, 2010, 01:42:42 am »
Well I was fiddling with it just now, and it seems like I've fixed it, although I'm not entirely sure what the problem actually was.

I changed my software to explicitly set all pins as outputs before anything else. That's all that was needed to fix the problem.

I've since reflashed it with a program that doesn't set all pins as outputs, and it still works. No noise at all. I'm not really sure how to interpret that. Do pins remember their initial state even after the PIC is reprogrammed? Or is there some glitch in the way the PIC initialises?

Either way, I'm happy now that I can continue on with the rest of the project. Thanks everyone who offered help.
 

Offline iqqyTopic starter

  • Newbie
  • Posts: 6
Re: Interference on a circuit using PIC micro
« Reply #9 on: April 07, 2010, 06:18:01 pm »
 ;D Yep. I was so relieved when it worked. :D

But if the problem reappears I'm *really* screwed!
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11714
  • Country: my
  • reassessing directives...
Re: Interference on a circuit using PIC micro
« Reply #10 on: April 07, 2010, 07:28:58 pm »
- if it happen again, then your project is metastable. you cant count on the successfull attempt, there must be a problem somewhere.
- you dont have to ground to PC casing, on the breadboard, there is one or two horizontal line that you can use as common ground
- i used to cross link the digital wires (really a mess), and i still dont get any noise.
- cheap crappy multimeter? use that! i have one. to check your digi pin is actually 5V at high
- thanx for the plastic ruler tricks, thats an idea. would like to share mine. i call it "debug leds" (i dont know if this is not new or already has it termed), re wire your chip to drive leds, if they light up as they should be, then your software has no problem. but make sure they light up brightly. dim led means your pin is set as an high impedance input or your output pin generating pulses (DSO here really helps if you have one)
- since i'm more prone to software type (non EE), i used to blame on my software, print it out and re-check letter by letter. and sometime i will blame on silicon errata and quickly refer to that (as per DAVE's advice)
« Last Edit: April 07, 2010, 07:33:09 pm by shafri »
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Offline septer012

  • Regular Contributor
  • *
  • Posts: 68
  • Country: us
    • http://www.danielbjohnson.net
Re: Interference on a circuit using PIC micro
« Reply #11 on: May 02, 2010, 08:50:43 am »
Set the Configuration fuse to external MCLR, and pull it (MCLR/VPP) up with 4.7Kohm

Set all your unused pins to outputs
Daniel
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf