Laser Challenge

Go To Last Post
64 posts / 0 new

Pages

Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello Freaks,

I am currently working on a Laser "Tag" project. Everything is going well, except for the trasmitter. The gun currently outputs a binary signal identifying the sender, sent in about a quarter of a second. I would like to use a laser pointer for the actual laser, as it has a tight beam with a great distance. Unfortunatly, I can't design the sensor to accept ONLY the laser pointer's light; it gets flooded by ambient light. A red filter woudn't do, as sunlight would make the unit hand dur to the way i've programmed it. As the unit would be used primarily at night, this is a viable option, but i'd rather have a better fix. I also had the idea of using IR leds - as some of the commercial sets do - but these have a limited range and a wide beam, even after the use of lenses.

Does anyone have any ideas on how to solve this problem?

- Dean

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't know how much control you have over the laser pointer, but if you can modulate it by turning it on and off quickly, you can do the same thing that is done with IR remotes. They basically have the same problem; how to distinguish an actual signal from the ambient IR. The way this is done is to turn the IR signal on and off at a rate that is usually somewhere betwen 30Khz-40Khz. The receiver then has a filter tuned to this frequency which allows the ambient to be filtered out.

Dave

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This thread involved a similar problem set: https://www.avrfreaks.net/phpBB2/viewtopic.php?t=14007

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Freaks,

I've already got the code that sends a binary signal through a port (which might be attached to an IR LED) at a fast rate <.1 sec or so. I could hook this up to the laser pointer's power (via appropriate resistors, etc.) instead, but how do I filter it at the reciever?

Here's my code so far (written in BASCOM) in only 48 hours (I got BASCOM two days ago). Ignore the "wait .x" statements, i'm aware that they should be "waitms x" instead.

'                     ULTIMATE LASER CHALLENGE CODE
'                         (C) Dean Camera, 2004

' PORT A BIT                         TASK
'     0           Alive Led on Wrist
'     1           Alive Leds (via transistors) on Main Unit
'     2           Alive Leds (via transistors) on Back Unit
'     3           Alive Leds (via transistors) on L Shoulder
'     4           Alive Leds (via transistors) on R Shoulder
'     5           Alive Leds (via transistors) on Gun
'     6           Active Led on Gun
'     7           N/A

' PORT B BIT                         TASK
'     0           Weapon Output (Laser)
'     1           Weapon Trigger
'     2           Sensor(s) on Main Unit
'     3           Sensor(s) on Back Unit
'     4           Sensor(s) on L Shoulder
'     5           Sensor(s) on R Shoulder
'     6           Sensor(s) on Gun Shoulder
'     7           Hand sensor on Gun

' PORT C BIT                         TASK
'     0           N/A
'     1           Feedback loop and tamper switch
'     2           Display Mode
'     3           N/A
'     4           N/A
'     5           N/A
'     6           N/A
'     7           N/A

' PORT D BIT                         TASK
'     0           Serial In (to Max232)
'     1           Serial Out (to Max232)
'     2           LCD R/W
'     3           LCD E
'     4           LCD Dataline #4
'     5           LCD Dataline #5
'     6           LCD Dataline #6
'     7           LCD Dataline #7


$sim                                                        'Remove for Programming
$crystal = 8000000
$regfile = "8535def.dat"

Enable Interrupts

Deflcdchar 1 , 32 , 10 , 31 , 31 , 31 , 14 , 4 , 32         ' Health Symbol
Deflcdchar 2 , 4 , 14 , 4 , 31 , 21 , 4 , 10 , 27           ' Armour Symbol
Deflcdchar 3 , 14 , 17 , 23 , 17 , 29 , 17 , 14 , 32        ' Stealth Mode Symbol

Config Lcdpin = Pin , Db4 = Portd.4 , Db5 = Portd.5 , Db6 = Portd.6 , Db7 = Portd.7 , E = Portd.3 , Rs = Portd.2
Config Clock = Soft

Declare Sub Master
Declare Sub Hit
Declare Sub Fire
Declare Sub Writelcd
Declare Sub Dead
Declare Sub Decode

Dim A As Integer
Dim B As Integer
Dim S As String * 11
Dim Ca As Byte
Dim Suitid As Byte
Dim Opponent As Byte
Dim Displaymode As Bit
Dim Lives As Integer
Dim Armour As Integer
Dim Stealthmode As Bit

Ddra = &B11111111
Ddrb = &B10000000
Ddrc = &B00000000

Suitid = &B10110110                                         ' This suit's ID No.

' Begin Start Sequence
Cls
Lcd "   ULTIMATE"
Lowerline
Lcd "LASER CHALLENGE"
Wait 2
For A = 1 To 16
Shiftlcd Left
Wait 0.1
Next
Cls
Lcd " BY DEAN CAMERA"
Lowerline
Lcd "  Code Ver 0.1"
Wait 2
For A = 1 To 16
Shiftlcd Right
Wait 0.1
Next
Cls
Lcd "SUIT ID:" ; Suitid
Wait 3
Cls
' End Start Sequence

' Begin Setup Sequence
Lives = 3
Armour = 5
Ddra = &B11111111

Date$ = "01/01/00"
Time$ = "00:00:00"

Gosub Writelcd
Gosub Master
' End Setup Sequence





Sub Master()                                                ' Master Routine
    Do
        If Portc.2 = 1 And Ca = 0 Then
         Displaymode = Not Displaymode
         Gosub Writelcd
         Ca = 1
        End If

        If Portc.2 = 0 Then Ca = 0

        If Portc.1 = 0 Then                                 ' Feedback wire cut
         Cls                                                ' or tamper switch
         Lcd "WARNING:"
         Lowerline
         Lcd "Tamper Detected!"
         Porta = 0
         Do
         Loop
        End If

        If Portb.1 = 1 Then
            Gosub Fire
            Goto Skipdecode
        End If

        If Displaymode = 1 Then
         Locate 2 , 1
         Lcd Time$
        End If

        Gosub Decode

        Skipdecode:
    Loop
End Sub

Sub Writelcd()                                              ' Write Lives and Armour to LCD
    Cls
    If Displaymode = 0 Then
    Lcd "Armour: "
    Lowerline
    Lcd "Lives:  "

    For A = 1 To Armour
        B = A + 8
        Locate 1 , B
        Lcd Chr(2)
    Next
    For A = 1 To Lives
        B = A + 8
        Locate 2 , B
        Lcd Chr(1)
    Next
    Else
    Lcd "Game Time:"
    Lowerline
    Lcd Time$
    End If

    If Stealthmode = 1 Then
      Reset Porta
      Locate 1 , 16
      Lcd Chr(3)
    Else
      Set Porta
    End If

    Return
End Sub

Sub Hit()                                                   ' Flash alive Lights and Decrease Armour/Life
    If Armour = 1 Then
        Armour = 5
        Decr Lives
    Else
        Decr Armour
    End If

    For A = 1 To Rnd(10)
        Reset Porta
        Wait 0.2
        Set Porta
    Next

    Cls
    Lcd "Hit! Reactivate:"
    Lowerline
    For A = 10 To 1 Step -1
        Locate 2 , 1
        Lcd A ; " Secs. "
        Wait 1
    Next

    If Lives = 0 Then Goto Dead
    Gosub Writelcd
    Return
End Sub

Sub Dead()                                                  ' No lives left - Dead
    For A = 1 To 16
        Shiftlcd Left
        Wait 0.2
    Next

    Cls
    Lcd " ***DECEASED***"
    Lowerline
    Lcd " Return to base"
    Reset Porta
    Do
    Loop
End Sub

Sub Fire()                                                  ' Fires Weapon
    If Portb.7 = 0 Then
    Cls
    Lcd "Place hand on"
    Lowerline
    Lcd "Gun to fire!"
    Wait 1
    Gosub Writelcd
    Return
    End If

    Set Portb.0
    Wait 0.3
    For A = 0 To 7
        If Suitid.a = 0 Then
            Reset Portb.0
        Else
            Set Portb.0.0
        End If
        Wait 0.05
    Next

    Cls
    Lcd "FIRED"
    Wait .5
    Gosub Writelcd

    Do                                                      ' Stop Rapid Fire
        Gosub Decode
    Loop Until Portb.1 = 0
    Return
End Sub

Sub Decode()                                                ' See if start-bit detected, if so decode opponent's suit id
    For A = 2 To 6
        If Portb.a <> 0 Then
            B = 0
            Do
            Wait .01
            Incr B
            Loop Until Portb.a <> 1 Or B = 310
            B = 0
            Do
                If B = 8 Then
                    Goto Continue
                End If
                Opponent.b = Portb.a
                Wait 0.05
                B = B + 1
            Loop
        End If
    Next
    Continue:

    If Opponent <> 0 And Opponent <> 255 And Opponent <> Suitid Then Gosub Hit
    Return
End Sub

- :twisted: Dean (a.k.a. DaRkLoRd)

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yo Mneary,

I checked out the address you gave me (https://www.avrfreaks.net/phpBB2/...) and it had basically what I wanted, but my code has irregular codes sent, which differ from suit to suit. The thread suggests putting an IR filter over the reciever (My dad happens to have some IR perspex in the shed) but woudn't this block the laser pointer?

- Dean

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

abcminiuser wrote:
Freaks,

I've already got the code that sends a binary signal through a port (which might be attached to an IR LED) at a fast rate <.1 sec or so. I could hook this up to the laser pointer's power (via appropriate resistors, etc.) instead, but how do I filter it at the reciever?

Check out the thread on filtering an 1800 Hz signal in one of the other forums: https://www.avrfreaks.net/phpBB2/...

Dave

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What if you combine your laser with IR.

Have IR send out a clasification code and use the laser to trigger reading of the IR.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yeah, I though about that, but how does the avr distinguish between the laser and a torch (for example)? Also, I want to use a Laser only as it has a better range and tighter beam. There is a university page where students made a pathetic version of the Laser Challenge i'm making (no LCD screen, no features, etc.) but this used really expensive filters that block all light but the laser pointer's wavelength.

I could just use a red filter seeing as it's probably only goint to be used at night (laser pointers don't work well in sunlight anyway) but i'd rather create a fantastic design than a mediocre one.

- Dean

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You could spend a little more money to buy a IR-Laser. So you could use a standard IR receiver.

Hava a look at my web page -> http://www.tobiscorner.at.tf

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There's a laser IR module?? I thought lasers were only avaliable in blue, red and green?

I'm only 15 but I have half a Dick Smith shop on my balcony (courtesy of my dad's electronics hobby from years ago) and included in this is a bag of 30 pristine 16*2 LCD screens perfect for my application. I can't purchase specialist stuff off the 'net but I want to make a proffesional system. The only thing stopping me is the laser - I think i'll just have to opt for night-use only.

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You can get Laser Modules with nearly every wavelength. I think for your system a IR laser would be best, because the enemies can't recognize the spot before they get "shot". Otherwise if you don't aim precise you enemy could see the red spot on the tree or something next to him. Next point is security. It would be safe if all members wear some protection, primarily for their eyes. I'm not sure but normal sunglasses do a good job in case of IR-Protection. But sunglasses at night???

Hava a look at my web page -> http://www.tobiscorner.at.tf

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

LOL!

I've played laser challenge at "DarkZone" before, which is (as the name suggests) dark, and they use lasers. The trick I suppose is to "Aim Low" and use my short transmission time (a couple of milliseconds won't do too much damage)

- Dean

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

But always think at the worst case...

One gun not sending short pulses but continuous into ones eyes. They guy's wearing normal glasses and because of glasses are some kind of lens the laser beam gets focused direct onto his retina. I'm sure that you won't laugh any more.
Only some mW for some seconds can damage your eyes.

I've seen systems running with a mean power of some mW buring holes in wrong placed digital multi meters!

Hava a look at my web page -> http://www.tobiscorner.at.tf

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hmmm, point taken. I don't think i'd be shooting me mates with my laser tho...

Another solution would be to use the red filter for the sensor, but wear glases that are tinted green or have a green filter over them. They'd add a "comando" element and prevent the red laser from hitting the retina.

- Dean

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I haven't looked at the details of what you're doing too much, so don’t shoot me down in flames. But, if the problem is differentiating the ambient light from the beam. Wouldn't it be possible to create a sort of fuzzy logic using an ADC input that compensates for the ambient light and picks up on expected periodic differences or signature? Just a thought....

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I hope this discussion hasn't totally killed the project due to "laser safety concerns".

You're planning on using commercial pointers, modulated to durations less than those of normal operation. Your users hopefully already know not to shoot into one another's eyes. The visible laser should also help the target protect themselves.... and since the competition is about hitting the target sensor, there's a serious competitive disadvantage to shooting elsewhere (such as face and eyes).

Sensible safety measures certainly must be followed, but they should be consistent with the safety measures for the laser pointers which you're building upon.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Freaks,

The IR would be better for the signal, as a laser would require perfect accuracy - but I still want a lser pointre to look good. The fuzzy logic is a good idea, just make the system remember the last light amount and respond to sudden changes.

I WAS going to have head-shots but this was scratched due to the lasers. I'm breadboarding the prototype now, to make sure it works.

- Dean

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

1) How do you aim a laser beam that you can't see in the dark?
2) Look into one of those Sharp IR detectors... demodulation done.
3) It seems to take a long time to send the code -- approx 0.1sec :shock: I think it would be very hard to hold a laser beam on a moving detector for very long. Wide beams and small but numerous detectors would be better.

Go electric!
Happy electric car owner / builder

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Freaks,

I deliberatly made the signal send time long, so that you have to have some accuracy, not just a change shot. I will alter it as I make the prototypes to the best interval.

I don't plan on complete darkness, but the ACTIVE LED ports will flash the team colour on the shoulder, fron, back and gun of the players. Dusk would be the best time, as injuries can occour in pitch blackness. My school has light on permenantly and I live near it - it would offer a perfect large arena as there is adequate light at night and enough places to hid in the maze of portables.

- Dean

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

As to differentiating from ambient light and the beam, that's why remotes use near-IR and the dark red filter. It's pretty transparent to the beam but blocks most of the ambient light.

Most detectors will have a fairly linear response region and that is where you want to be with the background plus signal light. With a modulated beam you can block most or all of the DC-like background with a high-pass filter and life is good.

But if you allow too much ambient to get through and move the signal up to where you start losing the top end or the detector is completely saturated just from ambient, and you lose signal intensity on the modulated part from the beam.

If you are outside in day, visible lasers are going to pose some tough problems. Inside, in darkish rooms or outside at night, you can still get away with visible beams since the background isn't too strong.

Please note - this post may not present all information available on a subject.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Freaks,

I've made a number of changes to the code, the largest of which is the juggling of ports. My original code had all the active LEDs on one port, and inputs another, etc., but this would lead to a complex and messy schematic so I added some routines to place all of each device's (such as Gun or Front Unit) inputs and outputs together.

'                     ULTIMATE LASER CHALLENGE CODE
'                         (C) Dean Camera, 2004

'  PORT A
'----------------------------------------
'0 Wrist Alive LED                      O
'1 Display Mode Button                  I
'2 Front Alive LED                      O
'3 Front Sensor                         I
'4 Back Alive LED                       O
'5 Back Sensor                          I
'6 LCD Light                            O
'7 N/A                                  -

'  PORT B
'----------------------------------------
'0 L Shoulder Alive LED                 O
'1 L Shoulder Sensor                    I
'2 R Shoulder Alive LED                 O
'3 R Shoulder Sensor                    I
'4 N/A                                  -
'5 N/A                                  -
'6 N/A                                  -
'7 N/A                                  -

'  PORT C
'----------------------------------------
'0 Gun Trigger                          I
'1 Gun Hand Sensor                      I
'2 Gun Reload Button                    I
'3 Gun Sensor                           I
'4 Gun Active LED                       O
'5 Gun Output                           O
'6 N/A - Crystal                        -
'7 N/A - Crystal                        -

'  PORT D
'----------------------------------------
'0 Serial In                            O
'1 Serial Out                           I
'2 LCD R/W                              O
'3 LCD E                                O
'4 LCD Dataline #4                      O
'5 LCD Dataline #5                      O
'6 LCD Dataline #6                      O
'7 LCD Dataline #7                      O


'$sim                                                        'Remove for Programming
$crystal = 8000000
$regfile = "8535def.dat"

Enable Interrupts

Deflcdchar 1 , 32 , 10 , 31 , 31 , 31 , 14 , 4 , 32         ' Health Symbol
Deflcdchar 2 , 4 , 14 , 4 , 31 , 21 , 4 , 10 , 27           ' Armour Symbol
Deflcdchar 3 , 4 , 14 , 32 , 14 , 14 , 14 , 14 , 31         ' Bullet Symbol

Config Lcdpin = Pin , Db4 = Portd.4 , Db5 = Portd.5 , Db6 = Portd.6 , Db7 = Portd.7 , E = Portd.3 , Rs = Portd.2
Config Clock = Soft
Config Lcd = 16 * 2

Declare Sub Master
Declare Sub Hit
Declare Sub Fire
Declare Sub Writelcd
Declare Sub Dead
Declare Sub Decode
Declare Sub Flashlights
Declare Sub Lightsio(byval Onoff As Integer)

Declare Function Sensoractive(number As Integer) As Byte

Dim A As Integer
Dim B As Integer
Dim C As Byte
Dim Flashpause As Byte
Dim S As String * 11
Dim Modeswitch As Byte
Dim Firing As Bit
Dim Suitid As Byte
Dim Opponent As Byte
Dim Displaymode As Byte
Dim Lives As Byte
Dim Armour As Byte
Dim Roundburst As Byte
Dim Ammorem As Byte

Config Porta = &B10101010
Config Portb = &B11111010
Config Portc = &B11001111

Ddra = &B01010101
Ddrb = &B00000101
Ddrc = &B00110000

Suitid = &B10110100                                         ' This suit's ID No.

' Begin Start Sequence
Cls
Lcd "   ULTIMATE"
Lowerline
Lcd "LASER CHALLENGE"
Wait 2
For A = 1 To 16
Shiftlcd Left
Waitms 100
Next
Cls
Lcd " BY DEAN CAMERA"
Lowerline
Lcd "  Code Ver 0.1"
Wait 2
For A = 1 To 16
Shiftlcd Right
Waitms 50
Next
Cls
Lcd "SUIT ID:" ; Suitid
Wait 3
Cls
' End Start Sequence

Lightsio 1
Porta.6 = 1

' Begin Setup Sequence
Lives = 3
Armour = 5
Roundburst = 3
Ammorem = 15

Date$ = "01/01/00"
Time$ = "00:00:00"

Gosub Writelcd
Gosub Master
' End Setup Sequence





Sub Master()                                                ' Master Routine
    Do
        If Porta.1 = 1 And Modeswitch = 0 Then
            Displaymode = Displaymode + 1
            If Displaymode = 3 Then Displaymode = 0

            For A = 1 To 16
                Shiftlcd Left
                Waitms 30
            Next
            Gosub Writelcd
            Modeswitch = 1
        End If

        If Porta.1 = 0 Then Modeswitch = 0

        Portc.4 = Portc.1

        If Portc.2 = 1 And Ammorem = 0 Then
            Ammorem = 15
            Gosub Writelcd
        End If

        If Portc.0 = 1 And Firing = 0 Then
            Gosub Fire
            Goto Skipdecode
        End If

        If Portc.0 = 0 Then Firing = 0

        If Displaymode = 1 Then
            Locate 2 , 1
            Lcd Time$
        End If

        Gosub Decode

Skipdecode:
    Loop
End Sub

Sub Writelcd()                                              ' Write Lives and Armour to LCD
    Cls

    Select Case Displaymode
        Case 0
            Lcd "Armour: "
            Lowerline
            Lcd "Lives:  "

            For A = 1 To Armour
                B = A + 8
                Locate 1 , B
                Lcd Chr(2)
            Next
            For A = 1 To Lives
                B = A + 8
                Locate 2 , B
                Lcd Chr(1)
            Next
        Case 1
            Lcd "Game Time:"
            Lowerline
            Lcd Time$
        Case 2
            Lcd "Ammo:"
            For B = 1 To Ammorem
               Locate 2 , B
               Lcd Chr(3)
            Next
    End Select

    Return
End Sub

Sub Hit()                                                   ' Flash alive Lights and Decrease Armour/Life
    If Armour = 1 Then
        Armour = 5
        Decr Lives
    Else
        Decr Armour
    End If

    Flashlights

    Cls
    Lcd "Hit by #" ; Opponent ; "!"
    Lowerline
    For A = 10 To 1 Step -1
        Locate 2 , 1
        Lcd A ; " Secs. "
        Wait 1
    Next

    If Lives = 0 Then Goto Dead

    Lightsio 1

    Gosub Writelcd
    Return
End Sub

Sub Dead()                                                  ' No lives left - Dead
    For A = 1 To 16
        Shiftlcd Left
        Waitms 110
    Next

    Cls
    Lcd " ***DECEASED***"
    Lowerline
    Lcd " Return to base"
    Lightsio 0
    Do
    Loop
End Sub

Sub Fire()                                                  ' Fires Weapon
    Firing = 1

    If Portc.1 = 0 Then
        Cls
        Lcd "Place hand on"
        Lowerline
        Lcd "gun to fire!"
        Waitms 600
        Gosub Writelcd
        Return
    End If

    If Ammorem = 0 Then
        Cls
        Lcd "No Ammo!"
        Waitms 600
        Gosub Writelcd
        Return
    End If

    For B = 1 To Roundburst
        Ammorem = Ammorem - 1
        Portc.5 = 1
        Waitms 10
        For A = 0 To 7
            If Suitid.a = 0 Then
                Portc.5 = 0
            Else
                Portc.5 = 1
            End If
            Waitms 5
        Next A
    Next B

    Portc.5 = 0

    If Displaymode = 2 Then Gosub Writelcd

    Return
End Sub

Sub Decode()                                                ' See if start-bit detected, if so decode opponent's suit id
    For A = 1 To 5
      C = Sensoractive(a)
        If C <> 0 Then
            B = 0
            Do
            C = Sensoractive(a)
                Waitms 10
                Incr B
            Loop Until C <> 1 Or B = 310
            B = 0
            Do
                If B = 8 Then Goto Continue
                C = Sensoractive(a)
                Opponent.b = C
                Waitms 5
                B = B + 1
            Loop
        End If
    Next
Continue:

    If Opponent <> 0 And Opponent <> 255 And Opponent <> Suitid Then Gosub Hit
    Return
End Sub

Sub Flashlights()
    For A = 999 To 1
        Lightsio 1
        Waitms A
        Waitms A
        Lightsio 0
        Waitms A
    Next

    Return
End Sub

Sub Lightsio(onoff As Integer)
 Porta.0 = Onoff
 Porta.2 = Onoff
 Porta.4 = Onoff
 Portb.0 = Onoff
 Portb.2 = Onoff
 Return
End Sub

Function Sensoractive(number As Integer) As Byte
Select Case Number
   Case 1
       C = Porta.3
   Case 2
       C = Porta.5
   Case 3
       C = Portb.1
   Case 4
       C = Portb.3
   Case 5
       C = Portc.3
End Select

Sensoractive = C
End Function

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You can use IR Lasers Modules (diode lasers) operating at their nominal power of about 5mW peak. That make them Class I, that means you can look at them for many minuts withou getting hurt.

Problem with that laser modules is they are the most ESD sensitive devices in the world, and they need some lenses to correct the wide beam angle they deliver. They're also very easy to burn if you get them too much voltage/current, that's why they have a photo diode inside to sense output power. They don't accept quick variation on their temp also.

Usually the transmission with laser is achived through a FM carrier with a single PLL 4046. That makes them very robust in front of other light pollution.

Guillem.
"Common sense is the least common of the senses" Anonymous.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What about passing the sensor data through a FFT and finding the peak frequency (you could use a certain frequency for each player)? I don't know if it would be fast enough on an AVR. :?

Math is cool.
jevinskie.com

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

as i understand it, at least in th US, the LASER systems are illeagal due to the eyeball issue, also if it's just for your own use, you can get away with it, but think about how big a sensor you would need to score a "kill" shot lasers are fairly presice in there target range, even a 1/4 inch off is a miss. if you do any target shooting, you can see that it is VERY HARD, even if your not far from the target to hit a 1/4 inch target (even with a full auto i assure you, actually thats even harder, bad example) the reason the hasbro's of the world use the refracted/ focused light is so that you CAN hit your aponent. grab your laser pointer and put your sensor on the other side of a 10 foot room and try to hit it with a push of the button. i am sure that even the "LASER" places actualy use IR for scoring and the laser is for effect..

darn neet idea though.
(a filter tuned to the right freq would be your best bet. if you REALLY want to go through with it. do you have a O-Scope? you will probably need one for proper tuning)

just a though

Jeremy

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Freaks,

I'm 15 years old!!! I'm not exactly in the market for a $$$$ ociliscope. The laser was an addition so that the shooter could have an idea of where their shooting (the laser turns on for a a second after the trigger is pulled). I originally wanted to use the lasers as the signal transmitter, but then ran into the same issues as above (tiny laser needsd a huge sensor to detect it).

I'm not going to use a standard IR led with lenses - i've read that such LEDS can be driven at 1.5 to 1.7 times their maximum current so long as it is pulsed for an VERY short time. Since the transmission time for the binary signal is only a few milliseconds, this wont be a problem.

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Freaks,

Much of the code seems to work ok - the "Alive" leds flash on and off at an exponentially increasing rate, but the system fails to pick up the gun hand sensor/trigger buttons. Can anyone see anything obvious in the code? I added a coupl eof debugging commands that send text phrases to the computer as each group of commands are executed, and it seems to work fine (no hangups). The BASCOM simulator shows the program working perfectly.

Also, I've made a simple audio X20 amplifier that does not seem to work. It's based upon a LM386 (I think) Op-Amp and hums when I touch the input (until I also touch the ground wire) but the BASCOM sound commands (not shown in the above code) dosn't seem to make any noise. Incidentally, what is this "ground loop" I keep hearing about? I'm not exactly new to electronics, but the audio side of it always mystifies me.

- Dean

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi abcminiuser,
Well done, you appear to be on the right track. I won't comment on the code itself, I much prefer assembler. However regarding the two points you bring up.

(1) The reaction to activating the trigger or other functions , would I be right in assumming this is a key scan? If so consider that your program for keyscan is best designed by polling the keys at let's say 1ms interupts. Then create a debounce on time (the time the key should be pressed before accepting it as valid) I normally use 20 to 40 ms. The key will then be active, until the key has been released for at least 20 to 40 ms (debounce off) time.

(2) The ground loop you refer to, exists because more than one ground potential may exist (lets say two pieces of equipment, with two different supply sources). Connecting the two grounds might cause a problem because one might have a higher potential to the other. Capacitors are most often used around devices to "Close" the circuit or to get rid of unwanted DC bias. The op-amp you are using obviously wont have fantastic audio performance (check the slew rate), but two 0.1uF capacitors from +V to gnd and also from -V to ground as near to the op-amp as possible should improve the sound quality. Any chance of posting the schematic? By the By, for better performace opamp at reasonable cost mabee look at the NJM4580. Proper grounding is a lenghty topic and some other considerations may be the distance from your main ground potential (long loopy wires will pick up noise), try to use thick tracks on a PCB, only connect digital and analog ground at the source, keep power lines and audio lines away from clocks they will cause noise.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

:oops: I think i've fixed the audio problem. I wrote a manual for a board made by Investment Technologies (now over 36 pages) but managed to forget my own advice. The speaker was hooked up to a port A pin - but I clean forgot to rig up the AVCC and AGND pins for the Port A logic levels!!

At the moment all the functions (individual keys/sensors) are hooked up to seperate pins (see start of code for pin map) and so no matrixes are required. I've breadboarded the design and it seems to work fine without any debouncing - but I will add this later as it will be played in a "noisy" environment with many stray fields.

Can anyone give a good example in BASCOM (or even in plain elglish) on how to encode the binary signal? The code at the moment just sends the code three times in quick sucession (30ms each) so that at least one should get through to the reciever when played at night, but i'd like to increase the reliability. Also, what's the turn on time for the IR LED? I want to know how fast I can turn on and off the IR LED so that the binary signal is still distinguishable by the reciever.

For that matter, how can I increase the range? I'm going to overdrive the IR LED at a higher than maximum current for VERY short periods to increase brightness, but where can I get some cheap but effective lenses?

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

:oops: I think i've fixed the audio problem. I wrote a manual for a board made by Investment Technologies (now over 36 pages) but managed to forget my own advice. The speaker was hooked up to a port A pin - but I clean forgot to rig up the AVCC and AGND pins for the Port A logic levels!!

At the moment all the functions (individual keys/sensors) are hooked up to seperate pins (see start of code for pin map) and so no matrixes are required. I've breadboarded the design and it seems to work fine without any debouncing - but I will add this later as it will be played in a "noisy" environment with many stray fields.

Can anyone give a good example in BASCOM (or even in plain elglish) on how to encode the binary signal? The code at the moment just sends the code three times in quick sucession (30ms each) so that at least one should get through to the reciever when played at night, but i'd like to increase the reliability. Also, what's the turn on time for the IR LED? I want to know how fast I can turn on and off the IR LED so that the binary signal is still distinguishable by the reciever.

For that matter, how can I increase the range? I'm going to overdrive the IR LED at a higher than maximum current for VERY short periods to increase brightness, but where can I get some cheap but effective lenses?

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Freaks,

Also, I want to use "curly cord" (such as on telephones) to link the main unit to the gun. The maximum-core cable I can find in 1 meter 4 core, which is ideal for I2C communication, but I want to implement bidirectional data. Other than using the serial communications (Tx and Rx pins) on both micros (in main unit and in gun) can anyone show a way to transmit and recieve data?

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

RX-485??

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello again Dean,
Glad you found the problem.

For full duplex communication, I have been using the two wie interface on the Atmega32. works great. The principle can be implemented even if the chip your using doesn't have this feature. Basically, make one micro the master , the other the slave. The master will transmit and request data from the slave at an interval you feel comfortable with. One pin acts as the clock , the other the data.

Regarding what method to transmit the code , I have written software for cordless Rf purposes and found PWM of the 1's and 0's to be the easiest and robust to decode after the signal becomes distorted.

Hopefully someone else with experience can advise about IR transmitters/receivers and also offer advise on BASCOM.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Freaks,

Thanks - I think i'll use 485. Do you have to cross the wires (wire A on one unit to wire B on the other) or are they wired A-A and B-B?

Also, I just added the LCD to the breadboard, but am getting 8 "blocks" on the 16x1 (I think it's a 16x1, but may be a 16x2) LCD screen. I've triple checked the wiring, and the screen's based upon the standard hitachi chipset. Any ideas?

Wiring in no particular order:

Micro LCD
5V 5V
GND GND
GND Contrast
GND R/W
E E
RS RS
PD.x D4
PD.x D5
PD.x D6
PD.x D7

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

$#^&^%$^%$!!!! The LCD screens we have in the shed (31 of em that my dad bought years ago) are all 16x1. This means I have to alter my entire program.

Is it possible that the fact that the micro is trying to communicate with a 16x2 screen screwing it up?

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

We've also got two cu165ecpb vacume florectent 16x1 displays (a little to big to fix on a wrist tho) and a starange LCD screen.

I found the screen under our house (my dad used to be an electronics junkie like me) and it's out of an old laserjet printer or somthing. It's almost identical to the 31 other 16x1 screens, but the circuitry at the back is strange - it has the same HD44780 controller IC, but also a HD44100 IC connected to it. Does anyone know what it is?

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OK,
If I undersatnd your pinout on the LCD contrast is wired to gnd. The contrast usually is around 70 to 80% of VCC. More importantly. Yes, different LCD behave in very differnt ways. I mentioned earlier I use asmebler, and the software is much more intricate than the BASCAM you are using. In fact from the BASCAM (and correct me if I am wrong) it looks like this will only work with 100% compatible devices .
My suggestion, and anyone ese could perhaps disagee, is to go with C or assembler. If you like I can offer some "base code" for starting off, and I think more people will be able to help you with your code.

Just a suggestion...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

abcminiuser wrote:
We've also got two cu165ecpb vacume florectent 16x1 displays (a little to big to fix on a wrist tho) and a starange LCD screen.

I found the screen under our house (my dad used to be an electronics junkie like me) and it's out of an old laserjet printer or somthing. It's almost identical to the 31 other 16x1 screens, but the circuitry at the back is strange - it has the same HD44780 controller IC, but also a HD44100 IC connected to it. Does anyone know what it is?

- Dean :twisted:

The HD44100 is the extension driver for the HD44780, it's a very common combination (typically shows up in 20+ character displays). If the display is old, try slowing down the timings in your routines, as the older 44780's were much slower.

Writing code is like having sex.... make one little mistake, and you're supporting it for life.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Freaks,

I've only got one of the LCD's that has the two driver chips - the others use the same standard hitachi chip alone - albeit in three versions. Most of the LCDs are standards, but a few have "version 2" and "version 3" on the back, not that I can tell much physical difference. Anyway, I believe that my micro code is wrong, but I'll look on the net for the pinout of the LCD screens i'm using.

Does anyone know how to drive the cu165ecpb vacume flurecent's? The've only got 12 pins.

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Freaks,

Ok, I've attached a (very) loow quality pic of the back of the LCD i'm using. It has "REV3" at the top, and it a "Sekio M1641".

- Dean :twisted:

Attachment(s): 

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

A search on Google found that:
http://www.noritake-elec.com/tversion.old.htm
There you can see that the CU165ECPB-T2J has a serial interface.
Searching for CU165ECPB-T2J showd me http://www.qscomp.cz/Pdf/CU165ECPB-T2J-01.pdf. But the datasheet only shows me a 6pin Connector.

Here you can see the Standard Header Orientation http://www.noritake-elec.com/connectors.gif

Hava a look at my web page -> http://www.tobiscorner.at.tf

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Freaks,

Hmmm, not quite right. Perhaps the code printed on the board is for the actual VFD and driver chip, not this board....

My version also has a minature power supply daughter board attached (little brown board). I've attached another low quality pic of my VFD.

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Freaks,

Ok, now back to the topic. I've changed my system; there is now 3 micros involved. The master micro controls all the LEDs, gets signals from the gun and SensMicro and controls the LCD. The SensMicro listens continuously for electronic "bullets" and holds a "SHOT" pin high (to be read by the master micro), until the master aknoweges by pulling the "sACK" pin high - then both pins go low. This was made becaus the pulse delays were so short, the one micro coudn't have any delays for fear of missing a shot (or recieving corrupt data). The third micro is in the gun, and transmits via the Tx and Rx pins to the master via a 1m curly-cord 4-core cable.

I've read a little about IR Modulating, but how EXACTLY is this done? I saw a simple example of a 32kHz (I think) modulated IR beam for an alarm (break the beam and set ot off), but how does the reciever stay in sync? The design only used a standard IR reciever connected to a PIC, although presumably the PIC checked to see if the signal was 32kHz. Anyone going to shed light on this for me?

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

abcminiuser wrote:
I've read a little about IR Modulating, but how EXACTLY is this done? I saw a simple example of a 32kHz (I think) modulated IR beam for an alarm (break the beam and set ot off), but how does the reciever stay in sync? The design only used a standard IR reciever connected to a PIC, although presumably the PIC checked to see if the signal was 32kHz. Anyone going to shed light on this for me?

Hey Dean, sounds like a great project, hope it works out for you. I am also working on an IR project and have been looking into IR modulation. The easiest solution, unless you are an accomplished analog electronics guy, is to just buy an IR receiver that handle the modulation, filtering, and amplification for you.

The advantages are:
They will just work, no monkeying around.
They are cheap, only about one US dollar for a wide selection of wavelengths.
They are an all in one unit, including the colored plastic for light filtering.
They are simple to interface with any micro. Atmel has an appnote on the use.
No need to understand how it works (although you should at least try).

There are no real disadvantages unless you have a special wavelength.

I learned a bunch just by googling around. But in the end I am using an IR receiver. Its fast and simple and cheap.

Check www.mouser.com for nice Vishay IR receivers. For example 782-TSOP2238 is a 38kHz 4.5V - 5.5V receiver I am using. I picked 38kHz because it is sorta in the middle of many American remote control freqs.

As far as the IR Emitters. Thats easy also. See the appnote. Pretty much just turn it on and off according to your frequency, then piggyback your data. You can also get those from mouser cheap, about 0.20 US. I recommend Mouser only because that is where I bought them, I am sure there are many other place.

If I remember correctly there are two appnotes, one for transmitting and one for receiving.

Let me know when your finishing up, I will share some FAT code with you so people can store their individual stats, shots fired, times hit, where they were hit, how long they payed, etc.

Good luck,

Vern

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for the info. Dick Smith Electronic sell "All-in-one" IR recievers - and I'm pretty sure they accept modulated data. All I need to do is check the datasheet for them to see what their output is. I'll check the ATMEL sending appnote later.

Thanks a bunch snafles, but what would I record the FAT data on? I'll probably use an external EEPROM.

I found a user on the net (who I can't contact) that used the same LCD module as me. His comments say that the LCD has oddball timing requirements, so I'll increase the delay between initialise and data-send.

All this creates another problem; what do I use to power all this? Three micros, ~25 Leds, LCD, Backlight (or a 100ma mini-globe above the LCD), etc. all drains about ~300ma-450ma. I doubt that a standard 9V would get far on that drain. We have a MILLION old, old, old, incredible old mobile-phones (my dad's from his years working at ICI - they let him keep his outdataed models) with good batteries ranging from 3.somthing to 5V. I'll probably use the 5V's as they offer a decent charge, all I need to do is find the *%*&^% chargers in the shed.......

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Holy [EXPLICATIVE DELETED]!!!! I just checked out the Jaycar and Dick Smith catalogues for "all-in-one" IR recievers (TTL Compatible, 32kHz modukated). They were >AU$6 EACH. I'm going to need three for each sensor lot (to ensure a wide angle response) and with front, back and two shoulders, 12 sensors=~AU$72!!!!!!!!!!!!!!!!

Jaycar also sells IR reciever diodes (phototransistors that look like LEDs sensitive only to IR) that are AU$1 each. I think I should purchase several of these and use a ATtiny (although these are not avaliable in my area - perhaps a tiny PIC and get somone else to program it for me) to check the diodes for a 32kHz signal. At $5 a micro, plus 3 IR reciever LEDs per section, it's only ~AU$32 for sensors - although I may be able to use one tiny micro for all (or two) of the sections. Any ideas?

I think i'll use direct UART (Tx and Rx) with the 4-core 1m curly cord to the gun as it's the simplest avaliable. Does anyone know how to focus the IR LED into a tight, long-range beam? I'll need lenses, but I don't know where from.

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

abcminiuser wrote:
Jaycar also sells IR reciever diodes (phototransistors that look like LEDs sensitive only to IR) that are AU$1 each. I think I should purchase several of these and use a ATtiny (although these are not avaliable in my area - perhaps a tiny PIC and get somone else to program it for me) to check the diodes for a 32kHz signal.

You should order your IR receivers from Mouser, I checked and they ship international. At 1.20 US thats about 1.60 AU. Much better than 6 AU.

The problem with the IR diode is that in order to get a decent range, you need to do more than just check the diode for a 32kHz signal. If it were that easy there would be no point in the IR receiver. From experience, my headaches disappeared when I switched to the receivers.

Vern

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Point taken. I'll try to buy some from mouser, but my parents don't like internet shopping due to fraud. Auzzia dollars are about ~1.7 Americans, so USA$1.20 is about AU$2 each.

Where can I get lenses to increase range?

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I've done some digging on optics. What you need is "plano-convex" lens. This kind of optics is used in "MegaZone" lasertag game, don't know about the lens focal lenght and diameter tough.
Another possibility is to use a mirror. I found something about the mirror system with google once, and it was all for some other laser tag game, they were pretty happy with the design. I'll try to dig it up.

Edit 1:
Twenty seconds of digging and I came up with this site. Hope this helps
TagTek

Edit 2:
IR receiver modules have to be modulated, besides the carrier frequency, for accetable burst. For Vishay TSOPxxxx:s it is 15 ms pause atleast every 90 ms, and for Everlight IRMxxxx:s it's 400 us min to 800 us max on/off, but this shouldn't be a problem.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok, it seem that they are mostly using ordinary magnifier lenses for the beam focusing, and can get up to 150 m range.

Here's a link for some info:
Dave Bodger's Lasertag Info

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks, it's great. One thing though - the guns do not seem to be attached to the main unit. How does it deactivate when the player has been killed? I want to be able to shut down the gun - and also make it smaller by supplying power via the cord.

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think the gun is the main unit in these, and any additional sensors connect to the gun.

Pages