# Overview
The simple yet effective Continuity Tester is just a conversion of the original one by [David Johnson-Davies](http://www.technoblogy.com/show?1YON) from the ATtiny85 to the ATtiny13A. It is designed to check circuit wiring and PCB tracks.
* Firmware (Github): https://github.com/wagiminator/ATtiny13-ContinuityTester

# Hardware
The basic wiring is shown below:

Connect one end of a wire to the GND terminal and use the other end together with the pogo pin to check the continuity of wires and traces. The device is powered by a 1220 coin cell battery. Please remember that only the rechargeable LIR1220 Li-Ion batteries work. The "normal" CR1220s don't deliver enough power for the buzzer.
# Software
## Implementation
The code is using the internal analog comparator of the ATtiny. By using the internal pullup resistors on both inputs of the comparator and by using a 51 Ohm pulldown resistor to form a voltage divider on the positive input, the comparator output becomes high if the resistance between both probes is less then 51 Ohms. This indicates a continuity between the probes and the buzzer will be turned on. For a more precise explanation refer to [David's project](http://www.technoblogy.com/show?1YON). Timer0 is set to CTC mode with a TOP value of 127 and no prescaler. At a clockspeed of 128 kHz it fires every millisecond the compare match A interrupt which is used as a simple millis counter. In addition the compare match interrupt B can be activated to toggle the buzzer pin at a frequency of 1000 Hz, which creates a "beep". If no continuity between the probes is detected for 30 seconds, the ATtiny is put into sleep, consuming almost no power. The device can be reactivated by holding the two probes together. The LED lights up when the device is activated and goes out when the ATtiny is asleep. The code needs only 252 bytes of flash if compiled with LTO.
``` c
// Libraries
#include
#include
#include
// Pin definitions
#define REF PB0
#define PROBE PB1
#define LED PB2
#define EMPTY PB3
#define BUZZER PB4
// Global variables
volatile uint16_t tmillis = 0; // counts milliseconds
const uint16_t timeout = 30000; // 30 seconds sleep timer
// Main Function
int main(void) {
set_sleep_mode (SLEEP_MODE_PWR_DOWN); // set sleep mode to power down
PRR = (1
schematic diagram
(
1
/
)
Empty
4
7
Collect to album