![]() |
microcontroller picking up noise?
I'm having a problem with a microcontroller project that's driving me insane. I've got a PIC18F4455. In an attempt to find the source of the problem, I've stripped it down to a very megar setup. The controller has power, its oscillator, a reset button, and an LED. When it starts up, it turns on the LED and just sits there. Now, if I connect anything that's also connected to the wall socket, it messes up. The LED either dims or turns off completely. I think the dimming is a result of high speed flickering though.
For instance, if I attach my oscilloscope probe (even just ground) to any part of the circuit, the controller flakes out. Also, if I use a wall transformer with a voltage regulator for power, putting my hand close to certain parts of the breadboard makes the LED go out. Touching the metal back plate of my board (which I have verified to be isolated from the circuit) completely puts out the LED. If I touch the back plate and circuit ground, everything is fine. If I run the circuit on a battery only however, it works fine. Just keeping the ground (the negative terminal) from the transformer in makes it flakey again. My multimeter, which runs on batteries, doesn't affect the LED. At the moment, I'm using a 20MHz crystal and the PLL to get the clock to 48MHz. Bringing down the clock speed (either by internal dividers or using a slower crystal) does very little. I even went as far as trying the internal 8MHz oscillator (but I didn't try it at lower speeds). I did discover that turning off brown out detection (which will trigger a reset if the power drops below 2.0V) makes it less sensative. With it on, the scope probe causes the LED to go out completely. Without brown out detection, it just dims (presumably flickering). This makes me believe that the controller is in fact resetting for some reason. However, my multimeter claims that the power is fine. The scope, which causes the controller to misbehave, also claims that the power is fine, but there's some noise. Adding capacitors cleans it up though. The caps only make the problem slightly better. After the first cap, additional caps don't make any noticable improvements. Here's another point. If I can successfully connect the scope without the controller freaking out, the crystal has a nice sine wave. When the LED is out, the crystal is 0V. When the LED is dim, the crystal has some strange almost-square waveform with noise in the latter half of the high period. I haven't figured out if the crystal problems are because the controller is resetting or if the noise in the crystal is forcing the controller to reset. I suspect the former though. I've narrowed down the problem to having something to do with the power line. I've tried different outlets at home and they all do the same thing. At work, however, the problem doesn't exist. I work in an ESD lab, so they may have some sort of special filtering or grounding that I don't know about. The technicians suggested some sort of noise at my house. I have yet to find the exact problem though. If I can't figure it out in the next few days, I'll make it a point to hunt down one of the engineers and see what they have to say. In the mean time, are there any ideas around here? |
Re: microcontroller picking up noise?
I have played with a 18F458 and an LED before. But I have only powered it with batteries(4.5v) and it work fine.
Try: powering the entire system with only battery power try striping down the code to bare minimum(take out interupts and such) I can't help you much more because it you seems that you know a lot more about it than I do. |
Re: microcontroller picking up noise?
Phil,
Interesting problem...You say you don't have any problems at work just at your house.?! Could be that the ground and neutral are reversed in your house wiring. Easy to check with a simple power checker you can get from Home Depot. You may have an open neutral. Are you burning out more light bulbs then you think you should? Have you scoped the power supply line on your board? Does it have any ripple or RF running on top of it? If you see a lot of RF on the power supply (fuzz on the DC on a scope) it is possible you have something in the house that is radiating. Common sources are touch on/off lamps, wireless phones, and believe it or not, aquarium heaters. Another source is X10 lamp controls which use the power line as a bidirectional serial line. They are only designed to transmit during commands but you might have one stuck in transmit. Are your neighbors close? They may have something as well. Finally, a souce of interference you would never think of is your TV. Do you have a plasma display which is a real source of noise. Other TVs also produce power line noise as well as computers. If you suspect one of these, unplug it from the wall to make sure it is not the culprit. Al |
Re: microcontroller picking up noise?
Phill,
I am currently interning at Microchip, my respose would be to try to take out the crystal and just use the internal clock, try that and see what happens, also what do you ahve the reset vecor set to do? and i know you hooked up a multimeter to the input power but have you tryed looking at it thro a scop and seeing how much current it drawing? |
Re: microcontroller picking up noise?
Quote:
However, I do agree with trying the internal RC oscillator, and make sure you have your fuse bits set for the right type and speed of crystal oscillator. Do you have any capacitors to ground on the crystal? The datasheet for the PIC should be able to tell you what size, but I think normal is the 10-20pF range. |
Re: microcontroller picking up noise?
I've been recently working with pic microprocessor and I was picking up alot of noise from the other pins. I solved the problem by grounding them out. Also make sure that your LED isn't getting to much current, about 20mAmps per a LED is normal. You might not see a light if theres to much current.
When using your oscilloscope add an op amp to reduce the impedience of your testing tool. This will make your testing effect your chip less. |
Re: microcontroller picking up noise?
If your PIC works fine with batteries and not with a power supply, you probably need to filter your power supply. Just hook up a .1 uF and a 10 uF capacitor between the power leads of the PIC. This solves most noise problems I've had working with PICs. The other thing is make sure that your power supply actually supplies 5V.
|
Re: microcontroller picking up noise?
Alright, the supply is clean. Well, if I put my scope at 5ns, it doesn't see any noise. I have capacitors right at my voltage regulators and right next to the PIC. Adding more does nothing, removing them increases the problem very little. So, I've ruled out a problem with the voltage supply. However, I have yet to rule out a problem with the power line as it seems to be the main culprit.
Using the internal oscillator in the PIC does nothing to solve the problem. That was one of the first things I checked. Just for kicks, I've even tried 15 different crystals at three different frequencies. I'm using 33pF caps with the crystal. According to the datasheet, I should be using 15pF with the 20MHz. I think that's close enough to the 27pF for the 4MHz crystals. But, again, changing the clock frequency doesn't fix the problem. The only change to the PIC that seems to have any effect is disabling brown out detection. I've done PIC projects before, but havnen't had this problem. The two differences now are the PIC and my board. I don't have time right now, but this weekend, I'll try to dig up some other PICs and my other board. Per Al's suggestion, I unplugged everything for the aquarium that's sharing the same socket I'm using. It didn't do anything. I also tried unplugging my wireless router. There's still plenty for my to try, but again, I think I'll have to wait for the weekend. |
Re: microcontroller picking up noise?
Quote:
I am more interested in what you see when the scope is at 50-150 ms(full screen). Connect the probe to the output of your regulator. Set the scope to "Line" on the trigger to lock the scope to the power line. Set vertical sensitivity to less than 1 volt and AC couple. Do you see any signal that is not moving on the scope? This is power supply/power line related stuff. It can occur at 60Hz or 120Hz, which is 16ms or 8 ms rep rate. It is not uncommon for three terminal regulators to output 60Hz noise when the input has a lot of ripple. Adding caps on both the input and output will not cure this problem. If you have a low voltage at the wall, then you step down transformer is not capable of giving greater than the 2 volt minimum for correct operation of the regulator. (A 7805 needs more than 7 volts input at all times to produce a clean 5 volt supply. Anytime the input falls below the 7 volt minimum, the output 5 will also fall. If you see any noise at all, it should be in microvolt range. Anything greater than .25 volt peak to peak is likely going to trigger the brownout detector and cause the oscillator to have a lot of FM modulation. When this occurs anything is possible. One thing we didn't discuss before is grounding. Are you absolutely sure that the power supply and board grounds are firmly attached? Are you using a scratch built power supply? If so are all the power supply filter caps tied together close to the negative terminal on the power supply rectifier. Considerable current exists in this path and if you stretch that out, a large voltage drop is developed at power line frequencies across your grounds. When building power supplies, one needs to think of a single point where all power supplies grounds tie together. Then a single wire from that point out to your board. This way, all the filter current passes through the component leads and not through the circuit being powered. Let me know what you find. I will check CD each day if you need any help. |
Re: microcontroller picking up noise?
Ok, this problem is bothering me so much that I've decided to forego tonights other activities to try and figure this thing out.
I'm powering the circuit using an everyday wall transformer. The output is rated for 9V 500mA, but I'm not drawing enough current so it hangs out at about 14V. I'm using a 7805 to power the PIC. There's also a 7806 for some other stuff. Everything downstream of the 7805 is drawing ~20mA. When the PIC freaks out, the current drops to near 0, again supporting the idea that it's resetting or otherwise turning off. Here's what the scope's giving me: http://ratlab.dyndns.org/scope/1/ There is some noise in the supply with a period of ~17ms, ~60Hz. It's amplitude is slightly different in each of my test cases, but is about 200mV. I guess this is something from the power line. Recomendations? |
Re: microcontroller picking up noise?
Phil,
Great pictures, now we are talking. The output waveforms from the wall transformer are normal outputs of a full wave rectifier with very little filtering or too great a load. Not ususally a problem for a 78XX when the lowest part of the waveform is still 2 volts greater than the output. Look close at this waveform and you will a lot of fuzz on the ripple. Since you have a dual trace scope, if you were to put your other probe on the output of the 7805 you would see that the two occur at the exact same time. If you were to delay trigger on the noise you are going to find it is a fairly high frequency, <1MHz. Since it is locked to the line, you have local interference from a line operated device. Most likely a dimmer. If you have a dimmer in your house, try turning it to a different brightness and the period of the noise will change. This could be a fan control, a touch on/off lamp or a wall dimmer. (X10 dimmers are the same.) This could also be caused by a bad switching power supply but that is pretty rare. The fact that the waveform gets worse when you touch the backplate just indicates that there is a strong field picked up by your body and capacitively coupled to the backplate. In rare cases, this could be caused by a bad insulator on the power line. Take an AM radio and tune it to a station that is not close to your house. See if you hear hum in the audio and then use the radio to point you to the offending device either inside or out. Am radios use a bar antenna and the greatest sensitivity is along the axis of the bar. By turning the radio you can get an idea of where the culprit actually is. If it turns out to be a bad insulator, you need to contact the power company and tell them you have interference from their equipment. They are required to make the repairs, although not in a timely fashion. You may be able to make things happy by grounding the back plate to the ground in your house. Run a wire from the chassis of the scope to the backplate and see if that makes things better or worse. Once you get this part cleared up, we can talk about the what the waveforms on the power transformer are telling you. |
Re: microcontroller picking up noise?
Ok, I'm back.
My experiments with the radio didn't turn out so well. I hear a distinct hum on any empty AM frequencies on all the radios that are plugged into the wall. I'm resonably sure that it's from the line because I've heard that same hum from things that I know are produced by the line. My battery powered radio doesn't have the same hum, but there is something there. However, it doesn't show up on all frequencies, just the lower ones, ~<750kHz. The other problem is that everything that runs on electricity produces some kind of noise if I bring the radio close enough. I can hear my computer think. There's also all sorts of cool noises at work. Back on the oscilloscope, however, things have changed. For some reason, I can't reproduce what I had before. But, while I was in there, I decided to take a look at the line. It's definately a sine, but there's some irregularities on the falling side (going toward 0V) of each peak. It looks symetrical, so whatever is introducing the noise is only happening at a certain voltage (positive and negative). I added more pictures to the same page: http://ratlab.dyndns.org/scope/1/ Any more insights before I turn off the power room by room to eliminate an internal source? |
Re: microcontroller picking up noise?
Phil,
The noise you are looking at is likely the same. In the upper photos, you were at 5ms/div in the most recent you are at 20ns/div. The distortion in the line voltage is unusual. How were you attaching the scope to the line? There is a possibility that someone attached to the same transformer as your house has something unusual connected to the power line. The distortion you see can occur when the power transformer is trying to supply more than it was designed for. In my area, residential power line transformers are typically feeding no more than eight individual homes. Design varies for different parts of the country. The hum in all the radios is indicative of the problem. You need to walk or drive around the neighborhood with your battery op radio and try to loacte the problem. Broadband over power lines (BPL) has been a hot subject in ham radio circles for a couple of years now. I have no personal experience with the issues but the system produces wideband noise sufficient to wipe out communications for ham radio operators. There is a system (Motorola) that uses radio frequecy filters at ham, TV and radio frequencies to prevent interference. Let me know if you find anything. Whenever I have had local hum, a quick drive around the neighborhood with the car radio on AM will usually locate the insulator. There is no doubt when you drive under the offending pole. If you live near high voltage lines, this will be much harder to find. High voltage lines have insulators that break down all the time. In your case the noise will get worse on rainy days or those days just following a rain. |
Re: microcontroller picking up noise?
I hope nobody minds that I revive my own thread.
I've been working on the problem on and off since my last report. To sum it up, I've found nothing. I've gone through the house and tried unplugging anything that might make noise and couldn't find the source. All I figured out is that most of the outlets in the house don't have ground. (That's 50's wiring for you...) However, I managed to try one that is grounded and it has the same noise. I've given up on trying to track down the source of the noise and fixing it. I've turned to trying to filter it out. Do you think a power line conditioner would work? Something like this or similar: http://www.apc.com/resource/include/...ase_sku=LE1200 I'm guessing that it won't because the UPS I have on my computer doesn't filter out the noise. But can someone point me to a device that would? I'm about to start my senior project and I would be really nice if I could do some work at home. |
Re: microcontroller picking up noise?
Quote:
So it's not surprising that the UPS isn't filtering the noise. I'd be curious to know if the disconnected UPS (beeping away) would fix the problem with your circuit. Good luck, JBot |
| All times are GMT -5. The time now is 08:22. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi