3.2 - One wire digital

Submitted by Webbot on October 30, 2008 - 5:05pm.

This mode uses a single output pin to drive the speaker. To activate this mode edit the 'global.h' file and make sure the line

          #define _AVR_BINARY_
is not commented out.

 

You can select which IO port and pin to use in global.h by changing these lines which currently use PORTB pin 4 :-

    #ifdef _AVR_BINARY_

    #define SOUND_PORT PORTB
        #define SOUND_DDR DDRB
        #define SOUND_BIT BV(PB4)
        #endif

 

This mode only requires the following additional hardware:-

1 x 10k ohm resistor

1 x 47 ohm resistor

1 x 2N2222 or similar NPN transistor

1 x 8 ohm 0.1 watt speaker

 

The following schematic shows how to assemble the electronics. Note that we use 0v, +5v, and the I/O port pin so you can use a standard 3 way cable (like the ones you use to connect to servos or sensors).

 

AttachmentSize
1port.zip10.02 KB