Random issue with self triggering

Andrei IRL

Senior Member
I have completed a project and i am having an issue.
Some times, for no good reason the Circuits gets triggered by itself.
Basicaly, i have an input from PNP Induction proximity sensor connected to C.3. Proximity sensor outputs 12V so im using voltage divider to bring it down to 4 volts and also have use Zenner diode 4V7 to make sure that PICAXE will never get more then 4.7 volts in case of spike of voltage (this is to be fitted in a vehicle). When proximity sensor meets metal object PICAXE triggers relay module (it has build in resistors, transistors and EMF diodes thats why they are not showing on the schematics)..
All is working rather well, accept for some times the relay gets triggered by itself.
I have re checked everything and tried to replicate the issue but not sure what exactly causes it to happen.
I have attached schematics and CODE in case some one would have a minute to go over them nad possibly point me in the right direction.
Thanks very much in advance.
Andrei.
Schematics Andrei.JPG

Code:
setfreq m8 ` Running at 8Mhz, all pause values are x2 times
symbol qs=pin3
symbol up=pin1
symbol down=pin2
symbol greenled=0 	`ready LED
symbol RELAY1=4
symbol RELAY2=2
symbol kill = b0
symbol patern=b1
read 0,kill
read 1,patern
ReadAdc 1, b2
	Select Case b2
  		Case > 106 : Goto raceshift
  		Case > 42  : Goto roadshift
  		Else       : goto main
	End Select

Raceshift: patern = 0	`race shift - pull
	For b3=0 to 4	`RED and GREEN LEDs flashing 5 times on power ON
	high greenled
	high relay1
	pause 600		`300ms
	low greenled
	low relay1
	pause 600		`300ms
	next b3
	write 1,patern
goto main

Roadshift: patern = 1	`road shift - push
	For b4=0 to 4	`RED and GREEN LEDs flashing 5 times on power ON
	high greenled
	high relay1
	pause 600		`300ms
	low greenled
	low relay1
	pause 600		`300ms
	next b4
	write 1,patern
goto main

main:       high greenled	
		if qs=patern then fire 
		
	ReadAdc 1, b5
	Select Case b5
  		Case > 144 : Goto BothPushed
  		Case > 106 : Goto Plusone
  		Case > 42  : Goto Minusone
  	End Select

			
goto main

fire:	     	high relay1
	     	high relay2
		low greenled
		pause kill
		low relay1
		pause 40	`20ms delay between two realys kicking spark back in
		low relay2
		
		pause 600		 `pause 300ms anti-bounce
		
waitforquickshifter:if qs=patern then waitforquickshifter

goto main

bothpushed:	kill = 130	`kill time 65ms
		write 0,kill 
		low greenled
		For b6=0 to 4
		high greenled
		pause 600 	` pause 300ms
		low greenled
		pause 600	`pause 300ms
	next b6

goto main

plusone:if kill>200 then main		`MAX 100ms
		kill = kill + 2  		`+1ms
		write 0,kill
		low greenled
		pause 1000			`pause 500ms
		high greenled
		
goto main

minusone:if kill<80 then main		`MIN 40ms
		kill = kill - 2		`-1ms
		write 0,kill
		low greenled
		pause 1000 			`pause 500ms
		high greenled
		
goto main
 
Last edited:

premelec

Senior Member
Often this sort of thing is from some sort of transient voltage - relays are referred to but not clear if they share power supply with PICAXE - also is the equipment working near other high current equipment? A first step would be to increase the capacitance across V+ and V- _very close_ to the PICAXE. You might also filter - add small capacitor - from some of the inputs that might be getting a spurious signal to V-.
 

Andrei IRL

Senior Member
Im really sorry, i forgot to mention that instead of relays im using pre assembled 4 channel relay midules which already have EMF diodes, current limiting resistors and transistors in them.
 

Andrei IRL

Senior Member
Often this sort of thing is from some sort of transient voltage - relays are referred to but not clear if they share power supply with PICAXE - also is the equipment working near other high current equipment? A first step would be to increase the capacitance across V+ and V- _very close_ to the PICAXE. You might also filter - add small capacitor - from some of the inputs that might be getting a spurious signal to V-.
When ever the falls trigger happened the circuit was running off 12V Acid car battery not connected to anything else.
There is no high current voltage any where around. Relay modules does share 5V power supply with PICAXE.
I'll try increasing the capacitance between V+ and V- as you suggested to check if thats helps.
I might be able to get my hands on a scope closer to weekend and might do a bit more testing then to see exactly what happens.
 

premelec

Senior Member
The prewired isolated relay modules I've tested from China have pretty hefty coil currents so better 5v supply filtering/isolation might work out. On the other hand if the glitch happens when no relays are in play it's something else... :)
 

Andrei IRL

Senior Member
Sounds like the input pin is floating, try a 10k pulldown resistor attached to pin C.3
Thanks for your reply. I did use 10K pull down on pin 3 before as part of the Voltage divider circuit but have changed it to 1K now as i needed 5mA to make sure Zener Diode kicks in if over voltage accures (in the spec sheets Zener im using needs 5mA to be able to turn on)..
 

Andrei IRL

Senior Member
The prewired isolated relay modules I've tested from China have pretty hefty coil currents so better 5v supply filtering/isolation might work out. On the other hand if the glitch happens when no relays are in play it's something else... :)
Thanks for that. I might throw on some EMF diodes on the relay pins for the good measure myself. Although, this random triggering happens when relay module is not even activated.
 
Yes it could be worth putting a 100uf - 220uf capacitor across the supply anyway.

Missed that you had a voltage divider on pin3, so yes disregard the pulldown suggestion.
 

edmunds

Senior Member
I just solved one of those problems today - it turned out a regulator leg was not properly soldered during reflow, although visually it looked fine. The pressure-only contact worked for quite a while so I had put the model in the "completed" box, but now all of a sudden it started resetting seemingly for no reason.

Generally, I have always found one of two reasons for this type of problem - a floating input pin, serial in more importantly than any other, or a power supply issue. Sadly, there is normally no quick and easy solution. You could, for an example build some simple circuit independent (running off batteries, but with common ground) of this one to monitor and log power supply voltage on an ADC pin. Leave it on and see what happens. Register some data in case of a change of more than x in on-chip EEPROM and read it later. Alternatively, if you have a logic or scope with suitable threshold capability, you could set it up for more or less the same thing.

From your schematics, I suspect you are using IC socket. I have had numerous unexplained "not working" problems because of bad connections in the sockets especially if you take the circuit outdoors or to a more humid premisses. My suggestion would be to add a full program download circuit (only 22k missing) and solder the IC properly. Or make sure everything works and dip it in some varnish or epoxy.


Good luck,

Edmunds
 
Top