sound vs. play volume

tracecom

Senior Member
I have breadboarded an LM386 amp connected to an 08M2. Using the sound command, the volume is loud enough, but using the play command, the sound is barely audible. What am I doing wrong? The output from the LM386 is going to a piezo if that matters.
 

Buzby

Senior Member
Are you sure you are using the correct pin for the output ?.

SOUND can use any pin, but PLAY is limited to a fixed pin on the 08.
 

tracecom

Senior Member
Are you sure you are using the correct pin for the output ?.

SOUND can use any pin, but PLAY is limited to a fixed pin on the 08.
Wow, what a quick response.

I did not know that. I am using C.1, but I will check to see if play is supported there.
 

tracecom

Senior Member
When I moved the amp input to C.2, the volume is perfect. It is interesting to note that there is apparently some crosstalk, because I was able to hear the tune at very low volume when the amp was connected to C.1.

Thanks.
 

Buzby

Senior Member
I wouldn't fret too much about it. The 386 is a great little amp, and it was probably reacting to the supply voltage wobbles.

You have got some decoupling caps dotted around, haven't you ?
 

tracecom

Senior Member
Things are working well with one exception. When I press SW1, Rudolph doesn't play. The other switches play their respective songs. I suspect that the problem is related to C.5 being the Serial In pin, but I am not sure. With my DVM, I can see C.5 go high when I press SW1.



Code:
symbol n = b1

main:
if pinC.1 = 1 then gosub happy
if pinC.3 = 1 then gosub jingle
if pinC.4 = 1 then gosub silent
if pinC.5 = 1 then gosub rudolph
goto main

happy:
for n = 1 to 1
play 0,1	; Happy Birthday to You with output 0 flashing
next n
return

jingle:
for n = 1 to 1
play 1,1	; Jingle Bells with output 0 flashing
next n
return

silent:
for n = 1 to 1
play 2,1	; Silent Night with output 0 flashing
next n
return

rudolph:
for n = 1 to 1
play 3,1	; Rudolph the Reindeer with output 0 flashing
next n
return

goto main
 

Attachments

Last edited:

hippy

Technical Support
Staff member
Add a DISCONNECT command at the top of the program and this will allow pinC.5 to be used as an input.

You will need to power-cycle the PICAXE to force a Hard Reset when downloading after doing that. Without the Hard Reset you will get "Hardware not found" messages.

http://www.picaxe.com/FAQs/Interfacing#q9
 

tracecom

Senior Member
Add a DISCONNECT command at the top of the program and this will allow pinC.5 to be used as an input.

You will need to power-cycle the PICAXE to force a Hard Reset when downloading after doing that. Without the Hard Reset you will get "Hardware not found" messages.

http://www.picaxe.com/FAQs/Interfacing#q9
Thanks. Now that you tell me, I remember reading that "once upon a time."

ETA: Works like a champ now. One other question. Given the 10k pulldown (R6) on C.5, should I eliminate the 33k (R1) that I put in to simulate the 10k and 22k programming circuit? It seems redundant.
 
Last edited:

hippy

Technical Support
Staff member
Given the 10k pulldown (R6) on C.5, should I eliminate the 33k (R1) that I put in to simulate the 10k and 22k programming circuit? It seems redundant.
Yes, one or the other is redundant.

If you want to program the PICAXE in situ then you don't need the 10K. If you are not planning on that you can keep the 10K and lose the 33K (22K+10K)
 

tracecom

Senior Member
Yes, one or the other is redundant.

If you want to program the PICAXE in situ then you don't need the 10K. If you are not planning on that you can keep the 10K and lose the 33K (22K+10K)
That is very helpful; I will eliminate R1 because I won't have a programming jack on the final assembly. Thanks again.
 

Circuit

Senior Member
I may be missing something here, but what is the purpose of diodes D2 and D3 in your schematic, preceded by C6 and followed by C7? They seem to me to be simply shorting out your output from C.2. The less complicated circuit diagram recommended on page 256 of PICAXE Manual 2 seems to work for me. (incidentally, why this is in Manual 2 and not 3 is somewhat puzzling...).
 

tracecom

Senior Member
I may be missing something here, but what is the purpose of diodes D2 and D3 in your schematic, preceded by C6 and followed by C7? They seem to me to be simply shorting out your output from C.2. The less complicated circuit diagram recommended on page 256 of PICAXE Manual 2 seems to work for me. (incidentally, why this is in Manual 2 and not 3 is somewhat puzzling...).
The signal will be clipped to -0.7V to +0.7V by the diodes. As to why anything in the manual is the way it is, I don't know.
 

erco

Senior Member

tracecom

Senior Member
Chickens are easy to train to come when called. Usually, it's a human calling, "chick, chick, chick," or something similar, and then feeding the chickens when they come. The chickens soon associate food with the call. I am going to train my chicks to come when I use the PICAXE to play "Happy Birthday," by feeding them a treat of mealworms. Soon, they will associate mealworms with "Happy Birthday."

Next step will be to use a RTC circuit to trigger the PICAXE to play "Happy Birthday" over a loudspeaker system in order to call the chickens into the coop before the coop door closes at dusk. Over time, I think they will be conditioned to come to the coop when they hear "Happy Birthday," even when there is no food treat.

I have every confidence that will work, but then I want to try to use another tune from the PICAXE to trigger a different action from the chickens. That is based on my belief that the chickens will be able to differentiate between different tunes from the PICAXE. We'll see.
 

Hendriks

Member
Is it allowed to switch off a PICAXE while the inputs remain powered like Tracecom did?
It would be very convenient in my current project if I don't need to switch off the inputs that come from a different source.
 
Top