• Willkommen im Geoclub - dem größten deutschsprachigen Geocaching-Forum. Registriere dich kostenlos, um alle Inhalte zu sehen und neue Beiträge zu erstellen.

Reaktivstation mit Playback-Modul

torama

Geocacher
Hier soll eine kleine Bastelanleitung für ein derartiges Teil entstehen. Jetzt kann jeder seine Station ohne große Programmierkenntnisse im Nachhinein noch anpassen ohne den Attiny13 neu programmieren zu müssen.
Teileliste (Kosten 5.00 Euro):

- Attiny13 (1.20 Euro;es reicht die billige Normalvariante)
- LED kann aus dem Voice-Modul genommen werden (ggf Widerstand bei Anzeige der Aktivierung)
- Record/Playback-Modul VM-5251 (2,90Euro z.B. bei PEARL)
- 1kOhm Widerstand
- 1 Kaugummidose
- 3 mal 1.5V Batterien

Die Ansteuerung des Playback-Moduls erfolgt über PIN 5 des µC (Attiny13).

Ist die Aufnahme in Form von Sprache oder Morsezeichen oder wie auch immer drauf, kann die Lithium (3V)Batterie entfernt werden. Danach LED, Tasten, Mikrofon ablöten. Das Modul merkt sich die Aufnahme, keine Angst. Es läuft auch super mit 4.5V. Hier die Beschaltung des Moduls:
8a85de3d-3825-48d5-94e0-3fce89bf56ec.jpg


Hier der Minisource in BASIC (für BASCOM):
'*** Test03
$regfile = "attiny13.dat "
'anstatt 113000 halbe Oszifreq (128kHz) nun
$crystal = 113000

Config Portb = &B00011001
Portb = &B11100110
Stop Adc
Stop Ac

'Watchdog definieren: 0.25sec, Interrupt, kein Reset
Wdtcr = &B11010100

Dim A As Byte
Dim I As Byte
Dim J As Byte
Dim S As Byte
Dim Hell_dunkel As Bit

Do
Gosub Led_abfrage
If Hell_dunkel = 0 Then

'Erkennung melden
For A = 1 To 3
Gosub Erkannt
Next A

'Voice-Modul ON/OFF
Gosub Speech

'2,5 sec
S = 20
Gosub Schlafe

End If

Loop

'Funktionen
Schlafe:
Enable Interrupts

For J = 1 To S
Reset Watchdog
Powerdown
Next J

Disable Interrupts
Return

'Speech
Speech:
'Beinchen 5 = PORTB.0
Config Portb.0 = Output
Portb.0 = 0
Waitms 100
Portb.0 = 1
Waitms 100
Portb.0 = 0
Waitms 100
Config Portb.0 = Input
Return

'Rückmeldung
Erkannt:
Portb.3 = 1
Waitms 50
Portb.3 = 0
Waitms 50
Return

Led_abfrage:

Portb.3 = 0
Portb.4 = 1
Waitus 1
Config Portb.4 = Input
Portb.4 = 0

'Empfindlichkeit hoch = lange Wartezeit
' Je nach LED-Typ
Waitus 7000
Hell_dunkel = Pinb.4
Config Portb.4 = Output
Portb.4 = 0
Enable Interrupts
Reset Watchdog
Powerdown
Disable Interrupts
Return
End
 
OP
torama

torama

Geocacher
Ich sehe gerade mit ein paar Tags kann der olle BASIC SOURCE etwas angehübscht werden, sorry für den häßlichen Vorthread. Da ichs nicht editieren kann hier mal ein Versuch. Ist aba nur die Rohform.
Code:
Hier der Minisource in BASIC (für BASCOM):
$regfile = "attiny13.dat "
$crystal = 113000

Config Portb = &B00011001
Portb = &B11100110
Stop Adc
Stop Ac

'Watchdog definieren: 0.25sec, Interrupt, kein Reset
Wdtcr = &B11010100

Dim A As Byte
Dim I As Byte
Dim J As Byte
Dim S As Byte
Dim Hell_dunkel As Bit

Do
     Gosub Led_abfrage
     If Hell_dunkel = 0 Then

          'Erkennung melden
          For A = 1 To 3
               Gosub Erkannt
          Next A

          'Voice-Modul ON/OFF
          Gosub Speech

          '2,5 sec
          S = 20
          Gosub Schlafe

     End If

Loop

'Funktionen
Schlafe:
     Enable Interrupts

     For J = 1 To S
          Reset Watchdog
          Powerdown
     Next J

     Disable Interrupts
Return

'Speech
Speech:
     'Beinchen 5 = PORTB.0
     Config Portb.0 = Output
     Portb.0 = 0
     Waitms 100
     Portb.0 = 1
     Waitms 100
     Portb.0 = 0
     Waitms 100
     Config Portb.0 = Input
Return

'Rückmeldung
Erkannt:
     Portb.3 = 1
     Waitms 50
     Portb.3 = 0
     Waitms 50
Return

Led_abfrage:
     Portb.3 = 0
     Portb.4 = 1
     Waitus 1
     Config Portb.4 = Input
     Portb.4 = 0

     'Empfindlichkeit hoch = lange Wartezeit
     ' Je nach LED-Typ
     Waitus 7000
     Hell_dunkel = Pinb.4
     Config Portb.4 = Output
     Portb.4 = 0
     Enable Interrupts
     Reset Watchdog
     Powerdown
     Disable Interrupts
Return

End
 
Oben