Made a beepy player, won't work right. ("button" problems...)

laserhawk64

Senior Member
Hello, folks. I'm back with another silly project... this one I'll actually finish if I can get the code right.

I have put together a little beep-tune player (using the "tune" command) that /almost/ works.You get a text description of the circuit because the schematic I drew isn't quite accurate and I'm not taking pictures of this bodge.

The whole thing is based on a 14p DIP socket that fought me every step of the way. That thing did NOT want to have solder attached to it!

A 1N4148 diode across pins 1 and 14, so that if I stick the batteries in backwards, it's not going to kill the chip.

The 22k resistor across pins 2 and 13, and the 10k across 3 and 12. The rest of the socket is occupied by an 08M2.

Underneath, on the bottom of the socket, pins 1 and 4 are joined to each other, and pins 2 and 3 are joined to SerIn (which would go to the headphone jack if I hadn't cut that off by now; I'm programming it in another board instead...).

Pin 5 bridges the socket to pin 13.

Pin 6 (corresponding to C.3 on the PICAXE) is hooked to the positive supply via a small button switch (momentary push button), which triggers the tune playback. Yes, the button has a pulldown. It's 10k.

*ahem* Pin 7 has been cut off the socket.

Pin 8 goes to a piezo disk (specifically the middle quartz part; the outside metal part is wired to ground).

Pin 9 has been cut off the socket.

Pin 10 goes to SerOut (or would if I hadn't removed the jack).

Pins 11 and 12 are grounded.

Pin 13, as previously mentioned, goes to pin 5, and pin 14 is the supply input.

There is a small power switch between the supply inputs and the batteries.

Batteries are a trio of LR44's; I'm reusing them, the piezo, and the enclosure from a dollar store magnetic window alarm!

I'll attach my code to the post, since (as usual) the forum editor doesn't like me and is taking out all the line breaks. I think it has something to do with how Linux does things... Windows uses the CR+LF non-printing characters; Linux just does LF. (CR = Carriage Return, LF = Line Feed; it's lingo left over from teletype and typewriter days... but it's how things are still done...)

The problem, in a nutshell, is that to play the whole tune, I have to hold down the button the whole time. I want a one-shot -- I poke the button, it plays the tune to completion. I poke it again, it plays a second time.

Just realized that I can cut up an 08 proto board to fit this case. I feel a little stupid -- once I get the program working I'll do exactly that since I have at least one spare proto board...
 

Attachments

Last edited by a moderator:

laserhawk64

Senior Member
Sure enough, it made my nicely laid out post one big fat ugly paragraph :( sorry 'bout that!
... the forum editor doesn't like me and is taking out all the line breaks. I think it has something to do with how Linux does things... Windows uses the CR+LF non-printing characters; Linux just does LF. (CR = Carriage Return, LF = Line Feed; it's lingo left over from teletype and typewriter days... but it's how things are still done...)
 

hippy

Ex-Staff (retired)
Could you draw a circuit diagram because, even with your text turned into paragraphs, there's a lot to comprehend. It's probably simple but too complicated to build that circuit up in one's head while reading. I'm completely confused by talk of a 14 pin socket when your code is for an 08M2 and your "pin" descriptions / numberings don't make sense to me.

TUNE should play and continue until it ends so the problem would seem likely to be one of three things -

1) Power being removed when button is released
2) The button push is causing the PICAXE to think there's a download happening
3) There's a short somewhere which is causing the chip to reset

Looking at your code, there's a flaw in the logic and it looks to me like it should be playing a tune continuously.
 

laserhawk64

Senior Member
Could easily be a short somewhere -- that socket did NOT want to be soldered to! It's a mess... some of the wires oxidized black somehow (I know how to solder just fine, not sure what the attitude is about with those wires) so the solder doesn't want to stick to them either. I've resoldered some connections three times because the wires fell off. I'm really not used to that kind of behavior in my projects...I wonder if that sad-sack socket has aluminum contacts. Wouldn't surprise me, it's from Radio Shack, somewhere around the turn of the century.At any rate, here's the schematic --> http://i.imgur.com/fA5Vkwh.jpg
 

stevesmythe

Senior Member
Hard to tell from your schematic but it looks like the "play switch" is wired wrongly. The V+ side of the switch is connected straight through to earth via a 10k resistor and the other side of the switch goes to a Picaxe pin (or so it looks, as you've drawn a loop in your schematic).

The side of the switch that goes to the Picaxe input pin should be the one that is tied to earth by the 10k resistor.
 

laserhawk64

Senior Member
I don't see any flaw. You press the button, it goes to PlayTune. You don't press the button, it sits there until the button is pressed. Or so I would think... I'll stick a "goto Main" in after the "button" command just to be sure tho.
 

laserhawk64

Senior Member
Yep, that was it *blush* well, now I know that the "button" command is NOT "sit there till the idiot presses the button" lol. Final code attached. Thanks folks!
 

Attachments

Top