A custom program to operate my basic stamp
SV2007
Posts: 8
I would like to use a board of education stamp to activate a servo.This stamp would activate useing two sensors the PIR and the LDTO switch vibration sensor.The goal is to make a device that extends the range of a common car alarm.The range of this car alarm would be extended to the service area of a cell phone.Honestly no one cares about your car alarm going off it would be nice if my car could call me and tell me there is a problem.I would like the stamp to be activated by thermal energy and the vibration of the alarm horn.The servo just moves and presses a button on the phone.This button is held for three seconds and then the servo returns to the first position.This would activate every four minutes until I shut it off.The stamp has to be on a different power source as my freinds can drill through car batteries.
I would like to have an LED that flashes five times when the power is on to the stamp in its standby mode.Will the stamp still contain all the programming if I dissconnect power to it?How do I write a program that combines the PIR+LDTO+LED+servo?I'm relly not too concerned about turning the stamp off and on I have figured that part out.Security is important this concept has its weaknesses.Any information that anyone has would be helpful.If you could contact me privately I would appreciate it.I currently have the phone mounted in the box with the servo,the board of education discovery kit,and the pir sensor.The PIR sensor is attached at the service port (12) and the servo is at (14) with the white red and black according to the book.The basicstamp bs2. program works good to hold the servo horn against the right button but I just don't know what to write to make the sensors activate the stamp to do the same.Installing the hardware has been easy its the software that I don't understand yet.Thankyou.
I would like to have an LED that flashes five times when the power is on to the stamp in its standby mode.Will the stamp still contain all the programming if I dissconnect power to it?How do I write a program that combines the PIR+LDTO+LED+servo?I'm relly not too concerned about turning the stamp off and on I have figured that part out.Security is important this concept has its weaknesses.Any information that anyone has would be helpful.If you could contact me privately I would appreciate it.I currently have the phone mounted in the box with the servo,the board of education discovery kit,and the pir sensor.The PIR sensor is attached at the service port (12) and the servo is at (14) with the white red and black according to the book.The basicstamp bs2. program works good to hold the servo horn against the right button but I just don't know what to write to make the sensors activate the stamp to do the same.Installing the hardware has been easy its the software that I don't understand yet.Thankyou.
Comments
Do you have any code written currently? If so, can you attach it?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
This program came right out of the book and it works to hold the horn against the button on the cell phone.The problem is I don't know what to write to make the PIR activate this program.
' What's a Microcontroller - ServoTest . bs2
' Test the servo at three different position signals.
' {$STAMP BS2}
' {$PBASIC 2.5}
counter VAR Word
DEBUG "Counterclockwise 10 o'clock", CR
FOR counter = 1 TO 150
PULSOUT 14, 1000
PAUSE 20
NEXT
DEBUG "Clockwise 2 o'clock", CR
FOR counter = 1 TO 150
PULSOUT 14, 500
PAUSE 20
NEXT
DEBUG "Center 12 o'clock", CR
FOR counter = 1 TO 150
PULSOUT 14, 750
PAUSE 20
NEXT
DEBUG "All done."
END
This is page 115,chapter 4 Controlling motion What's a microcontroller book. How do I make a code that makes this activated by the PIR and the vibra sensors??Thankyou for taking the time out of your busy schedual to reply.
DO : LOOP WHILE IN0 = 0
This assumes the PIR is connected to P0 and that the PIR has already settled. The PIR, when not triggered should be LOW on its output. That will cause the preceding line to sit in an infinite loop. Once motion is detected the program will drop through until the next line. Obviously this is very crude but does what you asked. I hope it helps. Take care.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
············ I haven't figured out how to attach what I want to show you.I put the "DO" command like you said after "counter VAR Word" it did not work.It says "Error 110 undefined symbol".I relly just don't get it.Is there anyone online whom can teach me how to program this?Thanks
··························································· Scott,
····························································SV2007
····································
Post Edited By Moderator (Chris Savage (Parallax)) : 3/10/2007 2:15:13 AM GMT
http://www.parallax.com/detail.asp?product_id=28152
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
I tryed to open that link that you listed and my screen froze up with a salt shaker.If you are talking about the links at the bottom of the PIR sensor product page, "PDF",then I down loaded the demo's four times.My computer will not let me access the files and it says "Windows does not recogonize file".I'm having difficulty getting those sample codes.I know from the "W.A.M.?" book I need to use a DO and LOOP commands.There is no reference to the PIR in the "W.A.M.?" book.I think I need to throw some more money at this.Should I buy #28127 "Applied Sensors Text"??Will it teach me what I need to know?Do you know of any classes in the St Petersburge Florida area?Iowa is too far from Cleveland,Ohio isn't there something closer?I'm moving to Florida in two years anyway.I will go over more of the actual hands on projects in the "W.A.M.?" book to see if it will help with the PIR codes.I think there might be something I overlooked "RC" something might apply to the PIR stuff.Thankyou talk to you later.
Scott,
SV2007
WAM doesn’t cover specific sensors or even every sensor. Just the few common ones to our educational materials. Once you’re familiar with things the documentation and example source code should be adequate to get most people going. We understand not everyone is at the same level which is why we have very good support. When there are materials available to help you we can direct you toward them. In order to view the PDF file you must have Adobe Acrobat Reader installed. This is free but it sounds as if you don’t have it. You can get it free from the following website. Applied Sensors does not cover the PIR. From a purely code point of view the PIR is no different or more difficult to program for than a pushbutton because like the pushbutton it only shows a HIGH or LOW (1 or 0). If you can make the code work at the push of a button (active HIGH) then it will work exactly the same with the PIR. That is how I would recommend focusing on this issue. The code I posted at the top works on my system. As soon as the PIR is tripped the program runs the next lines of code. Take care.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
When I run the program from the "W.A.M.?" the program that shows the status of the PIR at the PO it shows a "0" or a "1" in the DEBUG window.What does that mean?Does that mean that the stamp senses the PIR when motion is detected thus displaying a "1" in the DEBUG window?I tryed to hook the PIR up the same way as the push button and I think that it went to "1"'s in the DEBUG window when I had my hand by the PIR.I still can't get it to activate the servo yet.The good news is I figured out how to make the "ServoTest.bs2" go forever with the "DO" and "LOOP" commands I was pleased.I still have yet to discover what the "IF THEN " relley does to the program.I'm going to do a few more "pushbutton" projects.Thanks
SV2007
Scott,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
So I have to get the stamp, P13 because the PIR is in the servo header "13", to see the 1 of the binary code?It must be programed for input?When the P13 pin sees the 1 it will drop down to activate the servo?I'm almost ready togive up and go to plan B.Thanks.
SV2007
Scott,
I got it!!It works when I put my hand in front of the PIR it drops down into the servo program.The next concern is the timeing of the servo.The way the program is set up they will have there hands on the box before it calls me.I'm going to show you the program.I think a few ajustments to the "DEBUG" commands would speed things up?I need this thing activated the moment the PIR generates an electric charge.This program takes four seconds to generate a call.That is way way too long.Anouther defect in the program is it keeps hitting the button after the call is placed so when I'm called I hear a button being depressed.I need some kind of twenty second pause before it attempts to call back as these people have handheld jammers to try to drop the call.The jammers do work every once and a while so this device is going to need to keep calling me until it is linked.I do not want an LED status with this because I need to conserve all the energy I can for the servo.I also need to figure out how to hook up the vibratab and program it as well.Will I need a seperate stamp,box,cellphone and servo to do this
too or can both sensors activate the current stamp???The vibra sensor will extend the alam horn to the celluar service area.If the horn goes off it places a call as well.Then we get into rolling coded remote switches to activate and deactivate.Again those can be duplicated as well so don't bet the Ferrari on this.Anyway thanks for your much needed time on this project Chris you have been very helpful.Now I will list the successful program that needs tweeking.If you have any suggestions please let me know.
'The program that works
' Makes the servo activate when the PIR generates an electric charge
'{$STAMP BS2}
'{$PBASIC 2.5}
counter VAR Word
DO
DEBUG ? IN13
IF (IN13 = 1) THEN
DEBUG "Counterclockwise 10 o'clock", CR
FOR counter = 1 TO 150
PULSOUT 14, 1000
PAUSE 20
NEXT
DEBUG "Clockwise 2 o'clock", CR
FOR counter = 1 TO 150
PULSOUT 14, 500
PAUSE 20
NEXT
DEBUG "Center 12 o'clock",CR
FOR counter = 1 TO 150
PULSOUT 14, 750
PAUSE 20
NEXT
DEBUG "All done."
ELSE
PAUSE 100
ENDIF
LOOP
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
Thanks for the program sugestion.I just went to the parallax home page,entered the 605-00004,tryed to checkout with it and got "Error 500-12 Application Restarting Cannot display page". Do you know what's up with that?Is everyone having problems buying online right now at Parallax???I'm just going to have to buy it by phone tommorrow.I have a few more unanswered questions: Is there a Microcontroller class in St Petersburge,Florida?Can I combine the Vibra sensor with the current stuff already on the board of education or do I have to get a new board,cell,box,stamp ect?I'll try the new program you suggested later tonight I gotta go.Thankyou.
SV2007
Scott,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support