PicoBat
A PIC-based simple and cheap ultrasonic detector
A PIC-based simple and cheap ultrasonic detector.
Overview
An ultrasonic bat detector with only 3 components! The idea is to hack the PIC oscillator circuit by replacing the crystal with a piezo sensor: the frequency of the oscillator then depends on ultrasounds. Oscillator frequency is divided by 4 by the PIC and pushed into a piezo speaker.
It shares the same idea as PicoDetector, the metal detector.
Circuit Schematic
- The ultrasonic piezo receiver replaces the resistor in the PIC oscillator circuit.
- SP1 is any piezo speaker.
C Source Code
picoBat.c
/*
* picoBAT : an ultra simple and cheap ultrasonic detector
* Author : Bruno Gavand, february 2009
* http://www.micro-examples.com/
* source code for mikroC compiler V8.2
* target : PIC12, oscillator in HS mode
* GP0 : speaker +
* GP1 : speaker -
*/
void main()
{
CMCON0 = 7;
ANSEL = 0;
TRISIO = 0;
GPIO = 0;
for(;;)
{
GPIO ^= 0b11;
}
}
Download project
PicoBat project files
Download PicoBat-project.zip for mikroC PRO for PIC12F683:
PicoBat-project.zip (ZIP, 7 KB)
Includes:
- mikroC PRO project files
- C source code
- HEX files