News:

Forum may be experiencing issues.

Main Menu

The Microcontroller Thread.

Started by JakeFuzz, December 10, 2011, 11:08:30 PM

Previous topic - Next topic

JakeFuzz

I. What is a Microcontroller and why do I want one?

A microcontroller is like a miniature computer. We can send data in (both analog and digital data), we can process that data and we can output data. What we want this data to come from or go to is totally up to us. These devices are typically very handy for data acquisition; this is where we hook up an array of sensors (thermocouples, piezoelectric...) and output the zeroed and semi processed data to a computer for analysis. In fact there is an entire company that deals in high quality DAQ systems called National Instruments (you may also be familiar with their Labview software). Another application is as a controller; this is where the computer is taking in sensory input and using that data to intelligently control a system. Imagine a robot or a CNC mill, if you tell something to move to (x,y,z) position how does the device really know it is exactly at (x,y,z)? Just like you need your eyes for sensory input to tell you when you are driving inside the lines on the road, many systems like this need sensory feedback to operate correctly.

"But Paul i really don't care about all this stuff, what does it have to do with guitar effects?"

I am not going to talk about DSP in this thread; just how we can use microcontrollers for analog pedals. A microcontroller is a digital device, it deals in zeroes and ones and if we try and pass our guitar signal into it we no longer maintain that coveted all analog signal path. So what we want to try and do is isolate our digital device from our guitars signal. Obviously this limits what we can actually accomplish with the microcontroller.

The two primary analog applications of a microcontroller that immediately come to mind are function generators and switching devices. Switching devices are straightforward and using a microcontroller gives us lots of control over how this switching happens. Function generators (or as we know them LFO's) are used to modulate certain parameters in effects. We probably all have effects that use an LFO; think back to your tremolo or your phaser. These effects use a periodic waveform (sine wave, triangle wave, square wave...) to make time based changes in your guitars signal.

So we don't want to pass our guitars signal through the microcontroller; we just want to find ways to use the device to control the signal path as it is. This is the interesting part. To do this we need an external device that we can control using a digital signal but stay isolated from the analog path. This is where devices like relays, vactrols and digital potentiometers come into play. It is easy to control light or an electromagnetic coil using a digital signal; so we have these devices that use these phenomena to influence a photosensitive P-N junction or a mechanical switch. The creativity comes from using these devices in the circuits we have to make new and interesting guitar sounds.

II. Sign me up.

So how do you get started? I've mentioned numerous times something called an Arduino in the past. This is a board that interfaces with an already existing microcontroller (made by Atmel). The interface is open source and is is made to be very user friendly. You can pick one up on Amazon for around $30. This board includes a USB plug that you will use to link your PC to the microcontroller. This PC to Arduino link is used to load programs you've written in the free Arduino compiler onto the microcontroller. The USB also provides +5v power to the Arduino board. I believe this is the most simple device for a beginner to get started making microcontroller projects. This device also includes header pins for all of the outputs and inputs, this is very handy when you are trying to design something and need to quickly hook up and test, very much like a breadboard.

"Okay i've bought an Arduino, now what?"

Well now you need to learn a little bit of C. What is C? C is a computer programming language. We all know computers think in ones and zeroes, obviously humans don't think in ones and zeroes. C is like the language we can use to tell the computer how to operate. A compiler program translates this language that humans can understand and turns it into something the computer will understand.

C isn't too difficult to use and I think many of us could pick it up very quickly. I personally think the best way to learn C is to read through well documented example programs. As you go through the programs look up the definition of each command and what it does (obviously start with a simple program). After obtaining a fundamental understanding of each command change around some of the parameters and see what happens. This is especially interesting if you already have the Arduino plugged in; you can change the blinking of lights or see the changing input of an LDR.

After that it is all about creativity. There are so many sensors and control devices the application possibilities are endless. Obviously we want to focus on pedals so we will be dealing mostly with isolated type devices. A few of my engineering friends have done interesting things with uControllers like program their rice cookers to make perfect rice based on moisture content and another made an entire automated beer brewing line. I just finished programming LCD screens to display a set of images for a Biomed company. Get creative!

Here is the link to the Arduino website. This is the best resource for example programs and a description of all the native functions as well as general C syntax. It is bookmarked in my brower!  ::)  <nerd>

http://www.arduino.cc/


Hope that helps everyone out. Lets come up with some new and wild ideas for uControllers in guitar effects.

nzCdog

 :o Cool post... learned a lot there, nice and clearly written, thanks :)

jkokura

Paul, do you have a recommendation as to what kit to get for Arduino if you were beginning to look into making this happen?

Also, what if you use Mac?

Jacob
JMK Pedals - Custom Pedal Creations
JMK PCBs *New Website*
pedal company - youtube - facebook - Used Pedals

TNblueshawk

Geez I have little to no idea what you were talking about and it motivated me. Can't imagine how motivated I would be if I had the chops. I'm still learning the language of "E"...electronics  :P  Very well written for noobs.
John

dwstanford

That's quite manifesto.  I am curious about this concept of which you speak.  I took a couple of programming classes in college and hopefully retained some of it.  I have wondered about some of the electro harmonix pedals like the memory man with tap tempo and other digitally controlled timing.  Is that an example of what you're describing or do they use converters?

JakeFuzz

Quote from: jkokura on December 11, 2011, 04:05:37 AM
Paul, do you have a recommendation as to what kit to get for Arduino if you were beginning to look into making this happen?

Also, what if you use Mac?

Jacob

I have the UNO and it is great and the most readily available at the moment. Yes they have a Mac OS X compiler as well, so it should work.



Quote from: dwstanford on December 11, 2011, 04:00:05 PM
That's quite manifesto.  I am curious about this concept of which you speak.  I took a couple of programming classes in college and hopefully retained some of it.  I have wondered about some of the electro harmonix pedals like the memory man with tap tempo and other digitally controlled timing.  Is that an example of what you're describing or do they use converters?
Quote from: TNblueshawk on December 11, 2011, 01:41:04 PM
Geez I have little to no idea what you were talking about and it motivated me. Can't imagine how motivated I would be if I had the chops. I'm still learning the language of "E"...electronics  :P  Very well written for noobs.

You guys can do it! You can get the hang of the general syntax after reading just a few programs. Under the learning tab on the Arduino website, they start with just the most basic programs and give detailed descriptions for what everything does. I think you could probably teach yourself embedded C from that website in a day.

Yes you could definitely do tap tempo. You would just be taking input 5 volt pulses from a switch and counting them. Then changing the tempo of your LFO based on the input. It is interesting to look at how LFO's are used and how they can be replaced with a digital version. LFO's are generally isolated form the circuit to begin with, if you know what to look for you could pretty much drag and drop one into any tome based circuit.

badgerific

http://www.youtube.com/watch?v=zGHNEFjX4Zg

Here's a video I made for a uni project using the arduino uno. The code and how to build it are in this thread here if you're interested: http://www.buildyourownclone.com/board/viewtopic.php?f=8&t=33911

aziltz

it would be really awesome if someone could figure out how to make a tap tempo BBD clock for analog delays using a Microcontroller.  I'd really like to see that make it as a small board that would replace the clock and allow almost any analog delay to be tap controlled.  I more or less know how to code, but I haven't done micro controllers yet and won't have the time for a long while.

jubal81

I posted this in another thread, but I ordered a PicKit 2 kit this weekend.
Tap tempo is near the top of the list, but being a programming noob, it's probably going to take me until spring or summer before I have anything really useful.
"If you put all the knobs on your amplifier on 10 you can get a much higher reaction-to-effort ratio with an electric guitar than you can with an acoustic."
- David Fair

JakeFuzz

Quote from: aziltz on December 12, 2011, 05:21:17 PM
it would be really awesome if someone could figure out how to make a tap tempo BBD clock for analog delays using a Microcontroller.  I'd really like to see that make it as a small board that would replace the clock and allow almost any analog delay to be tap controlled.  I more or less know how to code, but I haven't done micro controllers yet and won't have the time for a long while.

I was looking at this same thing this last weekend. The delays I've seen use a pretty simple oscillator. Ill try and model one up in Pspice and see if I cant mimic the operation using a micro-controller and an optical isolator. 

jkokura

I have another question about Arduino. From the project badger posted it seems like the whole Arduino board was mounted inside the enclosure, making the project quite large. Does that happen with every build? If I wanted to build something, I'd like a smaller enclosure to be used, and I don't want to spend 30 bucks on a new Arduino board every time I built something. Does that mean I should look at PIC then?

Jacob
JMK Pedals - Custom Pedal Creations
JMK PCBs *New Website*
pedal company - youtube - facebook - Used Pedals

yanko_mr

I love arduino, i made some cool projects with it at school (wireless network for control)

JakeFuzz

#12
Quote from: jkokura on December 12, 2011, 07:44:59 PM
I have another question about Arduino. From the project badger posted it seems like the whole Arduino board was mounted inside the enclosure, making the project quite large. Does that happen with every build? If I wanted to build something, I'd like a smaller enclosure to be used, and I don't want to spend 30 bucks on a new Arduino board every time I built something. Does that mean I should look at PIC then?

Jacob

Nope you can mount the Atmel chip from the Arduino and use it in anything you want. The only external components you need are a clock, two capacitors and a pull down resistor for the reset switch. I have a vero board layout that I use and it is super tiny. You can get pre-programmed Atmel uControllers from Digikey for like 3 bucks. All the chips need are the Arduino bootloader, after that you can just use the Arduino board as a programmer and make as many microcontrollers as you want!

jkokura

ah, ok. That's just like a PIC controller.

Jacob
JMK Pedals - Custom Pedal Creations
JMK PCBs *New Website*
pedal company - youtube - facebook - Used Pedals

jubal81

I can't seem to get the code together on Arduino to use a momentary to rotate pins.
i.e. Pin A HIGH, rest off. Button press. Pin B HIGH, rest off. ad infinitum.

I've got debounce working with pullup resistors so far and have worked through several examples using arrays.
Just plain lost.
"If you put all the knobs on your amplifier on 10 you can get a much higher reaction-to-effort ratio with an electric guitar than you can with an acoustic."
- David Fair