Luke,
What are the fuse settings? BOD ? WDT?
The code?
-------------------------------
Luke,
What are the fuse settings? BOD ? WDT?
The code?
-------------------------------
Last edited by sayzer; - 3rd February 2007 at 14:35.
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
mat: If I try what you suggest won't the resistor allow a current to flow all the time? Or have I misunderstood how it should be connected?
sayzer: The code is definitely working ok - with no load across the relay it will switch on and off without any problems every time. It's only when there's a load across the relay that the pic will reset when the relay switches.
The fuses are everything off except PWRT (or 0x3F31). (Incidentally I'm using a bootloader, so this is the fuse configuration it defaulted to...)
Hi,
(Click to enlarge the picture)
See also this PDF:
http://www.redlion.net/Products/Grou...Docs/12027.pdf
Best regards,
Luciano
Yes the snubber will help!
also
- Make sure you have connected both PIC VSS pins.
- Make sure you have disable the LVP mode
- Set all unused i/o to input and connect ALL of them to GND
- i would add a 47-220 uF on the PIC VDD line as well (close to the PIC)
- Place your PIC away of your relay to see what's happen.
How much current do you drive on the AC side?
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
If you didn't change the default config fuse while loading the Bootloader firmware the first time, you can't modify them later in your code.
Default for 16F876_04.HEX are HS OSC,Watchdog off, Power up ON, Brown out ON, LVP OFF.
Maybe you could also try to reload the bootloader firmware but set the BrownOut to OFF... but, i think there's much more to check before...
Last edited by mister_e; - 3rd February 2007 at 14:27.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Thanks
>> If you didn't change the default config fuse while loading the Bootloader firmware the first time, you can't modify them later in your code.
I know! :-) But I'm quite happy with that fuse configuration right now... unless it's a factor in my problem.
>> Yes the snubber will help!
>>
>>also
>> * Make sure you have connected both PIC VSS pins.
>> * Make sure you have disable the LVP mode
>> * Set all unused i/o to input and connect ALL of them to GND
>> * i would add a 47-220 uF on the PIC VDD line as well (close to the PIC)
>> * Place your PIC away of your relay to see what's happen.
Ok, I'll try all of the above. But I'd like to understand why connecting a 47 Ohm resistor across the relay output (as part of the snubber circuit mat suggests) is a good thing -- surely it'll allow a current to flow all the time. Or have I misunderstood something?
Thanks again...
Mat suggested a RC snubber, so it's a resistor in Serie with a capacitor, so will flow only for a short period of time.
You may find some explanation in the following document
http://focus.ti.com/lit/an/slup100/slup100.pdf
I would prefer to switch on the AC zero crossing to extend the relay contact lifetime...
OR you may decide to use some SSR... a bunch more expensive...
EDIT: ah crap, i'm late
Also, probably a nice idea to place some 0.1 uF in parrallel with each realy coil + 100-470uF & 0.1uF on their VDD line.
Last edited by mister_e; - 3rd February 2007 at 15:14.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Thanks for all the suggestions - I'm blown away by how quickly people have responded.
Ok, I've added the snubber and it's immediately eliminated 90% of the resets. I can now turn the relay on and off with the light connected and it works. Strangely I can still produce a reset if I switch the mains on and off at the socket, even when the light is NOT connected. And I've still had one or two random resets.
I'll try connecting up the other VSS pin and adding the 47uF cap to the PIC power supply to see if that gets rid of the remaining resets.
>> * Set all unused i/o to input and connect ALL of them to GND
Is this something I should do whenever dealing with PIC, or only when dealing with mains voltages/currents? What's the rationale here? I'll try the other steps first since this is going to require me to produce a new PCB!
>> Also, probably a nice idea to place some 0.1 uF in parrallel with each realy coil + 100-470uF & 0.1uF on their VDD line.
ok, I'll do this too.
One other question: While reading up on this I've heard lots of talk of ground planes. Is this simply a large area of copper on the board which is tied to ground, or does is have to be an entire layer on the board (impossible in my case since the board is single sided). And how do they help (and indeed could they help in my case)?
Thanks again.
Then put also a snubber network on your mainssocket and mainswitch!
Oh! In series... Which is what you said to begin with (sorry, somehow misread your original post).
Thanks again.
Bookmarks