The NovaDrone www.casperelectronics.com/novadrone/ Throughout this guide I will attempt to give you some insight into the circuit theory and scientific principles at play in the NovaDrone. The user manual is the HOW guide to the NovaDrone. This document is the WHY. That said I will be giving little more than an intro to each topic and strongly encourage you to do further reading on topics you find interesting. Before reading this guide I suggest you read or at least skim through the users manual in order to become familiar with the general layout of the NovaDrone. This is a beta version of the NovaDrone Technical Guide. I expect to make revisions over time and eagerly encourage readers to send me feedback, questions, suggestions and especially corrections. Comments should be addressed to [email protected] TABLE OF CONTENTS: Section 1. Oscillator Primer 1.1 Frequency, amplitude & waveshape Frequency Amplitude Waveshape Review 1.2 Phase Phase controlled amplitude modulation Section 2. NovaDrone Oscillators 2.1 The Circuit Feedback loops Schematic RC time constant How it works 2.2 Pulse Width Modulation The comparator 2.3 The Mixer Section 3. Light *incomplete* 3.1 Sound and light 3.2 LED driver 3.3 Video patterns SECTION 1. OSCILLATOR PRIMER 1.1 Frequency, amplitude and wave shape The NovaDrone is basically a bunch of oscillators so it’s important to understand what an oscillator is. An oscillator is simply a pattern which repeats indefinitely. All of the electrically produced sound we hear is a repeating pattern of fluctuating voltage. When this is applied to a speaker, the voltage charges a coil in the speaker which pushes the cone of the speaker back and forth. This action pushes air which travels to our ears and is perceived as sound as our ear drums are excited into vibration. The sounds we hear around us are all incredibly complex patterns of air pressure modulation. Most electronic oscillators (including those used in the NovaDrone) are precise and easily controllable. There are three basic factors that make up all oscillators: frequency, amplitude and wave shape. In musical terms we would call these pitch, volume and timbre. I will also talk a fair amount about phase which is relevant when working with multiple oscillators and plays an important role in creating drones. The red line in fig 1 represents a voltage which goes up and down over a period of time. This is an oscillator. Frequency One complete sweep up and down is called a cycle. The number of cycles per second is your Frequency or Pitch. Frequency is commonly measured in Hertz, which is the number of cycles per second. Pitch is another term for frequency which is used only when referring to the frequency of an audio signal. The image to the left shows a triangle wave with a cycle length of .5 seconds. The frequency of this wave would be determined by seeing how many cycles will occur in 1 second. In this case there are Figure 1. An oscillator 2 complete cycles in 1 second. That means the wave has a frequency of 2 Hertz. This is well below the hearing range. Humans can hear oscillators between 20Hz and 20,000 Hz. Amplitude Amplitude refers to the magnitude of voltage change across one cycle of an oscillation. This in turn impacts the volume of the signal if it is sent to a speaker. The image above shows a triangle wave with a positive peak of +5 volts and a negative peak of -5 volts. The amplitude is determined by figuring the absolute difference between these peaks. In this case that difference is 10 volts. This is commonly referred to as 10 Vpk-pk (10 volts peak to peak). There are many different ways to measure amplitude (pk-pk, RMS, Vp, etc…) but we’ll just be talking about Vpk-pk. Waveshape The wave shape is the pattern of amplitude modulation over the course of a cycle. The waveforms in fig 2 are: Sine, ramp, triangle and square. Sine, triangle and square are the most common and are all symmetrical waves. That means the positive and negative portions of each cycle are of the same duration. Many musical synthesizers offer other wave forms which are asymmetrical versions of these common waves such as ramp, saw, and pulse waves. Figure 2. Wave shapes The importance and impact of wave shape depends on its application. Many audio effects such as tremolo or phaser use low frequency oscillators (LFOs) to modulate certain parameters of the sound. It is commonly more desirable to use a sine or triangle wave for many of these effects such as the tremolo which fades the volume in and out. Using a square wave for this would create dramatic shifts in volume which can be unpleasant. Many natural sounds are synthesized using overlapping wave forms like those shown above. For instance a flute can be synthesized using several octaves of a sine wave. A horn on the other hand will use more square waves and maybe a triangle or saw wave. More advanced wave and synthesis theory sites the sine wave as the basis of all wave forms. It is shown how even square waves can be created by combining several sine waves. Review The basic components of an oscillator are: Frequency. The number of oscillation cycles that occur in one second. Measured in Hz Amplitude. Magnitude of voltage sweep in one cycle of an oscillator. Measured in Volts or Vpk-pk (volts peak to peak) Wave shape. Sine, triangle, square 1.2 Phase Phase is a bit more complicated than the other terms but plays an important role in audio circuitry and especially in making drones. Phase refers to a particular position in a single cycle of a wave (such as the positive or negative peak) and is measured in degrees. It is most commonly used to describe the relationship between multiple waves. Figure 3. Phase Fig. 3 shows two sine waves (red & blue) of identical amplitude and frequency. The green oscillator is the mix or average of the red and blue oscillators. Phase is measured in degrees with 360 degrees being one complete cycle. 180 degrees is exactly ½ of a cycle. In fig. 3 the phase of the blue oscillator is offset at 45 degree increments from the red oscillator from left to right. With each step you’ll notice that the waves get farther apart and that the amplitude of the green (average) oscillator decreases. This may seem confusing at first but it’s really quite simple. The green oscillator is the average of the red and blue oscillators. Let’s say the red and blue oscillators sweep from -5 to +5VDC (10Vp-p). Now look at the right most illustration of the 2 waves out of phase by 180 degrees. When the blue wave is at its positive peak (90 degrees) of +5 volts, the red wave is at it’s negative peak (270 degrees) of -5 volts. What is the average of -5 and +5? Zero. They are always going to be the opposites of each other so the average will always be zero. Now look at the 90 degree image. When Blue is at +5 volts/90 degrees, red is at 0 volts/zero degrees. The average of +5 and zero is 2.5 volts. The important thing to take away from the info above is that the amplitude of an oscillator created by mixing two similar oscillators is relative to the difference in phase of the two source waves. In fig. 3 the oscillators have identical frequencies. This means that the phase relationship once established will remain the same and the resulting averaged amplitude of the two waves will also remain the same. Q: What will happen if the frequencies of your two waves are NOT identical? We established above that the amplitude of the averaged waveform is relative to the phase difference of the two wave forms, therefore as the phase difference of two waves increases and decreases so too will the averaged waveforms’ amplitude. What we have here is phase controlled amplitude modulation and the rate of phase modulation is controlled by the frequency difference between your two oscillators. In fig. 4 the blue oscillator has a frequency of 10 Hz, the red is 11Hz. That means that it takes the red wave 1/10th of a second longer to complete a cycle than the blue wave. You can see that with each cycle the red wave lags a little bit further behind the blue wave which increases the phase difference between the two. As a result, the amplitude of the averaged wave (green) decreases as the phase offset approaches 180 degrees and then increases as it continues past 180 to 360 degrees. Figure 4. Phase controlled amplitude This phenomenon of phase controlled amplitude is something many musicians use without even realizing it. This is the vary trick one uses when tuning a guitar. You tune one string to the other until the “beating” effect slows and eventually disappears. SECTION 2. NOVADRONE OSCILLATORS 2.1 The circuit The NovaDrone contains 6 oscillators. Each oscillator outputs a square wave and a triangle wave. The circuit which generates the oscillators is clean, simple and robust. They are generated using a remarkable device called an op amp. If you are interested in building synthesizers and don’t know where to start, read up on op amps. They are the key elements of most oscillators, filters, envelope generators, mixers and amps. Schematic Each channel of the NovaDrone (Red, green and blue) has 2 oscillators. These are shown in fig. 5 and fig. 6. They are very similar to one another but have been calibrated for different purposes. Osc 1 is an audio frequency oscillator. It has a coarse and fine tune adjustment and only operates at audible frequencies (20Hz-20kHz). Osc 2 is calibrated as a low frequency oscillator (LFO) with cycles as long as 2 Figure 5. Osc 1 (audio oscillator) minutes. It has a range switch and a single adjustment knob. Feedback loops The oscillator circuit is a feedback loop between two op amps that are configured as a schmitt trigger and an inverting integrator. Basically an integrator turns square waves into triangle waves. A Schmitt trigger is a kind of comparator that turns modulating signals (like triangle waves) into square waves. Figure 6. Osc 2 (LFO) The key elements of the relationship between these two circuits is that they form a loop (Schmitt > integrator >Schmitt>integrator> etc…) and that the integrator is also an inverter. This creates a continuous cycle of modulation: 1) Schmitt output goes HI. 2) Integrator inverts Schmitt signal and outputs slope going down (LOW). 3) When slope is near zero volts, Schmitt trigger is thrown and its’ output goes LOW. 4) Integrator inverts and generates upward slope (HI). 5) When integrator slope reaches peak, Schmitt trigger is thrown and output goes HI. 6) etc…… This is an overly simplified explanation but enough for our purposes. Do more research on these valuable circuits once you are familiar with some of the basics of op-amps. RC time constant In both oscillators (fig. 5 and 6) the element which defines frequency is the RC time constant. This relationship is a core component of most oscillators and is worth reading up on. The RC time constant is a period of time defined by the relationship between a resistor and a capacitor. The equation for this is simply Time = R*C. This equation defines the length of time it takes for one stage of your cycle to complete, for instance the rise time of your triangle wave. The wave created by this circuit is symmetrical which means it’s rise and fall times are identical, therefore the duration of one complete cycle can be defined by 2*RC. In Oscillator 2 the R is a 500k potentiometer in series with a 4.7k resistor between pins 8 and 13 of the two op amps. The C is one of the three capacitors between pins 13 and 14 of the rightmost op amp. One of these caps is selected using a three way switch on the NovaDrone circuit board. This controls the frequency range of the LFO. Let’s say the pot is all the way up (full resistance) and the middle cap has been selected. The equations for RC and subsequently the frequency is: R=504,700 Ohms C= .000022 Farads RC time constant= R*C = 504,700 * .000022 = 11.1 seconds I cycle = 2*RC = 22.1 seconds Frequency in Hz = 1 / (2*RC) = .045 Hz How it works Resistors limit the flow of current and capacitors store current. Current flows through the resistor and is stored in the capacitor. The resistor controls how much current flows into the capacitor per second. Therefore the size of capacitor and the amount of resistance will determine how long it takes to fill the capacitor. A common analogy is to think about current flow as water, the resistor as a spigot and the capacitor as a cup. The more you open the spigot (reduce resistance), the more water (electrical current) will flow and the faster the cup will fill (capacitor will charge). The oscillator circuit is configured in a special way which causes the capacitor to continuously charge and discharge. It is looking for two states from the cap, fully charged or fully discharged. When the cap reaches either of these states, the whole circuit reverses polarity and the capacitors charge status begins moving toward the opposite state. The amount of time it takes to charge and discharge is your RC time constant. 2.2 pulse width modulation (pwm) PWM is exciting stuff….really! It is essentially a 1 bit digital representation of an analog wave form. Digital wave forms only have 2 states, high and low. High is a voltage at or very close to the positive supply voltage. Low is a voltage at or very close to the negative supply voltage. It is basically just a square wave. Analog on the other hand is infinitely variable. Think about it like the difference between a light switch (digital) and a light dimmer (analog). PWM is a wave form that bridges the gap between these two formats. It can be used to make sound, control the brightness of an LED, control the speed of high torque motors and speak to microprocessors. It is also the language that a microprocessor will use to speak with the analog world. Pulse Width (PW) refers to the relative durations of high and low voltage in a single cycle of a square wave. Figure 7. Pulse width Fig. 7 shows three square wave oscillators of the same amplitude and frequency but with differing pulse width. The red oscillator has a 10% pulse width. That means the wave goes high for 10 % of the duration of one cycle. The green wave is 50% and the purple wave is 90%. What is important to note is that pulse width has nothing to do with frequency and only refers to the relationship between the high and low swing of the wave. The Comparator The job of a comparator is simple. Two signals are fed into the “+” and “-“ inputs (labeled 10 and 9 in fig. 8 respectively). If the voltage at the “+” input is higher than the “-“ input the output of the comparator goes high. If the “+” input drops below the “-“ input the Figure 8. Comparator/PWM output goes low. In the NovaDrone the triangle output of Osc 1 and Osc 2 combine through a simple comparator (fig. 8) to make a single square wave with a modulating pulse width. In this way, the comparator also functions as a pulse width modulation processor. Fig. 9 below shows how two triangle waves are transformed through the comparator into a square wave with a modulating pulse width. The blue triangle wave in fig. 9 is oscillator 1. The red triangle is osc 2. The green line is the combined PWM output. Any time the blue line (osc 1) is above the red line (osc 2), the green line (pwm) goes high. As the red line rises the percentage of each cycle that the blue line is above the red line decreases. This changing percentage is what makes our modulating pulse width effect. Figure 9. Pulse width modulation detail. Figure 10. simple mixer Mixer: The audio signals from each of the three channels of the NovaDrone are mixed using the circuit in fig. 10. This mixer is nice and simple and uses just one op amp and a few other components. This circuit is configured as an inverting mixer with an amplitude controlled by the feedback resistor and input resistors. The amplitude is calculated as RF/RI. In this case RF = 10,000 and RI = 100,000. That means the output signal is 1/10th the amplitude of the input signal. LED drivers: (3) 2N3904 NPN transistors are used to make 3 LED drivers. A driver is a simple but important circuit which isolates elements which use lots of current (like LEDs) from sensitive circuits (like the oscillators in the NovaDrone). Failure to use a driver can result in something called a loading effect which basically means that the device being driven Figure 11. LED driver will affect the behavior of the rest of the circuit in bad ways, like the pitch changing when the lights turn on. The LED in the NovaDrone uses a lot of current relative to the rest of the circuit (90mA vs around 30mA for the rest of the circuit) therefore a driver is necessary. The key component of a driver is the transistor. This is another topic worth reading a lot about.