https://www.instructables.com/id/PICAXE-Controlling-the-ISD1760-Voice-Recorder-Modu/

axemaker

New Member
I have constructed the above project and programmed the 20X2 as shown with the instructions. I included the missing command "loop" between return and end. The ISD1760 should play, as in the example, 94.1 FM , when powered up. (This is intended to be a voice announcement of a radio tuner). But it plays " 8 3 9 point " and repeats it. As an exercise, I'd like to get it working.
Different from that -- I plan on using this setup to play several, say, fifty announcements at random intervals on receiving an input to one of the 20X2 pins. The announcements may vary in length betwen 4secs. and 10secs.
Your help for this novice would be much appreciated.
 

inglewoodpete

Senior Member
Welcome to the PICAXE forum.

I had a look at the webpage you posted. I have to say my 'read' of the page was pretty superficial.

Did you download the code or did you have to transcribe it from the screen? I tried to copy the code (to paste it in the PICAXE Programming Editor) and it appeared to be an image, not text. If that was the case, I suggest you post the code you retyped (or downloaded) for the PE. You will have a better chance of Forum members giving you some help if they don't have to transcribe the code.

Edit: I see there is a downloadable file the should contain the code but you have to subscribe to the instructables to access it.
 

papaof2

Senior Member
FreeOCR can probably read the image and translate it to program text. I've good luck using it for other image-to-text work - and it's free.
 

axemaker

New Member
I've typed the program into the Picaxe Programming Editor as shown on the screen, adding the missing Loop command, as mentioned above. I must admit I haven't experimented with it as much as I wish to. Maybe starting with something simpler that embodies the same commands would provide some knowhow. When I do a simulation of the program it goes through five pauses and then at the end of Rst it stops and shows stack error-return without gosub.
 

Aries

New Member
Please ... post your code exactly as you have it, so that we can see what you are doing. Just copy it straight from the editor into your post, put [ CODE ] (without spaces between the square brackets) at the begining of the code, and put [ /CODE ] (again, without spaces) at the end of your code. This will keep the formatting and make it much easier for everyone.
 

axemaker

New Member
Code:
; using 20X2 connected to ISD1760 to achieve, as in this code example, 94.1 FM, the announcement of a radio tuner frequency
;
;


;PINS Set up
;C.O SDO to MOSI ISD1760
;B.5 SDI to MISO ISD1760
;B.7 SCLK
;
;
; ******** Directives ******

# com 5                                 
# picaxe 20X2   
;                      
;
;****** Constants and Variables *******

symbol CS = C.0                          
symbol i = b1                            ; counter i
symbol k = b2                            ; counter k       

;************ Main Program ************

do      
let k = 0                                
for i = 1 to 5                           ; for count of 5: Play 5 sound clips 
                          
gosub Rst                                ; goto Reset subroutine                          ;                                  ; 
gosub PU                                 ; goto ISD1760 power up subroutine;

if i = 1 then let b3 = 9  endif
if i = 2 then let b3 = 4  endif
if i = 3 then let b3 = 10 endif
if i = 4 then let b3 = 1  endif
if i = 5 then let b3 = 11 endif

gosub Fwd
gosub Ply
next i


Rst:                                     ; ISD Reset subroutine

Low CS                                   ; select 1760
let b0 = 0x03                            ; set b0 to first byte of reset command
spiout B.7,  C.1, LSBFirst_L,  (b0/8)    ; send first byte ,  LSB first,  8 bits
let b0 = 0x00                            ; set b0 to second byte of reset command
spiout B.7, C.1,  LSBFirst_L,  (b0/8)    ; send second byte, LSB first, 8 bits
High CS                                  ; deselect ISD1760
return                                 



PU:                                      ; ISD1760 Power up routine

Low CS                                   ; select ISD1760
let b0 = 0x01                            ; set b0 to first byte of PU command
spiout B.7,  C.1,  LSBFirst_L, (b0/8)    ; send first byte, LSB first, 8 bits
let b0 = 0x00                            ; send b0 to second byte of PU command
spiout B.7, C.1,  LSBFirst_L,  (b0/8)    ; send second byte,  LSB first,  8 bits
High CS                                  ; deselect ISD1760
return


Ply:                                     ; ISD1760 Play routine

Low CS                                   ; select ISD1760
let b0 = 0x40                            ; set b0 to first byte of Play command
spiout B.7,  C.1,  LSBFirst_L, (b0/8)    ; send first bytee, LSB first, 8 bits
let b0 = 0x00                            ; set b0 to second byte of Play command
spiout B.7,  C.1,  LSBFirst_L, (b0/8)    ; send second byte, LSB first,8 bits
High CS                                  ; deselect ISD1760
pause 1500 
return                                   ; wait 1.5 seconds for message to play

Fwd:                                     ; ISD1760 Forward to next message

if b3 = 0 then return endif              ; if b3 = 0 then do nothing
for k = k to b3                          ; forward b3 number of times
Low CS                                   ; select ISD1760
let b0 = 0x48                            ; set b0 to first byte of Fwd command
spiout B.7,  C.1, LSBFirst_L,  (b0/8)    ; send first byte, LSB first, 8 bits
let b0 = 0x00                            ; set b0 to second byte of Fwd command
spiout B.7, C.1,  LSBFirst_L,  (b0/8)    ; send seccond byte, LSB first, 8 bits
High CS                                  ; de-select ISD1760
next k
return
loop                                     ; (loop was missing from author's program)
end


;**************************** END  *****************************
The repeating announcement I'm getting is 8 3 9 point
 

axemaker

New Member
let k = 0 in the above program should not be there. But when reprogrammed with line removed the result was the same.
 

AllyCat

Senior Member
Hi,

Yes, as I suspected, you've put the LOOP in the wrong place, it should be at the end of the main: program, before the rst: subroutine. At the moment the main program flow is "falling into" the subroutine and then doesn't have anywhere to RETURN.

It looks as if there must an "extra" sound file before the list of "number" files; How are/were the files copied to the sound player? It you can't find/remove this file, then just increase the "if .. then b3 = nn " numbers by 1.

In addition to the missing LOOP instruction, IMHO that instructable is not very well coded. Just one extra subroutine could have avoided the need to use an X2 PICaxe, and the way the files are "selected" seems very "Brute Force..". I don't know anything about that particular Sound Module, but it would be interesting to see how it compares with the PICAXE-14 Audio Project Kit. ;)

Cheers, Alan.
 

axemaker

New Member
Cheers, AllyCat !
I followed your instructions and got it to work as it should -- announcing 94.1 FM
It doesn't matter now, but I recorded the files manually on the ISD1760 using the push swiches on the module.
As you'll see in my first post to the forum, my own project is different, but I feel I can make some progress with it now.
Thanks a lot.
 

AllyCat

Senior Member
Hi,

There are only two other threads on the forum concerning this Sound Module and neither really comes to any conclusion, so I've been looking at the Data Sheet and can partly answer my own question above. Firstly, it's the "ISD1700 Design Guide" which is needed, not just the Data Sheet, but that document runs to over 80 pages, so is not for the novice. ;)

The main difference between this module and the PICaxe Audio Project Kit is that it contains its own EEPROM (memory) whilst the PICaxe Kit requires a "spare" micro SD card at a significant additional cost. However, its memory plays for only about one minute, compared with the hours that can be generated from an SD card. Also, the audio is recorded via the module's microphone, not downloaded in .MP3 or .WAV file format.

The ISD1760 chip has three control modes: 1) Directly by the push-buttons on the module PCB, or 2) Similar commands sent via the "3-wire SPI Bus" (from the PICaxe), or 3) By a more complex set of commands sent via the SPI Bus. The Instructable uses the middle of these with very simple commands which do no more than can be achieved by pressing the buttons. Therefore, a few of the PICaxe pins could have been wired directly across the push-button switches (to emulate them being pressed) and avoided any need to use the SPI Bus, but that would require direct soldering to the PCB, rather than using the Interface Header/Connector. Unfortunately, that connector doesn't include the Ready/Busy status signal which might be useful for more advanced PICaxe control.

Looking carefully at the program (above), the subroutines are all very similar and could be even simpler! Probably a single "Bit Banging SPI Routine" might be used, within a program of similar size and with no need to use an X2 PIcaxe (for its SPI Bus commands). And/Or the memory of the ISD1760 can be accessed via the SPI Bus directly in increments of typically 1/8 second (125 ms), for a more "rich" control of the voice message fragments.

Finally, the issue of the "importance" of the two supply rail diodes to prevent the PICaxe being "destroyed". They shouldn't be necessary and the "Design Guide" specifically recommends that the supply rails of the two chips are connected together. It's really only an inductance that might normally generate high "spike" voltages to damage the PICaxe and the basic module doesn't have any inductors. But a Loudspeaker does have inductance so if that is driven "badly" then it might be able to generate enough voltage to damage any of the semiconductors. In particular, the Intructable shows only a 100nF capacitor across the supply rail to the ISD 1760, which is rather "pointless" because there are already similar values on the module PCB. However, particularly as the chip has a "Class D" (PWM switching) audio output stage, I would fit at least a 100 uF capacitor, and maybe more, across its Supply Rail(s). But personally, I suspect that the author's 20X2 chips were NOT damaged, but that at some time he used a SERRXD command (which executes an "invisible" DISCONNECT) and that the chips could be brought back to (Programming) Life, by using PICaxe's "Hard(ware) Reset Procedure".

Cheers, Alan.
 

axemaker

New Member
Hi AllyCat
It's been very interesting to read all your comments in your message yesterday. I've had to see to other work since my last post but intend, when I get a chance, to continue with the project. I will fit a 250uF cap on the supply rail. I too felt there should be one there. Anything I've read in adverts for the ISD1760 refers to the possibility of adjusting the sampling rate by fitting and external resistor. But where do you fit it, and what value ?. Multi-messages indeed !. Not many, if we're thinking of a message consisting of two sentences. However, for my use a "message" would be as brief as "Red led on", or "Green flashing", so the amount of memory would be sufficient. The click noise of the record push-button when pressed seems to be picked up by the mic. In any case, I like the idea of using a text-to-speech app and using Audacity "Effects" function to manipulate the text-speech voices. Any advice with applying that idea ?

Bye from Axemaker
 

AllyCat

Senior Member
Hi,

The "Design Guide" gives a "Typical Application Circuit" diagram, but I don't know how close that is to the available Voice Recorder Modules. One of the ebay sellers shows a circuit diagram, but the detail (resolution) is very poor and it shows 7 buttons whilst the modules appear to have only six? The connector does appear to carry the "Anain" (ANAL?) pin which can be used to load audio signals (not direct data files) from a computer, instead of the Microphone. But that does require more sophisticated SPI Bus control commands.

ISD1760-moduleSchematic.png

The sampling frequency is set by a resistor on pin 20 of the chip, nominally 80k ohms for 8 kHz (+/- 5%). There are very few resistors in (pictures of) that area of the module PCB, so I guess it's R7 it looks to be R6 (75k). However, I wouldn't bother to attempt to change the frequency; 8 kHz basically gives "telephone quality" which is "about right" for most applications. Only reduce the frequency if you're desperate for a longer playing time, or I believe it's possible to drive the pin with an ~ 2MHz clock (for 8 kHz sampling) to give better precision of the frequency than the default +/- 5%.

Personally, I'm not a fan of the SPI Bus, much preferring I2C (particularly for bi-directional communications) and that particular "Instructable" seems too simplistic for what you've described in your project. It appears that the module needs to use the Bus in bi-directional mode, i.e. employing both MOSI and MISO pins (at the same time?), which is not well-supported even by the PICaxe X2 chips. Therefore, I would be looking at "Bit Banging" the SPI (with either an M2 or X2) using my own program code (or perhaps employing the base PIC's SPI hardware via PICaxe's POKE/PEEKSFR commands); It won't be as fast as using the native HSPIN or HSPOUT commands, but should be fast enough:

To clarify why I "dislike" the program code in the Instructable; it has four very similar subroutines, each starting with a Low CS (Enable chip-select), ending with a High CS (Disable chip-select) which appears to be an integral part of the SPI protocol of the ISD 1760. Each routine sends a second zero byte, so a single WORD could be defined for each function (e.g. Symbol PLAY = $0040 : W0 = PLAY : GOSUB sendSPI ) with a single subroutine used for all these basic functions. Then, more sophisticated commands devised for loading the address pointer(s), rather than just repeatedly stepping to the next track (which would take some time for 50+ tracks). But all this is significantly more "advanced" programming than is shown in the Instructable. :(

Cheers, Alan.
 
Last edited:

axemaker

New Member
Hi AllyCat
Thank you for all your info.
Hoping to make some progress with this project when time allows. whenever that may be.
Bye for now
Axemaker
 
Top