Design’Overview’downloads.deusm.com/designnews/GF196_build.pdfLM741-+ Piezo Buzzer +15V +5V 1kΩ...

17
Design Overview Our device is a simple waterfall that is backlit by a series of LEDs that react to music played through speakers built into the device. The device is broken down into six main components; the body, the water system, the control unit, the speakers, the output screen and the LEDs. The body is be made out of Plexiglas. It has be bonded together to make a pyramid shaped design. The top has a shallow water tray that receives water from the pump that then runs down the three faces of the pyramid. The water is collected in a lower tray that wraps around the base of the pyramid. All the electronics and components are hidden within the pyramid itself. The water is pumped is a simple drill pump that is powered by a cordless drill battery. The PIC controls the pump through a relay and has the ability to turn it on and off. The pump is attached to flexible tubing to access the waterfall. The control unit is comprised of a computer power supply, two 16F88 pic chips and a separate mp3 player. There is one master pic for the inputs and another slave pic to drive the LEDs to provide the light show. To output the music we use a mp3 trigger that is then sent to a standard amplifier. The amplifier connects directly to the mp3 unit with an 1/8 th inch stereo jack. The amp then drives separate speakers and plays the music from the mp3 trigger. A piezoelectric buzzer is then attached to the speaker to act as a microphone. The LEDs will then be synced to the volume that the buzzer detects. The output display is a 3”x1” LCD screen that displays the operating mode and instructions to the user. It is mounted to the side of the pyramid on the base board, next to the input controls.

Transcript of Design’Overview’downloads.deusm.com/designnews/GF196_build.pdfLM741-+ Piezo Buzzer +15V +5V 1kΩ...

Page 1: Design’Overview’downloads.deusm.com/designnews/GF196_build.pdfLM741-+ Piezo Buzzer +15V +5V 1kΩ 1kΩ 10kΩ 1kΩ oPin A0 f Slave PIC Piezo Buzzer and Op Amp Schematic NC NC C 0,25

Design Overview

Our device is a simple waterfall that is backlit by a series of LEDs that react to music played

through speakers built into the device. The device is broken down into six main components; the body,

the water system, the control unit, the speakers, the output screen and the LEDs.

The body is be made out of Plexiglas. It has be bonded together to make a pyramid shaped

design. The top has a shallow water tray that receives water from the pump that then runs down the

three faces of the pyramid. The water is collected in a lower tray that wraps around the base of the

pyramid. All the electronics and components are hidden within the pyramid itself.

The water is pumped is a simple drill pump that is powered by a cordless drill battery. The PIC

controls the pump through a relay and has the ability to turn it on and off. The pump is attached to

flexible tubing to access the waterfall.

The control unit is comprised of a computer power supply, two 16F88 pic chips and a separate

mp3 player. There is one master pic for the inputs and another slave pic to drive the LEDs to provide the

light show. To output the music we use a mp3 trigger that is then sent to a standard amplifier. The

amplifier connects directly to the mp3 unit with an 1/8th inch stereo jack. The amp then drives separate

speakers and plays the music from the mp3 trigger. A piezoelectric buzzer is then attached to the

speaker to act as a microphone. The LEDs will then be synced to the volume that the buzzer detects.

The output display is a 3”x1” LCD screen that displays the operating mode and instructions to

the user. It is mounted to the side of the pyramid on the base board, next to the input controls.

Page 2: Design’Overview’downloads.deusm.com/designnews/GF196_build.pdfLM741-+ Piezo Buzzer +15V +5V 1kΩ 1kΩ 10kΩ 1kΩ oPin A0 f Slave PIC Piezo Buzzer and Op Amp Schematic NC NC C 0,25

The LEDs are bright blue and red high output LEDs. They are mounted on the front and both

sides of the pyramid under the Plexiglas. They are mounted in cardboard and from here wired to

ground through a current limiting resistor and a transistor and directly to the 7-­‐volt output on the

computer power supply.

The device plays various music tracks with the LEDs displaying the volume behind the water.

The user is able to pick various music tracks with the button inputs and see what mode it is in via the

display. This makes for a spectacular show in light and sound.

Page 3: Design’Overview’downloads.deusm.com/designnews/GF196_build.pdfLM741-+ Piezo Buzzer +15V +5V 1kΩ 1kΩ 10kΩ 1kΩ oPin A0 f Slave PIC Piezo Buzzer and Op Amp Schematic NC NC C 0,25

12,4

2

22

6

0,25

Page 4: Design’Overview’downloads.deusm.com/designnews/GF196_build.pdfLM741-+ Piezo Buzzer +15V +5V 1kΩ 1kΩ 10kΩ 1kΩ oPin A0 f Slave PIC Piezo Buzzer and Op Amp Schematic NC NC C 0,25

RB06

RB17

8RB2/RX

9RB3

RB7

RB6

RB5/TX

RB4

13

12

11

10

RA32

RA43

4MCLR

5VSS

RA0

OSC1

OSC2

VDD

17

16

15

14

RA21

RA118

PIC16F88

5V

5V

0.1μ F

1KΩ

DOWNENTERUP

10KΩ

5V

10KΩ

5V

10KΩ

5V

LCD Display

Vss Vcc Vee RS R/W E DB4 DB5 DB6 DB7

K

A

5V5V

20KΩ pot

5V 1KΩ

4.2V

(Contrast Control dial)

Water Pump Control (on/off)

Reservoir

Top of Structure

LCD and Master PIC Schematic

To RA2 of Slave PIC

To RX of MP3 Trigger

NC

NC

NC

Page 5: Design’Overview’downloads.deusm.com/designnews/GF196_build.pdfLM741-+ Piezo Buzzer +15V +5V 1kΩ 1kΩ 10kΩ 1kΩ oPin A0 f Slave PIC Piezo Buzzer and Op Amp Schematic NC NC C 0,25

Left Side, Red LEDS Front Face, Blue LEDS Right Side, Red LEDS

7.4V

7.4V

7.4V

7.4V

7.4V

7.4V

100Ω 100Ω

100Ω

1KΩ

100Ω 100Ω

100Ω 100Ω

100Ω 100Ω

100Ω 100Ω

100Ω 100Ω

To PortB.6 (Slave)

100Ω

1KΩ To PortB.5 (Slave)

100Ω

1KΩ To PortB.4 (Slave)

100Ω

1KΩ To PortB.3 (Slave)

100Ω

1KΩ To PortB.2 (Slave)

100Ω

1KΩ To PortB.1 (Slave)

Led Array

Page 6: Design’Overview’downloads.deusm.com/designnews/GF196_build.pdfLM741-+ Piezo Buzzer +15V +5V 1kΩ 1kΩ 10kΩ 1kΩ oPin A0 f Slave PIC Piezo Buzzer and Op Amp Schematic NC NC C 0,25

-15V

OFFSET N11

IN-2

3IN+

4Vcc-

NC

Vcc+

OUT

OFFSET N2

8

7

6

5

LM741

-

+

Piezo Buzzer

+15V

+5V1kΩ 1kΩ

10kΩ

1kΩ

To Pin A0 of Slave PIC

Piezo Buzzer and Op Amp Schematic

NC

NCNC

Page 7: Design’Overview’downloads.deusm.com/designnews/GF196_build.pdfLM741-+ Piezo Buzzer +15V +5V 1kΩ 1kΩ 10kΩ 1kΩ oPin A0 f Slave PIC Piezo Buzzer and Op Amp Schematic NC NC C 0,25

0,25

6

22

9,5

Page 8: Design’Overview’downloads.deusm.com/designnews/GF196_build.pdfLM741-+ Piezo Buzzer +15V +5V 1kΩ 1kΩ 10kΩ 1kΩ oPin A0 f Slave PIC Piezo Buzzer and Op Amp Schematic NC NC C 0,25

0,25

5,75

12,4

2

13,75

Page 9: Design’Overview’downloads.deusm.com/designnews/GF196_build.pdfLM741-+ Piezo Buzzer +15V +5V 1kΩ 1kΩ 10kΩ 1kΩ oPin A0 f Slave PIC Piezo Buzzer and Op Amp Schematic NC NC C 0,25

RB06

RB17

8RB2

9RB3

RB7

RB6

RB5

RB4

13

12

11

10

RA32

RA43

4MCLR

5VSS

RA0/AN0

OSC1

OSC2

VDD

17

16

15

14

RA21

RA118

PIC16F88

5V

5V

0.1μ F

1KΩ

To Piezo Buzzer/Op Amp Output

Slave PIC Schematic

To Row 1 of LED

Array

To Row 2 of LED

Array

To Row 3 of LED

Array

To Row 4 of LED

Array

To Row 5 of LED

Array

To Row 6 of LED

Array

To RB1 of Master PIC

NCNC

NCNC

NCNC

NC

Page 10: Design’Overview’downloads.deusm.com/designnews/GF196_build.pdfLM741-+ Piezo Buzzer +15V +5V 1kΩ 1kΩ 10kΩ 1kΩ oPin A0 f Slave PIC Piezo Buzzer and Op Amp Schematic NC NC C 0,25

4.5V to 12.0V, or regulated 3.3V

RX1

Power2

3Gnd

TX

Vout

Vout

8

7

6

MP3 Trigger

Sound System Schematic

Amplifier

Vout

Vout

Vin

Vin

To RB5/TX of Master PIC

NC NC

NC

Page 11: Design’Overview’downloads.deusm.com/designnews/GF196_build.pdfLM741-+ Piezo Buzzer +15V +5V 1kΩ 1kΩ 10kΩ 1kΩ oPin A0 f Slave PIC Piezo Buzzer and Op Amp Schematic NC NC C 0,25

Pic Programming:

Master Pic Code:

ANSEL = 0 CMCON = 7 define OSC 8 'Set the internal oscillator to 8mhz... OSCCON = %01110010 ; intosc to 8mhz 'use the USART and HSEROUT commands. 'To set-­‐up the UASRT ... DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive DEFINE HSER_TXSTA 24h ' Enable transmit, BRGH = 1 DEFINE HSER_SPBRG 12 ' 38400 Baud @ 8MHz, 0.16% DEFINE HSER_CLROERR 1 ' Clear overflow automatically trisb = %11010100 '0(pump),1(slave),3 (lcd),5(mp3) output '2(mp3?),4(enter),6(down),7(up) input pause 500 'wait for lcd to start up lcdout $FE, 1, "Welcome!" '"welcome!" displayed pause 3000 'pause 3 seconds high portb.0 'activate pump high portb.1 'activate slave PIC voldis var byte vollvl var byte 'declare song variable, volume displayed and volume variable track var byte vollvl = 0 ‘Initializing volume level track = 1 ‘Initializing track number Serial_out VAR PORTB.5 ' pin 5 to mp3 trigger

Page 12: Design’Overview’downloads.deusm.com/designnews/GF196_build.pdfLM741-+ Piezo Buzzer +15V +5V 1kΩ 1kΩ 10kΩ 1kΩ oPin A0 f Slave PIC Piezo Buzzer and Op Amp Schematic NC NC C 0,25

'subs: displayout: lcdout $FE, 1, "Volume-­‐Up Song-­‐Down", $FE, $C0, "Pump-­‐Enter"

'display volume level, activate pump, and choose song options

pause 200 goto main main: 'main menu if (portb.7=1) then 'if up pressed gosub volume goto volumex pause 200 endif if (portb.6=1) then 'if down pressed gosub songx goto songx pause 200 endif if (portb.4=1 & portb.0=1) then 'pump off low portb.0 pause 200 endif if (portb.4=1 & portb.0=0) then 'pump on high portb.0 pause 200 endif goto main volumex: lcdout $FE, 1, " Up or Down", $FE, $C0, " Volume: ", DEC vollvl

'new display item. Volume is displayed. goto volume volume: 'volume menu voldis=((250-­‐vollvl)/25)*10 ‘voldis is for display purposes. Vollvl is for the mp3 trigger.

'track volume variable through up/down buttons (set minimum and maximum, mp3 ‘trigger only accepts numbers 0 though 255)

if (portb.6 = 1) then 'if statement prevents overflow for byte variable vollvl if (vollvl < 250) then ‘sets a maximum for vollvl vollvl = vollvl + 25 endif lcdout $FE, 1, "Up or Down", $FE, $C0, "Volume: ", DEC voldis ‘displays volume level

Page 13: Design’Overview’downloads.deusm.com/designnews/GF196_build.pdfLM741-+ Piezo Buzzer +15V +5V 1kΩ 1kΩ 10kΩ 1kΩ oPin A0 f Slave PIC Piezo Buzzer and Op Amp Schematic NC NC C 0,25

hserout ["v", vollvl] ‘sends command to mp3 player to set volume level pause 200 endif if (portb.7 = 1) then 'if statement prevents overflow for byte variable vollvl if (vollvl > 0) then ‘sets a minimum for vollvl vollvl = vollvl -­‐ 25 endif lcdout $FE, 1, "Up or Down", $FE, $C0, "Volume: ", DEC voldis ‘displays volume level hserout ["v", vollvl] ‘sends command to mp3 player to set volume level pause 200 endif if (portb.4=1) then 'enter key pressed? then back to main menu/ main task loop goto displayout endif goto volume songx: lcdout $FE, 1, "Up for forward", $FE, $C0, "Down for back" 'new display item goto song song: 'choose song

'track song variable # through up/down buttons (set loop for selection). This configuration is set ‘to play only 6 songs. But more can be added.

if (portb.7=1 & track < 6) then ‘max track number set to 6 track = track + 1 lcdout $FE, 1, "Play Track", $FE, $C0, " ", DEC track, "?"

'new display item hserout ["p", track] pause 300 endif if (portb.6=1 & track > 1) then ‘min. track number set to 1 track = track -­‐ 1 lcdout $FE, 1, "Play Track", $FE, $C0, " ", DEC track, "?"

'new display item hserout ["p", track] pause 300 endif if (portb.4=1) then 'enter key pressed? then update song on mp3 trigger by song variable and back to main goto displayout

Page 14: Design’Overview’downloads.deusm.com/designnews/GF196_build.pdfLM741-+ Piezo Buzzer +15V +5V 1kΩ 1kΩ 10kΩ 1kΩ oPin A0 f Slave PIC Piezo Buzzer and Op Amp Schematic NC NC C 0,25

endif goto song end

Slave Pic Code:

‘This portion of programming controls the light display.

' 10-­‐bit A/D conversion ' Connect analog input to channel-­‐0 (RA0) ' Define ADCIN parameters ' Set number of bits in result DEFINE ADC_BITS 10 ' Set clock source (3=rc) DEFINE ADC_CLOCK 3 ' Set sampling time in microseconds DEFINE ADC_SAMPLEUS 10 adcVar VAR WORD ' Create variable to store result adcVar = 0 ' Set PORTA to all input TRISA = %00000101 TRISB = %00000000 'high porta.2 'for testing ' Set up ADCON1 ADCON1 = %10000010 Const1 var byte Const2 var byte Const3 var byte

Page 15: Design’Overview’downloads.deusm.com/designnews/GF196_build.pdfLM741-+ Piezo Buzzer +15V +5V 1kΩ 1kΩ 10kΩ 1kΩ oPin A0 f Slave PIC Piezo Buzzer and Op Amp Schematic NC NC C 0,25

Const4 var byte Const5 var byte Const1 = 33 ‘used a linear progression method for sound volume sensing, not a logarithmic

‘one Const2 = 66 Const3 = 99 Const4 = 132 Const5 = 165 Row1 var portb.1 ‘Row 1 represents the bottom row of leds and Row 6 is the top row. Row2 var portb.2 Row3 var portb.3 Row4 var portb.4 Row5 var portb.5 Row6 var portb.6 Pause 500 ' Wait .5 second main: while(porta.2 == 1) ‘the loop that keeps the ADC checking the current volume level. ADCIN 0, adcVar ' Read channel 0 ‘reads the ADC and sets adcVar equal to it. if (adcvar <= Const1) then 'check if row 1 should be active high Row1 low Row2 low Row3 low Row4 low Row5 low Row6 Pause 10 ' Wait.01 second goto main endif if (adcvar <= Const2) then 'check if row 2 should be active high Row1 high Row2 low Row3 low Row4 low Row5 low Row6 Pause 10 ' Wait.01 second goto main endif

Page 16: Design’Overview’downloads.deusm.com/designnews/GF196_build.pdfLM741-+ Piezo Buzzer +15V +5V 1kΩ 1kΩ 10kΩ 1kΩ oPin A0 f Slave PIC Piezo Buzzer and Op Amp Schematic NC NC C 0,25

if (adcvar <= Const3) then 'check if row 3 should be active high Row1 high Row2 high Row3 low Row4 low Row5 low Row6 Pause 10 ' Wait.01 second goto main endif if (adcvar <= Const4) then 'check if row 4 should be active high Row1 high Row2 high Row3 high Row4 low Row5 low Row6 Pause 10 ' Wait.01 second goto main endif if (adcvar <= Const5) then 'check if row 5 should be active high Row1 high Row2 high Row3 high Row4 high Row5 low Row6 Pause 10 ' Wait.01 second goto main endif if (adcvar > Const5) then 'check if row 6 should be active high Row1 high Row2 high Row3 high Row4 high Row5 high Row6 Pause 10 ' Wait.01 second goto main endif Pause 10 ' Wait.01 second Wend ‘end of while loop

Page 17: Design’Overview’downloads.deusm.com/designnews/GF196_build.pdfLM741-+ Piezo Buzzer +15V +5V 1kΩ 1kΩ 10kΩ 1kΩ oPin A0 f Slave PIC Piezo Buzzer and Op Amp Schematic NC NC C 0,25

goto main end