Picaxe 08m and sound card

Frank91608

New Member
Hi,

I'm new to the Picaxe and have been having fun learning. I came across a couple of things that have me stumped. I have the o8m starter kit and I would like to have it connected to a small sound board (http://www.electronics123.com/s.nl/it.A/id.499/.f?sc=8&category=2) I just can't figure out how to connect it to the board. I set pin2 to high and when it's connected to the +v on the sound board it cycles the power to it on and off but if I connect an LED it stays lit.

Also, I would like a switch to start the program so I set up and if/then command so when pin3=1 it starts and 0 nothing happens, but as soon as power is applied it starts. In the simulator it works like it should but not on the actual board.

Hope these aren't really stupid questions, thank you for any help you may provide.
 

BCJKiwi

Senior Member
The blurb indicates;
"The other button just has to be momentarily pressed to replay the message. A second momentary press during playback will stop the playback."

Not sure how it is hooked up but to make it work I would expect that +5V and 0V will need to be connected to power the unit. Connect the 0V to the same 0V as the 08M and use the same +5V supply for both.

Pin2 needs to go high momentarily (pulsout) and be wired to the pushbutton so the pulsout appears to be a button push.

To stop playback send a pulsout again.

Bit difficult to give more detailed info without the circuit diagram or much more info.

Post your circuit diagram and program so we can assist further.
 

Andrew Cowan

Senior Member
Have a look at the circuit - do the switches connect the input to 0V or 5V? I was having problems trying to get an LCD counter to work - then I realised the switches needed to go between the pin and 0V.

Andrew
 

Frank91608

New Member
Thank you both. It was all great advice and it got a few things working. I now have a switch to start the program which works. Also, the pulsout command was exactly what was needed to trigger that sound board. My only problem is that after it plays the sound clip it repeats over and over. When I apply power nothing happens which is perfect, then I hit the switch and the LED lights and sound plays. The LED fades out and the whole thing should end but the sound keeps repeating. I tried putting a "low" command to shut down that output but it seems to keep triggering it. Any ideas? I put my code below - if it makes no sense it's because I'm just learning this.

symbol LED = 2 'rename output 1
symbol voice = 1 'rename output 3


main: if pin3=0 then main
if pin3=1 then start
goto main

start: gosub noise
gosub fadeup

noise: pulsout voice,200


fadeup: if b5=255 then goto delay 'LED fade up
inc b5
pause 3
pwm LED,b5,1
goto fadeup

delay: high LED
wait 10
goto shutdown

shutdown: gosub fadedown

fadedown: if b5=0 then goto main
dec b5
pause 3
pwm LED,b5,1
goto fadedown
 

Andrew Cowan

Senior Member
From manual 2: Every gosub command MUST be matched by a corresponding return command.

Also, pulsout just inverts the pin (high to low, or low to high). Make sure this works correctly by adding a low voice at main (or after/before the pulsout).

Hope this helps. it is not all needed, but I like to put stuff like this in my code to make sure nothing funny happens.

Andrew
 

Frank91608

New Member
Thanks for the answer - forgot the return! I corrected that.

anyway, just realized that the switch on the sound board will trigger the sound whether it gets +v or 0v so when the pin is high or low it starts the sound playing over ands over.

anyway around that?
 

eclectic

Moderator
Frank.

Have a look at the last line of post #2. (from BCJ)

Please post your circuit diagram, and also, your new code.

e
 

Andrew Cowan

Senior Member
Thanks for the answer - forgot the return! I corrected that.

anyway, just realized that the switch on the sound board will trigger the sound whether it gets +v or 0v so when the pin is high or low it starts the sound playing over ands over.

anyway around that?
Erm.. All I can think of is to connect it then disconnect it by using either a relay or a transistor.

Edit: SOLUTION! (I think). If the pin is relabled as an input (possible on an 8M), this would leave it in the required floating state. This is why it works at first, but not after the first trigger - pins are set as inputs by default on an 8M (except output 0).

This can be done by using the REVERSE command (see manual 2).

Andrew
 
Last edited:

Frank91608

New Member
Andrew - you rock!

I was thinking about adding a relay. Tried it and it works like a charm. Thanks so much for your advice today.
 

BCJKiwi

Senior Member
Should not need a relay.

It appears the code (post#4) is missing a step in the shut down process.

The manual for the product indicates that it needs a momentary button press to start playing,
AND
a momentary button press to stop playing.
The code shows the pulsout to start it playing.

It will continue to play in a loop forever by the sound of it.
So you need another pulsout is needed to stop it playing.

In most installations, I would expect the unit to be powered up along with everything else and stay powered up.

pulsout to start it playing,
pulsout (again) to stop it playing.
 
Top