Saturday, 27 July 2019

Basic op-amp circuits

Just refreshing my rusty memory.
This might help newbies to electronics as well.
I'll add to this page over time.....

Op-amps are used a lot in electronics so I decided to list some of the most common op-amp circuits that I've seen again and again while building & repairing synthesizers.
If I have made any mistakes or omissions please let me know.

The name op-amp uses the word "operational" .... because they were first developed to do mathematical operations in early analog computers.

 1.Voltage comparator

 This circuit compares two input voltages and lets you know which is greater.
 V2>V1 if Vout = +V
 V2<V1 if Vout = -V

The output voltages are driven by supply voltages (+V or -V).
So if the op-amp comparator is driven by the positive supply voltage, then V2 will be greater than V1.
if the op-amp comparator is driven by the negative supply voltage, then V2 will be less than V1.

2. Voltage follower
This is also called a unity-gain amplifier, a buffer amplifier, an impedance buffer, and an isolation amplifier.
It's is a great way to stop one circuit from affecting another.
is a great way to stop one circuit from affecting another

is a great way to stop one circuit from affecting another

is a great way to stop one circuit from affecting another

It has a voltage gain of 1.
Basically, the inverting input is connected to the output.

Vin = V out

3. Inverting op-amp
Here the output signal will be 180 degrees out of phase to input signal.

Notice the non-inverting (+ve) input is grounded and the feedback resistor connects to the inverting input.
Vout  = Vin* (R2)/R1

4. Non-inverting op-amp
Here the output is in phase with the input. (eg if the input is  a positive voltage, then the output will also be positive.)

Notice that the inverting input is grounded.
Vout = (1 + R1/R2)Vin

5. Non-inverting summing op-amp
Summing amplifiers are also known a voltage adders.
This is pretty much the identical circuit to the inverting summer (see below), except that the summing input is the op-amp's positive terminal.
In any non-inverting summing amplifier, the output voltage is in phase with the input voltage.
This is a great circuit for adding two or more voltages without amplification.
The output voltage, ( Vout ) is proportional to the sum of the input voltages, V1, V2, V3.
For this to occur R1, R2 & R3, etc must have identical resistances.
ie: R1=R2=R3, etc. If we call this resistance "Rin", then

Vout = (R4/Rin) * (V1 + V2 + V3 ....etc)

A Scaling Summing Amplifier can be made if the individual input resistors are “NOT” equal.

6. Inverting summing op-amp.
 Summing amplifiers are also known a voltage adders.
With the inverting summing op-amp, summing input is the op-amp's negative terminal.
The output voltage is also out of phase with the input voltage.
Ie  the circuit will produce the negative sum of any number of input voltages.

The output voltage, ( Vout ) is proportional to the sum of the input voltages, V1, V2, V3
 -Vout = (R4/Rin) * (V1 + V2 + V3 ....etc)
If the inputs resistors, R1, R2, R3 etc, are all equal a “unity gain inverting adder is made".
If the input resistors are of different values a “scaling summing amplifier” is made.

You will find this type of circuit in many CV processors.

7. Differential Amplifier.
This is also known as the Voltage Subtractor.
 We basically have an upper and a lower voltage divider.

If all resistances are equal, Vout = V2-V1
By adjusting the resistances within the two voltage dividers we can get differential voltage gains.

8. Op-amp Integrator

The output is proportional to the input integrated over time.The feedback loop uses a capacitor instead of a resistor.
For more on the integrator click here.

9. Converter - current  to voltage.
Here, the input current is converted into a proportional voltage.
It's also known as a transimpedance amplifier (TIA).

The very basic version of this circuit consists of an op-amp and a resistor.
"i" = input current.
This type of circuit is useful in measuring small currents.... eg from photodiodes.
The sensitivity of the above circuit can be increased by increasing the feedback resistance.

10. Differentiator Amplifier.
This is not to be confused with the Differential Amplifier.
This is a variation of the Integrator circuit in that the position of the capacitor and resistor have been reversed. In fact, Integration is the opposite of Differentiation.
We can see a capacitor in series at the input. The resistor forms the feedback loop.
The basic differentiator circuit performs the maths operation of Differention.
It measures rate of change.
It produces an output voltage amplitude that is proportional to the rate of change of the input voltage.

Feeding in a saw tooth or triangle waveform into the input will give a square output.
If we feed a sine wave, the output is also a sine wave but it will be out of phase by 180 degrees  with respect to the input.

Differentiator  circuits are used in high pass filters, wave shaping circuits and as frequency modulators.

A few years ago I had the pleasure of visiting visit the NonLinearCircuits lab in Western Australia.

Andrew showed me an old analog computer which had many of these above circuits.

The integrator:

The adder:
These days, when someone mentions a computer, most will think digital.
But for most of human history, computers were analog.

Digital circuits can be extremely complex using  sometimes masses of ICs and transistors operating in patterns of zero's and ones.

Analog computers appear in comparison to be much simplier.
Here numbers can be represented using voltages and calculations are performed in a "fluid & continuous" fashion. One disadvantage with analog over digital seems to be less precision and possibly a greater chance of error. But in situations where precision isn't critical, analog is a very beautiful and elegant alternative.

After looking at all these op-amp circuits, one can't avoid seeing the similarities between these early computers and analog synthesizers 

+ Integrator
+ A visit to NLC labs in Western Australia
+ Building an analog computer with op-amps

Wednesday, 24 July 2019

Serge Index

Serge - CGS & Driscoll
* Power Supplies
* TKB - Touch Keyboard Sequencer - build notes
* SYNTHACON VCF - CGS 35 build notes
* CGS 86 - Build notes for the Serge Touch Keyboard
* Utility LFO - CGS 58 - Build notes
* CGS 81 - Voltage Processor build notes
* CGS 22 - Master pulse divider - Build notes
* Serge Resonant EQ/Filter - Euro format (CGS 202)
* Serge Bi-Directional Quad Switch (CGS 88)

* Roland mixer - PSU replacement using Ken Stone/CGS ideas

Vintage / Paperface 
* The Morley Serge - Phaser & Reverb repairs (CGS/Ken Stone)
* The Morley Davidson Serge - Reverb Tank - Girls of Milton (KS)
* David Morley's Serge - The Sherman Chaos Bank (CGS/Ken S)
* Morley Serge - Chaos Bank pics (CGS)
* Morley Serge - Final restoration pics (Thanks to Ken Stone)

* Two panel vintage paperface - Pre restoration pics.

* Warren Burt's Driscoll/Serge synth
* Warren Burt - Serge panel 2/2
* Warren Burt - Serge Negative Slew - repairs
* Warren Burt - WAD and TKB restoration pics (NLC & CGS)
* Warren Burt - Driscoll pics 

* The Ship of Thesus

Teensy Audio Tutorial & Workshop

This looks like a good way to start learning about Arduino & Teensy microcontrollers.
The Teensy looks great  esp fro audio... Comes from a company called PJRC.
You can create all sorts of effects .... delay, chorus, reverb etc
It can also synthesize sounds etc etc.
You can get multichannel sound out of this  chip.

The Teensy 3.2 seems to be very popular. It's used in the Faderbank, and many Eurorack mosules such as the Radio Music / chord organ and the TELEX Teletype.

The Hackaday page is here

This uses a Teensy 3.2 and the audio adapter board

The workshop PDF is here.


 Audio library delay line demo

The analog pins are labeled A0 to A9

Connect the buttons to pins 0, 1, and 2
The pots connect to A1, A2 & A3

Audio input I2S. .... also called I²S (Inter-IC Sound).
" is an electrical serial bus interface standard used for connecting digital audio devices together. It is used to communicate PCM audio data between integrated circuits in an electronic device."
I2S is unrelated to the bidirectional I2C (IIC) bus. (Wikipedia).

The I2S component operates in master mode only. It also operates in two directions: as a transmitter (Tx) and a receiver (Rx). The data for Tx and Rx are independent byte streams.

The Display:

Adding Pushbuttons.
To read the pushbutton, you must configure the pin to work as an input. (pinMode)
Then you can use digitalRead to actually read the pin.
There is no need to add a pullup resistor since the Teensy board provides a pullup resistor on every pin. This is built inside the chip itself.
Connect the pushbutton by wiring one side to ground and the other side to a pin.
You can activate the pullup resistor by using INPUT_PULLUP with pinMode in your setup function.

Adding Potentiomers
This uses the analog input side of the teensy.
Connect one of the outside pins to ground, and the other to 5V
The middle pin goes to the analog input
The microphone
Digi-Key Part Number 668-1296-ND

The thumbnail pot
Digi-Key Part Number 3352T-253LF-ND

Putting the two boards together with headers

I'm using these
I removed the bottom spacers
Then soldered them to the main teensy board.

Next, attach female headers

Insert audio board & solder

+Arduino workshops for beginners
+ Teensy Tutorials
+ PJRC Audio design system for Teensy
+ Teensy Audio Library
+ Sparkfun - 4 channel audio
+ Microcontroller Index Page
+ i2c protocol 
+ Kickstarter 3.6

All about flip Flops

What is a flipflop ?

This is not about the things you wear on your feet.

Rather, Flip flops are a form of data storage.
They are also called Latches or bistable multivibrators.
They are digital circuits.made up of bits : 0 or 1

Flip flops can store one of two states
0 = logical low
1 = logical high

Using these 1s and zeros, we can express any data of any size.
Digital circuits make use of these binary digits.

So to emphasise, a flip flop is a way to store digital data.
They are effectively 1-bit memory cells allowing circuits to store data and deliver it at a later time. One result of this is that they can turn an impulse into a constant signal, "turning a button into a lever".

In the synthesizer world, flip flops can be found in many devices (like sequencers).
Digital hardware that requires data storage (like pitch or trigger information) will likely use flip flops.
By connecting multiple flip-flops in the right way you can make shift registers, storage registers, and counters. 

The simplest flip flop will store a bit at it's output.
ie either a zero or a one (at its output).
When we change the input (to the flip flop) the output will of course also change.
Unlike simple logic gates, flip-flops use feedback. This is important in creating sequential logic circuits as opposed to combinational logic circuits.

There are several basic types of Flip flops. Their input lines are labeled according to their purpose (Set, Reset, Toggle, Data, Clock). The output is commonly labeled Q & "inverse output" Q̅.
Q̅ is always ON when Q is OFF and vice versa.

Flip flops can be designed to respond to the level of a signal or be triggered by a change in the signal.
Level = Latch
Change = flip- flop

Types of Flip-flops:

1) SR- Flip flops.
      a) Using NAND gates
      b) Using NOR gates

2) D-flip flops

3) JK-flip flops

4) T-flip flops


1) SR - Flip flops

(SR = Set Reset)

The SR flipflop comes in two varieties: NAND & NOR.
These refer to the gates that make up the flip flop.
The SR flip flop is also "non-clocked".

The diagram is very simplified:.

You may see a flip drawn like this:
  You have two boxes made up of NAND and NOR gates

Each flipflop  has 2 outputs.  "Q" and "not Q"
Each flipflop has two inputs : S & R

The outputs are connected to opposing gate inputs.

This is what a NAND gate flip flop looks like


2) D- Type flip flop.

D stands for Delay or Data
This is an example of a clocked flip flop
It's symbol is:
There are 2 inputs : Clock & Data.
There are 2 outputs: Q & not Q.

It only transfers data at a certain time of the clock cycle.
When the clock goes high ( 0 or 1) data will be transferred to Q.
When the clock goes low, Q remains unchanged..
 It can be viewed as a delay line.

The D input condition is only copied to the output Q when the clock input is active.
When the clock goes low, the flip flop wont change its state (until another clock high is reached).
It will store whatever data was present on its output before the clock transition occurred.


3) JK-flip flops

This is basically a gated SR flip flop, but a clock input is added.
There are 2 inputs labelled J & K, plus a clock input.
This is the circuit symbol for a +ve edge triggered JK flip flop.
J = set (Jump)
K = reset (Kill)

The flip flop responds differently depending on the values of J & K
When the clock is triggered, the latch's output can be set, reset, toggled, or left as is, depending on the combination of J and K.
J = K = 1 condition to Toggle or flip
J = 1, K = 0 is a command to set the flip-flop
J = 0, K = 1 is a command to reset the flip-flop

The JK flip flop is very flexible as you can make it behave like other flip flops (SR, T & D).
For example,
To make a D flip-flop, simply set K equal to the complement of J.
To make a T flip-flop, set K equal to J.


4) T flip Flop

T = Toggle. (think of a toggle light switch)
This type of flip flop changes its output on each clock edge.
The type of clock edge is important. .... negative or positive?

Whenever the toggle is triggered, the latch changes its state from OFF to ON or vice versa.


Examples of Flip-flops

74LS73 - Dual JK-type Flip Flops with Clear (LS TTL)
74LS76 - Dual JK-type Flip Flops with Preset and Clear (LS TTL)
74LS107 - Dual JK-type Flip Flops with Clear (LS TTL)
74LS109 - Dual Pos-Edge-Trig J-K Flip-Flop (LS TTL) 
74LS273 - CMOS Latch (Ken Stone's CGS11 - D/A converter)
74HC112 - Dual Neg-Edge-Trig J-K Flip-Flop (CMOS)
74HC393 - flop flop (Hyve Synth
4027B - Dual JK-type Flip Flop (CMOS)

74LS74 - Dual D-type Flip Flops with Preset and Clear (LS TTL)
74100 - Dual 4-bit Latch (Texas Instruments) 
74174 - Flip Flop  LZX Flip Flop Hex w/ Clear  (74HC174)
74LS175 - Quad D-type Flip Flops with Clear (LS TTL)
74LS273 - Octal D-type Flip Flops with Clear (LS TTL)
4013B - Dual type D Flip Flop (Standard CMOS) -- NLC flip flop chaos, NLC Divide & C
40174B - Hex D-type Flip Flop with Master Reset (Standard CMOS)
4042 -  Quad D-Latch (CMOS)
4514 - Four Bit Latch / 4-16 Line Decoder

555 - timer

+ TTL - transistor-transistor logic  
+ DIY Index
+ How did NASA steer the saturn V - the computer & data storage in the 1960s (memory module)
+ LVDC - The saturn V memory module

Wednesday, 17 July 2019

FaderBank - 16n

Some of my build notes re the fader bank.
This is a eurorack compatible module, however it does use midi and i2c so I hope it is compatible with other synths.

The official website is here:

You can make your own PCBs and panels for it.

The module uses a teensy microcontroller

The official build notes are here:

cd 4067
This is a cmos 16 channel multiplexer

This is a quad op-amp

diodes: D1 to D4 are four SOD-123 diodes.

 R17 and R18 are 4.7k resistors.
+ If you plan on using I2C with an ER-301,
   Ansible or TXo, (ie I2C "MASTER" mode) you should populate the 4.7K resistors.
+ If you plan on using I2C with a monome Teletype,
   do not populate these resistors - it may well cause problems.

........................ I'll leave these off for the moment... see how it goes

16n’s I2C jack is a 3.5mm stereo jack wired as follows: tip SDA, ring SCL, and sleeve GND (ground).

 the stereo jack sockets for MIDI and I2C.

the 16 mono jacks. 

tHE Teensy 3.2

 Created by Paul Stoffregen and the team from PJRC, the Teensy 3.2 is a microcontroller development board running a 32-bit ARM Cortex M4 processor, clocking in at 72MHz (overclockable to 96MHz). It also packs 1MB of flash, 4K of EEPROM, and 34 I/O pins

The switch setects different types of MIDI connectors Arturia Vs Korg
 'Arturia/Novation' (tip is current source) and 'Korg/Makenoise' (ring is current source) standards; board is labelled such.

There are two ways to flash the microcontroller

The Build guide uses the Arduino IDE/Teensyduino software.
The first step is to plug your new Teensy in using the USB cable.

All brand new Teensy boards come with the LED blink program pre-loaded. You should see the Orange LED blink slowly, 1 second on, 1 second off.

Before you can flash your Teensy you will need two pieces of software:
1. The Arduino IDE
2. Teensyduino

First install the Arduino IDE. (I'm using version 1.8.9)

Next install Teensyduino

Within the Arduino IDE software application, you need to open the Tools men.

be sure to set the Board to Teensy 3.2, USB type to MIDI, CPU speed to 120mhz overclock.

Open the _16n_firmware.ino file in the Arduino IDE.

Flash the board (upload the file).

I ran into a few problems using this method ... compiling errors such as:

A friend suggested I try the simple Teensy Loader Application
This is the second method.
This, only uploads hex files.

And it worked perfectly.

+ Teensy First use
+ Using Teensy with Arduino IDE 
+ Teensyduino - software
+ Microcontrollers - general info 
+ i2c protocol  


Based on original work by Brian Crabtree and Sean Hellfritsch.
Minijack MIDI, I2C circuitry and CV outputs by Tom Armitage.
Firmware by Brian Crabtree, Tom Armitage, and Brendon Cassidy.