www.micro-examples.com : PicoBat

Views
From www.micro-examples.com
(Difference between revisions)
Jump to: navigation, search
(C Source code)
(PicoBat : a PIC-based simple and cheap ultrasonic detector)
Line 7: Line 7:
 
The idea of this circuit is to hack PIC oscillator circuit, by replacing the crystal by a piezo sensor : the frequency of the oscillator will depend on presence ultrasonic waves.
 
The idea of this circuit is to hack PIC oscillator circuit, by replacing the crystal by a piezo sensor : the frequency of the oscillator will depend on presence ultrasonic waves.
  
Oscillator frequency is then divided and pushed to a piezo speaker.
+
Oscillator frequency is then divided by 4 by the PIC and pushed to a piezo speaker.
  
 
It shares the same idea as [[PicoDetector]], the metal detector.
 
It shares the same idea as [[PicoDetector]], the metal detector.

Revision as of 18:58, 7 February 2012

An ultrasonic bat detector with only 3 components !

Contents

PicoBat : a PIC-based simple and cheap ultrasonic detector

Let me introduce PicoBat to you with this short video clip :


The idea of this circuit is to hack PIC oscillator circuit, by replacing the crystal by a piezo sensor : the frequency of the oscillator will depend on presence ultrasonic waves.

Oscillator frequency is then divided by 4 by the PIC and pushed to a piezo speaker.

It shares the same idea as PicoDetector, the metal detector.

Circuit Schematic

PicoBat-circuit-schematic.png

  • The ultrasonic piezo receiver replaces resistor in PIC oscillator circuit
  • SP1 is any piezo speaker you have

C Source code

/*
 *******************************************************************************
 * picoBAT : an ultra simple ultrasonic bat detector
 *******************************************************************************
 *
 * Author : Bruno Gavand, February 2009
 * see more details on http://www.micro-examples.com/
 *
 * source code for mikro C compiler V8.2
 * feel free to use this code at your own risks
 *
 * target : PIC12
 *
 * PIC PIN Assignemnt :
 *
 * GP0 GP1 : piezo speaker
 * GP5 : ultrasonic transducer receiver
 *
 *******************************************************************************
 */

void    main()
        {
        /*
         * configure GPIO as digital port
         */
        CMCON0 = 7 ;
        ANSEL = 0 ;

        TRISIO = 0 ;
        GPIO = 0b01 ;

        for(;;)
                {
                /*
                 * toggles speaker outputs
                 */
                GPIO ^= 0b11 ;
                }
        }

No, there is no mistake, full source code is above !

Download project

Download picoDetector_project.ZIP file for mikroC : File:PicoDetector-project.zip

Includes :

  • mikroC PRO project files for PIC12F683, should work also with most of PIC
  • picoDetector C source code
  • picoDetector .HEX files

Navigation
Others
Donation
You can help :
with Paypal
Share
Personal tools
www.micro-examples.com Electronic circuits with micro-controllers, projects with source code examples