Shop OBEX P1 Docs P2 Docs Learn Events
Computer 'watchdog' w/BS2 questions — Parallax Forums

Computer 'watchdog' w/BS2 questions

pvalepvale Posts: 8
edited 2005-01-15 02:40 in BASIC Stamp
I have some PCs crunching Seti BOINC workunits that I do not have much physical access to, and due to power glitches/outages I find the machines shut down quite a bit. Now, when they are operating I have VNC connection to them over the internet. I do not have the option of UPS backup for these machines.

What I want to accomplish is;

1. If machine locks up, bring reset low, then high. (Reset pin available on motherboard header for front panel leds, etc.)

2. If machine powers off, bring soft switch pin low, then high to restart. (Soft switch pin on motherboard header.)

I am going to monitor the power led for power off conditions, but to detect lockups, I need a clock signal of some sort that stops on lockup. I was thinking of using the keyboard clock, but don't know the speed of this clock signal, nor if it stops on lockup. Barring that, I can write a little program on the pc that pulses a parallel port pin, or something similar. I am going to use a BS2, running on a battery backed-up power supply, so will be immune to power failure. Anyone know about the keyboard clock, or have any other ideas of a clock signal that is within the range of a BS2?

Perry Vale

Comments

  • allanlane5allanlane5 Posts: 3,815
    edited 2005-01-08 00:08
    In theory, you could use a serial port (or USB to Serial Converter) to talk to the BS2. The BS2 would expect to be talked to every so often by your program. You could use a time-outable SERIN command on the BS2.

    If the PC missed enough 'strobes' to the BS2, then the BS2 could (in theory) reset the PC by pulling the reset line. You might have to open the PC to find the reset line -- or wire in to the reset button on the PC. It would have to know to wait a while for the PC to reboot and re-start the program until the next 'strobe' would reach the BS2.

    This would be a pretty brute-force 'Watch-Dog Timer' application.

    It would be best if your program issued the 'strobe' signals to the BS2 -- that way, no matter what went wrong, your PC would be reset.
  • steve_bsteve_b Posts: 1,563
    edited 2005-01-08 00:18
    When I'm playing with computers at work and it locks up...I usually try the caps lock key to see if light will flash for me.· If it doesn't, I KNOW it's locked up...BUT, having said that, I've still had lock ups with the caps lock light still working!

    I'm not sure if this will work...but if you occasionally toggle some RS232 lines to see if they respond.· Again, I don't know if the PC HAS to have a comm. program running, but maybe in the background (if you're running windows).

    And I'm trying to work out the right pins....say, DCD on the PC...maybe that'll trigger DTR which you could monitor!
    OR, put RTS/DSR and DTR high and see if CTS goes high....

    OF COURSE, all this relies on the motherboard crashing and hardware locking up.· Software can crash and still leave things running....

    Do you have access to the source code in your software?· you could put in a few lines to trigger serial port lines and monitor these with the stamp!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve
    http://members.rogers.com/steve.brady
    http://www.geocities.com/paulsopenstage

    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."

  • pvalepvale Posts: 8
    edited 2005-01-08 00:24
    Nope, don't have access to the source code for BOINC, but no problem to write a little app to toggle parallel pin(s). I would use parallel, because it's TTL already, although I'm going to use opto-isolators between PC and stamp anyway. Going to try to monitor 2-3 machines per BS2.
  • allanlane5allanlane5 Posts: 3,815
    edited 2005-01-10 00:52
    Windows has made it kind of difficult to directly toggle printer-port pins -- Windows makes that port a privileged resource, and wants to use that port for its printer drivers. Having said that, there do exist shareware drivers that give you access to the printer pins directly.

    If you're using DOS, of course, you have direct access to it.
    And you could use a BS2 to monitor the port pins as a 'watchdog', so if it doesn't see a transition in a certain period of time it resets your PC.

    Note if you use a single BS2 to monitor 2 or 3 PC's, you now have a single-point of failure tying three systems together. It is conceivable a failure on the BS2 would hold all three systems in continuous reset. Just something to think about. Make sure you engineer the system to be as robust as you can. The BS2 is a pretty robust module to start with, though.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2005-01-11 16:12
    It seems that the USB port is your best choice. You possilby have some +5 for charging the BasicStamps battery [noparse][[/noparse]as a trickle charge] and you might find that is has more ways to choose your lockup condition.

    You can also interface the BS to a telephone line and read the STATUS or intiate a reset from the telephone. This might be a good secondary system to have in place while developing your first choice of a fully automated, self-monitoring watch dog. It seems obvious that if you system has bugs and you have to run back and forth to reboot, you are going to need a secondary option to avoid real headaches.

    You can also have the BS monitor power outages, but that may be redundant.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    G. Herzog in Taiwan
  • allanlane5allanlane5 Posts: 3,815
    edited 2005-01-11 20:45
    Note also that the only hardware a BS2 needs to RECIEVE RS-232 is a 22 Kohm resistor in the line. It's only 'talking' RS-232 that needs a MAX232 chip -- and you don't even need that if you are using the 'programming port', which has a built-in 232 level converter.
  • Martin KingMartin King Posts: 9
    edited 2005-01-12 16:28
    >It would have to know to wait a while for the PC to reboot and re-start the program until the next >'strobe'·would reach the BS2.

    Rather than wait for a specific time interval, which could vary, when your watchdog program on the PC starts it should send a start signal first to the stamp to say it's sucsessfully started and the stamp·can start looking for Watchdog pulses. As a backup, if·the stamp doesn't·recieve a start signal within a reasonable·time (say 15 minutes), it will attempt to reset the PC again·(sometimes PC's crash again while·re-booting), if you want to get really fancy, if multiple resets fail, the stamp could look for a working PC·(There's no reason why one stamp can't monitor several machines)·and signal it to EMail you that there is a major problem.·you could also use this start message to keep an internal log in the stamp of how many times the PC has reset (add an·RTC and you can even see when it was reset)·to see if·you have a major problem. Now you just need to detect whether the stamp's crashed ;-)

    Martin.
  • pvalepvale Posts: 8
    edited 2005-01-13 01:03
    I have found that BOINC writes to the hard drive every 30 seconds on the dot, so this may get real simple. I'm just going to monitor the hard drive LED pin to the front panel. So, all of the signals I need for this project can bbe gotten right off the motherboard header. I am starting to write code, and good idea about after performing a reset, to have extra wait for computer to boot. I am going to devote a BS2 to each computer. I have some small perf boards from Radio Shack and will use header plugs and wires junked from old computer cases. I'll tap power from the PC power supply. I have some Maxim battery backup chips that I'll use for keeping the battery. A couple of pieces of double sided foam tape, and this device can be stuck somewhere inside the case. I have a bunch of 4N35 optoisolators, and I'll use them for isolation to the PC. The only thing that makes this more economical versus a UPS, is that I already have most of the parts. I'm thinking about connecting the serial pins amyway, so that I can VPN to the computer remotely and read any debug messages from the Stamp. Thanks for all the help and ideas. If anyone is interested, I'll write this up and take pictures when I get done.
  • steve_bsteve_b Posts: 1,563
    edited 2005-01-13 01:08
    Just to note that the pc's power supply is a switching power supply.· Not 'nice' power for a stamp.· There's another thread on this going on at the moment.

    You'll want to make sure the voltage is nicely filtered....not sure if the BOE will handle that or not!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve
    http://members.rogers.com/steve.brady
    http://www.geocities.com/paulsopenstage

    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."

  • pvalepvale Posts: 8
    edited 2005-01-14 23:38
    Steve,
    I've been running my stamps from an old Compaq laptop power supply since I've had stamps. I haven't had any issues. I do put a 100uf and a .01uf cap on the 5V rail coming out of the power supply. I'll have to go read that other thread.
  • steve_bsteve_b Posts: 1,563
    edited 2005-01-15 00:19
    are the laptop "bricks" any different than desktop power supplies?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve
    http://members.rogers.com/steve.brady
    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."
  • pvalepvale Posts: 8
    edited 2005-01-15 02:40
    Steve,
    The particular one I use on the bench has 5v, 12v, and 18v. The 18V output i use for the input to regulators down the line when I need them. But I do use the 5V and 12V directly as needed. I've run a lot of electronics from it. I don't know what currents the outputs are capable of, but I keep the draw to a couple of amps or less. I just retrieved several of my basic stamps and various carrier boards from 'cold' storage. I found a few 9v batteries in there too that were frozen and bulged. But I gave up on 9v batteries long ago and they went in the trash. I'm in the process of trickling a few electrons in the stamps now and making sure they work. And.....they're hooked to the 5v on the bech from aforementioned supply.
Sign In or Register to comment.