Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIC curcuit works only when I bring screwdriver near it

Status
Not open for further replies.

pkshima

Member
Hi,

I tried the tutorial at **broken link removed** and it works. Just that its not stable and works only when I bring my screw driver or hand near it.

Any ideas what I might be missing ? I built the simple led blink tutorial not the hall effect one.

Thanks

P.S : I recall having seen a post answering a similar question but cant find it now.
 
Last edited:
Hi,
Do you follow exactly the schematic provided in that page? Check the connection on MCLR and the decoupling capacitor.
 
Let's see, perhaps:
1. Your power supply isn't supplying the voltage it needs. What does the Vcc measure? 5V, +/-5%, hopefully.
2. The MCLR pin still needs a pullup resistor, say10KOhms.
3. Your crystal or resonator is too far away, the pump caps (the two caps from the crystal's leads to ground) are too far off in value (try 18 to 30 pF), or missing altogether (not needed for the resonator).
4. You need a bypass cap still, say 0.1uF, from Vcc to ground, close to the PIC's power pins.

That should do for starters. Let us know how it goes.
kenjj
 
I built the same circuit except that ...

1. I added a 1N4148 diode to the MCLR pin.
2. I also used 10k resistor for the pull up on MCLR.
3. I added wires for the ICSP

The Vcc measures +5 or something very close I think 5.01 V.
There is no crystal needed in the tutorial since it uses the internal one.
I set the config fuses using MPLAB as instructed by the tutorial.
I adeed the 0.1 uF cal on the supply line. I tried putting it on very closely on top of the PIC as well but no good.
 
1. I added a 1N4148 diode to the MCLR pin.
.

hi,
Check the that diode is the correct way around.

Are you sure the crystal osc is working OK, wires not too long etc.
EDIT: I see you are using the internal osc..

Hand capacitance effects are usually due to floating pins [not connected when they are supposed to be]

Do you have power rail decoupling on the board.?

Can you post a picture of your layout.?

EDIT: I see you are using the internal osc..
 
Last edited:
Strange PIC effects

Hi, pkshima!

I had similar problems with other PIC projects (several), and I find this is caused by high frequency (auto-oscillations) produced internally on the PIC, mainlly in the ones what uses the internal oscilator instead crystals.
The solution I used to solve this: put resistors (arround 3K3 is OK) in the unused pin´s ports to GND!
This ends the strange behaviors you´re having. I noted too what this depends on the way the circuit is wired, and the PIC itself (some of then will do present the problem, others don´t!).
Anyway, I hope this can help.
Good lucky!
 
Hi, pkshima!

I had similar problems with other PIC projects (several), and I find this is caused by high frequency (auto-oscillations) produced internally on the PIC, mainlly in the ones what uses the internal oscilator instead crystals.
The solution I used to solve this: put resistors (arround 3K3 is OK) in the unused pin´s ports to GND!
This ends the strange behaviors you´re having. I noted too what this depends on the way the circuit is wired, and the PIC itself (some of then will do present the problem, others don´t!).
Anyway, I hope this can help.
Good lucky!


I also did the same thing to fix a similar problem. Its called floating pins i think. And im sure resistors will fix it. But if you dont want to add hardware.Set all unused pins as output and it may help. If not use the resistors.
 
I also did the same thing to fix a similar problem. Its called floating pins i think. And im sure resistors will fix it. But if you dont want to add hardware.Set all unused pins as output and it may help. If not use the resistors.

Sounds unlikely to me?, I've never seen any such problems - but setting unused pins as outputs certainly won't do any harm.

The only time it could perhaps cause problems is if you're actually reading floating pins, but you shouldn't be doing that anyway.

As for 3.3K resistors, bit of overkill, far greater values would do just as good a job.
 
Last edited:
I experienced these symptoms once when I forgot to turn LVP off in the config' bits and left the PGM pin floating. Not sure if this applies in your case though.

Mike
 
Thanks a lot for the help guys.
more updates .... its not my screwdriver or hand but its proximity to my laptop. If I move the circuit away from the lappy, it works fine.

I am working on a tiny breadboard so not able to put in the resistors. I will try a crystal for the clock once i find out which freq and the value of the caps.

thanks again :)
 
I tried running the circuit using a 20MHz crytal but still same behaviour.
I will try putting resistors then. But I am not sure how I am going to survive PIC18 if I have to do this on all my circuits. Especially if I have to build a robot around it since things will be so much more noisy there.
 
I tried running the circuit using a 20MHz crytal but still same behaviour.

It was never going to have any effect.

I will try putting resistors then. But I am not sure how I am going to survive PIC18 if I have to do this on all my circuits. Especially if I have to build a robot around it since things will be so much more noisy there.

There's absolutely no need for resistors, ensure all unused pins are set as outputs (just in case, though not really required) - but it sounds like you have MCLR set as external, and not connected. Another option is you have it set to LVP, and that pin floating.

Check my tutorial examples, they mostly use the 16F628, internal oscillator, internal MCLR reset, and almost no external components required at all.

You need to correct the error you have made, not try and 'bodge' round it.
 
Thanks for replying Nigel.

I tried setting all pins to output but had no luck.
Also, when I disabled LVP, the circuit stopped working altogether so I had to enable it again. Do I have to ground/vcc a pin as well when I enable/disable LVP ?

I will try again today evening when I reach home.

I have tried your tutorials using pic16f628 and had no such troubles there.
 
Also, when I disabled LVP, the circuit stopped working altogether so I had to enable it again. Do I have to ground/vcc a pin as well when I enable/disable LVP ?

There's your clue, LVP shouldn't affect the running of the ciruit unless you're wired wrong - I've never used LVP (it seems so totally pointless?), but if it's set you can't let the enable pin float.
 
By enable pin, you mean the MCLR pin right ? i.e. pin 4 in the case of pic18f1320 (18 pin package) ? If so it is wired correctly to +5 V via a diode and resistor of 1k value.
Any idea which parts of the datasheet I must read carefully to get my concepts clear ?
 
I dont intend to use LVP. I program using Inchworm. So if I understand correct then I just need to disable LVP in the config fuse and things should work? or must I connect a pin to ground or vcc *along* with diabling LVP ?
 
I dont intend to use LVP. I program using Inchworm. So if I understand correct then I just need to disable LVP in the config fuse and things should work? or must I connect a pin to ground or vcc *along* with diabling LVP ?

Disable LVP in your config settings, it should never be enabled unless you're using it - and is most certainly the cause of your problems - nothing else is required, just disable it.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top