How best to include a malfunction alarm

Peter-C

Member
I have a simple and very effective circuit based on a 14m, which monitors temperatures and switches a pump in to prevent overheating or freezing in a water circuit.
I am concerned that the system could potentially malfunction without the user realising, and damage could occur.
I would like to have an audible alarm which would trigger in the event of a power loss, program crash or temperatures moving outside of a permitted range.
I can see that I could use a completely separate circuit (8M) with independent battery power but wonder if anyone has found a way of incorporating the desired alarm functions into the main Picaxe program, as a sort of failsafe. Obviously the critical functionality would be tripping the alarm in the event of program crash, where it cannot be guessed whether a given pin would crash high or low, if you follow me.
Any thoughts will be welcomed.
 

Dippy

Moderator
Have a read on watchdog or heartbeat alarms.
A lot of systems use this method.
But then, who watches the watchdog....?

To me a simple way would be for your programme to pulse out a 'heartbeat'. A secondary circuit (maybe a simple rectifier and voltage comp or, a missing-pulse 555 circuit) can alert or switch things off/on if the pulse stops.

Lots of ways and hardware is usually more reliable than software, but you could easily get another PICAXE or 2 to monitor and take action if the 'master' fails.

I'm sure there are many ways and it depends on your budget and experience.
 

hippy

Ex-Staff (retired)
Any effective 'crash detect' system requires a secondary system monitoring the main controller ( or something else in the controlled system ) which is immune to whatever crashes the main controller.

It may also be necessary to be able to do something about any fault when detected beyond raising an alarm. How complicated, robust and costly it needs to be depends upon the consequences of failure.

Starting point is usually Failure Mode Analysis ( determining what could go wrong and how that could be caused ) then Risk Assessment ( how likely any possible failure is and how catastrophic if it occurs ). Modify the system ( add fail-safes, inter-locks and alarms ) as necessary, and repeat until the system meets whatever criteria of acceptability there is.
 

retepsnikrep

Senior Member
I used a seperate 08m to peform this watchdog function. Ideally it should be opto isolated and powered seperately from the main circuit.

I basically added a line in main pic to toggle a pin on/off each time through my main loop.

The watchdog looked for these pulses and sounded an audible alarm if they were missing or not enough had arrived in my time period (1 minute). My watchdog circuit also tries to reset the main pic by pulling the reset pin low, again you can do that via an opto to keep everything seperate.


My code is here

Code:
Start:	
	high MasterReset		 ;Deactivate Master Reset Output [Pull High] (Note pcb jumper setting)	
	count WatchDog, Time, Pulses	 ;Count Watchdog pulses recieved in 60 seconds
	if Pulses > MinPulses then Start ;If Pulses received > MinPulses then goto program start

	high Alarm 			 ;Activate Audible alarm	
	high Led			 ;Activate WatchDog alarm dashboard Led
	low MasterReset			 ;Activate Master Reset Output [Pull Low] (Note pcb jumper setting)
	pause 1000			 ;Pause for 1 second to allow Master Reset
	goto Start			 ;Goto program start
 

Peter-C

Member
What a brilliant forum this is, to get three considered and informative responses within such a short time period. Many thanks for your thoughts and contributions, I am off to plan how to tackle it and I am sure I will be using the code from retepsnikrep.
Thanks guys
 
Top