Go Down

Topic: Switching/Controller Project - To DIY Or Not (Read 1 time) previous topic - next topic

swipesy

Hello everyone. I am building a multi-channel preamp for guitar and need to come up with a switching system. I'm an analog guy, I've never messed with digital before. Before someone mentions it, MIDI is out (overkill, plus there isn't a lot of DIY stuff out there that is intended for something other than keyboards), and while I could do it using discrete wires, there are things that could be done with an Arduino (PWM is one example) that would be most beneficial. I have been reading up on the Arduino's abilities and it's intriguing to me.

I should explain that one local person replied to a local ad I posted and, instead of trying to help, proceeded to suggest things in which I had no interest (i.e., buy certain existing products, etc.), tried to tell me what I need (as if he knew me), told me it was a waste of time, and called my project a Model T in a world of Mercedes, among other things. As I explained to that person, this is a personal project, and it's something I've wanted to build for many years. I also explained that I'd take a Model T over a Mercedes any day because if it breaks then I could repair it myself. I like to get my hands dirty, I like to build things, and it's a hobby that I enjoy. That, of course, is referring to ... analog, NOT digital! :o

So, as I was looking over different code samples this past weekend (every waking moment, I might add), I found myself getting confused. I'm a pretty good PHP programmer, so much of the code made sense to me (loops, ifs, conditions, etc.) but of course some of the syntax and built-in functions were totally unfamiliar. What made my head spin, though, was the different types of communication between units - I2C, serial, etc. - and some of that code was way over my head. I don't know which would be the best way to go, I can't seem to follow the different RX/TX codes ... I just don't, well, "get it." That's where I'm at right now.

Now, since this is a personal project and very likely to be the only project where I would ever use something like this, I'm trying to decide whether I want to spend the weeks (months, most likely) learning what I would need to learn to have it do the things I would like it to do. Truthfully, I'm leaning against it. I'm sure some people here could do those things in their sleep, just like I could create a dynamic web site during my own slumbers. Thing is, PHP is simply code written within a specified language, there is no hardware to deal with so it's not the same. (Sure, a server is hardware, but that's primarily handled by the operating system.) Frankly, I'd rather spend the time working on the analog circuits of the preamp. That's something I understand and am comfortable with.

On to the digital realm now. Assuming I decide not to pursue learning everything I need to learn, would there be someone out there willing to help? I'd like to get an idea of how much someone might charge for something like this, as I have no clue.

Following is a short description of my project relating to the digital aspect only. If there is anything else someone wants to know I'll be glad to answer any questions - digital, analog, the preamp itself, or whatever.

1. Communication (probably) needs to be a continuous 2-way (synchronous?) setup and as fast as possible, with controlling functions on both ends (the preamp and the foot controller/footswitch).
2. The two units will be wired at a distance of no more than 50 feet.
3. There are 8 channels on the preamp (only one on at a time) with four "options" per channel.
4. The footswitch will be laid out in an 8x4 matrix so each channel and its four options are directly accessible with a single footswitch. (Again, only one switch in the matrix can be on at any one time.)
5. There are six other momentary switches for other purposes, i.e., setting delay times, mute, etc.
6. Besides the 4x8 + 6 footswitch, the preamp itself will have switches to choose channel, channel option (separately - no matrix), delay time, etc.
7. Current settings must be indicated on the footswitch, whether controlled at the footswitch or on the preamp.
8. It will be "wired" using a computer-style DB cable.
9. I would prefer it include PWM for voltage controlled volume and blend. (I'm guessing it could be something like 2 to 4 PWM lines.)

That's about all I can think of at the moment. Looking at the different units available, I'm thinking a Mega at both ends would be enough, as those seem to have enough I/O pins. Then again, I'm sure someone who knows more about this stuff might have a different opinion there. I'm open to suggestions, of course.

Any interest out there? If not, that's ok - I can always fall back on the discrete wire method if need be. I'm sure it would work ok, digital would just be better.  Of course, all of the audio signals will be analog. Digital would only be used for switching and perhaps voltage control.

Thanks for your time! 8)

Gene

swipesy

Hello again,

I was just thinking ... with a master/slave setup, if the code could be written so when an input pin is taken high on either the master or the slave, a corresponding output pin is made high on both the master and slave as long as the input pin is high. Two or more input pins could be made high at any one time from a single button for encoding purposes. I can use latches external to the Arduino to latch data where necessary, that's not a problem at all. There wouldn't be any conflicting activity between the master and slave since only one button on either the master or the slave would be pressed at any one time.

I'd still like to have PWM if possible, but it's not a deal breaker.

Would that make it simpler?

Thanks again.


swipesy

#2
Nov 09, 2017, 02:09 am Last Edit: Nov 09, 2017, 02:14 am by swipesy
I've been thinking about it, and last night I played around with some PICAXE code on an emulator and was able to get it to do things fairly easily. That's mostly what led me to try it on my own. Of course, that was just the simple stuff, no PWM or communication involved - that's what I'll have the most difficult time with.

The code I wrote last night is below. If I spent more time on it I'm sure I could have made ot more streamlined. I'm pretty sure coding for the Arduino would be similar for the same functions. Wish me luck!

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

Code: [Select]

#picaxe 40X2
eeprom 0,(0)
main:
'Begin channel selection, only 1 of 8 on at a time
if pinA.0=0 AND pinA.1=0 AND pinA.2=0 then
{
high C.0 low C.1 low C.2 low C.3 low C.4 low C.5 low C.6 low C.7
}
endif
if pinA.0=1 AND pinA.1=0 AND pinA.2=0 then
{
low C.0 high C.1 low C.2 low C.3 low C.4 low C.5 low C.6 low C.7
}
endif
if pinA.0=0 AND pinA.1=1 AND pinA.2=0 then
{
low C.0 low C.1 high C.2 low C.3 low C.4 low C.5 low C.6 low C.7
}
endif
if pinA.0=1 AND pinA.1=1 AND pinA.2=0 then
{
low C.0 low C.1 low C.2 high C.3 low C.4 low C.5 low C.6 low C.7
}
endif
if pinA.0=0 AND pinA.1=0 AND pinA.2=1 then
{
low C.0 low C.1 low C.2 low C.3 high C.4 low C.5 low C.6 low C.7
}
endif
if pinA.0=1 AND pinA.1=0 AND pinA.2=1 then
{
low C.0 low C.1 low C.2 low C.3 low C.4 high C.5 low C.6 low C.7
}
endif
if pinA.0=0 AND pinA.1=1 AND pinA.2=1 then
{
low C.0 low C.1 low C.2 low C.3 low C.4 low C.5 high C.6 low C.7
}
endif
if pinA.0=1 AND pinA.1=1 AND pinA.2=1 then
{
low C.0 low C.1 low C.2 low C.3 low C.4 low C.5 low C.6 high C.7
}
endif
'End channel selection
'Begin effect settings, no restrictions
if pinA.3=1 then high D.0 endif
if pinA.3=0 then low D.0 endif
if pinA.5=1 then high D.1 endif
if pinA.5=0 then low D.1 endif
'End effect settings
'Begin tap tempo
if pinA.6=1 then high D.2 endif
if pinA.6=0 then low D.2 endif
'End tap tempo
'Begin mute
if pinA.7=1 then high D.3 endif
if pinA.7=0 then low D.3 endif
'End mute
'Begin chorus toggle
if pinB.0=1 then high D.4 endif
if pinB.0=0 then low D.4 endif
'End chorus toggle
'Begin delay toggle
if pinB.1=1 then high D.5 endif
if pinB.1=0 then low D.5 endif
'End delay toggle
'Begin delay options
if pinD.6=1 then
{
read b0,b1
if b1<3 then inc b1 elseif b1=3 then b1=0 endif
}
endif
write b0,b1
read b0,b1
if b1=0 then low B.2 low B.3 low B.4 endif
if b1=1 then high B.2 low B.3 low B.4 endif
if b1=2 then low B.2 high B.3 low B.4 endif
if b1=3 then low B.2 low B.3 high B.4 endif
goto main

wvmarle

What made my head spin, though, was the different types of communication between units - I2C, serial, etc. - and some of that code was way over my head. I don't know which would be the best way to go, I can't seem to follow the different RX/TX codes ... I just don't, well, "get it."
You'll probably need Serial but it all depends on what communicates to what over what distance and at what minimum required speed.

Quote
1. Communication (probably) needs to be a continuous 2-way (synchronous?) setup and as fast as possible, with controlling functions on both ends (the preamp and the foot controller/footswitch).
"As fast as possible" is too ambiguous: what is the maximum acceptable delay? Is it in the tune of microseconds or are several milliseconds acceptable?

Quote
2. The two units will be wired at a distance of no more than 50 feet.
That's important: that distance excludes most of the very fast protocols. Maybe a wireless link is suitable as well here. 50 ft of wire is a bit of a handful to deal with, but no problem for a 433MHz wireless link. It depends on the allowed delay and amount of data to be sent.

Quote
3. There are 8 channels on the preamp (only one on at a time) with four "options" per channel.
4. The footswitch will be laid out in an 8x4 matrix so each channel and its four options are directly accessible with a single footswitch. (Again, only one switch in the matrix can be on at any one time.)
Those foot switches: this are basic on/off switches? How do they connect to the pre-amp? I assume the Arduino will have to read your foot switches, and then somehow relay the signal to the pre-amp.

Quote
5. There are six other momentary switches for other purposes, i.e., setting delay times, mute, etc.
6. Besides the 4x8 + 6 footswitch, the preamp itself will have switches to choose channel, channel option (separately - no matrix), delay time, etc.
What kind of switches? Rotary with many stops? What kind of outputs for the Arduino to read on those switches?

Quote
7. Current settings must be indicated on the footswitch, whether controlled at the footswitch or on the preamp.
How?

Quote
8. It will be "wired" using a computer-style DB cable.
The type of wire doesn't matter much for digital signals - unless you go for very high speeds (MHz range) and I don't see that here yet.

[quote[
9. I would prefer it include PWM for voltage controlled volume and blend. (I'm guessing it could be something like 2 to 4 PWM lines.)
[/quote]
Why PWM? That's a block wave. You're probably better off using a DAC for this part, then you actually get a voltage out of it, rather than a lot of noise which is likely going to mess up your volume control (with it trying to go from maximum to zero 1000 times a second).

Doing a rough count of the inputs and outputs you mention, a Mega indeed looks like it will fit the bill. But you'll have to provide more information - best would be a rough schematic of the whole digital part, as I have problems visualising most of it.

As I understand it you want two Arduinos.
One at your foot switch array, reading the switches and setting some indicator (LED?) in the switch to show its state.
This connects through a longish wire (up to 50 ft) to the other Arduino, which operates the pre-amp: setting volume, setting switches.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

Go Up