Help with AXE171 PICAXE-14 Audio Kit

Moya

New Member
Can anyone help ? - I want to know if its possible to have more than one push button switch as an input with the Pickaxe Audio Kit - I'd like to have seven push button switches - the input from each switch processes only one output - i.e. each push button switch plays a particular MP3 file. If this is possible where do I solder the push button switches on the AXE 171 board? Thanks.
 

Circuit

Senior Member
Welcome to the Forum - and what a great way to start with an AXE171.

Looking at the datasheet, the problem is that a circuit diagram does not appear to be available; it is listed as "to be added" on the AXE171 datasheet that I looked at. The input/outputs are, however, listed under section 4 and whilst seven inputs could be made available, there would have to be some modification of the board. It appears that B.1, B.3, C1 are available as "spare" but you would have to disconnect B.2 and B.5 from their LEDs and patch into C.1 which has a switch which could be ignored and C.4 which is connected to the LDR. - Quite a lot of modification!

Alternatively, you could just pull the PICAXE chip out of its socket and bend those designated PICAXE pins outwards and connect to them directly so that they are not connected to the AXE117. -Crude indeed, but it would work.

Another possibility is simply to make your own board using perf board and socket in the PICAXE to that. The connections to the player unit are relatively straightforward and a seven-switch selector would be relatively easy to design.

Finally, you might consider putting the seven switches on a resistor array and using the ADC input of one of the spare connectors on the AXE171 - there are details on this forum showing how to go about setting this up and how to program using the ADC input to tell which switch has been pressed. With two spare inputs you could do a three button and four button approach. See here; http://www.picaxeforum.co.uk/showthread.php?28204-Newbie-question-on-Multiple-Switches-using-single-Input
 

premelec

Senior Member
@Moya - welcome to this forum - the AXE171 is a fairly complicated item - Please indicate what level of experience you have with programming and hardware... doesn't matter where you are in experience but advice given could be suited to your ability - as Circuit indicates there are possibilities. Do you understand them and have you read through the PDF file on the product an understood it? Would several presses of one button suit you to select or do you need to have many buttons?
 

hippy

Technical Support
Staff member
On the AXE171 pin B.3 is nominally intended as an LCD or Servo output and goes to the 3-pin header at the top right of the board, also providing V+ and 0V. There is no reason B.3 could not be used as a digital, serial or analogue input.

The simplest solution would be to connect to that header and use it as an analogue input and have a push button controlled resistor ladder or a push button resistive matrix.
 

Moya

New Member
@Moya - welcome to this forum - the AXE171 is a fairly complicated item - Please indicate what level of experience you have with programming and hardware... doesn't matter where you are in experience but advice given could be suited to your ability - as Circuit indicates there are possibilities. Do you understand them and have you read through the PDF file on the product an understood it? Would several presses of one button suit you to select or do you need to have many buttons?
My level of experience is quite limited and unfortunately I'm a bit out of my depth with some of the answers given here. If it's possible to attach three push button switches for the input - we could have more than one Picaxe for the display?
 

premelec

Senior Member
OK - one thing at a time in building up a system - and you have added another item 'for the display' which had not been mentioned previously.

What materials do you actually have at hand?
Do you know how to solder things together?
Have you experience with programming? [in particular PIXACEs?]

What are you trying to produce - what does it do?
What are the inputs - ? - buttons? and how many and what effect do they have?
Outputs - sound, light display.

It's one thing to have functions in mind and another to get advice how to actualize them by someone else without them having accurate and clear definition...

The reference to using one pin on a PICAXE to read many different buttons that has been referred to is simply using READADC - which measures a voltage on a pin - to read voltages that are selected by buttons connected to a resistor voltage divider string in various possible ways. Ohm's law is one of the maths that is useful for this. I have attached an example of a keypad resistive network I drew some years ago tow read the key pressed by an output voltage to a READADC pin. The PICAXE program then translates the voltage read into doing some particular action you want.
 

Attachments

Moya

New Member
Many thanks for your response premelec and apologies for not making myself clearer. My daughter works for a wildlife charity and wants to create a display in their small visitor centre with images of different animals and buttons for the visitors to push - when the button next to each animal is pushed the speaker plays the sound the animal makes. She asked me if I had any idea about how she could achieve this - she has no experience of electronics or programming. I suggested we look at using Picaxe because I have a very limited knowledge of it - I can solder and have written a very simple flow chart program for a 08M Picaxe chip in the past. She talked to someone at Picaxe and explained the project over the phone to them and they told her the AXE171 Picaxe Audio kit would be ideal for her project. We basically want to attach a number of push button switches for the visitors to press (my daughter mentioned about 7) to a single speaker. She lives in Scotland and I live in the Midlands - so at the moment we've each bought the kit - once I got the kit I couldn't see how to use that many push button switches with it? Thanks for taking the time to reply.
 

Moya

New Member
Thank you for your reply Circuit - I'll work my way through your suggestions - much appreciated.
 

Circuit

Senior Member
The simplest PICAXE store solution for you may be here; http://www.picaxestore.com/index.php/en_gb/picaxe/add-on-modules/ppm155.html
It does not give you one speaker for all, but each kit includes both push buttons and a speaker. They work rather well and the volume is quite decent if you box up the speaker with a suitable baffle box -the volume increases markedly. It is extremely easy to record the 20 seconds of sound which I guess would be ideal for a push-button display next to each cage/tank etc. You would be advised to change the playback button to something more robust for use by the general public but otherwise you would only need a suitable case.
 

premelec

Senior Member
@Moya - Circuit's suggestion could work for you - if you search ISD1820 in Ebay you'll find a bunch of 10 second record/playback units which might work for you - still need power source and perhaps better speaker and/or amplifier.

There are also units which can play multiple sound files from an SD card of any length you want - Search "mp3 format TF" on Ebay... you might use a PICAXE with one of these to select particular file.. an issue with your project is when two different buttons are pushed at once -
 
Last edited:

Technical

Technical Support
Staff member
The advice given on the phone was actually that the AXE171 would be an ideal low-cost board to prototype the system with (ie getting two switches to play two different recordings). Once that is done the program is complete and you can test if it works as you want in position. At that point you can then decide how many switches you actually need (and decide on which PICAXE chip to use) for the final unit - depending on how many switches required. The program would be the same, you would just transfer the sounder module over to the PICAXE board with enough inputs. One way to do that may be the SPE035 MP3 player unit (from AXE171 kit) connected to a different project board with more inputs e.g. the AXE118 which would be a simple way to give you 8 pairs of holes for 8 switches.

Here's a program for the AXE171 based on that given on page 24 of the datasheet. You need 2 tunes called 0001.mp3 and 0002.mp3 in the /MP3 sub folder on the SD card. When assembling the board put in wires for a second switch in the LDR position (instead of the LDR) - that gives you two switches to test with on C.0 and C.4.

Code:
[COLOR=Navy]#Picaxe [/COLOR][COLOR=Black]14M2[/COLOR]
[COLOR=Navy]#Terminal 4800[/COLOR]

[COLOR=Blue]Symbol [/COLOR][COLOR=Black]TX        [/COLOR][COLOR=DarkCyan]= [/COLOR][COLOR=Blue]B.4
Symbol [/COLOR][COLOR=Black]RX        [/COLOR][COLOR=DarkCyan]= [/COLOR][COLOR=Blue]C.3
Symbol [/COLOR][COLOR=Black]BUSY_PIN  [/COLOR][COLOR=DarkCyan]= [/COLOR][COLOR=Purple]pinC.2[/COLOR]

[COLOR=Blue]Symbol [/COLOR][COLOR=Black]BAUD_FREQ [/COLOR][COLOR=DarkCyan]= [/COLOR][COLOR=Blue]M8
Symbol [/COLOR][COLOR=Black]BAUD      [/COLOR][COLOR=DarkCyan]= [/COLOR][COLOR=Blue]T9600_8

Symbol [/COLOR][COLOR=Black]cmd       [/COLOR][COLOR=DarkCyan]= [/COLOR][COLOR=Purple]b0[/COLOR]
[COLOR=Blue]Symbol [/COLOR][COLOR=Black]arg       [/COLOR][COLOR=DarkCyan]= [/COLOR][COLOR=Purple]w1 [/COLOR][COLOR=Green]; b3:b2[/COLOR]
[COLOR=Blue]Symbol [/COLOR][COLOR=Black]arg.lsb   [/COLOR][COLOR=DarkCyan]= [/COLOR][COLOR=Purple]b2[/COLOR]
[COLOR=Blue]Symbol [/COLOR][COLOR=Black]arg.msb   [/COLOR][COLOR=DarkCyan]= [/COLOR][COLOR=Purple]b3[/COLOR]
[COLOR=Blue]Symbol [/COLOR][COLOR=Black]whichTune   [/COLOR][COLOR=DarkCyan]= [/COLOR][COLOR=Purple]w2[/COLOR]

[COLOR=Green]; Initialise[/COLOR]
[COLOR=Blue]High [/COLOR][COLOR=Black]TX[/COLOR]
[COLOR=Blue]Pause [/COLOR][COLOR=Navy]2000[/COLOR]
[COLOR=Black]cmd [/COLOR][COLOR=DarkCyan]= [/COLOR][COLOR=Navy]$09 [/COLOR][COLOR=Black]: arg [/COLOR][COLOR=DarkCyan]= [/COLOR][COLOR=Navy]$0002 [/COLOR][COLOR=Black]: [/COLOR][COLOR=Blue]Gosub [/COLOR][COLOR=Black]Send[/COLOR]
[COLOR=Blue]Pause [/COLOR][COLOR=Navy]4000[/COLOR]

[COLOR=Green];Set sound to 20[/COLOR]
[COLOR=Black]cmd [/COLOR][COLOR=DarkCyan]= [/COLOR][COLOR=Navy]$06 [/COLOR][COLOR=Black]: arg [/COLOR][COLOR=DarkCyan]= [/COLOR][COLOR=Navy]20 [/COLOR][COLOR=Black]: [/COLOR][COLOR=Blue]Gosub [/COLOR][COLOR=Black]Send[/COLOR]
[COLOR=Blue]Pause [/COLOR][COLOR=Navy]1000[/COLOR]

[COLOR=Green];Test each switch in turn[/COLOR]
[COLOR=Blue]Do
  If [/COLOR][COLOR=Purple]pinC.0 [/COLOR][COLOR=DarkCyan]= [/COLOR][COLOR=Navy]1 [/COLOR][COLOR=Blue]Then 
    [/COLOR][COLOR=Black]whichTune [/COLOR][COLOR=DarkCyan]= [/COLOR][COLOR=Navy]1
    [/COLOR][COLOR=Blue]Gosub [/COLOR][COLOR=Black]PlaySound
  [/COLOR][COLOR=Blue]Endif
  If [/COLOR][COLOR=Purple]pinC.4 [/COLOR][COLOR=DarkCyan]= [/COLOR][COLOR=Navy]1 [/COLOR][COLOR=Blue]Then 
    [/COLOR][COLOR=Black]whichTune [/COLOR][COLOR=DarkCyan]= [/COLOR][COLOR=Navy]2
    [/COLOR][COLOR=Blue]Gosub [/COLOR][COLOR=Black]PlaySound
  [/COLOR][COLOR=Blue]Endif
  [/COLOR][COLOR=Green]; any number of more switches can be added here in exactly same way[/COLOR]

[COLOR=Blue]Loop[/COLOR]

[COLOR=Green]; Play the actual MP3 file[/COLOR]
[COLOR=Black]PlaySound:
  cmd [/COLOR][COLOR=DarkCyan]= [/COLOR][COLOR=Navy]$12 [/COLOR][COLOR=Black]: arg [/COLOR][COLOR=DarkCyan]= [/COLOR][COLOR=Black]whichTune : [/COLOR][COLOR=Blue]Gosub [/COLOR][COLOR=Black]Send
  [/COLOR][COLOR=Blue]Pause [/COLOR][COLOR=Navy]1000
  [/COLOR][COLOR=Blue]Do While [/COLOR][COLOR=Black]BUSY_PIN [/COLOR][COLOR=DarkCyan]= [/COLOR][COLOR=Navy]0
    [/COLOR][COLOR=Blue]Pause [/COLOR][COLOR=Navy]100
  [/COLOR][COLOR=Blue]Loop
Return[/COLOR]

[COLOR=Black]Send:
  [/COLOR][COLOR=Blue]SetFreq [/COLOR][COLOR=Black]BAUD_FREQ
  [/COLOR][COLOR=Blue]Pause [/COLOR][COLOR=Navy]10
  [/COLOR][COLOR=Blue]SerOut [/COLOR][COLOR=Black]TX, BAUD, [/COLOR][COLOR=Blue]( [/COLOR][COLOR=Navy]$7E[/COLOR][COLOR=Black], [/COLOR][COLOR=Navy]$FF[/COLOR][COLOR=Black], [/COLOR][COLOR=Navy]$06[/COLOR][COLOR=Black], cmd, [/COLOR][COLOR=Navy]$00[/COLOR][COLOR=Black], arg.msb, arg.lsb, [/COLOR][COLOR=Navy]$EF [/COLOR][COLOR=Blue])
  SetFreq MDEFAULT
  [/COLOR][COLOR=Black]arg [/COLOR][COLOR=DarkCyan]= [/COLOR][COLOR=Navy]0
  [/COLOR][COLOR=Blue]Return[/COLOR]
Page 23 of the SPE035 datasheets shows the line out connection positions that were also requested.

http://www.picaxe.com/docs/spe035.pdf
 
Last edited:
Top