Shop OBEX P1 Docs P2 Docs Learn Events
--personal defense turret--v1 — Parallax Forums

--personal defense turret--v1

sushiandmorihikosushiandmorihiko Posts: 40
edited 2007-10-23 15:04 in BASIC Stamp
yoo people,
first of all,thanks for the help lately,

as perhaps some of you may have read my thread before, i am going to tell you guys what i am doing right now.

i am making a turret with pan and tilt system (2 servo) which on the top,i am planning to mount an airsoft cannon from rc tank toy (that i am going to take it off apart and use its cannon to be placed on my pan and tilt).other than airsoft gun on top of the pan and tilt, i am gonna attach a camera and some sensors like infra-red.i am going to explain a little bit further on the use of these later on.
lastly and probably,the whole of this turret will be placed on my boe-bot so that it may move--my boe-bot have line following sensor from parallax itself--so i hope it will follow marker line that i draw.hopefully.

this turret will have 2 modes:

1.automatic:
here,the turret makes use of its infra-red sensor to detect any interference, for this case,i hope it can detect and follow the movement of my hand.it goes up and down, left and right.i hope that once the sensor finds an interference,it will lock to that interference and and follow it all the way-just like shadowbot code/following boe-bot code and wait for my ultimate command to declare the first blood with its bb gun.

2.manual:
here,i am almost done with this part.here how this part works.as the pan and tilt consists of 2 servos,i use 2 potentiometer to drive the servos.so when i turn the knob of the potentiometer,the servo will turn propotionally as the turns of the potentiometer.what i like in this part is that,i ll be using the camera mounted on top too.so i should see what the camera seeing in my computer ,then i have every control of my turret and ready to shoot its bb bullet by aiming with my camera--(optionally i will add laser beam as for aiming targets).

so far,my progress for the manual is quite ok, but for the automatic,it is indeed tough and kinda stuck.it is really tough to code the infra-red to act that way, i am trying D Faust idea (he had mentioned that i should try 4 infra-reds--2 on top--2 below.i really do hope if someone could help me in this part--to help me finish the automatic mode.


any kind of ideas,comments or suggestion either long winded ones or impossible ones will be welcomed-because all along this project comes partly from the help of you guys.

thank you,people
best regards

Comments

  • sushiandmorihikosushiandmorihiko Posts: 40
    edited 2007-10-13 08:52
    hello,
    its me again,

    i am now having some problem in infra-red. i dont know why the value of the infra-red keeps on changing from 1 to 0 and 0 to 1 when even no interference is detected
    this is the sample code:

    DO

    FREQOUT 10,1,38500
    value1 = IN11

    FREQOUT 13,1,38500
    value2 = IN12

    DEBUG CRSRXY,2,3, BIN1 value1
    DEBUG CRSRXY,9,3, BIN1 value2

    loop

    anyone knows how to make the value1 and value2 stable?

    thank you
  • D FaustD Faust Posts: 608
    edited 2007-10-13 12:57
    I on't think that IR will give you the range that you want; it only goes out to 1 meter or so. PING goes out to three. Just something to think about.

    Are you sure those are you input pins? They would float if not connected to anything. Are you getting mostly 1s and a few 0s, vice versa, or is it 50%-50%.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    LOOKDOWN ThisThread, [noparse][[/noparse]Your_?, My_?, Cool_Thing], looknum
    LOOKUP looknum, [noparse][[/noparse]1, 2, 3], subnum
    ON subnum GOTO Hope_this_helps, Thanks!, WOW!!
    END 
    
  • sushiandmorihikosushiandmorihiko Posts: 40
    edited 2007-10-13 15:58
    yes i am sure D Faust,in fact i copied from the existing program which i am trying right now.

    right now i am testing with 2 infra-reds.so it detects left and right--and it works but not so perfect.when i place my hand over the left infrared--the servo turns accordingly and so on for the right one too.however,i encounter a little problem here. there are some times-like every 5 seconds--the value change from 0 to 1 and 1 to 0 very fast/unstable although i didnt place my hand over the sensors-causing the servos to get confused and turned a little bit left and right--stuck.

    is the any way i can get the value to be stable--

    thanks for the help
  • D FaustD Faust Posts: 608
    edited 2007-10-13 16:01
    IR does seem to· be somewhat unstable.· You might want to average the the values over a certain period of time to get a better value.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    LOOKDOWN ThisThread, [noparse][[/noparse]Your_?, My_?, Cool_Thing], looknum
    LOOKUP looknum, [noparse][[/noparse]1, 2, 3], subnum
    ON subnum GOTO Hope_this_helps, Thanks!, WOW!!
    END 
    
  • PJMontyPJMonty Posts: 983
    edited 2007-10-13 18:03
    Perhaps this will give you some ideas on how to tackle this problem:

    www.waterhobo.com/

    He uses a webcam and open source image tracking software to locate kids crossing his yard and then squirt then with water. He's not actually using tracking information to target, but rather as a robust trigger.

    The site has some amusing videos to watch...

    Thanks,
    PeterM
  • Tom CTom C Posts: 461
    edited 2007-10-13 19:08
    sushiandmorihiko,

    You might want to try a Thermal Sensor Array (TSA) as described in Steve Norris' article "Follow Me" in the Summer edition of Robot Magazine.

    I successfully duplicated his TSA tracker except that I used a BS2p in place of his PIC.

    The TSA tracker works very nicely and will pick up my thermal signature about 6 feet away.

    The I2C TSA is a bit pricey at ~$100, but it works very reliably.

    Just a thought.

    Regards,
    TCIII

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    If you are going to send·a Robot·to save the world, you·better make sure it likes it the way it is!
  • sushiandmorihikosushiandmorihiko Posts: 40
    edited 2007-10-14 03:19
    thanks for the advice guys,
    however i still want to finish up what i have started for the time being. i am still stuck in the infrared part--its tough. it works pretty well when my hands are over it but when it goes idle and i do not place my hand there--the values (1 and 0) will keep on changing causing confusion to the servo---i dont know why this happens--i dont think there is any interference. oya about D Faust idea on averaging the value--may i know hoe do you do that----because i only have 2 value---either 1 or 0?

    here is the program: (it may seems long but quite direct--i am using D Faust codes)


    ' {$STAMP BS2}
    ' {$PBASIC 2.5}

    value1 VAR Word
    value2 VAR Word
    OK_Difference VAR Word
    pulse VAR Word
    counter VAR Word


    DO

    FREQOUT 10,1,38500
    value1 = IN11

    FREQOUT 13,1,38500
    value2 = IN12

    DEBUG CRSRXY,2,3, BIN1 value1
    DEBUG CRSRXY,9,3, BIN1 value2






    IF value1 > value2 + OK_Difference THEN
    pulse = pulse + 20
    IF pulse > 1000 THEN 'all the way one direction
    pulse = 1000
    ENDIF
    ENDIF

    IF value2 > value1 + OK_Difference THEN
    pulse = pulse - 20
    IF pulse < 100 THEN 'all the way the other direction
    pulse = 100
    ENDIF
    ENDIF

    pls tell me what goes wrong.

    thank you--greatly appreciate your guys help
  • D FaustD Faust Posts: 608
    edited 2007-10-14 12:13
    If you add the value (1s or 0s) the stamp will give go the one that shows up most.

    reading1+reading2+reading3+reading4+reading5
    = 1 or 0
    5

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    LOOKDOWN ThisThread, [noparse][[/noparse]Your_?, My_?, Cool_Thing], looknum
    LOOKUP looknum, [noparse][[/noparse]1, 2, 3], subnum
    ON subnum GOTO Hope_this_helps, Thanks!, WOW!!
    END 
    
  • sushiandmorihikosushiandmorihiko Posts: 40
    edited 2007-10-14 12:20
    hhhmm,i didnt quite get what you are saying D Faust. can you elaborate a little bit more--thanks
  • D FaustD Faust Posts: 608
    edited 2007-10-14 12:24
    Because of the BS2's math it doesn't do decimals, which this value would be. Instead it rounds to the nearest whole number (I think) So if you have 3 0s and 2 1s then the verage would be a 0 because the actuall average would be .4.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    LOOKDOWN ThisThread, [noparse][[/noparse]Your_?, My_?, Cool_Thing], looknum
    LOOKUP looknum, [noparse][[/noparse]1, 2, 3], subnum
    ON subnum GOTO Hope_this_helps, Thanks!, WOW!!
    END 
    
  • sushiandmorihikosushiandmorihiko Posts: 40
    edited 2007-10-14 12:30
    heey, i think something got into my mind with your golden word--"show up the most". maybe i ll try that way. to create a code that allows to filter 1 or 0 that shows up the most---thanks man--i m trying now
  • sushiandmorihikosushiandmorihiko Posts: 40
    edited 2007-10-18 06:39
    hi guys,

    i am still stuck with my infrared detector being unstable if she does not detect anything--eg.if she does not detect anything,it should read up 1 on the screen but it once in a while the value changes very fast to 0 and vice versa causing confusion to the servo.

    sorry guys that i have to post the same problem again but i did try it for a couple of days and it didnt work

    i know it is something wrong with my infrared detector bcos when i plug out the infrared--the value still changes from 1 to 0 once in while very fast.(less than 0.2 s)


    i come up with this idea but i dont how to translate this idea to basic code:

    IF input = 1 FOR less than 0.2 second then x = 1 (off/not detecting anything)

    can i do this way--

    thanks guys
  • D FaustD Faust Posts: 608
    edited 2007-10-18 18:31
    If input = 1 then
    For countr = 0 to 100
    If input = 0 then goto main
    Next
    .....
    .....
    .....

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    --DFaust
  • allanlane5allanlane5 Posts: 3,815
    edited 2007-10-18 18:34
    I've had some issues with SOME IR-Decoders that they seem to like having a "pull-up" resistor on their signal line -- 10Kohm is a good value. This gives a firmer '1' than the Decoder itself does.

    This depends a LOT on the particular Decoder being used. Just a thought.
  • D FaustD Faust Posts: 608
    edited 2007-10-18 18:42
    You could use a ping to sense if there is anything in front.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    --DFaust
  • sushiandmorihikosushiandmorihiko Posts: 40
    edited 2007-10-19 06:07
    thanks D Faust---i ll give it a try and inform you back
  • sushiandmorihikosushiandmorihiko Posts: 40
    edited 2007-10-22 13:41
    well--i tried few ways but still i could not make the infra-red detector stable enough and it makes the audience think i am really an ameteure (although of course i am).

    i am thinking that i will get some "Sharp GP2D12 Infrared Sensor" instead---what do you think guys---is it worth it? i never tried this sensor before--how can i fit the education board with basic stamp--can it work together? cos i think parallax does not sell this type of sensor if not i ll get it from parallax as i am more familiar with it.

    pls give me some advice about this sensor and how does it fit my project? thanks guys
  • sushiandmorihikosushiandmorihiko Posts: 40
    edited 2007-10-22 14:20
    and one more thing--is this device significantly better than the seperate infra-red transmitter and detector set(like the one comes in the boe-bot set)--thanks
  • JonathanJonathan Posts: 1,023
    edited 2007-10-22 14:56
    Sushi,

    One last thing you might try is to get a piece of IR filter and put it front of the IR receiver. You can get a piece from an old VCR. It is the piece of plastic covering the IR receiver. If your problem is ambient light, like flourescent lights, this may help.

    As to GP2D12, it is more stable than regular IR receivers. It's range isn't that great, I find about 5 feet. To use it would will need an ADC (analog to digital converter) to read the output. The sensors also require some calibration to use.

    For more information, check out my website at: http://madlabs.info/gp2d12/sharp_gp2d12.shtml

    Jonathan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
  • sushiandmorihikosushiandmorihiko Posts: 40
    edited 2007-10-22 23:24
    thanks for the reply jonathan and i have read your article on this device-it was very helpful.i am thinking if analog to digital ic will do the trick? because i heard that this device measures distance by having variable volatages? is it compatible to my basic stamp board and will there be a lot of trouble to use this device onto my board?.

    thinking that each of this device will cost you like 4 times the normal infrared transmitter and receiver--i am really scared it wont work when i purchase them cos i need 4 of the with 2 panners,so that will cost quite a lot.--is it worth it?

    thanks a lot for you help
  • JonathanJonathan Posts: 1,023
    edited 2007-10-23 15:04
    Sushi,

    Glad the webpage was useful. I doubt that the GP2D12 will have the range that you need. I use it for short range object detection along with a Ping sensor. The sensor and ADC will work with the BS2 however. How far away are you trying to detect? Since the whole thing is to be mounted on a BOE, I'm also not sure you can get the two sensor far enough apart that they won't just both pick up any object in range. What size object? Human?

    I'll see if I can find the time to dig a couple of these sensors out and do a quick test, but no promises, I am very busy this week.

    Jonathan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
Sign In or Register to comment.