Some good news! Using a square wave oscillator to provide loop functionality does indeed provide more stable operation when ‘loop’ is active whilst recording. The only downside is that the oscillator is bleeding into the audio input of the ISD1820, which results in a high pitched whining sound being recorded. I suppose the other downside is that several inverters of the CD40106 are redundant. Is that really a problem? Well, perhaps there might be a simpler way to create an oscillator.
The granular effect I was hoping for wasn’t achieved. The oscillator was producing a square wave which was connected to the play trigger pin of the ISD1820. This oscillator is running at such a high frequency that once recording ceases it’s only a fraction of a second before the play trigger pin receives a rising edge required to begin playing. Whilst the sample is playing, the loop oscillator continues to send rising edges to the play trigger pin. This doesn’t seen to be an issue as the sample continues to play to the end at which point it’s ready to receive another rising edge and begin playing again, this gives the impression of looped playback. I experimented by connecting a loop oscillator to the play gate pin. The sample will only play when +5 volts is present at this pin. When the loop oscillator waveform drops to 0V the sample stops playing. As the loop oscillator is running at a high frequency all that was heard was a series of clicks. A granular effect should be achievable with control over pulse width. I’m in two minds about implementing this as it will complicate the interface somewhat as to get a basic loop effect as before one would need to set both the frequency and pulse width of the oscillator accordingly.
I went back to ‘Getting Started in Electronics’ to reference a touch switch circuit which utilises a CD4011 IC. I didn’t have a 22m resistor as suggested by the schematic but found a combination of a 22r and 100k resistor sufficed. The touch switch was wired up to the record pin of the ISD1820 and works well. I’m thinking now that perhaps the oscillator and touch switches can be provided by a single AVR chip. Perhaps an ATTiny85 has too few pins for the functionality I have in mind? Some further thought is required.
Todays lab session saw me looking into the unreliable behaviour of the ISD1820 Voice Recorder Module when attempting to record whilst the loop switch is active. The datasheet states that the record function takes precedence over every other function, so providing the record pin is high the device should record. Therefore, I assume that the ISD1820 should still record even when one of the play modes is active. This is essentially what is happening when loop mode is switched on, it’s sending 5 volts to the play trigger pin. There were two avenues I wanted to explore in my attempt to solve the issue.
First of all I wanted to see if there was some way of using a transistor to switch off the voltage being supplied to the play trigger pin of the ISD1820 as doing this manually, through flicking the loop switch back and forth, returns the ISD1820 to normal operation. I found a bunch of PN2222 NPN transistors in my components box. I had to refresh my memory on the difference between NPN and PNP transistors. A tutorial on the ‘Learning About Electronics’ website helped to clear up the difference between the two. Essentially an NPN transistor allows current to flow from the collector to the emitter when a certain amount of current is applied to the base. I sketched out a couple of possible circuit configurations but unfortunately couldn’t figure out a way to implement a PN2222 in such a way that would allow current flowing through the loop switch to be cut when record is active. After spending some time on this I decided to cut my losses and explore another potential avenue as to the source of the issue.
I wondered if the record button needed further debouncing as rapid switching of the record function may not be appreciated by the ISD1820! Keen to try this in hardware, I added a second 104 ceramic capacitor in parallel to the one already running from one leg of the record button to ground. Upon doing this, my computer, which was powering the circuit via USB complained of a connected USB device drawing too much power. I must have shorted the circuit in some way. This reminded me of my supervisor warning some young students not to make new connections on a breadboard whilst it’s powered by your computer. I must bear this in mind as I only recently bought my MacBook Pro and wouldn’t want to have to get it repaired so early on. My second attempt at hardware switch debouncing saw me implementing or at least trying to implement a debouncing switch circuit described in ‘Getting Started in Electronics’ by Forest M Mims, the infamous creator of the ‘Atari Punk Console’! Sadly, I couldn’t get this to work either. I’m starting to wonder if I need more patience in my pursuits!
I’ve successfully implemented debouncing with an Arduino board in the past so I decided to follow this route, reminding myself of what needed to be done by following a tutorial on the Arduino website. This worked and ran successfully on the ATTiny85. Sadly the ISD1820 still behaved as erratically as before when recording with loop active.
So, I was able to explore a few things during this session and cross them off the list as it were. I reminded myself of how transistors work and practiced programming the ATTiny85. The next action for me to take is to implement an oscillator based on a CD40106 inverter IC as suggested by Peter Edwards for triggering the sample in a looped fashion. I wonder if some granular style effects might be achieved by decoupling the loop end point from the end of the sample, as well as potentially fixing the erratic behaviour of the ISD1820.
A tough but productive day in the lab all in all. After failed attempts to flash a ATTiny85 via a USBasp programmer obtained for a couple of pounds at Maker Faire Newcastle, I decided to resort to using an Arduino UNO as an ISP. Again I faced similar problems flashing the ATTiny85 via AVR Dude. The Mac Terminal complained of undefined references to registers. This problem was reported in the book ‘AVR Programming: Learning to Write Software for Hardware’. The book suggests that this could be due to an issue with portpins.h. Apparently there is an inconsistency between portpins.h provided in early versions of the Arduino IDE and portions.h supplied with the AVR library included with the book. This was when it occurred to me that perhaps it was the AVR Library which was the source of the error. I remembered seeing an MIT tutorial for writing to the ATTiny85 via the Arduino IDE which was conveniently linked to via the Bastl Instruments site. Suffice to say that after following the tutorial I was able to successfully flash the ATTiny85 using the Arduino IDE and an Arduino UNO as an ISP. My next question is can the Arduino UNO be replaced with the USBasp? Through the process of troubleshooting I managed to successfully update the firmware of the USBasp, so it’s ready to be tested but in the interest of time I’ve decided to leave this for another day.
Following guidance from Peter Edward’s tutorial on the ISD1820 I breadboarded a circuit which Peter had based on a circuit described in the ISD1820 datasheet. Pitch control is provided through a sliding potentiometer, and a toggle switch activates sample looping. Another feature taken from Peter’s suggestions is a line level input. Peter’s schematic provides two gain settings. I decide to opt for the high gain configuration only as the use case I have in mind is that of recording audio from a computer or phone. When I initially test the circuit, it appears to record but with a large amount of high pitch noise. After snooping around I was able to attribute this to the SPI connections coming from the Arduino Uno to the ATTiny85 which was still on the same breadboard. I was surprised by the amount of noise created. Removing these connections solved the issue immediately.
With the circuit now functioning without the additional SPI noise I was able to explore its operation. I enjoyed playing around with it. The ISD1820 is certainly lo-fi, however it has potential to be musically interesting and fun to use. Both the mic and line inputs clip very easily. I’m going to explore changing resistor values in an attempt to reduce the gain on both. Also, currently the mic and line inputs are recorded simultaneously – I wonder if there’s a way to cut the mic when a jack is connected to the line input? I did try temporarily disconnecting the mic from pin 4 of the ISD1820, however, this resulted in high-frequency ‘warbling’ being produced from the audio output, which I assuming is due to the fact the mic reference voltage was still connected to pin 5.
Another aspect which warrants further investigation is the unreliable behaviour of the ISD1820 if record is activated whilst the loop toggle switch is on. Essentially, not often than not the ISD1820 will fail to play ‘and loop’ after the record function is stopped. Switching loop off then on again usually fixes the issue. Pin 13 of the ISD1820 is used to signal when a sample has finished playing. An LED is connected to this pin, which is kept high until the end of the sample, when the pin is briefly set to low, which results in the LED flashing. Interestingly this means that looping functionality can be achieved by connecting this pin to either of the two play controls. My current thinking is that perhaps I could use a switching transistor to temporarily switch off loop when record is active. I haven’t fully thought this through but I’m keen to dig around in my component box and see if I can find a transistor to try during the next lab session.