Disabling Alarm system with Hex Keypad

Hello,

I am trying to figure out a way to disable an alarm system using a Hex (4x4) keypad. I am using two micro-controllers; one for the alarm itself, and a second one for the keypad. For the second micro-controller, i am looking for a code that will be able to not only disable the alarm using a set code, but also reset the entire system. The code used for this will be simply; "1, 2, 3, A"

Thank you

Comments

  • 29 Comments sorted by Date Added Votes
  • Need a bit more info. Schematics or alarm model info would help. How is the alarm system reset now?
    In science there is no authority. There is only experiment.
    Life is unpredictable. Eat dessert first.
  • PublisonPublison Posts: 9,668
    edited September 11 Vote Up0Vote Down
    Welcome to the forums!

    It will be very hard to answer your question with the limited amount of information supplied.

    Which microcontroller(s) are you using? The code that yuo are using currentley would be helpful.
    Infernal Machine
  • TJRyanTJRyan Posts: 14
    edited September 11 Vote Up0Vote Down
    I dont have any sample code/model so far. This is for a project and i need to figure it out before i actually do it. Would a step by step process of how the alarm works be more helpful? and I am using the Parallax Board of Education
  • Posting the step by step would be helpful as would an overview of the alarm functions. Also, are you using the Propeller Board of Education or the Basic Stamp Board of Education?
    In science there is no authority. There is only experiment.
    Life is unpredictable. Eat dessert first.
  • Basic Stamp. And by step by step, do you mean a generic list of how it is supposed to work?
  • TJRyan wrote: »
    Basic Stamp. And by step by step, do you mean a generic list of how it is supposed to work?

    I mean like the sample below.

    The system monitors:
    6 switch contacts on windows and doors.
    3 motion sensors on the main floor
    1 signal from the fire alarm system
    1 panic switch

    The system ccontacts:
    Monitoring company if switches or motion sensors are active
    Monitoring company and fire department if fire alarm is active
    Monitoring company and Police if panic switch is activated
    In science there is no authority. There is only experiment.
    Life is unpredictable. Eat dessert first.
  • alright. so its just like a small alarm that is only for detecting things right in front of it.

    It has:
    1 IR sensor
    1 Piezo buzzer
    2 Basic Stamp Board of Education micro-controllers
    1 Hex Keypad

    It is armed with an IR Beam that hits an IR sensor
    Once the beam is broken and the Sensor stops sensing IR light, the alarm (which is a simple piezo buzzer) will begin to sound at a set interval.
    Once the buzzer goes off, the second microcontroller will activate
    Once it is active, the proper keypad input must be put in (This input will be simply, 1,2,3,A-top left to top right)
    Once the code is properly sequenced, the ENTIRE system (both micro-controllers) will deactivate and will bring it back to the first micro-controllers first line of code (which simply looks for IR light at the sensor)

    I know how to write the code for the first micro-controller, what i dont know how to do is sequence the keypads inputs, and also how to reset the system once the proper sequence is put in
  • Is this the Parallax 27899-4x4-Matrix-Membrane-Keypad?
    In science there is no authority. There is only experiment.
    Life is unpredictable. Eat dessert first.
  • That is the plan, yes
  • kwinnkwinn Posts: 7,563
    edited September 12 Vote Up0Vote Down
    TJRyan wrote: »
    That is the plan, yes

    OK, then you can download the sample programs for the keypad as a starting point. The simplest interface between the two micros would be to use two pins on each.

    Alarm micro...............Keypad micro
    alarm_out->>>>>>alarm_in
    valid_code_in<<<<-valid_code_out

    When the alarm_out is high the keypad micro reads 4 digits from the keypad and if they are the correct code outputs a high on the valid_code_out pin. The alarm micro turns off the alarm when it receives that high.
    In science there is no authority. There is only experiment.
    Life is unpredictable. Eat dessert first.
  • so alarm_out, alarm_in, valid_code_in, and valid_code_out are all pins?

    and is this how i would write the code in the Basic Stamp Editor?

  • Also, where would i go to download some sample code?
  • Yes, all four are pins on the two micros, one input and one output on each micro.

    You can find the keypad code here.

    For safety you should put resistors between the pins rather than connecting them directly. 1K would be good. Same goes for the keypad. Page 3 of the keypad manual shows where they go. They prevent damage to the pins in case of a bug in the program.
    In science there is no authority. There is only experiment.
    Life is unpredictable. Eat dessert first.
  • TJRyanTJRyan Posts: 14
    edited September 12 Vote Up0Vote Down
    Awesome. Thank you, I'll take a look at the sample program.
  • The keypad code in the product page isn't reliable; you get false reads. Here is a link to a discussion I started some time ago. It points, in turn, to an old discussion that explains the problem.
    Re-inventing the wheel is not a waste of time if, when you are done, you understand why it is round.
    Cool, CA, USA 95614
  • TJRyanTJRyan Posts: 14
    edited September 13 Vote Up0Vote Down
    The keypad code in the product page isn't reliable; you get false reads. Here is a link to a discussion I started some time ago. It points, in turn, to an old discussion that explains the problem.

    So if I understand this correctly, I need to add in 10k pulldown resistors to the first four input pins?

  • kwinnkwinn Posts: 7,563
    edited September 13 Vote Up0Vote Down
    TJRyan wrote: »
    The keypad code in the product page isn't reliable; you get false reads. Here is a link to a discussion I started some time ago. It points, in turn, to an old discussion that explains the problem.

    So if I understand this correctly, I need to add in 10k pulldown resistors to the first four input pins?

    There are two concerns with this keypad if used directly.

    The first is possible damage to the I/O pins if a button is pressed and the code has the two pins connected to that button set to outputs with one pin high and the other low. Very easy to do when debugging code. Even if the code is perfect a short between pins can happen if two buttons are pressed at the same time. Series resistors between the pins and the keypad will prevent that.

    The second is floating input pins. This can lead to false readings. Since a button is connected between one row and one column only one input is connected to an output so three of the inputs are floating. Pull down or pull up resistors can solve that.
    In science there is no authority. There is only experiment.
    Life is unpredictable. Eat dessert first.
  • TJRyanTJRyan Posts: 14
    edited September 13 Vote Up0Vote Down
    kwinn wrote: »
    TJRyan wrote: »
    The keypad code in the product page isn't reliable; you get false reads. Here is a link to a discussion I started some time ago. It points, in turn, to an old discussion that explains the problem.

    So if I understand this correctly, I need to add in 10k pulldown resistors to the first four input pins?

    There are two concerns with this keypad if used directly.

    The first is possible damage to the I/O pins if a button is pressed and the code has the two pins connected to that button set to outputs with one pin high and the other low. Very easy to do when debugging code. Even if the code is perfect a short between pins can happen if two buttons are pressed at the same time. Series resistors between the pins and the keypad will prevent that.

    The second is floating input pins. This can lead to false readings. Since a button is connected between one row and one column only one input is connected to an output so three of the inputs are floating. Pull down or pull up resistors can solve that.

    So i would already be adding resistors to the connections between the pins and Keypad. Do i have to add 1K resistors to every single one of the pin connections? Or just to the ones shown on the data sheet? Also, would i now just have to add 10K resistors to each keypad connection and use them to connect to either ground or power?

  • kwinnkwinn Posts: 7,563
    edited September 14 Vote Up0Vote Down
    FYI, I don't have a Parallax 27899-4x4-Matrix-Membrane-Keypad. I have an old push button keypad that I have wired up for prototyping. Circuit wise it is identical to the Parallax keypad, including the wire numbering. It is wired as shown in the attached schematic.

    In science there is no authority. There is only experiment.
    Life is unpredictable. Eat dessert first.
  • One mistake on the schematic. The resistor network marked "4 X 1K" should be marked 4 X 10K. Can't believe I missed that when I was editing it to match the Parallax key symbols.
    In science there is no authority. There is only experiment.
    Life is unpredictable. Eat dessert first.
  • Corrected schematic attached.

    688 x 579 - 13K
    In science there is no authority. There is only experiment.
    Life is unpredictable. Eat dessert first.
  • kwinn wrote: »
    Corrected schematic attached.

    So, all of the wires are connected using 120 ohms, and connection 1 also has a 10k connection to ground?
  • Update also, as it turns out i will not be using the actual board of education, just the micro controller. i will be making all connections with a circuit board. will this affect how i hook up the keypad?
  • TJRyan wrote: »
    kwinn wrote: »
    Corrected schematic attached.

    So, all of the wires are connected using 120 ohms, and connection 1 also has a 10k connection to ground?

    All the wires have 120 ohms, but there are 4 wires ( 1, 2, 3, 4 ) with 10K resistors to ground.
    In science there is no authority. There is only experiment.
    Life is unpredictable. Eat dessert first.
  • TJRyan wrote: »
    Update also, as it turns out i will not be using the actual board of education, just the micro controller. i will be making all connections with a circuit board. will this affect how i hook up the keypad?

    Nope, it should connect to the same I/O port pins on the microcontroller.
    In science there is no authority. There is only experiment.
    Life is unpredictable. Eat dessert first.
  • Alright, I got it. What parts of the keypad code would i need for reading the proper sequence? Also, would i need IF-THEN statements for reading each input
    i.e.

    IF
    Keypad1 HIGH
    THEN (whatever would be done to move the sequence)
  • TJRyan wrote: »
    Alright, I got it. What parts of the keypad code would i need for reading the proper sequence? Also, would i need IF-THEN statements for reading each input
    i.e.

    IF
    Keypad1 HIGH
    THEN (whatever would be done to move the sequence)

    The is example code for reading the keypad is in the "4x4MatrixKeypad_Demo.bs2" file, although that is not necessarily the best way to do it for your use.

    If you are using a BS2 microcontroller you can use a FOR loop and a SELECT CASE statement to decode the keypresses, if you are using a BS1 there is no SELECT CASE so you would need IF THEN or some other way of decoding it. Do you need the decoded value to match the number/character on the keypad button?
    In science there is no authority. There is only experiment.
    Life is unpredictable. Eat dessert first.
  • kwinn wrote: »
    TJRyan wrote: »
    Alright, I got it. What parts of the keypad code would i need for reading the proper sequence? Also, would i need IF-THEN statements for reading each input
    i.e.

    IF
    Keypad1 HIGH
    THEN (whatever would be done to move the sequence)

    The is example code for reading the keypad is in the "4x4MatrixKeypad_Demo.bs2" file, although that is not necessarily the best way to do it for your use.

    If you are using a BS2 microcontroller you can use a FOR loop and a SELECT CASE statement to decode the keypresses, if you are using a BS1 there is no SELECT CASE so you would need IF THEN or some other way of decoding it. Do you need the decoded value to match the number/character on the keypad button?

    Yes, i need it to be able to read the inputs so when the correct buttons are pressed, the valid_code_out pin goes HIGH, resetting the whole system
  • What model of Basic Stamp are you using?
    In science there is no authority. There is only experiment.
    Life is unpredictable. Eat dessert first.
Sign In or Register to comment.