Project showcase
Frozen Computer Alarm

Frozen Computer Alarm © GPL3+

Make an alarm sound when the computer stops working.

  • 2,242 views
  • 3 comments
  • 8 respects

Components and supplies

Necessary tools and machines

About this project

This project is an Arduino-based alarm to monitor if the computer is working. In case the computer freezes, it will emit a warning sound signal.

The project is composed from two parts: a program which runs on the computer, and an Arduino connected in an USB port.

The computer programs sends a predefined character to the Arduino, at 1 second interval. Arduino reads from the data sent from the computer. If it doesn't receive any character for 10 seconds, it makes a sound from a buzzer attached to pin 10.

The computer program is written in Visual Basic. It is a simple Windows Forms Application, containing a Form (Form1), a label (Label1) and a timer (Timer1).

The Timer1 Interval is set to 1000 ms.

The source code of the computer program:

Imports System.IO.Ports
Public Class Form1
Dim port As SerialPort
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
port = New SerialPort("COM4", 9600) 'Set your board COM
port.Open()
End Sub
Private Sub Form1_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing
port.Close()
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
On Error GoTo error1
port.Write("1") 'character to send to COM port, wich the Arduino will expect.
Label1.Text = Now() & " - Sent ""1"" on COM4 baud 9600 - Success!"
Exit Sub
error1:
Label1.Text = Now() & " - " & ErrorToString()
End Sub
End Class

The Arduino program source code:

char incomingChar = 0; // for incoming serial data
int NoSignalCounter = -60; // delay to allow for computer startup time
void setup() {
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
}
void loop() {
while (Serial.available() > 0) {
NoSignalCounter = 0;
incomingChar = Serial.read();
if (incomingChar == '1') { // '1' is the character expected from the computer
noTone(10);
}
else {
tone(10, 2400); // alarm: the character sent from the computer is different from the expected character
}
}
NoSignalCounter++;
if (NoSignalCounter >= 10) { // alarm: no character was received from the computer in the last 10 seconds
NoSignalCounter = 0;
tone(10, 2400); //(pin,frequency)
}
delay(1000);
}


Code

Computer ProgramVB.NET
Imports System.IO.Ports

Public Class Form1

    Dim port As SerialPort

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        port = New SerialPort("COM4", 9600) 'Set your board COM
        port.Open()
    End Sub

    Private Sub Form1_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing
        port.Close()
    End Sub

    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        On Error GoTo error1
        port.Write("1") 'character to send to COM port, wich the Arduino will expect.
        Label1.Text = Now() & " - Sent ""1"" on COM4 baud 9600 - Success!"
        Exit Sub

error1:
        Label1.Text = Now() & " - " & ErrorToString()
    End Sub
	
End Class
Arduino CodeArduino
char incomingChar = 0; // for incoming serial data
int NoSignalCounter = -60; // computer startup time

void setup() {
  Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
}

void loop() {
  while (Serial.available() > 0) {
    NoSignalCounter = 0;
    incomingChar = Serial.read();
    if (incomingChar == '1') { // '1' is the character expected from the computer
      noTone(10);
    }
    else {
      tone(10, 2400); // alarm: the character sent from the computer is different from the expected character
    }
  }
  NoSignalCounter++;
  if (NoSignalCounter >= 10) { // alarm: no character was received from the computer in the last 10 seconds
    NoSignalCounter = 0;
    tone(10, 2400); //(pin,frequency)
  }
  delay(1000);
}

Schematics

circuit_uNyZKKfCd3.jpg
Circuit unyzkkfcd3
the compiled exe file of the Windows program
alarm-vb_ulHvJm1tM4.exe

Comments

Similar projects you might like

Sump Pit Alarm

Project showcase by loupalladino

  • 3,224 views
  • 6 comments
  • 15 respects

Motion Sensing Alarm With Keypad & Password

Project showcase by thehack904

  • 20,395 views
  • 62 comments
  • 61 respects

Buzzer Alarm System With Help Of Arduino

by Team ONYX

  • 62,156 views
  • 10 comments
  • 38 respects

Car Sensor monitoring & Alarm

Project showcase by petemnz

  • 26,703 views
  • 12 comments
  • 50 respects

Alarm Clock and Timer Working Standalone

Project showcase by ozyRonald

  • 14,757 views
  • 11 comments
  • 15 respects

Weather Forecast Clock Using Old Alarm and Arduino

Project showcase by LenkaDesign

  • 8,925 views
  • 19 comments
  • 41 respects
Add projectSign up / Login