PICAXE get short circuit!

Pekari

Senior Member
I have a circuit where Picaxe have 4,2-4,3V.
I have connected serial in to - and reset to + without a resistors.
Serial out is floating.

Voltage measured with oscilloscope: No spikes, it is stable.

Circuit controls a motor with 2 relay (ON/OFF & COURSE).
Relays have a diode to arrest a voltage spike and transistors are controlling them which are controlled by that Picaxe 18X.

I have a broblem:
Sometimes when Picaxe outputs go low and relays go to rest, picaxe goes to short circuit and blow a fuse.

If I will put bigger fuse Picaxe will get hot!

I have no idea which could arouse this condition.

I have used a two different Picaxe, so I thing bug is not in those.
 
Last edited:

hippy

Technical Support
Staff member
If the PICAXE is getting hot it indicates you are passing too much current through it. That suggests your circuit is not wired correctly or is incorrectly designed.

It is not recommended to connect RESET directly to +V but that seems unlikely to be the problem here.
 

Pekari

Senior Member
Hippy, RESET need a resistor?
Could a 1,5 kohm be a good value?

Outputs have a 330 ohm resistors.
 

MPep

Senior Member
I would recommend using a transistor to drive the relay coils, NOT the PICAXE directly!!
 

BCJKiwi

Senior Member
@MPEP
Pekari already has these as per the initial post;

"Circuit controls a motor with 2 relay (ON/OFF & COURSE).
Relays have a diode to arrest a voltage spike and transistors are controlling them which are controlled by that Picaxe 18X."
 

Pekari

Senior Member
Now this problem are solved.

Reason was that I haven't put a resistor to RESET-pin.

Picaxe makes sometimes a pulse to RESET-pin and its must to be able to do that. In the other case it try do a pulse a high current.
I get several problems because of that resistor is "0 ohm".

An example variates get a wrong value, maybe because of it read wrong value reading READADC or there is another reason to get wrong values.
I believe that cleaning IC be due to this bug in circuit.

Now I have 2,7 kohm resistor in RESET because I haven't a 4,7 kohm right now.
Device are working beginning with last evening and it's running like a clock now.

Thanks!
 

hippy

Technical Support
Staff member
Picaxe makes sometimes a pulse to RESET-pin and its must to be able to do that.
Are you sure about that - Is this a theory or have you been able to prove that by observation with an oscilloscope ?

The 16F88 datasheet ( Figure 15-1 ) shows the MCLR ( RESET ) as an input only. While that's a simplified diagram there's no indication elsewhere that anything the chip does can bring RESET low. Particularly WDT timeout is said not to cause a RESET pin low which would be the most likely cause for such behaviour.

In the datasheet I have, the block diagram ( Figure 1-2 ) gives the impression that RA5 ( MCLR ) can be an output but I believe that is a simple drawing mistake because everything else ( Table 1-2, Table 5-1, and particularly Figure 5-5 ) shows it as input only.

If you are seeing a low on RESET that suggests it is coming from somewhere other than from within the PICAXE itself.

Could it be that you have an intermittent short between the RESET pin and one of the other PICAXE pins; Serial In and 0V are adjacent, and it is opposite Input 6 and close to Input 7 ?

One of those pins going low with a short would cause a reset and without a pull-up R on reset would short +V to 0V. Given that the PICAXE heats up, this suggests there is some sort of connection between a PICAXE output to RESET; the output goes low, pulls in +V via the RESET, overheats that output driver.

This generally correlates with the behavior you are seeing.
 

hippy

Technical Support
Staff member
Good point BeanieBots - the problem may have now been resolved.

One confirmation check would be to put a scope on the RESET pin and check it is always at +V. I've had similar shorts which affect signal lines but not enough to cause reset or misbehaviour but over time they can.

It's not always easy to check an intermittent reset though without a storage scope. I would personally be prepared to risk sacrificing the PICAXE, short out the RESET pull-up with a wire link and seeing if it still overheats. If it gets even slightly hot there's still a problem which needs tracking down, otherwise it would appear to have been solved.

Another worthwhile test is to write a program which puts an incrementing binary pattern on the outputs and check with a scope that all signals switch cleanly between 0V and +V. Any other results indicate a short of some sort.
 

BeanieBots

Moderator
I think those would be very worthwile tests. Particularly a "walking 1" with the reset 'shorted' to 5v.
I nearly always do the "bad practice" of direct link to 5v even in harsh environments and have never experienced such a phenomenon.
 

Pekari

Senior Member
hippy and BeanieBots, your's are right.
My device get a reset and get running a program from the start this evening.:(
 
Last edited:

BeanieBots

Moderator
It's always "good practice" to use a resistor for both reset and serin. More often than not, you can get away with a hard connection.
However, in your application, you have motors and relays. These devices kick out spikes which are not very micro friendly, so for your application I would recommend fitting the resistors. Besides, as far as serin is concerned, for the sake of two resistors, I always fit them anyway so that you can have in-circuit programming.
 

Pekari

Senior Member
Motor controlling circuit

This circuit blow a fuse again today.

What is so very, very wrong in this circuit that Picaxe go to short circuit?:confused:

I don't see anything else component which can do that and once picaxe getting hot when I put a fuse 1A.

Why output states change wrong?

I have check a program and there is no bug.
 

Attachments

BeanieBots

Moderator
Need a bit more explanation from you.
A cap on the reset line should be fitted if using the resistor but that does not explain what you are seeing.

What is the 5v regulator for?
Why is the PICAXE powered from 6v (via 2 diode drops) if 5v is available?

Need to know a bit more about the 6v supply. Is it capable of absorbing the relay turn-off spikes?

If your PICAXE has managed to blow a 1A fuse, I would consider it dead. I would also be very suspicious of any PICAXE which has ever got hot. You say "again". That implies it has happened before. The earlier event may have caused internal damage which only manifests under certain conditions.
 
Last edited:

Pekari

Senior Member
BeanieBots, relays need 6 V.
2 diode drops voltage 6V to 4,3V.
Fuses which blow were 3x200mA and 2x500mA, not any 1A.

Need to know a bit more about the 6v supply. Is it capable of absorbing the relay turn-off spikes?
I don't know. Could a problem in there?

I put a Capacitor to remove spikes if them appears, it still doesn't eliminate mess.
 

BeanieBots

Moderator
Ok, missed the diode on your 7805 to give ~6v. So that is your 6v supply?
Should be OK with 47uF. You should also fit 100nF very close to the PICAXE power pins.

No obvious circuit issue to cause the problem. Assuming your actual circuit is identical to the drawing, then can only be internal latching caused by relay spikes.

Try some very simple tests to eliminate each part.
Have a program which does nothing except cycle one relay every second.
Leave it running for an hour.
Then do the same with the other relay.
Then do the same with all the other outputs. Even the unused ones.
 

Pekari

Senior Member
I run that test code with both relays 1hr/each and it never resetted in that time.
When I connect a motor (24VAC) to relay with test program it get reset usually, so I think problem is voltage spikes from motor relays via circuit board.
Relay circuit is side by side with -.

Motor: 24VAC/14W
Which capacitos could be good for this? I try 2200pF but not any help.
 

BeanieBots

Moderator
So it's noise from the load on the relays:(
Curing this will not be easy. Your circuit is picking up EMI. Probably more when the (inductive) load is switched off. There will be significant arcing at the relay contacts.
The solution will be more a question of layout than extra components.
If you are not exerienced with this sort of thing, then it is going to be difficult to try to explain.

Keep all the mains to one side of the board. Have all wires come from it in one direction. This will help reduce radiated noise/pickup.
Have the relays in one location with wires comming straight (no curves) to the control board.
You MUST fit 100nF very close to PICAXE power pins.
You MUST fit 100nF to reset pin.

The most effective method is to reduce the noise in the first place. This will involve the use of suppressors on the AC switch contacts. This involves connection to mains so please be careful.
A good starting point would be 10R+0.1uF in series across the relay contacts. The components MUST be capable of coping with mains voltage and surge currents. You can't just use some old bits from your junk box.
 

westaust55

Moderator
This circuit blow a fuse again today.

What is so very, very wrong in this circuit that Picaxe go to short circuit?:confused:

I don't see anything else component which can do that and once picaxe getting hot when I put a fuse 1A.

Why output states change wrong?

I have check a program and there is no bug.
I presume that the fuse is only rated at 200mA as per your schematic versus the PICAXE gets hot when you use a 1Amp fuse.

What are the details of your relays? What is the current draw?
Data I have on some small 5Vdc relays is a draw of 42mA and coil resistance of 120 Ohms.

For the drive to the base of the two BC337 transistors I would suggest a higher value of resistor. The 330 Ohm resistors allow around 14mA of current. I typically use around 10k Ohm with a higher gain BC548 type transistor but suggest for your lower gain transistors that you try say a 1kOhm resistor as a start. Although the roughly 28mA draw from the two relays does not exceed the PICAXE max rating, that modification will help reduce the current draw through the PICAXE.

What is connected to the other four 330 Ohm resistor to external control? How much current is drawn though these PICAXE pins? If it is the same level around 14mA per pin then the total current could be getting around 100mA which may cause the PICAXE to operate warm.

While the datasheet suggests a PICAXE 18 can handle 200mA, for some other PIC chips (eg 278X1 and 40X1), Microchip has reduced the total draw into Vdd to just 95mA.

With two relays at say 40 to 50mA draw each you would be very close to the 200mA fuse rating
 
Last edited:

westaust55

Moderator
I run that test code with both relays 1hr/each and it never resetted in that time.
When I connect a motor (24VAC) to relay with test program it get reset usually, so I think problem is voltage spikes from motor relays via circuit board.
Relay circuit is side by side with -.

Motor: 24VAC/14W
Which capacitos could be good for this? I try 2200pF but not any help.
Small motors with commutators can generate RFI. Many small motors are universal type that can operate from AC or DC and have a commutator.
If the motor has a commutator try putting a small capacitor (try 100nF) across the motor. Best directly across the brushes but if not accessible at least across the motor terminals.
 

Pekari

Senior Member
Thanks again.
I did a space to these circuits but it dosn't help.
I think I will put a relays to other board. Picaxe is so disposed to do a bug.
 

Pekari

Senior Member
Next thought:

If spike is comig via base resistor, that doesn't help at all.
Do I have to put a opto-coupler?

westaust55, relay coil = 65 ohm.
 
Last edited:

Pekari

Senior Member
BeanieBots, VERY BIG thank you!

I put to motor capacitor 0,1 uF and 12 ohm resistor which I found my "junk box".;)
I have to choose 8 or 12 and this works well!!!:) No reset any more, I hope.

Voltage spike is still + - 150V (300V) but it doesn't flow via relay.
 
Last edited:

BeanieBots

Moderator
Glad you got it sorted.
If your capacitors can take the current, you could decrease the resistance even more to reduce the spikes even more.

BTW, your tranny circuit wouldn't work let alone cure anything.
 

Pekari

Senior Member
BeanieBots, you are right, it's a miserable plan.

My funktion was to arrest a spike from relay because it's floated it. Must do something with hurry...:eek:
 

Pekari

Senior Member
BeanieBots, I read again your post and you advance to put a resistor+capacitor to relay contacts, but I put it to motor coupling. I have usually done this way. Is this wrong habit? I think spike will be eliminated better this way, because it is come from there and not go to relays at all. Is from this something harmfully affect?
 

BeanieBots

Moderator
You should do both.
At the motor, it removes RFI/EMI from brush arcing. At the relay it removes contact RFI/EMI.
Think of it in a similar manner to supply decoupling. You need a cap at the supply source and also one at the destination.
In some circumstances, having capacitance at both ends of a line can cause ringing. More often than not, the ringing will be damped by the resistance of the cable. Only testing with a good DSO will tell you for sure.
 

westaust55

Moderator
Next thought:

If spike is comig via base resistor, that doesn't help at all.
Do I have to put a opto-coupler?

westaust55, relay coil = 65 ohm.
Just looking at the relay resistance, (without worrying about the inductance of the relay coils which will increase the total impedance), I = V / R
so the current for each relay is 6 / 65 = 0.92A or 92mA.
Peak curent will likely be greater and when the moving armature has closed the magnetic circuit the current could be lower.

But in roundish figures, 160 to 180mA if both relays energised at the same time plus 20mA to the BC337 transistors plus current for rest of the circuit, so it was no wonder that the 200mA fuse was blowing.

Even if it did not fail the first time it would have been stressed and fail after a few simultaneous energisations of both relays.

While this does not cover all the problems, it does indicate likely reason why the 200mA fuses were blowing.
 

Pekari

Senior Member
BeanieBots, thanks again.

westaust55, about a program: Relays NEVER energized at the same time: 0,25/0,5 sec in program.
I mean this:

Code:
	bit0=1
	bit2=1
	low 2
	pause 500
	high 0
	pause 250
	high 2
	pause 250
I remaind that it have blow 500mA fuse too.
Fuses are blowing because of voltage spike via relay and that spike is from motor coil.
Normally fuse is bearing extremely well because it will bear some overload.

I will change fuse to T250mA, thanks.
 
Last edited:
Top