Tag Archives | alarm

Active Level Alarm with Trim Control via GPIO

This project sets up a continuously monitored voltage level change at a potentiometer as derived from a source reference. As continuously variable voltage level changes, voltage levels are read into memory from an analogRead operation. From memory, those levels are read and compared to an assigned maximum value (1000). If an increase of voltage is exceeded beyond that value (by potentiometer control), the alarm triggers with a corresponding notice within the serial monitor.

Active buzzer and potentiometer connectivity to Arduino UNO. Analog GPIO pin A3 and digital GPIO pin 8 attached to potentiometer and DC buzzer respectively. This is no a passive buzzer which requires and AC signal.
Both devices require a ground path while only the potentiometer requires its reference 5VDC. The wiper pin of the pot is connected to the A3 GPIO port.

Program & Functional Operation:

This video demonstrates how the code corresponds to the running levels that appear at the Serial Monitor. Notice the code specifies a 1000 limit to the analogRead of the potentiometer level value. Further along in the video, the potentiometer control is rotated to indicate an exceeded level until rotated back below that value again.


Code Setup:

int potVal;
int buzzPin=8;
int potPin=A3;

void setup()
{
Serial.begin(9600);
pinMode(buzzPin,OUTPUT);
pinMode(potPin,INPUT);
}

void loop()
{
potVal=analogRead(potPin);
Serial.println(potVal);
delay(400);
while (potVal>1000)
{
digitalWrite(buzzPin,HIGH);
potVal=analogRead(potPin);
Serial.println(potVal);
delay(400);
Serial.println(“Level Exceeded”);
}
digitalWrite(buzzPin,LOW);
}

Arduino IDE:

Code set up in the Arduino IDE (Sketch).
Continuously scrolled level increases or decreases as values are read into memory via analogRead from the potentiometer control.

Further Project Details: -Paul McWhorter