mp3 playback module

BeanieBots

Moderator
Well, there are some great big fat clues there!

No problem when run from battery.
Problem when run from mains via regulator.
Series resistor into regulator helps to reduce noise level.

Conclusion.
It's NOT the module.
It IS related to supply and/or wiring.

Don't know what caps you have in your collection but those old 20 year old electrolytics you took out of your grandads gramaphone won't have any effect on 'clicks'. As stated by AC, you need to use low ESR. These are unlikely to be lying around in a drawer unused unless you do a lot of electronics because they are expensive and usually bought for a specific project. eg power supplies.

What value resistor to use.
The highest you can get away with.
To work that out (not guess or trial and error) you need to know the supply voltage, the current drawn and the output voltage of the regulator.
Use ohms law to determine the resistance that will give you about 3v headroom into the regulator.

Once you know that value, halve it and use two in series.
Then fit a LOW ESR cap between the junction and 0v and another one between regulator input and 0v.
Across each LOW ESR cap, fit a ceramic 100nF to make them even lower ESR at high frequencies.

If the above does not eliminate the problem, then start looking for ground loops.

Another quick and easy test would be to take the ENTIRE setup to a different location and try it there. If the problem goes away, then start looking for something in your house that might be generating the noise and shoving it down the mains line.
 

1968neil

Senior Member
My own experiences with the problem you have was cured by following some simple tasks

Always fit a 100nF capacitor directly to or as close to as possible to the Picaxe supply pins
I did the same with the module

I supply the mp3 module via a 7812 from the same power supply as the PICAXE which has its own 7805.

I always fit a IN4001 across the input and output pins of both regulators (this cured mine) cathode to in anode to out, this would signify that the regulator may be the issue, maybe a loading problem ?

Also found that on breadboard the module has some strange noises (pops,clicks). but the same layout on a pcb doesn't.
I put this down to rf pick-up, so it would appear decoupling plays a major part in the operation of this module.
I have mine running via a maplin preamp kit into my hifi and it sounds near to cd quality.
Without the preamp your volume will be set quite high to get a reasonable level. Really do recommend a good pre-amp, this way the module is not working too hard and power supply issues are halved (less current req).
It certainly sounds better than most expensive mp3 players !

Regards

Neil
 

eggie

Member
Thanks for the suggestions - I will have a dabble again at the weekend as I have no chance in the evenings this week. I have the module working sufficiently well for my requirements but if I can improve on what I have done so far then I will not complain.

My caps collection is modern and new!!:) my grandad was in the era of valves...... now I wonder ..... no, silly idea!!

I had not heard of Low ESR (had to google that one)

eggie
 

Grogster

Senior Member
I could not agree more with 1968neil - everything he said, is pretty much what I did and I have never had any noise or humming problems.

I do recall that there was some hum when I first breadboarded the module, but I put this down to unsheilded audio cables, as I was using wire jumpers for the audio out during that phase of testing - once I put the module on a PCB with a ground-plane, I never had a single hint of humming.

It's also nice to see 1968neil also pointing out about the preame - I keep saying it and saying it... Expect noise if you are trying to feed the module into a stereo without a preamp in front of it.

Also the supply voltage thing does not seem to be hitting home with many - DO NOT use 5v to supply the module, use 12v or 9v as a MINIMUM, fed from it's own regulated supply rail. I do exactly the same as 1968neil, in that I have TWO supply voltages floating around - 5v for the PICAXE and other associated logic via it's own regulator and filter caps as already mentioned, and a 12v rail for the module. In some projects, I have three regulated supply rails: 3v3, 5v0 and 12v0, all derived from the same common input power, but fed off to different things which want different supply voltages. All PSU's have to have their own decoupling and filtering caps on input and output.

Check my PCB design, page 15, post 142 - this one I have made several of, and they never give any hum or other noise, no matter what PSU is used from linear to switchmode.

The preamp on this PCB does have a small RF filter on the input though, which may well help. It consists of nothing more glorious then a single wire passing through a ferrite bead.
 
Last edited:

Radarman2

Member
Has anyone received one of these that looks different to the diagram?
I ordered a couple from mdfly a while ago and have just started playing with it, the regulator on mine is near pin1, the decoder chip is in the middle of the board with the xtal near pin20.
M0 & M1 also appear to be linked, have fluked them to find they're sitting at gnd. Thought it was a bit weird them turning up in parallel mode (m0 0,m1 0), but it explained why I couldn't get a picaxe to control it via serout.
The manual (from Tenda) then goes on to say that "All of the functions of this module can be realized[sic] in Parallel and Serial mode."
Not on mine they're not! So I've had another fiddle and tried to set m0 & m1 to 1 by linking them to regulated output, result = board shuts down until link removed, but board is fine.
Anyone else having similar problems?
 

Radarman2

Member
I should have added that I've got it playing by grounding the P0 to P7 pins and I can adjust the volume, but that's it. It's acting exactly like ch 4.2.3 (parallel mode) of the Tenda manual.
 

hippy

Technical Support
Staff member
Have you contacted MDFLY to ask what their take is on the situation, or checked their forum ?

The version I received were in sealed anti-electrostatic bags and I'd guess that's how MDFLY receives them, shelves them until shipped, so may never have noticed if the latest were different to what was expected.

According to my TDB380 manuals ( version 2.0 and 2.1 ); "M0 and M1 points shown on above PCB picture, "0": Connect to GND, "1": NC (Not connected)" and "1,1 = Serial Mode" - so perhaps remove M0 and M1 rather than linking to regulated supply.
 

Radarman2

Member
The 2 I got were in anti-static bags as well (guess they all are). I'd read that bit about "M0 and M1 points...", but it hadn't really registered as the rest of the manual is the normal Chinese to English cheap translation. Now that you've pointed it out I can see the sense in NC (Not Connected) as they'l float to a '1'.
Cheers Hippy, shall I get it working and incorporate some lasers just for you lol.
 

Grogster

Senior Member
I ordered about 20 of these modules direct from Tenda back when this thread was new. :D

Some of them were a different layout - search through this thread, cos I am sure I posted pictures of the newer layout. The newer ones can have either SD card or USB flash-drives as the MP3 storage medium, and the also moved the SD card socket to a more accessable location, making removing the card easier then on the earlier modules.

Yes, they moved the position of the 317 regulator in the new version of the board, according to what I remember.
 

Grogster

Senior Member
That is a very cute module. I woulden't mind betting, that the mp3 codec is the exact same chip... ;)

As far as I am concerned, the Tenda module gives excellent performace, and CD-quality sound no problems at all, but then, I guess it is a personal choice thing.
 

fritz42_male

Senior Member
Not sure if anybody has played with this module

http://www.tendaelectronics.com/?action=wareshow|tenda|128|en|110,427|427

It seems to be easier to get the SD card in and out
 

fritz42_male

Senior Member
Hi, I'm having trouble getting the (original) Tenda board to trigger from an 18M2.

Code:
symbol TENDA_OUT=B.3

HIGH TENDA_OUT

wait 2                                                               'Allow module to fire up
serout TENDA_OUT,T4800_4,($EF)                          'STOP module
wait 2                                                                    
serout TENDA_OUT,T4800_4,($01)                          'Start playing first mp3
Any ideas? In simulation, the codes seem to come up OK. 08M version seems to work fine.
 
Last edited:

1968neil

Senior Member
try this, works fine with my mk1 module

symbol TENDA_OUT=B.3

HIGH TENDA_OUT
pause 5000
serout TENDA_OUT,T4800,($EF)
serout TENDA_OUT,T4800,($01)
 

1968neil

Senior Member
Two things spring to mind,
1) is the module actually doing anything with the commands sent ? try it with a play button connected to see if it actually works.
2) is the sd card compatible and are the tracks formatted to the card correctly, there is a thread in this section regarding this

I have just hooked mine up and written a basic test code for you and it works as expected in the real world
Using the busy line is a MUST as the next command send over rides the next etc.
Regards
Neil



Rem Plays 1st track and waits until finished by monitoring the tenda module busy line
REM then plays the 2nd track and waits until finished then repeats this loop etc.





Symbol Wait_if_busy = pinB.7; Set pin 13 as Voice module active (busy Line)
Symbol Tenda = B.5 ; Tenda module on B.5
Symbol Baud = T4800


serout Tenda,Baud, ($EF); STOP MP3 module
pause 500
serout Tenda,Baud, ($E1); Set MP3 volume
pause 500


Main:

serout Tenda,Baud, ($01) ; send command to Play track 1
pause 1000 ; 1 sec pause

do
if Wait_if_busy = 1 then exit ; wait until voice module has finished
loop

serout Tenda,Baud, ($02) ;send command to Play track 2
pause 1000

do
if Wait_if_busy = 1 then exit ; wait until voice module has finished
loop

Goto main
 

fritz42_male

Senior Member
Sorry, am I missing something? shouldn't busy go low to exit the wait loop?

Waiting for answers from Halstaff on the play button but things have been fine on an 08m
 
Last edited:

1968neil

Senior Member
the busy line is LOW when active ie: wait till it goes HI then exit (data sheet confirms Busy = active LO on Pin 13)

Pin No. Pin Name Function
13 BUSY Busy, Low active --
15 RXD Data Receive --
16 TXD Data Transmit --
 

fritz42_male

Senior Member
Bugger! Thanks for that. Hadn't noticed and made an assumption -that'll teach me!

the busy line is LOW when active ie: wait till it goes HI then exit (data sheet confirms Busy = active LO on Pin 13)

Pin No. Pin Name Function
13 BUSY Busy, Low active --
15 RXD Data Receive --
16 TXD Data Transmit --
 

1968neil

Senior Member
No problem,glad to be of service, Great little module once you get to grips with it !
I use them for remote security monitors that send a voice prompt via a pmr radio link and they are faultless.
Do make sure the power supply is clean and well decoupled, i would also seriously recommend reading the whole of this thread as some of the other forum members have done some sterling work with them.
Best Regards
Neil




Bugger! Thanks for that. Hadn't noticed and made an assumption -that'll teach me!
 

fritz42_male

Senior Member
Thanks Neil. I have read through the thread and have some of the modules myself but they aren't currently set up nor do I have the time to put them into operation (my garage is full due to a business change and it's about 2 days work to clear over to my bench!)

I was working through a friend's problems with them. Could the problems my friend is having be due to a timing issue on the 18m2 as mentioned in this thread by another poster (I think)
 

1968neil

Senior Member
I use the 18M2 with this module and it works fine, try connecting it up and use the code i posted earlier (same connections as mine).
As this is tried and tested you would then be able to isolate your problem.
Maybe Hippy or Westaus55 would be able to answer the timing problem if that is your problem, however as i say mine works fine when connected as per code example.
 

hippy

Technical Support
Staff member
Maybe Hippy or Westaus55 would be able to answer the timing problem if that is your problem
It's been a long time since I used the module and with 200+ posts it would help if someone can post a link to where those timing issues were discussed if we need to review that or remind people what they were.
 

1968neil

Senior Member
The timing errors i had were with a pic using an external xtal, the Picaxe (18M2) has its own internal osc.

I've had no errors with the 18M2, it honestly does work fine for me, Maybe you could post your full code and a circuit diagram for us to have a look at and see if we can see any flaws that may be giving you the problem.

Regards
Neil
 

fritz42_male

Senior Member
Hi Neil, Thanks for the offer. Code is below. EVERYTHING works apart from reliable re-trigger of the Tenda board (& currently the audio-servos). Just to give some info on what the thing is doing.

The 18M2 is controlling a 'seance room' for a Halloween display. The ROCK_LIGHT, ROCK_MOTOR & BOOK_MOTOR outputs are linked to MOSFETS driving lights & motors and these work fine. The Leota sequence is linked to a servo that just presses a play button on a DVD remote control and this works fine.

The 18M2 is on a Kiwi board and there is a separate board containing a Tenda MP3 player and 1458 Op-Amp. All this board does is provide an audio-out from the Tenda to the op-amp which then amplifies it to the point where the 18M2 can process the audio and convert it into servo positions (for a jaw movement on a skull). This board works fine on an 08M2 setup.

The problem we are having at the moment is that the Tenda triggers once and then never again. In Editor simulation, everything is working fine as far as we can see. I'll post the Pebble layouts after and I'll create a schematic this weekend but if you have any suggestions in the interim it would be appreciated. The boards run off a regulated 4A 12V supply with the Kiwi board having an onboard 5V regulator and supplying 5V to the Audio board and there is adequate decoupling round the 18M2. The servos are just 'ordinary ones' and don't draw massive amounts of current so I don't believe we are over stretching the power supply. There is a common ground between the 18M2 board and the Audio board.


Code:
'Picaxe 18M2 Seance Room Controller

#Picaxe 18M2
 

symbol BOOK_MOTOR=B.0
symbol ROCK_LIGHT=B.1
symbol JAW_IN=B.2
symbol TENDA_OUT=B.3
symbol ROCK_MOTOR=B.4
symbol DVD_PUSH=B.5
symbol JAW_OUT=B.6
symbol PIR_IN=pinB.7
symbol BUSY=pinC.1


symbol JAW_POS=b1
symbol PIR_COUNT=b2
symbol SERVO_MIN=b3        
symbol SERVO_MAX=b4
symbol JAW_SOUND=b5

symbol Leotatime=w4
symbol Retriggertime=w5
symbol Jawtime=w6
symbol BAUD=T4800




Init:               						'Staring point to setup all inputs, outputs and set variables
 
  debug 
  SERVO_MIN=180
  SERVO_MAX=214
  Pause 2000         						'NORMALLY wait 60 secs for PIR to settle down - set at 2 secs for testing
 
 
Startup:
		Leotatime=300					'Set wait 20 half seconds for Leota to finish
		Retriggertime=30          			'Set wait 30 half seconds for Retriggerdelay
		Debug PIR_COUNT
  
PIRtest:
  		Do : Loop Until PIR_IN=1
  
  		Do
  		PIR_COUNT = PIR_COUNT + 1 * PIR_IN
  		Loop Until PIR_COUNT = 10
  		PIR_COUNT = 0



Routine:
		HIGH ROCK_LIGHT
  		'HIGH ROCK_MOTOR
  		'HIGH BOOK_MOTOR
  		Gosub AUDIO
  		pause 3000            				'temporary pause to see what is happening
  		LOW ROCK_LIGHT
  		'LOW ROCK_MOTOR
  		'Gosub LEOTA
  		'LOW BOOK_MOTOR
  		Gosub Retriggerdelay
  
		Goto Startup


 
AUDIO: 
  		serout TENDA_OUT,BAUD, ($EF); 		'STOP MP3 module 
		pause 500
		serout TENDA_OUT,BAUD, ($E1); 		'Set MP3 volume
		Servo JAW_OUT,SERVO_MIN       		'Initialises b.6 as a servo output and sets servo to the start position
		pause 500
		serout TENDA_OUT,BAUD, ($01)			'Send command to Play track 1
		pause 1000 						'1 sec pause       


  		Do
		Readadc JAW_IN,JAW_SOUND     			'Read input voltage from Tenda/Op-Amp board 
  		JAW_POS=225-JAW_SOUND+SERVO_MIN   		'Add offset for servo's CCW output 
  		If JAW_POS<SERVO_MIN then gosub SERVOMAX
  		If JAW_POS>SERVO_MAX then gosub SERVOMIN  'Test for more than servo min position and if more, set at servo max
  		servopos JAW_OUT,JAW_POS     			'Pulse pin 4 (leg 3) width=b1 - Using servopos can help prevent jitter
  		pause b2 						'Wait Delay b2
  		If BUSY = 1 then exit
  		Loop          					'Test for Audio play finished
  
		return


SERVOMIN:
  		JAW_POS=SERVO_MIN          			'Test for less than servo min position and if less, set at servo min
  		return 

SERVOMAX:
  		JAW_POS=SERVO_MAX          			'Test for less than servo min position and if less, set at servo minservomax:
  		return 



LEOTA:
  		servo DVD_PUSH,160       			'Move servo to other end to press button and start Madame Leota 
  		pause 500            				'Hold the button down for a half a second    
  		servopos DVD_PUSH,75        			'Move the servo back to the other position
  		pause 500
  		LOW DVD_PUSH          				'Switched servo signal off to conserve power/cut down interference
    
  		Do              
  		Pause 500
  		Leotatime=Leotatime - 1
  		Loop Until Leotatime=0 
  		return

 
Retriggerdelay:      
 		Do
 		Pause 500
 		Retriggertime = Retriggertime -1 
 		Loop Until Retriggertime=0
 		return
 

fritz42_male

Senior Member
Here are the Pebble layouts - haven't finished the schematics yet.


Kiwi Board
Code:
IC||471|210|2||U?|||PICAXE18M2|IC||PICAXE18M2_2

Miscell||605|445|1||XX?||1|32|||misc_32

Miscell||468|88|1||XX?||1|32|||misc_32

Miscell||358|116|1||XX?||1|32|||misc_32

Miscell||331|116|1||XX?||1|32|||misc_32

Miscell||194|116|1||XX?||1|32|||misc_32

Wire||124|42|11||11|#FF0000|2|11||10|

Miscell||221|116|1||XX?||1|32|||misc_32

Miscell||194|88|1||XX?||1|32|||misc_32

Miscell||221|88|1||XX?||1|32|||misc_32

Wire||587|402|21||11|#FF0000|1|11||10|

Wire||180|72|23||13|#000000|14|11||8|

Wire||194|44|22||11|#FF0000|14|11||10|

Capacitor|0.1uF|715|211|4|Capacitor|C?||3|4|||cap_434

Wire||589|308|12||11|#FF0000|5|11||10|

Wire||589|180|11||11|#000000|5|11||10|

Wire||779|209|21||11|#CC6633|3|11||10|

Wire||752|209|21||11|#00A060|3|11||10|

Wire||754|372|11||11|#00A060|3|11||10|

Wire||781|317|11||11|#CC6633|2|11||10|

Wire||781|454|11||11|#000000|2|11||10|

Resistor|10000|748|405|2|Resistor|R?||1||IC||

Wire||671|152|11||11|#CC6633|4|11||10|

Resistor|22000|646|119|1|Resistor|R?||3||IC||

Miscell||605|391|1||XX?||1|32|||misc_32

Note||576|470|1||||1||PIR - B.7||NOTEPAD_11

Wire||587|72|21||11|#000000|1|11||10|

Note||280|283|1||||1||5V Motor||NOTEPAD_11

Wire||259|72|21||11|#000000|1|11||10|

Wire||124|454|11||11|#000000|2|11||10|

Miscell||687|391|1||XX?||1|32|||misc_32

Miscell||523|391|1||XX?||1|32|||misc_32

Miscell||550|391|1||XX?||1|32|||misc_32

Miscell||523|445|1||XX?||1|32|||misc_32

Miscell||687|418|1||XX?||1|32|||misc_32

Miscell||550|445|1||XX?||1|32|||misc_32

Miscell||550|418|1||XX?||1|32|||misc_32

Miscell||523|418|1||XX?||1|32|||misc_32

Resistor|330|529|322|2|Resistor|R?||1||IC||

Resistor|330|693|322|2|Resistor|R?||1||IC||

Resistor|330|556|322|2|Resistor|R?||1||IC||

Miscell||528|340|1||XX?||1|36|Cut||misc_36

Miscell||692|340|1||XX?||1|36|Cut||misc_36

Miscell||555|340|1||XX?||1|36|Cut||misc_36

Note||357|450|2||||2||Skeleton Jaw  Servo - B.5 & DVD Player Servo - B.6||NOTEPAD_22

Note||486|70|1||||1||Start Audio||NOTEPAD_11

Miscell||495|88|1||XX?||1|32|||misc_32

Note||115|90|2||||1||LED Lights||NOTEPAD_12

Note||117|121|2||||1||12V Motor||NOTEPAD_12

Wire||122|235|21||22|#FF0000|1|41||10|

Wire||122|235|11||22|#FF0000|2|41||10|

Transistor|BC559|261|126|1|IRL520|Q?|||2|IC||transistor_21

Diode|0|207|148|1|1n4001|CR?||0|1|IC||diode_101

Wire||233|180|11||11|#3253FF|2|11||10|

Wire||316|183|13||11|#A233C3|9|11||10|

Diode|0|344|148|1|1n4001|CR?||0|1|IC||diode_101

Transistor|BC559|398|153|1|IRL520|Q?|||2|IC||transistor_21

Wire||396|72|21||11|#000000|1|11||10|

Wire||370|180|11||11|#3253FF|2|11||10|

Wire||452|116|12||11|#A233C3|3|11||10|

Note||4|474|1||||2||LED Lights for bookshelf and  rocking skeleton||NOTEPAD_21

Note||178|466|1||||2||Audio uses a Tenda daughter board||NOTEPAD_21

Note||-1|418|1||||2||12V power supply to T1 or secondary 12V power supply to T2||NOTEPAD_21

Note||387|120|1||||1||LED Lights||NOTEPAD_11

Note||526|104|1||||1||Audio In||NOTEPAD_11

Note||387|11|2||||2||Seance Room Controller||NOTEPAD_22

Transistor|BC559|288|373|1|IRL520|Q?|||2|IC||transistor_21

Wire||286|402|21||11|#000000|2|11||8|

Miscell||249|281|1||XX?||1|32|||misc_32

Miscell||221|281|1||XX?||1|32|||misc_32

Diode|0|234|313|1|1n4001|CR?||0|1|IC||diode_101

Wire||231|402|21||11|#FF0000|1|11||10|

Wire||261|345|11||11|#3253FF|2|11||10|

Wire||343|400|11||11|#A233C3|5|11||10|

Miscell||605|61|1||XX?||1|32|||misc_32

Miscell||605|33|1||XX?||1|32|||misc_32

Note||639|34|1||||2||5V to Tenda/Servo Board||NOTEPAD_21

Resistor|330|474|130|2|Resistor|R?||1||IC||

Miscell||473|147|1||XX?||1|36|Cut||misc_36

Wire||341|209|21||11|#FF0000|1|11||10|

Wire||204|209|21||11|#FF0000|1|11||10|

Miscell||605|418|1||XX?||1|32|||misc_32

Resistor|330|501|322|2|Resistor|R?||1||IC||

Miscell||500|340|1||XX?||1|36|Cut||misc_36

Miscell||495|445|1||XX?||1|32|||misc_32

Miscell||495|418|1||XX?||1|32|||misc_32

Miscell||495|391|1||XX?||1|32|||misc_32

Note||350|374|1||||1||IRL520||NOTEPAD_11

Note||717|411|1||||1||Busy Signal||NOTEPAD_11

BREADBOARDSTYLE=BB37

SHOWTHETOPAREA=false

And the Audio Board

Code:
IC||283|210|1|LM1458|U?|||DIP8|IC||DIP8_1

Wire||397|264|21||11|#000000|1|11||10|

Wire||373|317|11||11|#000000|1|11||10|

Wire||254|143|12||11|#FF0000|1|31||10|

Wire||239|143|23||11|#FF0000|3|41||10|

Wire||254|155|13||11|#999999|3|41||10|

Wire||253|161|22||31|#999999|6|44||10|

Wire||254|302|12||11|#999999|1|21||10|

Diode|0|320|176|3|N4148|CR?||3|2|IC||diode_233

Resistor|2200|428|148|1|Resistor|R?||1||IC||

Capacitor|10uF|414|211|2|Capacitor|C?||1|1|||cap_112

Resistor|10000|474|212|2|Resistor|R?||1||IC||

Miscell||140|45|1||XX?||1|25|5K||misc_25

Wire||211|174|11||12|#000000|1|12||10|

Wire||236|42|21||22|#000000|5|33||10|

Wire||184|42|11||22|#000000|2|14||10|

Wire||145|209|22||23|#3253FF|4|13||10|

Wire||146|320|13||11|#3253FF|6|21||10|

Wire||199|209|22||23|#FF0000|5|13||10|

Wire||200|348|13||12|#FF0000|3|21||10|

Resistor|1000|311|350|2|Resistor|R?||3||IC||

Capacitor|0.1|320|475|1|Capacitor|C?||1|4|||cap_411

Resistor|47000|502|267|2|Resistor|R?||0||IC||

Resistor|47000|528|240|2|Resistor|R?||1||IC||

Wire||346|345|11||22|#FFFF00|6|11||10|

Wire||507|317|11||11|#000000|1|11||10|

Miscell||113|348|1||XX?||1|25|1K||misc_25

Resistor|10000|105|479|1|Resistor|R?||0||IC||

Resistor|10000|186|479|1|Resistor|R?||0||IC||

Wire||365|125|21||21|#FFFF00|1|21||8|

Wire||158|189|23||31|#FFFF00|4|41||10|

Wire||164|183|13||31|#FFFF00|6|42||10|

Capacitor|0.1|258|239|2|Capacitor|C?||1|4|||cap_412

Wire||101|264|21||11|#000000|7|11||10|

Wire||212|237|23||13|#3253FF|8|11||10|

Note||-32|252|2||||1||0V In||NOTEPAD_12

Note||-32|219|2||||1||+5V In||NOTEPAD_12

Note||254|447|2||||1||Audio In||NOTEPAD_12

Wire||308|125|11||11|#FFFF00|2|44||10|

Wire||302|125|22||23|#FFFF00|2|42||10|

Miscell||37|226|1||XX?||1|32|0V||misc_32

Miscell||37|253|1||XX?||1|32|0V||misc_32

Terminal||469|6|1||TS?||3|4|||terminal_431

Wire||47|70|11||22|#CC6633|24|33||8|

Note||536|156|1||||2||Left pin is Audio in to Kiwi, yellow pin triggers audio||NOTEPAD_21

Miscell||468|171|1||XX?||1|32|+5V||misc_32

Terminal||388|6|1||TS?||3|4|||terminal_431

Terminal||308|6|1||TS?||3|4|||terminal_431

Terminal||227|6|1||TS?||3|4|||terminal_431

Terminal||146|6|1||TS?||3|4|||terminal_431

Terminal||577|6|1||TS?||3|4|||terminal_431

Miscell||549|6|1||XX?||1|32|+5V||misc_32

Miscell||118|6|1||XX?||1|32|+5V||misc_32

Wire||586|44|21||22|#3253FF|9|11||8|

Wire||346|448|11||21|#A233C3|7|12||10|

Wire||640|44|21||11|#FF0000|7|11||8|

Wire||613|44|21||11|#000000|8|11||8|

Wire||559|44|21||23|#A233C3|10|12||8|

Terminal||547|375|1||TS?||3|1|      Speakers||terminal_131

Wire||612|290|21||21|#00A060|6|41||10|

Wire||588|317|11||22|#3253FF|4|14||10|

Wire||694|317|21||22|#3253FF|3|31||10|

Note||288|-56|2||||2||Audio/Servo Driver with Tenda Audio Board||NOTEPAD_22

Wire||531|345|21||22|#3253FF|2|41||10|

Wire||505|44|21||22|#FFFF00|4|11||10|

Miscell||495|171|1||XX?||1|32|+5V||misc_32

Wire||517|326|22||32|#A233C3|5|42||10|

Wire||523|320|13||13|#A233C3|1|33||10|

Wire||613|290|11||22|#00A060|1|33||10|

Wire||634|264|21||22|#00A060|1|12||10|

Wire||532|345|11||22|#3253FF|2|31||10|

Wire||534|400|11||11|#00A060|1|11||10|

Wire||669|400|11||11|#00A060|1|11||10|

Miscell||441|33|1||XX?||1|32|+5V||misc_32

Note||363|35|2||||1||Busy Wire link||NOTEPAD_12

BREADBOARDSTYLE=BB53

SHOWTHETOPAREA=false
 

1968neil

Senior Member
Hi,

Try using the adjusted code,
You original code as you say works fine in the simulator, i have tried it on my test set up and get a similar error, if you scope the serial lines the command is being sent fine, it appears that having the set volume and stop commands in the "running code" upsets it.
I think whats happening is the set volume and stop commands have a higher time overhead than the play commands.

Using the busy line solves the play problem, and moving the stop and volume commands to the initialise part of your program will help as you only need to use that the once as the module stores that in its eprom, this maybe where the timing overheads come in.

it works fine this way. Can't make any use of the pebble layouts as i have yet to try them, must have a play !

I also recall that there are power supply issues with the module if it shares a supply, i use a seperate 7809 reg on mine just for isolation and to know that the supply is clean and stable.
Also bear in mind that read/adc inputs have a code time overhead so this will need to be worked in with your pauses.
Look forward to seeing the circuit.
Hope this cures the issue.
Nice project/idea wish i had the time for such things ! :)

Regards
Neil


the code :
Code:
'Picaxe 18M2 Seance Room Controller

#Picaxe 18M2
 

symbol BOOK_MOTOR=B.0
symbol ROCK_LIGHT=B.1
symbol JAW_IN=B.2
symbol TENDA_OUT=B.3
symbol ROCK_MOTOR=B.4
symbol DVD_PUSH=B.5
symbol JAW_OUT=B.6
symbol PIR_IN=pinB.7
symbol BUSY=pinC.1


symbol JAW_POS=b1
symbol PIR_COUNT=b2
symbol SERVO_MIN=b3        
symbol SERVO_MAX=b4
symbol JAW_SOUND=b5

symbol Leotatime=w4
symbol Retriggertime=w5
symbol Jawtime=w6
symbol BAUD=T4800




Init:               						'Staring point to setup all inputs, outputs and set variables
            serout TENDA_OUT,BAUD, ($EF); 		'STOP MP3 module 
		pause 1000
		serout TENDA_OUT,BAUD, ($E1); 		'Set MP3 volume
  debug 
  SERVO_MIN=180
  SERVO_MAX=214
  Pause 2000         						'NORMALLY wait 60 secs for PIR to settle down - set at 2 secs for testing
 
 
Startup:
		Leotatime=300					'Set wait 20 half seconds for Leota to finish
		Retriggertime=30          			'Set wait 30 half seconds for Retriggerdelay
		Debug PIR_COUNT
  
PIRtest:
  		Do : Loop Until PIR_IN=1
  
  		Do
  		PIR_COUNT = PIR_COUNT + 1 * PIR_IN
  		Loop Until PIR_COUNT = 10
  		PIR_COUNT = 0



Routine:
		HIGH ROCK_LIGHT
  		'HIGH ROCK_MOTOR
  		'HIGH BOOK_MOTOR
  		Gosub AUDIO
  		pause 3000            				'temporary pause to see what is happening
  		LOW ROCK_LIGHT
  		'LOW ROCK_MOTOR
  		'Gosub LEOTA
  		'LOW BOOK_MOTOR
  		Gosub Retriggerdelay
  
		Goto Startup


 
AUDIO: 
  		
		Servo JAW_OUT,SERVO_MIN       		'Initialises b.6 as a servo output and sets servo to the start position
		pause 500
		serout TENDA_OUT,BAUD, ($01)			'Send command to Play track 1
		pause 1000 						'1 sec pause       


  		Do
		Readadc JAW_IN,JAW_SOUND     			'Read input voltage from Tenda/Op-Amp board 
  		JAW_POS=225-JAW_SOUND+SERVO_MIN   		'Add offset for servo's CCW output 
  		If JAW_POS<SERVO_MIN then gosub SERVOMAX
  		If JAW_POS>SERVO_MAX then gosub SERVOMIN  'Test for more than servo min position and if more, set at servo max
  		servopos JAW_OUT,JAW_POS     			'Pulse pin 4 (leg 3) width=b1 - Using servopos can help prevent jitter
  		pause b2 						'Wait Delay b2
  		If BUSY = 1 then exit
  		Loop          					'Test for Audio play finished
  
		return


SERVOMIN:
  		JAW_POS=SERVO_MIN          			'Test for less than servo min position and if less, set at servo min
  		return 

SERVOMAX:
  		JAW_POS=SERVO_MAX          			'Test for less than servo min position and if less, set at servo minservomax:
  		return 



LEOTA:
  		servo DVD_PUSH,160       			'Move servo to other end to press button and start Madame Leota 
  		pause 500            				'Hold the button down for a half a second    
  		servopos DVD_PUSH,75        			'Move the servo back to the other position
  		pause 500
  		LOW DVD_PUSH          				'Switched servo signal off to conserve power/cut down interference
    
  		Do              
  		Pause 500
  		Leotatime=Leotatime - 1
  		Loop Until Leotatime=0 
  		return

 
Retriggerdelay:      
 		Do
 		Pause 500
 		Retriggertime = Retriggertime -1 
 		Loop Until Retriggertime=0
 		return
 
Last edited:

fritz42_male

Senior Member
Hi Neil, apparently we are still having problems. Trying to isolate the issues now.

I wish I had the time to build this and test it myself but a recent job change has left me with precious little spare time so I'm helping from a distance (I'm in West Aus and Halstaff (Steve) is in California).

The annoying thing is that the simulation seems to work perfectly as regards the specific events and timing. It may come down to PSU or hardware design as you have suggested.

One interesting issue is that the Jaw servo remains energised even when we have a LOW command against that port?

Thanks for the help.

Cheers

Mike
 
Last edited:

Pat13

Senior Member
I am having problems with the Tenda board. I have the SD card formatted to FAT32, I did not use Drive Sort, just copied on SD. I have 9 mp3's recorded in stereo for a Halloween prop. On left side is verse, on right side is tone (used Audacity to record tracks). The code is similar to the one used by Fritz42_male, as we are both in contact with the same fellow, and i just used relevant parts of his code.
My problem is two fold. The Tenda seems to be playing in mono as both left and right are coming out of the HPL pin. Am going to check the HPR pin tonite after work to see if there is signal coming thru it. I used the code posted on page 22 post #216 by 1968neil, of this thread, modified for my pins and to sequence thru all files. It played first file (A001) and stopped. i do not have any resistors connected to any of the pins on the tenda
Code:
'Rem Plays 1st track and waits until finished by monitoring the tenda module busy line
'REM then plays the 2nd track and waits until finished then repeats this loop etc.





Symbol Wait_if_busy = pinB.1; Set pin 1 as Voice module active (busy Line)
Symbol Tenda = B.3 ; Tenda module on B.3
Symbol Baud = T4800


serout Tenda,Baud, ($EF); STOP MP3 module 
pause 500
serout Tenda,Baud, ($E1); Set MP3 volume
pause 500


Main:

serout Tenda,Baud, ($01) ; send command to Play track 1
pause 1000 ; 1 sec pause 

do 
if Wait_if_busy = 1 then exit ; wait until voice module has finished
loop

serout Tenda,Baud, ($02) ;send command to Play track 2
pause 1000

do
if Wait_if_busy = 1 then exit ; wait until voice module has finished
loop
serout Tenda,Baud, ($03) ;send command to Play track 3
pause 1000

do
if Wait_if_busy = 1 then exit ; wait until voice module has finished
loop
serout Tenda,Baud, ($04) ;send command to Play track 4
pause 1000

do
if Wait_if_busy = 1 then exit ; wait until voice module has finished
loop
serout Tenda,Baud, ($05) ;send command to Play track 5
pause 1000

do
if Wait_if_busy = 1 then exit ; wait until voice module has finished
loop
serout Tenda,Baud, ($06) ;send command to Play track 6
pause 1000

do
if Wait_if_busy = 1 then exit ; wait until voice module has finished
loop
serout Tenda,Baud, ($07) ;send command to Play track 7
pause 1000

do
if Wait_if_busy = 1 then exit ; wait until voice module has finished
loop
serout Tenda,Baud, ($08) ;send command to Play track 8
pause 1000

do
if Wait_if_busy = 1 then exit ; wait until voice module has finished
loop
serout Tenda,Baud, ($09) ;send command to Play track 9
pause 1000

do
if Wait_if_busy = 1 then exit ; wait until voice module has finished
loop

Goto main
i have contacted Tenda about the stereo to mono thing and they are going to the engineer with the query. Has anyone else run into this problem?
 

Jeff Haas

Senior Member
I've worked with the Tenda board, here are a few (probably obvious) suggestions, but worth double-checking:

Check the mp3 track - listen to it on the computer before copying it to the SD card. You should hear your vocal track out of one speaker and the tone track out of the other. The Audacity user interface is a bit confusing, it's possible to click on something in Audacity and get a mono track instead of the stereo track you want.

Make sure you've hooked up the headphone jack correctly. Test playing back a standard stereo mp3 through the Tenda board, you should hear both channels.

It's worth the small amount of time to use Drive Sort; name the files "001 Intro.mp3", "002 Second Track.mp3" etc and sort them after they're copied to the SD card. Drive Sort will sort them by the 001, 002 etc at the beginning of each file name. This will make it much easier to manage them.

Jeff
 

1968neil

Senior Member
Hi Pat13,

Drive sort will sort out the file problem, i used that when i posted the code you used.

Other issues that may arrise :

Power supply to the module needs to CLEAN and free from any noise, i used screened cables from the outputs as this seems to be the biggest noise creator, decoupling plays a big part on reliable operation, i even have decoupling on the busy line this will help with debounce when the busy line goes high again.
I use the modules to send voice prompts over a pmr radio system and have no problems with the rf getting in since i decoupled it properly.
The unit has been in service daily since the beginning of the year with no problems.


As far as using two tracks one in each channel i see no problems if the tracks are split properly, audacity isnt that user friendly and may take a bit if playing around to achieve what you want, but it IS possible.
A great little module for the price tag.

Regards
Neil
 

Pat13

Senior Member
Hi Pat13,

Drive sort will sort out the file problem, i used that when i posted the code you used.

Other issues that may arrise :

Power supply to the module needs to CLEAN and free from any noise, i used screened cables from the outputs as this seems to be the biggest noise creator, decoupling plays a big part on reliable operation, i even have decoupling on the busy line this will help with debounce when the busy line goes high again.
I use the modules to send voice prompts over a pmr radio system and have no problems with the rf getting in since i decoupled it properly.
The unit has been in service daily since the beginning of the year with no problems.


As far as using two tracks one in each channel i see no problems if the tracks are split properly, audacity isnt that user friendly and may take a bit if playing around to achieve what you want, but it IS possible.
A great little module for the price tag.

Regards
Neil
Thanks folks, I seem to have resolved the issues, the mono thing was a bad solder, and the other seems to have sorted itself out, the program now works. As far as power I am using a hacked computer power supply to power the entire prop. The 5v leg will power the 18M2, the servos and a circuit to convert the tone track from the tenda into pulses to drive a jaw servo to mimic talking. The Tenda will be powered off the 12V leg of the CPS. I have not been able to get the talking circuit running properly. The designer of the circuit and myself have been emailing back and forth and we are pretty sure it is either a soldering issue (some cold solders, perhaps, though the circuit is showing continuity and there is no spill over) or it may be that i am powering the tenda and the 18M2 off the same power source (the CPS). He has indicated that he had some issues from powering the 18M2 and the tenda from the same source, not sure if that would be an issue using different legs of a CPS.
i have seen other posts in which decoupling was mentioned but I'm not sure what it is.
It is a great module! if i can get this system worked out, i want to expand to two, perhaps three animated props that can interact with each other.
 

fritz42_male

Senior Member
The Tenda board uses 5V.

If I was you I'd power the servos off a 7806 regulator connected to the 12V line and the Tenda off a 7805 again connected to the 12V line. Both with plenty of decoupling and electro caps as per the 78xx requirements (obviously you can use more sophisticated regulators if you want).

I'd power the the Picaxe and the other stuff off the 5V line.
 

Pat13

Senior Member
The Tenda board uses 5V.

If I was you I'd power the servos off a 7806 regulator connected to the 12V line and the Tenda off a 7805 again connected to the 12V line. Both with plenty of decoupling and electro caps as per the 78xx requirements (obviously you can use more sophisticated regulators if you want).

I'd power the the Picaxe and the other stuff off the 5V line.
Hi Fitz, I'm using Halstaff's daughter board and we have been in regular email contact trying to resolve this. I have gone over my board and resoldered everything to make sure I had no cold solders. At his suggestion, i added a 330 ohm resistor between the picaxe and the servo. I have since added the 7805 for the tenda. I still have no joy. I know that the servo is working (ran simple servo code) and i know that the tenda is working (ran 1968neil's code). I am at a loss. The only thing I can think is that either i fried something during soldering (although nothing looks burned) or I was sold the wrong diode and the wrong trim pots. Since I am a newbie to electronics and have to trust that the store i deal with (which is the only supply store in town) is giving me the right parts.
here is the code I am using, which I borrowed from Halstaff, and which has been working for him.
Code:
symbol JAW_IN=B.2           'tone track from right side of tenda
symbol TENDA_OUT=B.3    'tenda trigger
symbol JAW_OUT=B.6        'servo
symbol JAW_POS=b1
symbol SERVO_MIN=b3                                                               
symbol SERVO_MAX=b4
symbol JAW_SOUND=b5
symbol Jawtime=w6                                                       
symbol BAUD=T4800
Init:                                                                                                                        'Staring point to setup all inputs, outputs and set variables
 
            serout TENDA_OUT,BAUD, ($EF);                                                 'STOP MP3 module 
                                pause 1000
                                serout TENDA_OUT,BAUD, ($E8);                             'Set MP3 volume
                                SERVO_MIN=180                                                             'Mouth open position
                                SERVO_MAX=214                                                            'Mouth closed position


Startup:
		Jawtime=8950 
Routine:
                                                                                                                'Turn on skeleton eyes
                Gosub AUDIO                                                                                                    'Start skeleton greeting
                pause 3000                                         'temporary pause to see what is happening
AUDIO:  
                Servo JAW_OUT,SERVO_MAX                                   'Initialises b.6 as a servo output and sets servo to the start position
                wait 2                                                                    
                serout TENDA_OUT,BAUD,($02)                               'Start playing first mp3
                 
                Do             
                Readadc JAW_IN,JAW_SOUND                                 'Read input voltage into b0
                JAW_POS=225-JAW_SOUND+SERVO_MIN                   'Add offset for servo's CCW output 
                If JAW_POS<SERVO_MIN then gosub SERVOMAX
                If JAW_POS>SERVO_MAX then gosub SERVOMIN           'Test for more than servo min position and if more, set at servo max
                servopos JAW_OUT,JAW_POS                                  'Pulse pin 4 (leg 3) width=b1 - Using servopos can help prevent jitter
                pause b2
                Jawtime=Jawtime - 1
                Loop Until Jawtime=0                                                                    'Wait Delay b2 
                JAW_POS=203                                                                                  
                return


SERVOMIN:
                JAW_POS=SERVO_MIN                                 'Test for less than servo min position and if less, set at servo min
                return   

SERVOMAX:
                JAW_POS=SERVO_MAX                                               'Test for less than servo min position and if less, set at servo minservomax:
                return 

                return
When the code starts, the jaw opens and closes and then does not respond. I am using a tone of 1200 hertz.
 

centrex

Senior Member
For those who can access the Australian Silicon Chip magazine the October issue has a full length article on using the MP3 player incl how to set up the files.
It is not a Picaxe project but could answer a lot of the above questions about the file system and the unwanted noise.
regards
Centrex
 

1968neil

Senior Member
i have seen other posts in which decoupling was mentioned but I'm not sure what it is.

Decoupling is a must if using servos, they inherently generate noise due to the motors inside.

To decouple a basic circuit add a 100nf capacitor directly across the supply of the picaxe and the tenda module as CLOSE to the chips and module as physically possible. i tend to use a surface mount version and solder it directly to the pins below the chip.

In my experience the tenda module works best at 9v so a 7809 would be ideal, again decouple the input and the output of the regulator as close to the pins as possible and add a good resevoir capacitor also (1000uF on the input and 22uF on the output)

I would also suggest using a 10k pot instead of the audio circuit, if adjusting the pot makes your jaw move then the picaxe/servo side of your project is ok add the pot between the 5v and ov rails and the wiper to the picaxe adc input pin.

if nothing works as expected after substituting the audio circuit with a pot then your picaxe/servo side of things has some thing amiss.
Hope this simplifies the fault finding process for you.
Regards
Neil


For those who can access the Australian Silicon Chip magazine the October issue has a full length article on using the MP3 player incl how to set up the files.
It is not a Picaxe project but could answer a lot of the above questions about the file system and the unwanted noise.
regards
Centrex
I have an online subscription and the october issue hasn't yet been uploaded !, Silicon Chip whilst a great mag has the idea of uploading bits of the mag over the coming month rather than the whole issue in one go, very frustrating but they wont change it.
Hence i wont be renewing my annual subscription !
Rant over
Regards
Neil
 

Pat13

Senior Member
Decoupling is a must if using servos, they inherently generate noise due to the motors inside.

To decouple a basic circuit add a 100nf capacitor directly across the supply of the picaxe and the tenda module as CLOSE to the chips and module as physically possible. i tend to use a surface mount version and solder it directly to the pins below the chip.

In my experience the tenda module works best at 9v so a 7809 would be ideal, again decouple the input and the output of the regulator as close to the pins as possible and add a good resevoir capacitor also (1000uF on the input and 22uF on the output)

I would also suggest using a 10k pot instead of the audio circuit, if adjusting the pot makes your jaw move then the picaxe/servo side of your project is ok add the pot between the 5v and ov rails and the wiper to the picaxe adc input pin.

if nothing works as expected after substituting the audio circuit with a pot then your picaxe/servo side of things has some thing amiss.
Hope this simplifies the fault finding process for you.
Regards
Neil
Ok, mocked this up on the breadboard, adding a 100uf cap close to the picaxe at the B.3/B.4 end, using a 10k pot and i did get some response out of the servo at the 11 -12 o'clock position of the pot . I could best describe the servo response as "jerky", like it was getting intermittent voltage, for lack of a better term. The servo did not move to position 75 when the pot was turned one way and then to pos 225 when turned in the opposite direction. At best it moved from 150 to 153.
i then took the supposed 1k pot, connected it and got the same response. I took a vid but cannot attach it here.
 
Last edited:

fritz42_male

Senior Member
Ok, mocked this up on the breadboard, adding a 100uf cap close to the picaxe at the B.3/B.4 end, using a 10k pot and i did get some response out of the servo at the 11 -12 o'clock position of the pot . I could best describe the servo response as "jerky", like it was getting intermittent voltage, for lack of a better term. The servo did not move to position 75 when the pot was turned one way and then to pos 225 when turned in the opposite direction. At best it moved from 150 to 153.
i then took the supposed 1k pot, connected it and got the same response. I took a vid but cannot attach it here.
Odd - I've never had the slightest problem with Picaxes and servos. New battery pack or mains power supply?

If you run a simple program to send the servo to start, mid point and end with a pause between each movement does it work correctly?
 
Top