Arduino Uno Remote Alarm


This page describes my experiments with Arduino Uno. I created remote alarm and curve tracer.

Remote sensors station with 433 MHz trasmitter

I have something, that is about 30m from my home and I want to watch it. There is not cable connection, so I decided to make wireless alarm station that uses 433 MHz connection

Schema, function description

Remote Alarm Schema

ATtiny2313A periodically checks three inputs PD3 - 5, where are PIR, light and fire sensors connected. In case that alarm is signaled, relay switch ON transmitter. UM3758-120A is coder/decoder, that have 3-state inputs, that's used for pairing transmitter with receiver - both must have set this same code on A1 - A12 inputs. So last 3 ones: A10 - A12 I use for signaling 8 alarm types. Remote alarm uses 4, others are reserved for future use:

001Fire alarm
010PIR alarm
011Light alarm

When no activity occurred, green LED blinks and watchdog is periodically signaled.


For developing, I use breadboard and following tools:

Testing sensors

AVR USBasp is great tool - it allow insert many types of ATxxx family CPU's into socket and load program into it. There are pins that allow connect CPU to breadboard and develop circuit and software in flexible way. Finally, circuit can be moved to PCB.

Source code

Software is very simple: in infinite loop, sensors (PD3 - 5 inputs) are checked and when alarm is signaled, proper code is set to PB0 - 3 outputs (alarm code) and also PB3 switch relay ON for 10 seconds to give time for receiver to scan it. When no alarm occurred, watchdog signal is send every 50 green LED blinks.


Construction is on universal board, housed in ABS plastic box.

Arduino Uno base station with 433 MHz receiver

Base station is used for alarm signalling and also for playing and learning.

Schema, function description

This schema contains 6-button keyboard and radio receiver for remote alarm. PCF8574, the I²C 8-bit expander is used for adressing 74HC151, that scans buttons. Also UM3758-120A decoder A10 - A12 inputs allows scan 8 alarm codes from 433 MHz radio receiver.

Remote Alarm Schema


Construction is on universal board, it's not like final product, rather used for learning and playing in future

On base PCB, there is 6-button keyboard with related logic, 16x2 LCD with I²C interface and piezzo buzzer. 433 MHz radio receiver and decoder is on dedicated PCB module.

Remote Alarm working ...


Base station software I develop using Arduino IDE. This code contains alarm logic, and aditionaly there are routines for playing with PCF8583 (I²C RTC), PCF8574 (I²C 8-bit expander) and PCF8591 (I²C 8-bit A/D and D/A converter). For this reason, following source code is not complete, here is only keyboard, LCD and alarm related code.

Sketch download.

Learning PCF8583, the I²C RTC

RTC Schema

PCF8583external link is RTC clock/calendar with alarm functionality. The device has 256x8-bits of RAM. On base PCB, I placed two ones - first used for clock/calendar and daily alarm, second used as timer for updating status LED's independently from rest of software.

Both RTC's are backed up with CR232 baterry. Arduino Uno have only two interrupt inputs:


For driving this device, there are some libraries available, but no ones fit's to me. I decided join two ones and make it suitable for my needs. You can download it.

Here is most of my source code for RTC's. Note, that interrupt handlers only sets global variable, that serves as flags. Those flags are checked in main loop and here is required functionality. It's not good idea do some complex work in interrupt handler routine (e.g. I²C communication), because it may conflict with main code.

Note, that in routines handleInterrupt0(), handleInterrupt1(), alarm must be restarted using appropriate function.

Daily alarm test

Wake up me every day at 17:54, when I watch weather forecast at TV:

Weekday alarm test

Following code trigger daily alarm in next minute, but only in Tuesday:

Dated alarm test

Following code trigger alarm at specified date-time:

Timer alarm test

Following code trigger timer alarm every 5 seconds:


Learning PCF8574, the I²C 8-bit expander

Remote Alarm Schema

PCF8574external link is the I²C 8-bit expander, that allows give another I/O ports, when Arduino ones is consumed. This chip is available in two variants: The PCF8574P has an I²C address starting with 0100 but the PCF8574AP has an address starting with 0111. This means that PCF8574P uses address range 0×20 - 0×27, PCF8574AP uses address range 0×38 - 0×3F.

For playing with it, I made simple circuit with PCF8574AP driving 8 FLUX LED's using ULN2803A.

Testing sketch

This sketch demonstrates bit rotations with sending data to PCF8574 driving LED's:

Another sample:

Learning PCF8591external link , the I²C 8-bit A/D and D/A converter


PCF8591 has one 8-bit DAC. This sketch shows triangle wave on DAC output:

triangle wave on DAC output

Curve tracer


I create simple curve tracer, inspired by this pageexternal link. Instead of using Arduino PWM outputs, two PCF8591 DAC's are employed.

Schema, function description

Curve tracer schema

For each traced curve, DAC #2 sets base (or gate) voltage, defined in array:

Then sawtooth wave is set as collector voltage by ADC #1 and Uce and Ice are measured by Arduino ADC's. PCF8591 ADC is not used, because it's only 8bit, Arduino have 10 bit ADC's.


Tracer software is divided to two parts: On Arduino is running sketch that drive DAC's and make measurement. Measured values are sended to Serial line to PC (trough USB connection), where run Processingexternal link sketch that draws chart. Both sketch are based on Don Sauer's work, I added some functionality, made changes to use PCF8591 and borrow some code for keyboard and LCD support from alarm project.

Running Processing sketch

Note, that I use Processing 2.0.3 - Win 32, because Serial not supported in 64 bit version. Also note that Processing 2.1 have Serial functionality buggy - Serial.flush(); function not works for me.

28BYJ-48 – 5V Stepper Motor with ULN2003 driver

Original Arduino Stepper library not works well with this device (because it requires 8-step controlling), so I modified it - it's compatible with original. Code is fork of original library and driving of motor is borrowed from article on Instructableexternal link

Links external link

Valid XHTML 1.0!     Creative Commons License - non commercial