VC-1: New circuit

The first circuit design for the VC-1 was a bit unstable and very dependant on the quality of the control signal. Since the goal here is to control the resistance with a PWM signal from the micro-controller, the control signal is going to be a fixed frequency square wave with a variable duty cycle (variable power-on period). I had tried an RC filter with no success. I ended up using a transistor and a programming trick to push the PWM frequency out of the audio range. The PWM programming became tricky, as a wrong value would load the response curve, to the point where distortion became a problem. In effect, some values would push the circuit into a nice “receiver” mode and I could hear radio talk on the amplifier!

Also, the circuit was using two PWM pins from the micro-controller, each with its own code to modify the response curve and additional code to balance the responses of the two opto-couplers used.

Here’s the new circuit (adapted from the Silonex web site):

How it works

Audio:

As before, the INPUT signal goes into the first opto-coupler, while the second opto-coupler is connected to ground. This is known as a “series/shunt” volume control circuit. The audio signal goes through the first LDR. That’s the “series” part. The output audio signal is tied to ground (analog ground) through LDR number 2. This is the “shunt” part. The OUTPUT connection is equivalent to the wiper connection on a standard potentiometer.

Control:

The changes were made on the control side (left). The control voltage (PWM1) is expected to vary from 0 to 5 volts. When using a potentiometer, the circuit sees a nice regular voltage variation. When using a digital signal, like a PWM signal, the circuit is fed a rapidly switching 0-to-5 volt series of pulses. Because the light from the LEDs inside the opto-couplers will vary rapidly in sync with the control signal, some audio artifact might “bleed” through the analog signal on the LDR side. The solution is to use an RC filter to produce a varying voltage from the switching peeks of the PWM signal. Click here for a good explanation of RC circuits. According to the RC rules(and this site), using a 1.2K resistor with a 22uF capacitor will remove most of the ripple from the signal and still respond quickly to a change in PWM duty cycle, and produce a smooth volume curve with minimum induced distortion on the audio side.

Feeding the LEDs, the 5 volt source voltage is going through 2 diodes in series which lower it to 3.6 V (5 -0.7 -0.7). The idea here is that the resistance of the opto-coupler varies nicely for part of its range, but varies more rapidly near the end. Having a voltage limiter solves part of the problem. The 470 Ohms resistors limit the current through the LEDs. The LEDs inside the opto-couplers have a voltage drop of 2.5 V. All the resistor is doing is controling the current through the LED. If we have 3.6 – 2.5 = 1.1 V max through the resistor, V/R = I, 1.1/470 = 2 mA MAX going through that LED when the PWM duty cycle is zero.  The response curve for the opto-coupler shows that the resistance for the LDR varies a lot when current through the LED goes from 0 to 1 mA, effectively going from >25 MegOhms to a few hundred Ohms. Letting more current through (up to 20-25 mA will lower the resistance from a few hundred to around 60 Ohms. I measured a maximum current of 1.6 mA through that LED when zero volt is present on the control input. As the voltage on the control input rises, the LED – connection is becoming “less negative” with respect to the LED + side. At some point, the LED shuts off and goes dark. The LDR’s resistance goes quickly to >20 MOhms. At the same time, as the control voltage goes up, the + side of the second LED becomes more positive than its – side. Eventually, the LED turns ON and shines a little light on the LDR. This will smoothly reduce its resistance and shunt the signal to ground to lower the output volume, while balancing the impedance seen on the output side of the circuit.

Ideally, both opto-couplers should have the same response curve. Silonex recommends using their NSL32SR3S series of matched LDRs. I only had unmatched units to build the circuit but the results were just fine. I suspect that matched components would provide a more balanced impedance, but because I use a good line buffer, the very low impedance going into this circuit is not affected too much by the irregular impedance curve.

Notes

I am now ready to build a few PCBs and field-test the device. The PCB will allow some circuit modification to account for variable specs of some of the components. One or both 470 Ohms resistor could be replaced by 500 Ohms potentiometers.

Posted in Electronics, Music equipment, VC-1 | Tagged , | 1 Comment

Tech Preview: Alesis Vortex

Alesis keeps putting new products on the market. Many of them are made to use the iPad ( and some the iPhone, like this one). I have reviewed, and I use, the iO Dock. They must have hired an apple freak! :)

One new product that I’m looking at is the Vortex.

It’s a Keyboard/Midi controller: a keytar. You might read all sorts of reviews already. You might, or might not, like the idea. For me, two things are important: first, it’s not available yet(!)(not before May 2012) so, as far as I’m concerned, cannot be reviewed. Second, I’m looking at the controller possibilities. So this post is about the Vortex’s technical specs (or what I get/imagine from the Alesis site. I will probably get a unit when it’s available. So you will have to come back for more!

The main features are:

  • The first USB keytar controller—works with all of your software instruments & synths on Mac, PC, & iOS* devices
  • USB and traditional MIDI jacks for use with virtually any synth, sound module, or other MIDI hardware or software
  • Embedded, MIDI-assignable accelerometer for performance parameter control by tilting the neck
  • Thumb-controlled volume slider, sustain button and pitch-bend wheel on neck
  • Finger-controlled MIDI-assignable touchstrip, sustain, and octave-control buttons on neck
  • 37 velocity-sensitive keys with aftertouch for compact, yet complete melodic range
  • Eight velocity-sensitive drum pads/sample triggers enable you to create beats or trigger clips
  • Large transport & patch-select controls for instant access
  • Includes strap; standard guitar strap pegs are compatible with virtually any strap
  • Bus powered when USB-connected to Mac or PC; battery compartment for use with MIDI modules and iOS devices

As soon as I get one, I’ll open it up and take a look, as I did when I got my (then) new iO Dock (look here).

I find it interesting that Alesis decided to include an accelerometer in there. These things are getting cheaper (less than 10$ for a 3 axis 5G model) and there is even a library available for the Arduino. I have been testing one for a while for inclusion into a future Practical Usage module. The touch strip is often found on keyboards and control surfaces and permits gradual value changes. The sustain button is a good idea. There is also an input for a sustain pedal, from what I understood. That makes it an even better idea. Some drum pads a included for additional control and a transport patch (stop, play, etc).

Now, what I really like, is the Midi compatibility: One USB Midi in/out port and one standard Midi Out port. Can you imagine the Vortex connected to the PU-2…

I can.

Imagine the Vortex as an input to the PU-2. The PU-2′s powerful midi processor can really improve the possibilities of the Vortex: multiple commands per input midi command (from the Vortex), commands re-assignment on the fly, midi filtering, etc. Now, imagine using the PU-2′s 14 switches and pedals at the same time that you use the Vortex…

I’ll have to wait for my unit before I post the rest.

Posted in Electronics | Tagged , | 4 Comments

EM-1: Energy Monitor – Completed Hardware

Christmas vacations are for having fun. I did have fun! I completed a project that had been sitting idle for some time: The Energy Monitor for the house/office. The project is described over a few other posts. Most of the theory and practical application is explained in detail at openenergymonitor.org. I adapted their circuits for my purpose: North America 120 Volts main and 5 sensors measuring various current drains. What I added to the project is the use of Processing (processing.org) language to develop a user interface and a data logger.

The EM-1 is made up of two parts: the Sensor/Sending unit and the Base/Receiving/Processing unit.

The hearth is the sensor/sending unit.

EM-1 Sensor/Sending

EM-1 Sensor/Sending unit

The picture shows (left to right): A 10 volt transformer, the connection board, the Arduino micro-controller (actually a Jeelabs Jeenode V6).

The transformer is used to compare readings to a known source (mains voltage varies by up to 10% here!) and use the measured voltage to compute power values. It is also used to measure the sine wave form of the alternating mains voltage. This is then used to compute real power usage versus apparent power usage. It could also be used to power the jeenode but since I have a ton of 5Volt transformers, I used one of those to supply power to the circuit.

The connection board is used to connect the 5 sensors to the micro-controller. Two sensors measure the whole house/office power consumption and the 3 other measure various current drains. The board is made of two parts. The first part is a voltage divider that takes the 10 volt power supply output and reduces it to about 1 volt, which is then used to drive the analog pins on the micro-controller. The second part is the sensor connection terminals. It’s made of a few resitors (burden resistors) and jumpers. Nothing complicated, but a lot of calculation was necessary to make it work.

The micro-controller serves two purposes: it measures the sensor inputs and transmits the measurements using a wireless radio. The board is an Arduino compatible micro-controller that happens to have an integrated transceiver, the Hope RFM12B.

The program running on the Jeenode is then made of two parts: the first one computes power values bases on the sensor inputs and the second part sends the computed values to the EM-Base unit.

EM Base

EM Base: Laptop, Jeenode

The EM-Base unit is a standard Jeenode connected to a USB port on a computer. No hardware modifications. The key to the Base is the software.

The Jeenode receives data from the EM-Sending unit. It then sends that same data on the serial port. A Processing program waits for data to show up on that port and process it. A few things happen. The data is interpreted and a graphical indicator is showed to indicate the present Total Power for the two main sensors. The other sensor values are put into the first window. Two more windows show the total power used, in Watt/Hour for the current hour, the last hour, the current day and the previous day.

The power data is written to a file every ten minutes. Each record contains the power totals (apparent and real) for each sensor for the last 10 minutes. The record also contains a time stamp.

 

Posted in Arduino, EM-1 | Tagged , , | 2 Comments

VC-1: Volume Control Beta

The VC-1 is.

On the left, the Silonex Audiohm opto-couplers (OC) with the electronic drivers. it has been described here. On the right, the line-buffer/impedance-controller described there. It works as expected, using two digital pins on the Arduino micro-controller to change the volume.

Partial specifications

I use 2.2 Mohm metal film resitors as a voltage divider on the analog input. Using 1% metal film supposedly lowers the distortion (if any) caused by fluctuating voltages on the op-amp input. Gain = 1. Input impedance = 1.1 Mohm, which should be enough to plug in any guitar. Output impedance is a few ohms, which is what Silonex recommends to drive the OCs. Simple, no distortion, relatively cheap to build.

Problems

The Silonex OCs have to be calibrated by hand. Eventually, a matched pair would alleviate the problem, but really well matched pairs are hard to find, and expensive. So I included a function in the code to alter the resistance curve of the OCs digitally. To calibrate, I use a multimeter to measure the actual resistance and try different values in the curve function to obtain the specs I want. This also means that the VC-1 has to be tied to a micro-controller (and Arduino in this case, of course).

The design is sensitive to its environment. Having a micro-controller driving an analog audio signal is difficult. I spent many hours in research and testing mode to find a way to prevent “digital leakage” on the audio side. Also, the OCs have to be very well calibrated, or the device will pick up various radio channels…

Future development

After testing is done, I will have the circuit board produced in quantity. There will be more than one version possible, probably on a “universal” board. So it will be available as a “product”.

Right now, the input driving the VC-1 has to be 0-5 volts, with the two channels balanced to an optimal “curve”. The next version will have two trim potentiometers on board to allow for unbalanced 0-5 volts input/outputs. It will also allow the VC to be controlled by only one control voltage. This will make the VC controllable by ANY 0-5 volt signal. So you’ll be able to attach any old scratchy potentiometer volume pedal, most expression pedals, a midi volume control or any other source to the distortion-free, low impedance VC.

Talking about midi: this version is midi compatible, if attached to a micro-controller that translates incoming midi messages to 0-5 volts outputs. It might be a first…

Posted in Arduino, Electronics, Music equipment, VC-1 | Tagged , | 1 Comment

VC-1: More impedance control

In the previous post, I described the circuit that I’m using to emulate a potentiometer using a couple of opto-isolator (or opto-couplers?). There is one small problem with the circuit: the input impedance has to be quite low.

If you just plug a guitar in the circuit, which generally has a high impedance output, it will have a hard time keeping its signal straight. Mostly, you will loose some of the high frequencies present in the guitar signal. Even more so if the cable between the guitar and the circuit is long. For a real and very detailed explanation, take a few minutes to read http://www.soundonsound.com/sos/jan03/articles/impedanceworkshop.asp

The best way that I know of to correct the impedance mismatch is to use a line buffer. So I decided to include one right into my VC-1. This way, the user (sorry… guitar player…) can plug his/hers instrument into the PU-2 and the signal will be brought down to the proper impedance. There is another benefit to this: the impedance buffer/VC combination will keep the impedance fairly low all the way to the output. This way, the rest of the guitar signal run will receive a lower impedance signal, which is always a good thing.

The circuit I’m using:

The TL072P  Op Amp is just used for pin placement. I’m actually using a NE5332A Op Amp because it has a very low noise circuit and is only marginally more expensive than the TL072. The 2M resistor are Metal Film for even lower noise. The input impedance is 1M, which is plenty for any guitar. The ouput impdance is only a few ohms. The gain, which is controlled by the connection between pin 1 and 2 (and 6 and 7 for the other Op Amp) is set at 1, so the signal at the output should be at the same volume as the input.

Posted in Arduino, FCB1010, Pedal board, VC-1 | Tagged | 3 Comments

VC-1: Digital/Midi Volume Control

A user asked if I could design an FCB1010/PU-2 volume control. I love challenges…

It took me weeks to get one working properly. The are two main parts to this: the analog side and the digital side.

The analog side

A potentiometer will generally be connected between ground and signal as:

In this case, the output impedance is determined by the value of the base resistance of the potentiometer and is considered constant on the output signal because the variable resistance of the pot is always mixing some ground and input signal. As an example, take a 5K pot: if the wiper (the movable part of the potentiometer) is all the way to the IN side, the output is equal to the input signal. The impedance is determined by the resistance to GROUND,  5K. If the wiper is on the other end of it’s travel, the output becomes = GROUND and no sound can be heard. The impedance is still 5K, as the resistance between the wiper and the IN signal is still determined by the pot resistance.

Now, if the wiper is placed somewhere between the two extreme, the output signal is a combination of IN and GROUND. Let’s say the wiper is 1/5th the way from IN. The resistance (if the pot is linear (that’s another story)) between IN and OUT is about 1K. The resistance between GROUND and OUT is about 4K. The impedance is (Resistance from IN to OUT) + (resistance from GROUND to out) = 5K.

That, in a simplified way, is how it works.

One might be tempted to use the pot in the following manner:

or even  

but this will not work, especially when the resistance decreases. It will create all sorts of distortion and the equipment in the rest of your audio chain will definitely not appreciate the lack of impedance control.

After quite a bit of research, I decided to use the Silonex Audiohm optocouplers (http://www.silonex.com/audiohm/index.html). A LED turns on and off depending on  the voltage present on its leads. It is closely coupled with a Light Detecting Resistor (LDR) and affects the resistance on the output side. The ones I chose (NSL-32SR3) have an “empty” resistance of 25M Ohms and go down to 40 Ohms when fully energized (about 5 volts).

In theory, this is how the circuit should work. The signal is fed from the PU-2′s expression pedal to the micro-controller and a small piece of code writes to the PWM pins (Pulse Width Modulation) to control the LED on each of two LDRs. Why two? If you understood the beginning of this section, you will understand that the upper LDR will act as the half of the potentiometer that ties IN to OUT, and that the bottom LDR then acts as the half of the potentiometer that ties GROUND to OUT, to preserve the output impedance.

The trick here is to feed a proportional signal to the two LDRs so that their combined resistance is pretty much constant.

The signal that drives the LDRs is digital. So let’s take a look at that and we will come back to the analog side later.

The Digital Side

The signal that will drive the LDRs is coming from two digital pins on the Arduino. The pins have to provide PWM output. PWM is a simulation of analog voltage output. The microcontroller is providing this simulated voltage by sending pulses of voltage (5 volts) at controlled intervals. For example, if the microcontroller send 5 volts for 1/4 of a second and then sends 0 volts for 3/4 of a second, a component might believe that it’s receiving 1.25 volts (1/4 of 5 volts). Vaguely.

There’s a decent tutorial on the Arduino site (http://www.arduino.cc/en/Tutorial/PWM) and a very complete one at http://en.wikipedia.org/wiki/Pulse-width_modulation. You can find many others with a simple Google.

Oddly enough, it doesn’t really work in practice. The LDRs are quick enough to react to the square wave signal and introduce artifacts (awful distortion!) in the audio signal. I figured that the LDRs would behave better if fed a true voltage. So I decided to insert an RC filter (http://en.wikipedia.org/wiki/RC_circuit) in front of the LDR to smooth things out. I couldn’t find one that worked…

Then, I figured that the signal could be made faster by making the PWM pulse faster. The logic was that if I could push the PWM frequency outside of the audio spectrum (above 20,000 Hz) I would eliminate the interference. It worked… partly.

This line of code:

 

  TCCR0B = TCCR0B & 0b11111000 | 0x01; //adjust PWM frequency to put it ouside hearing range (62K)

forces the Arduino PWM on certain pins to “vibrate” at 62500 Hz. While this is enough to get most of the distortion outside of the audio spectrum, it changes the behaviour of the LDRs. They loose their mind…

I tried other RC filters/PWM speeds combination to no avail. Nothing worked.

Finally, I suspected that there might be a current drop on the LED inside the LDR. The datasheet specifies 25mA maximum for the LED. But can the Arduino supply enough current when operating in PWM mode?

I decided to add a simple transistor in series with the PWM pin to augment the current to the LDR’s  LED. (How many 3-letter abbreviations can I put in a single sentence?) So I chose a 2N2222 transistor wired this way:

This worked a lot better!

The Arduino code I used for testing:

PU_2_AnalogInOutSerial

 

Posted in Arduino, FCB1010, Pedal board, PU-2, VC-1 | Tagged | 3 Comments

PU-2: SD card capacity

I have just written a new version of the software that is used to convert a .CSV file into a Sysex file that the PU-2 can process. This version uses the SD card.

Preleminary tests show that 2000 midi commands require about 16KB of storage. So, my (very) old 16Meg SD card can store approximately 2,000,000 midi commands.

Actually, now that I’m using an SD card, the PU-2 can also display comments or command descriptions on the display. So the space on the SD card will be shared between the Sysex file and the Command Description file. I guess I’ll have to use a bigger SD card! Maybe even my (old) 256Meg card!

I now have to work on the Arduino side to process the commands from the SD card. The read speed is slow enough to introduce some latency when I do a bank switch. Also, as long as a bank (values for the 16 switches) contains less than approximately 4000 commands, I can store the command array in EEPROM. But if a bank contains more than 4000 commands, the PU-2 will have to perform direct SD reads to access the data. I could add more EEPROM. I have a batch of 128KB chips on hand. This chip could store up to 32000 commands per bank (128000 commands for a 512KB EEPROM card!). But I will test the preemptive reading of banks first. I will post the test results here.

Posted in Arduino, FCB1010, Pedal board, PU-2 | 2 Comments

SD Card reader: No Voltage required!

While testing a slight modification on the PU-2 prototype, I decided to test the current draw of the SD Card reader described in the previous post. I placed my multimeter in series with the 3.3 volt pin and measured 11 milli-Ampères. Even while reading data, the current draw was constant. I then decided to measure the current draw when using 5 Volts. I disconnected the 3.3v pin and connected the 5v pin in series, again, with the multimeter. The current draw was 0 mA.  !?

I disconnected the 5v pin and launched the reading program on the Arduino. It works. Really! The SD card reader is linked to ground, and MISO, MOSI, SCK and CS pins. NO power.

I can only guess that the SPI pins provide the necessary power to read the SD card. Here’s the schematic for this particular adapter:

Click to view larger image

Anyone has any idea? Anyone wants to try and replicate this?

Posted in Arduino, FCB1010, Pedal board, PU-2 | 1 Comment

PU-2: Data on SD card

Just in time! I received the SD card readers the day that I had planned to ship the first PU-2 Beta. I re-opened the boxes and fitted the card reader in each prototype.

This is the SD card reader that I chose:

SD card reader

It’s a generic card holder, that has the advantage of working with both 5V and 3.3V. The on-board IC is a voltage regulator that transforms the 5 Volt of the Arduino to the 3.3 Volt required by the SD card. I decided to use the 3.3v connection from the Arduino Mega board because the SD card operation requires very little current ( <50mA (safe for the Arduino)) and I will use other SPI components in the future. All the SPI components that I want to use are 3.3v. I could also have used the 5v pin and extracted the 3.3v from the card reader.

The SD card reader is connected to the Arduino with only 4 pins that are used to control the peripheral. This type of connection is explained on Wikipedia and on the Arduino site. An extra SPI peripheral will require only one more pin from the Arduino.

The card reader will let the user program the PU-2 faster. I decided at the beginning of the project that the PU-2 would not allow direct programming like the FCB-1010 on which it is based. Until now, all programming was done on a PC (or Mac (or Linux)) and a special file was created and sent to the pedal board. The input file can now be placed on the SD card and read directly by the PU-2. This will reduce the memory needed by the program to hold the data. This will soon mean that there is no limit to the total number of commands that the PU-2 can store and use.

Also, the fact that the file is now available to the Arduino means that the comment field, or description, is now available for display. The user can chose which description to post for each switch press, for each command bank. The limit is still about 3500 commands total, but I will switch the commands matrix from EEPROM to the SD card with a future version of the software.

Here’s the internals of the prototype, serial number 3, ready for final inspection.

Inside the prototype

 

Posted in Arduino, FCB1010, Pedal board, PU-2 | 1 Comment

FCB1010 vs PU-2: Why do it?

While waiting for parts (I do have to get a better inventory “system”) to complete the Betas for the PU-2, I went through a short period of discouragement. It’s hard to stay fully motivated when the project is bogged down by unforeseeable delays (or is it bad management?). But yesterday, I read an entry on the FCB1010 forum that reminded me why I was doing all this. A fellow user is trying to program the FCB1010 to communicate with a Yamaha device. The series of instruction that he had to document, after much trial and error I’m sure, goes like this:

So… to set the 1010′s bank 00, preset 3 button to access my Motif’s PRE 3
bank, patch 92, I put the 1010 in operation mode, called up bank 00 and hit
button 3 to indicate that I wanted to program that preset, then held the down
switch for 2-3 seconds.Hit the UP button to display which functions are active for the preset.For any button LED that light up besides button 5,6 & 7 (assuming that the only
thing this preset is going to do), press and hold that button down until the LED
goes out.

If button 6′s LED isn’t lit, press and hold button 6 until the LED comes on
steady.

Press button 6 again to start defining that button’s function, and it starts
flashing.

Press UP to view the current CC# the button will send.

Enter 00 (Remember, the MSB paramater is sent with CC0) as the CC # you want the
button to send and press UP to enter.

Button 6 is still flashing, and the numeric display changes to show the current
CC value. Enter 63 (the MSB value) and press UP to enter.

We’ve just defined the first CC change.

If the button 7 LED isn’t on, hold it down until the LED comes on.

Press button 7 briefly. It starts flashing, now we need to program the LSB
value.

Press UP. The numeric display flashes the current CC # for the button. Enter 32
(Yamaha accepts LSB values as CC32) and press UP to enter.

The numeric display flashes… enter the LSB value for the bank change (in my
case I wanted bank PRE 3, which the data list defined as LSB = 2).

At this stage, the 1010 preset is set up to select the Motif’s PRE 3 bank, but I
still need to tell it which actual patch I want. An old post from Michael
LaMeyer stated that only PROG CHG 5 is sent AFTER the CC’s, so…

If button 5′s (PROG CHG 5) LED isn’t lit, press and hold until it is. Press
again to begin programming PROG CHG 5, and the button 5 LED starts flashing)

Press UP and the numeric LED shows the current PC value. In my case, I want
patch 92 (of my PRE 3 bank), so I type 92 and UP to enter.

The button should now be fully programmed to select the PRE 3 bank, patch 92.

Press and hold DOWN to save and exit, and button 3 of the 1010′s 00 bank should
now select MSB 63, LSB2, Patch #92. If the device (Motif, in this case) already
happens to have that bank and patch selected, manually change the device’s bank
and patch to another patch, and hit button 3 to test.

On the PU-2 the input file for the same thing would include 3 lines:

Bank,Switch,Type,Cmd Type,Channel,Command,Value,Extra,Comment
0,3,0,CC,1,0,63,,MSB
0,3,0,CC,1,32,2,,LSB
0,3,0,PC,1,92,,,PATCH

Then run the Java utility and send the Sysex to the FCB1010.

Repeatable, savable, simple.

That switch could be programmed to send anything else, including other CC commands to have other equipment react to a press of switch 3.

Posted in Arduino, FCB1010, Pedal board, PU-2 | 5 Comments