SPLat Controlled Bluetooth IR Room Alarm System

Introduction: SPLat Controlled Bluetooth IR Room Alarm System


I particularly like this project because it requires minimal electrical experience as most of it is pre-made sensors and PLCs. But lets start off with, this is NOT a professional alarm system and is NOT intended to be used as such, therefor I assume NO responsibility for any stolen property due to the reliance of this project. It is meant for novelty purposes only!!



1 IR (infrared) motion sensor available at radioshack for about $10

1 buzzer of choice (I use a fire alarm buzzer that draws 0.5A but low current piezo buzzers can also be used just leave out the relay)

1 5v or 12 relay (I used a DPDT relay soldered to a PCB that brings the terminals to terminal strips)

1 2n2222 NPN transistor

1 JY-MCU Bluetooth Wireless Serial Port Module for Arduino $6

1 LM317T regulator OR a fixed 5 volt regulator

1 5k trim potentiometer

1 240 ohm resistor

1 1k ohm resistor

1 diode (Ii use 1n4001)

1 12v 1A power supply of some sort (I used an AC wall adapter and used a round charger plug to plug it into the system)

female pin headers

misc wire

solder and soldering iron

hot glue gun (or your preference of glue)

A computer running SPLat/PC, the free SPLat programming environment (IDE)

Now lets get started!

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: The Schematic


Here is a schematic of the whole project.

Note that all connections on the EC1 are as if you are looking at it from the top.

Step 2: Power


lets begin with our power supply:

We will need both 5v and 12v and since I am using a 12v adapter all I need is to make a regulator to get my 5v witch powers our EC1 and our IR sensor.

If you are using a fixed regulator you can simply connect your 12v to the input and the 0v to the GND input and solder a female header to the output and the GND

If using the LM317T:

We start by placing the 240 ohm resistor across the adjust and output pins (far left and center)

Then we will connect one leg of out 5k pot to the adjust (far left) i used the wiper leg

One of our left over legs on the pot will become our negative so we can solder one header wire to it, our neg from the wall adapter and one extra wire for our buzzer.

The positive input to the regulator (far right) will be connected to our wall adapter and one extra wire for the buzzer

Finally the center pin can be connected to another pin header, this will be our 5v supply AFTER we tune it to 5v using a multi-meter and screwdriver to turn the pot.

Step 3: Connect Everything!


Believe it or not that is is the only complex connection there is! we can now connect our sensor, BT module, relay, and buzzer.

lets start with the BT module and IR sensor:

The BT module comes with a connector that you can connect to the module and the EC1 making sure that the VCC and GND connections are in the correct places (see "Connecting EC1 to a JY-MCU Bluetooth module" for detailed instructions)

Now using some female header jumpers connect the IR sensors VCC input to the 5V terminal on the EC1 and the GND terminal to the 0V on the EC1 and finally the output to pin 20 on the EC1 which is input 1.

Now for programming purposes we need a jumper from pin 28 to pin 21 (this is for the program to know what mode it is in.

Step 4: Prepare the Relay


Now in order to trigger our relay we will need a transistor between the EC1 and the relay coil

If you are using a low current buzzer or piezo buzzer you can connect the emitter of the transistor to the negative of the buzzer and connect the positive to the correct voltage (5V or 12V) Then connect the base to pin 6 and the collector to the 0V pin on the EC1.

This I did by soldering a female header to the collector and emitter, then a 1000 ohm resistor to its base and another header to the resistor. I connect the collector to the negative on the EC1 and the emitter to one pole of the relay coil.

Now I connect the base of the transistor to pin 6 (input 2) on the EC1

NOTE!!!!! my relay was on a PCB and had the diode already there! to protect your transistor you must place a catch diode on the coil of the relay! from the - to the +!!!

Step 5: Connect Everything! (cont)


Now we can connect our regulator to the EC1 so that we can connect our relay.

If using a piezo, skip this step.

Connect one pole of the coil to the 5v terminal on the EC1 (or the main 12V depending on your relay)

Now connect that extra 12V wire to the input of the relay and the + side of the buzzer to the output of the relay (normally open)

Connect that extra negative wire to the negative of your buzzer.

Now we can program our EC1 so go ahead and plug it into your PC via USB and open SPLat/PC

Step 6: The Program


The atatched program consists of the beginning of "An Easy Bluetooth and SimpleHMI example program" in order to connect to the Bluetooth module.

I have created the password program myself. It can be changed by simply changing what event holds the "T" after it.


# HMI ButtonEvent(,9,5,3,7,"1",evbuttonf)
# HMI ButtonEvent(,9,12,3,7,"2",evbuttont) <---- this is the Correct number IE- evbuttonT

# HMI ButtonEvent(,3,5,3,7,"3",evbuttonf)

# HMI ButtonEvent(,3,12,3,7,"4",evbuttonf)

# HMI ButtonEvent(,3,19,3,7,"5",evbuttonf)

This will allow a jump to the next portion or digit in the sequence. for now I will make it "2 9 3 1 8 6" this is just a random sequence of numbers I came up with.

Every time you connect to the module it will ask for this password before you can arm/disarm the program.

The password is set up were if you get a number wrong it will jump to an alternate line were it allows you to enter the remaining numbers but will not unlock therefore you will never know what number you got wrong

EX: if you enter 123456 and the correct number was 023456 it will let you enter the "23456" but will not open because you got the first digit wrong.

You can download the program from this page and load it to your EC1 Now and it will work with the password "293186"

Step 7: Pug It in and GO!


Now you are all ready! Take that glue I talked about and secure your components to a platform or enclosure and turn it on! Scare your friends, family or pets haha no one willl enter your room again! How about adding a back up battery so they cant just unplug it!

I hope you enjoy this instructible and feel free to check out my other PLC based instructables!


Microcontroller Contest

Participated in the
Microcontroller Contest

Be the First to Share


    • Backyard Contest

      Backyard Contest
    • Silly Hats Speed Challenge

      Silly Hats Speed Challenge
    • Finish It Already Speed Challenge

      Finish It Already Speed Challenge

    6 Discussions


    5 years ago on Introduction

    hello, Im sorry it isnt working, When i mad it it worked for me, I will take a look and see if there is an error in the code. I will get back to you in a day. by the way thanks for trying it!

    Also, when connected to the EC1 on your PC with SPLat/PC open if you click the red circle on output 2 does the buzzer sound? and when the IR sensor detects motion does it show up as an input on input 1?


    Reply 5 years ago on Introduction

    Oh sorry, i simply had a problem with the battery. my battery holder doesnt work properly. thank you for the reply. But i have another question.

    1. How does it works actually? Does pressing DISARM means the system will falls in idle state?

    2. When i press DISARM, my piezo make a sound for a few second regardless theres an obstacle or not in front of it. this also applies when i press ARM.


    Reply 5 years ago on Introduction

    Ok so basically It first asks you for a password, if you get a number wrong it transferes the program to an alternate one that lets you put in the rest of the nmbers so that you will not know what one you got wrong. if you got it correct then it shows the arm and disarm buttons, when you press "arm" it turns an output on and the second program named "disarm" that we started in the beginning then reads that and transfers its program to the arm state. once armed if the IR sensor detects motion it will input to input 1 and thus transfer the program again to the alarm and cause the buzzer to sound.

    as for your beep every time you press arm, try replacing the Arm part with this:


    waitoff 1


    goifinoff 2,disarm

    waitont 1,1

    goifnz alarm

    goto arm

    and then any button that leads to arm needs to lead to Armwait so that it will wait for the IR sensor to turn off before arming


    Reply 5 years ago on Introduction

    Hello, About the input/output :

    Clicking Red 0 : Causes the EC to emit green

    Red 1 : EC emit Red

    Red 2 : Potentiometer clicking sound

    Both the arm and disarm still continue doing the same stuff. Here is the exact scenario.

    1. Pairing to HC 06 (Bluetooth) will cause the piezo to make a sound but very light. double beat per sound (i dont know how to decribe it properly sorry)

    2. Next, after paired, the piezo sound becomes louder and continuous even when im inserting the passcode. the sound cease after 10 seconds and continues back for every digit of passcode i press.

    3. After i insert the passcode, the simpleHMI will show "arm" button but the continuous piezo sound refreshes and will turn off after 10 secs (give or take)

    4. This will also happens if i press "Disarm" regardless if the IR sensor detects motion or not.

    my armwait arm and disarm are as followed while the other coding are remain untouched. :


    waitoff 1


    goifinoff 2,disarm

    waitont 1,1

    goifnz alarm

    goto disarm


    goifinoff 2,disarm

    on 2

    pause 40

    off 2

    pause 40

    goto alarm


    goifinon 2,Armwait

    on 0

    pause 20

    off 0

    pause 40

    goto disarm


    Reply 5 years ago on Introduction

    ok i will have to look at it tomorrow as i am busy today but first, do you have your buzzer connected directly to output 2? if so you need to put a transistor and relay in line because the EC1 can only drive 20mA per output so a buzzer could be over loading it.