Archived Geocache GC3MBEF (Electric Dongle)

"Das Abenteuer des Agent Finley"

 

The technical stages of this geocache disappeared several times I decided to archive this cache.

Because there has been a lot of effort in developing this cache I thought it might be interesting for the croud to see what's inside the box.

 

First assembling on the breadboard

The first step was to put everything together on the breadboard and check if I realize what I had in mind.

There should be a spinning 7 digit display and every time a dongle is connected the display shows a number.

For that I shortened for every dongle a different wire, which was quite an easy but effective solution.

 

 

Drawing the PCB for the project

This was one of the first PCBs I have ever drawn.

My next PCBs were made with Eable, but this one was made in a graphic tool.

 

 

Putting everything in a nice frame

After the PCB was ready and the breadboard constellation worked, it was time to put everything in a nice frame.

On the top I put a little transparent plastic for protection of the electric.

As connection I used a male and female DB9 connector.

The Dongle was originally designed for turing on a desk light.

 

 

Writing the code

With programming the ATMega168 the parts would not do a thing.

As power supply I used a 9V battery.

Here you can see the tiny and simple code which I used for that cache.

 

Main Program

View source
// 7_segment_display.c
// for NerdKits with ATmega168
 
#define F_CPU 14745600
 
#include <avr/io.h>
#include <inttypes.h>
#include <util/delay.h>
 
#include "../libnerdkits/lcd.h"
#include "../mylibs/7segment.h"
#include "../mylibs/7segment.c"
 
// PIN DEFINITIONS:
 
// PC4 -- LED (g)  7 Segment Kathode
// PC3 -- LED (f)  7 Segment Kathode
// PC2 -- LED (e)  7 Segment Kathode
// PC1 -- LED (a)  7 Segment Kathode
// PC0 -- LED (b)  7 Segment Kathode
 
// PD2 -- LED (d)  7 Segment Kathode
// PD3 -- LED (DP) 7 Segment Kathode
// PD4 -- LED (c)  7 Segment Kathode    
 
int main(void) {
 
	DDRC  = 0b00011111; // Pinb.0,1,2,3,4 auf Ausgang schalten, Rest auf Eingang  
	DDRD  = 0b00011100; // Pind.2,3,4 auf Ausgang schalten, Rest auf Eingang
 
	// PB5 als Eingang
	DDRB &= ~(1<<PB4);
	DDRB &= ~(1<<PB3);
	DDRB &= ~(1<<PB2);
 
	// turn on the internal resistors for the pins
	PORTB |= (1<<PB4); // turn on internal pull up resistor
	PORTB |= (1<<PB3); // turn on internal pull up resistor
	PORTB |= (1<<PB2); // turn on internal pull up resistor
 
  while(1) {
 
			clear_segment();
			PORTC = 0b11111101;
			_delay_ms(50);
			clear_segment();
			PORTC = 0b11111110;
			_delay_ms(50);
			clear_segment();
			PORTD = 0b11101111;
			_delay_ms(50);
			clear_segment();
			PORTD = 0b11111011;
			_delay_ms(50);
			clear_segment();
			PORTC = 0b11111011;
			_delay_ms(50);
			clear_segment();
			PORTC = 0b11110111;
			_delay_ms(50);
			clear_segment();
 
		while(!(PINB & (1<<PB4))) // When Button pressed
		{
			segment('8');
		}
 
		while(!(PINB & (1<<PB3))) // When Button pressed
		{
			segment('5');
		}
 
		while(!(PINB & (1<<PB2))) // When Button pressed
		{
			segment('2');
		}
 
  }
  return 0;
}