Saturday, 27 March 2021

Arduino Workshop 2 - LED strips

 This was the second Arduino class.
An introduction to the world of LED lights.
 

 
 
Though not directly linked to synths, I'm sure the coding practice will come in handy
in the future.
Maybe I can pimp out a future clear acrylic case with these ?

tHERE  are quite a few different types of LED strips.
Some have just 3 leads.
 

Others like this one have 4
By BrentMauriello - Flexfire LEDs comparison between 5050 and 3528, CC BY-SA 4.0, https://commons.wikimedia.org/w/index.php?curid=44905968


You can cut them to any length
They are SMD LEDs , very flexible with an adhesive back.

This particular LED that I'm using isRGB, addressable:
Meaning it has multiple colours and addresses. 
ie Each LED has its own chip which can be individually triggered for chasing, strobing, and colour changing.
It operates on 5V DC
 

 I really like using Tinkercad
It's a really easy way to prototype your designs.

tHE working circuit

University of Wollongong Makerspace.
I am so lucky to live in a city with these great resources.


Thanks to Ed, Jess & Andrew
 
 
 ---------------------------------
-------------------------------------

wOLLONGONG - oLD Courthouse - art exhibition.

 It was such a great feeling to be out and about last Friday.
We have been in lockdown for so long.
Seems like things are 90% normal.
 

NSW & Australia hopefully has the virus under control.
Everyone can take credit for this.
Achieved the old fashioned way ... Just people caring for one another by doing the right things ...wearing masks, isolating esp from vulnerable sick elderly people, etc etc 
 
Hopefully, when vaccinations start in earnest, we can have the life we used to have.

Do visit the Old Courthouse in Wollongong. The gallery is holding  a small exhibition.
 Rei Sato and Linda Fuller - Art Exhibition. 
 

 
Saturday 27 and Sunday 28 March 2021 
 

 
 
Caught up with some old friends.
 

The old Courthouse hold regular exhibitions.
I wonder if we should hire this out for electronic music performances one day.
Lovely high ceilings ... great acoustics



Friday, 26 March 2021

Rotary Encoders - arduino

Encoders.
I've built quite a few eurorack modules in the past using these puppies, but never really understood what they are.
They are rotary devices just like a potentiometer.
However, they measure rotation, rather than resistance.
They are digital not analog.

You will sometimes hear them described as electro-mechanical. They convert the position of a shaft, into a digital signal.

There are two main types of rotary encoder: absolute and incremental.
Absolute:  indicates the current shaft position.
Incremental: provides information about the motion of the shaft.
 
Encoders  can be commonly found in synths. Other possible applications are to control a LED strip light level via PWM, or to control a servo motor angle. You could also use them to control devices like digital potentiometers.
 
The encoder on the left is an incremental rotary encoder. It's called a KY-040.
It's soldered to a breakout board making it easy to connect to projects.
 
It has 5 pins:
1. CLK - Clock (Out B)
2. DT - data (Out A)
3. SW - switch (when we press the shaft, the switch connects to GND. Otherwise it is floating.)
4. + : Vcc
5. GND
 

You most often will find encoders without the breakout board.
 
They still have 5 pins.
Here there are two GNDs
There is no Vcc
 
 
 
 
 
 
 

 
The encoder on the left is a RGB encoder.
 
It has Red, Blue, and Green LEDs mounted inside it which illuminate the clear shaft, and has a built-in switch when you press on the shaft.
 
 All encoders, whatever the type output digital signals (LOW & HIGH)
There is no limiting point -- ie they have infinite turns
 
They are also known as quadrature rotary encoders.



This refers to the fact that the pulses emitted from the data lines are 90 degrees out of phase. 
These data pulses are referred to as Grey Code. 

The quadrature nature allows you to  measure when the encoder has being turned & what way it has been turned.

Notice how the A & B signals shift by 90 degrees when you turn the knob clockwise (CW) and counter clockwise (CCW).

Below is a first basic setup.
I'm using an Arduino Uno.
 
This project will dim / brighten the LED when you turn the encoder.
 

 
It will also output data to your serial monitor, so you need to keep the module plugged into your computer
while running the program.


The connections are:
+ pin 10 - to encoder
+ Pin 11 to encoder
+ Pin 12 to encoder
+ pin 6 to LED
   The cathode (short leg) of the LED connects to GND
   The anode connects to pin 6 of the arduino via a resistor - 220 Ohm
+ gnd
 
//-------------------------------------------------------------------
// Code: eg 1
// This is the code that reads the encoder and switch.
 
 
#define ENC_DATA_PIN       10 // may also be called A
#define ENC_CLK_PIN        11 // may also be called B
#define ENC_SW_PIN         12
#define LED_PWM_PIN         6
#define INCREMENT           1 // change this for different steps sizes

byte enc_clk, enc_clk_old; // comparing the clock signal transition
byte enc_switch, enc_switch_old; // comparing the switch signals
int rotary_value;

void setup() { 
 // these are our 3 input pins 
  pinMode (ENC_CLK_PIN,INPUT_PULLUP);
  pinMode (ENC_DATA_PIN,INPUT_PULLUP);
  pinMode (ENC_SW_PIN,INPUT_PULLUP);
 // next we read the old clock & switch values
 enc_clk_old    = digitalRead(ENC_CLK_PIN);
 enc_switch_old = digitalRead(ENC_SW_PIN);
 // some serial printing
  Serial.begin (9600);
  Serial.println("Rotary Value");
  Serial.println(rotary_value);
}

void loop() {
// READ SWITCH
//we read the switch pin and give the value to enc_switch
 enc_switch = digitalRead(ENC_SW_PIN);
// here we compare old vs new values of the switch
 if((enc_switch_old == 1) && (enc_switch == 0)) { // 1->0 transition
    Serial.println("SWITCH is PRESSED");
    delay(10); // add this delay to avoid bouncing in software
  }
  enc_switch_old = enc_switch; // changes the old value into the new value

// READ ROTARY
  enc_clk = digitalRead(ENC_CLK_PIN);
  if((enc_clk_old == 0) && (enc_clk == 1)) { // 0->1 transition
    if(digitalRead(ENC_DATA_PIN) == 1)
      rotary_value = rotary_value + INCREMENT;
    else
      rotary_value = rotary_value - INCREMENT;
    Serial.println(rotary_value);// prints on serial monitor screen
    analogWrite(LED_PWM_PIN, rotary_value);
    delay(10);// anti bounce
  }
  enc_clk_old = enc_clk;
}
//-----------------------------------
 
 Info and code from Rudy's Model Railway
https://www.youtube.com/watch?v=I6-lU2SMdw8&t=1s 
+ http://adam-meyer.com/arduino/Rotary_Encoder 
 ---------------------------------
-------------------------------------

Monday, 22 March 2021

Guitar Pedals - A Historically Accurate Musical Comedy

..

Super funny video by JHS Pedals and yes, I do think it is historically accurate. :-)

The musical covers the 1960s.

+ Maesto Fuzz Tone FZ1 - 1962
+ Sola Sound Tone Bender MK1-1965 (Fuzz box)
+ FuzzFace - Arbiter Electronics Ltd. first issued the Fuzz Face in 1966
+ King Vox Wah pedal - First wah wah pedal November 1966.
+ Octavia- designed for Jimi Hendrix by his sound technician, Roger Mayer, 1967
+ Uni-Vibe - Designed by audio engineer Fumio Mieda in 1968. Phaser pedal.
   (love the bonsai & Mt Fuji painting)
+ Big Muff Pi - ElectroHarmonics -  Mike Matthews 1969.

.+ Electro-harmonix Timeline

Please do a part 2 covering pedals of the 70s

 

Monday, 15 March 2021

Arduino Midi note player - MIDI out DIN connector

This project is good for testing some hardware connections. 
I mainly wanted to test a MIDI out connector.
 
 
It's also a good first Arduino midi project.
Super simple.
MIDI, the Musical Instrument Digital Interface, is a useful protocol for controlling synthesizers, sequencers, and other musical devices
 
If this circuit is connected to a MIDI synth, it will play the notes
  F#-0 (0x1E) to F#-5 (0x5A) in sequence.
You don't need a breadboard. 
The code is in the public domain.
 It was created on the  13 Jun 2006 & modified 13 Aug 2012
  by Tom Igoe. Thanks Tom.

I'm using old fashioned DIN connectors (rather than USB).
ie a  hardware serial connection.
The Uno can’t communicate using MIDIUSB, btw.,
but the Leonardo can.
These have 5 pins. MIDI DIN connectors use just the middle 3.
The centre pin is always ground.




The other two pins have 220 ohm resistors soldered. They connected to pins 5V & Tx
on the Arduino.










Note:
Some of the MIDI OUT connectors I've seen on the web, use just one 220 ohm resistor (on the 5V connector).
I'm not sure if these are any better.

I'll make a MIDI IN connector in a later post. I understand many use optocouplers to protect the microcontroller and prevent ground loops.

 
I'm using a Arduino Uno in this project.


MIDI is a serial protocol that operates at 31,250 bits per second. 
It's digital. Data is usually notated in hexadecimal.
MIDI banks are usually grouped in banks of 16.

Unlike analog clocks & voltages that I'm used to using, 
MIDI signals are sent in the form of bytes.

These can be divided into two types: command bytes and data bytes
 
Command bytes are always 128 or greater, or 0x80 to 0xFF in hexadecimal. 
If you convert these numbers to binary, you will see they range between
 10000000 to 11111111..... that is, the first number (MSB or most significant bit) is always a one.
This is how it knows its a Command byte.
These include things like note on, note off, pitch bend, aftertouch, continuous controller, channel pressure, .

Data bytes are always less than 127, or 0x00 to 0x7F in hex. 
If you convert these numbers to binary, you will see they range between
 00000000 to 01111111..... that is, the first number (MSB or most significant bit) is always a zero.
This is how it knows its a Data byte.
These include things like Pitch, Velocity , pitch bend amount & loudness.
 
The order of the binary numbers tell the synthesizer lots 
The first 3 bits after the MSB set the type of command.
The last 3 bits set the midi channel.

For more details, see the MIDI specification or one of the many MIDI Protocol Guides on the Web.


The serial ports are TX & RX - digital pins 1 & 0.

Here is the schemo

The 5-pin DIN Jack in this pic is viewed from the front.

Red = Tx
Black = Gnd
White = 5V

--------------------------------------------------------------------

This is the code:

/*
  MIDI note player

  This sketch shows how to use the serial transmit pin (pin 1) to send MIDI note data.
  If this circuit is connected to a MIDI synth, it will play the notes
  F#-0 (0x1E) to F#-5 (0x5A) in sequence.

  The circuit:
  - digital in 1 connected to MIDI jack pin 5
  - MIDI jack pin 2 connected to ground
  - MIDI jack pin 4 connected to +5V through 220 ohm resistor
  - Attach a MIDI cable to the jack, then to a MIDI synth, and play music.

  created 13 Jun 2006
  modified 13 Aug 2012
  by Tom Igoe

  This example code is in the public domain.

  http://www.arduino.cc/en/Tutorial/Midi
*/

void setup() {
  // Set MIDI baud rate:
  Serial.begin(31250);
}

void loop() {
  // play notes from F#-0 (0x1E) to F#-5 (0x5A):
  for (int note = 0x1E; note < 0x5A; note ++) {
    //Note on channel 1 (0x90), some note value (note), middle velocity (0x45):
    noteOn(0x90, note, 0x45);
    delay(100);
    //Note on channel 1 (0x90), some note value (note), silent velocity (0x00):
    noteOn(0x90, note, 0x00);
    delay(100);
  }
}

// plays a MIDI note. Doesn't check to see that cmd is greater than 127, or that
// data values are less than 127:
void noteOn(int cmd, int pitch, int velocity) {
  Serial.write(cmd);
  Serial.write(pitch);
  Serial.write(velocity);
}

--------------------------------------------------------------------------------------





Links
 
 ---------------------------------
-------------------------------------

Saturday, 13 March 2021

Marf 248r - Rev one - external clocking

 I love my Marf(s) 248r.
They are sadly not originals but I find them still so very useful.
I've always found external clocking a bit fiddly. Esp the early rev1.
The rev2 has had firmware updates which I believe has improved this issue.
The rev 1 (as far as I know) hasn't had any software updates so the issue persists.

This is how I used to clock it.


You can use any clock source such as the 259 in the video.
The base patch is that you must plug your clock into the start jack.
The stop jack is plugged into the all pulses out jack.

So every time a clock pulse is sent to the 248, it advances. The AllPulses jack then sends out a pulse
which stops it. The cycle continues.
 

The only issue is that the marf misses a step.
It seems that the pulse from the "All Pulses" isnt quick enough.
 
 The solution was really staring me in the face.
Use two clocks.
One must be twice the speed of the other.
You can use a clock divider/ multiplier. Something like a 281, 0r 284 should do nicely.

The slower clock is your master.
The faster one takes the place of the "Allpulses" jack.
The clock isn't perfect, and its still quite fiddly trying to work out the correct divisions.
 
Sometimes, the marf will jump a step, but it doesn't happen too often.
I kinda like that odd bit of uncertainity.
You need to make an envelope with a rise time slower than the clock
 The quad function generator really is a very useful module. Don was a genius.
The 281, 280, 284 etc are all great.
They can be set to behave as 4 synced clocks each with a division or multiplication of the others.
Or you can let them run at different unrelated speeds for some crazy patterns.
 

Buchla Clock Dividers

 Clock dividers in the Buchla Universe.


Use the 246/245 sequencer's odd or even outs

 Actually most Buchla sequencers will let you do this. You can make odd divisions with a Buchla 251e
for example.

 

 

 

 

 


281e, 281, 284

Make an envelope with a rise time slower than the clock
 The quad function generator really is a very useful module.
It can be set to behave as 4 synced clocks each with a division or multiplication of the others.

 

 

 

 

 

 

 


Pendulum ratchet

 Eardrill

 

 

 

 

 

 

 


Intellijel MM ustep

 

 

 


 Sputnik 244 sequential switch

 

 








Time & Triggers - 2TT
Based on the Temps Utile & Mutable Instruments
Branches (Bernoulli Gate)










K4816 Pattern Generator

Kilpatrick Audio









Verbos Electronics

Model 243v Programmable Pulser







Buchla 242

Programmable Pulser










252e
Buchla Polyphonic Rythm Generator






250e

Dual Arbitrary Function Generator













There are probably other modules I haven't thought of.
Shoot me a message, if you have any ideas.

------

One of my readers (Kyle) suggested these modules:

"The 248 MARF & the sample and hold section on the 266 Source Of Uncertainty can 
divide a pulse by two, and the Polyphonic Adaptor section on the 264 Quad 
Sample & Hold can be used to divide pulses by 2/3/4."

Cheers Kyle.

Arduino Workshop - Wollongong Uni

The Maker's Space at Wollongong Uni, is doing Arduino classes.
Really enjoyed the first workshop last Thursday.

The  classes are intended to be a basic introduction into the world of Arduino
The first class was the obligatory flashing LED tutorial.
I'm not intimidated with standard electronics, but what has in the past slowed my entry into the world of Arduino is the programming aspect.


The classes make use of TinkerCad
It's a really good way to trial your projects before building them in the real world.
 

 
 


TinkerCad is also an easier way to learn programming.
It gets started with code blocks.
These are pre-written blocks of code which you can drag, drop, rearrange.















You are encouraged to search the web. These classes are just designed to get you stared.
 The pic below is a MIDI output for Arduino

 
Korg Littlebits


Makers space also has some 3D printers and lazer cutters which I will most likely find useful in the future.


The next class will focus on LED strip lights
 

Links
+ https://www.makeuseof.com/tag/getting-started-with-arduino-a-beginners-guide/
 
 ---------------------------------
-------------------------------------