Introduction: PICAXE - Controlling the ISD1760 Voice Recorder Module With SPI (Serial Peripheral Interface)
This project uses the SPI (3-wire bus) and a PICAXE 20X2 microcontroller to control the sequential playing of messages recorded on an ISD1760 voice recording module. This is a bit tricky and required a bit of SPI bus bit banging to get it to work. If you can understand this project, then you will understand how to get the module to play any number of messages and in any order you like.
The ISD1760 module as shown in the picture allows you to record any number of messages with a total messages length of between 40 and 120 seconds depending on sample frequency. You can use either the manual push buttons on the module or the SPI (Serial Peripheral Interface) bus to do this.
For this particular demonstration I wanted to get the ISD1760 to play the message "94.1 FM". In the future I want use this method to read out the frequency of a digitally tuned radio. This demonstration program only reads out "94.1 FM", but if you understand this method you will see that you can easily modify the program to read out any possible FM frequency.
To begin you will manually record the numbers 1 to 9 as individual, approximately 2 seconds each, recordings. Then record the word "Point", then the word "FM", and finally the word "0". Again, all are approximately 2 second recordings. To do this use the push button switches on the module which allow you to manually record, forward, play and erase. When you are finished you will have 12 short, approximately 2 second messages recorded in the order specified above. Before you start play around with the module, record, play, erase and forward with a couple of messages so that you understand how the module works manually.
Step 1: The Circuit Diagram
The Circuit diagram is shown in the attached image. The reader may wonder why we use a PICAXE 20X2 with so many extra pins when perhaps a lower pin count I.C might do? This is because the 20X2 allows us to use a simplified version of the SPIOUT command. Using a 20X2 simplifies the code substantially. For more information on this see the Picaxe programming manuals.
A very IMPORTANT part of this circuit is the use of diodes D1 and D2. DO NOT be tempted to omit these. At first glance they do not seem to serve any purpose. There is a very important reason they are there. When I first connected both the ISD1760 and the PICAXE 20X2 to the same battery, the PICAXE 20X2 would stop working and I found could never be programmed again. I blew several 20X2 I.Cs (at $5 a pop) before discovering that just connecting both to the same battery would damage the 20X2. I can only conclude that the ISD1760 is putting some nasty spikes on the power rail, although I was not able to see them on a scope. I determined that either using separate battery packs with a common ground, or using Diodes D1 and D2 to isolate the power prevents this issue.
I also added resistors R1 to R4 on each of the SPI lines and chip select line to provide isolation although strictly speaking you should not need these. The SPI interface consists of the connections: SCLK - the clock line, MOSI - Master Out Slave In, MISO - Master In Slave Out and SS - Slave Select or sometimes also called CS - Chip Select.
Also attached is the circuit diagram for connecting the PICAXE programming jack and a picture with details showing how to wire it's 3 pins to Serial IN, Serial Out and Ground.
Step 2: Prototyping the Circuit
For this project I only built the circuit on a breadboard. In the image you will see that the ISD1760 is connected to a PICAXE 20X2 I.C on a breadboard using male to female jumper wires.
Here the programming jack along with resistors R5 and R6 are on a separate piece of proto-board that I use for connecting the PICAXE cable to any breadboard. You can see how this is made in the Circuit Diagram section of this instructable or you can just wire your jack directly to the breadboard as you wish.
To power the circuit I just connected up a battery holder with 3 x AA batteries and fed the ISD1760 and 20X2 power via diodes D1 and D2. You can use a benchtop power supply also. Again a very IMPORTANT part of this circuit is the use of diodes D1 and D2. DO NOT be tempted to omit these. Make sure you have these isolation diodes separating the ISD1760 and PICAXE 20X2 power pins. If you don't you will likely blow up your 20X2!
Step 3: The 20X2 Program
The program is shown in the attached images and is also included in the zip file in the last step of the instructables as ISD1760.bas. This program is intended to read out the message "94.1 FM" from several separate sound clips. However once you understand how the program works, you can modify it to read out anything you want.
The program is fully commented and you should be able to follow the steps by reading the comments. The overall method used in this example is to reset and power up the ISD1760 and the send multiple forward commands to cue up the correct sound clip and then play it. Here "94.1 FM" is composed of 5 separate sound clips and you can see that based on the order in which they were recorded, we send 9 forward commands to get to the "9" recording, then 4 forward commands to get to the "4" recording, then 10 forward commands to get to the "." recording, then 1 forward to get to the "1" recording, then 11 forward commands to get to the "FM" recording.
The key points to notice in the program are when the reset, power up and forward commands are used. Note that after reset or power up, the ISD1760 will be at the last recording made if you send a play command. This is why we record the zero last. After reset or power up we are always at the zero or "0" recording and this is the reference point for counting forward commands. Note also that after a reset you need to send a power up command.
Another important thing to notice is the SPIOUT command structure. In this command (spiout B.7, C.1, LSBFirst_L, (b0/8)) we have to state SCLK and SDO pins, that the data is to be sent Least Significant Bit (LSB) first and that it uses an 8 bit byte. Here b0 contains the command we will send.
Step 4: Parts List
To build this project you need:
1 - PICAXE Programming Cable (Solarbotics 28405)
1 - ISD1760 Module (DX.Com SKU: 281926)
1 - Breadboard (DX.Com SKU: 121534)
1 - Pack of Male to Female jumper wires (DX.Com SKU: 33907)
1 - Pack of Male to Male jumper wires (DX.Com SKU: 121345)
1 - PICAXE 20X2 Microcontroller (Solarbotics 28465)
2 - 0.1 Uf capacitor
4 - 330 ohm resistor
1 - 10K resistor
1 - 22K resistor
2 - 1N4007 diode
1 - 3.5mm stereo jack (Solarbotics 17850)
1 - 5cm x 7cm protoboard (DX.Com SKU: 143913)
1 - Pack of alligator jumpers
3 - AA batteries or 5 V power supply
3 - AA battery holder (Solarbotics 17010)
1 - 9V battery clip for battery holder
1- 8 Ohm loudspeaker
solder, wire, tools
PICAXE Programming Editor - free Software from www.Picaxe.com
Step 5: Attachments
Attached is a zip file containing the photos, circuit diagram, picaxe programming guide, ISD1760 spec and program.
Step 6: Read My Ebook "PICAXE Microcontroller Projects for Makers" for More Projects Like This.
Read My ebook "PICAXE Microcontroller Projects for Makers" for more projects like this. Available at Apple, Chapters, Barnes and Noble, Smashwords etc.
This eBook contains detailed instructions on how to build and program 15 different PICAXE Microcontroller projects. It is very comprehensive and includes all of the programs as well as circuit diagrams, parts lists, photographs and construction details.
Visit my website at http://www.squeezebyte.com
We have a be nice policy.
Please be positive and constructive.