Jump to content

Rotatory Switches question


matcom3
 Share

Recommended Posts

Hi everyone

 

I'm building a midibox to control a really nice softsynth... but..... I start to do worries about one thing

 

i am planing to use rotatory switches to choose diferent fixed values of a single CC, for example:

 

position 1  send MIDI CC 23 value 14

position 2  send MIDI CC 23 value 45

and so on

 

this is the rotatory switch I will use:

 

http://www.aliexpress.com/item/5pcs-lot-Band-Switches-Band-Channel-Rotary-Selector-Switch-1-Pole-12-Position-Or-2/1607807856.html

 

 

on the paper everything its ok, i will conect the the out of the swith to an analog in of the AIN mudule and every pole will have a 10k ajust potentiometer to send the rigth midi cc value

 

here you have the ones i will use:

 

 

http://www.aliexpress.com/item/Free-Shipping-100pcs-lot-103-10K-Ohm-high-precision-carbon-film-potentiometer-Variable-Resistors/548373358.html

 

 

my problem is:

 

 

what happends when I change for example from positio 1 to position 2 of the switch if the conetion break for a fraction of second?... will the midibox send random midi events on that micro period of time?, if so, is any way to prevent this?

 

i hope you can understand me, my english is not so "perfect"

 

thank you 

Link to comment
Share on other sites

Why don't you use endless rotary encoders and instead of having them cover the full parameter range from 0-127, just "connect" them to a table of values, so turning them to the right one tick would change the CC 23 value from 14 to 45? Your solution seems to be very complicated to me!

 

Or, use the rotary switch you link to above, and connect the pins to a DIN module that triggers the MIDI messages you want to send?

Link to comment
Share on other sites

hi matcom3,

 

i believe ilmenators solution would work, but as you want to use rotary switches, encoders are not the proper solution for you.

had the same problem before and have attached a part of the diagram from my project. you can find further infos, including pictures of my pcbs, using rotary switches, here:

 

http://www.chipkit.net/forum/viewtopic.php?f=15&t=2561

 

i made this before i came across midibox, but it will still work with that. the idea is to use the rotary switch as part of a voltage divider. the output of the switch has to be connected to an analog input. because the switch-output is pulled down to GND as well, you wouldnt have the problem with "open" analog-inputs. you need to modify your program to read out the switch, so it doesnt accept 0v between 2 switch-positions. worked fine for me...:-)

 

another problem, i see with your idea, are the switches itself. depending on the money you want to spend for your project, you might be better off with these ones here:

 

http://uk.rs-online.com/web/p/rotary-switches/0327901/

 

dont know where you are from, but rs is available literally everywhere. ok they are a bit more expensive then yours, but i cant advise you to use yours. have tested them before, but they are really a waste of money in my view. also you cant mount them really on a pcb, can you ?? :D

 

kind regards,

mOnO

 

post-20416-0-02487200-1399672713_thumb.j

Link to comment
Share on other sites

Why don't you use endless rotary encoders and instead of having them cover the full parameter range from 0-127, just "connect" them to a table of values, so turning them to the right one tick would change the CC 23 value from 14 to 45? Your solution seems to be very complicated to me!

 

Or, use the rotary switch you link to above, and connect the pins to a DIN module that triggers the MIDI messages you want to send?

This solution it's very good but my intention is to do a "vintage" look and feel of my front panel, that's the reason why i'm using rotatory switches

Link to comment
Share on other sites

hi matcom3,

 

i believe ilmenators solution would work, but as you want to use rotary switches, encoders are not the proper solution for you.

had the same problem before and have attached a part of the diagram from my project. you can find further infos, including pictures of my pcbs, using rotary switches, here:

 

http://www.chipkit.net/forum/viewtopic.php?f=15&t=2561

 

i made this before i came across midibox, but it will still work with that. the idea is to use the rotary switch as part of a voltage divider. the output of the switch has to be connected to an analog input. because the switch-output is pulled down to GND as well, you wouldnt have the problem with "open" analog-inputs. you need to modify your program to read out the switch, so it doesnt accept 0v between 2 switch-positions. worked fine for me...:-)

 

another problem, i see with your idea, are the switches itself. depending on the money you want to spend for your project, you might be better off with these ones here:

 

http://uk.rs-online.com/web/p/rotary-switches/0327901/

 

dont know where you are from, but rs is available literally everywhere. ok they are a bit more expensive then yours, but i cant advise you to use yours. have tested them before, but they are really a waste of money in my view. also you cant mount them really on a pcb, can you ?? :D

 

kind regards,

mOnO

thank you!!

 

thats what i were looking for

Link to comment
Share on other sites

This solution it's very good but my intention is to do a "vintage" look and feel of my front panel, that's the reason why i'm using rotatory switches

 

Then go for my second suggestion, connecting the rotary switch to a Digital In (DIN) board. I think this is much more straight forward than using the rotary switch to implement some voltage divider, which is then sampled by the analog input of the Core. Especially software-wise, using the DIN modules to send fixed CC values is dead easy. There is a code tutorial you might want to take a look at: you want to look at tutorial #010 "Scanning up to 128 buttons connected to DINX4 Modules"!

Link to comment
Share on other sites

Then go for my second suggestion, connecting the rotary switch to a Digital In (DIN) board. I think this is much more straight forward than using the rotary switch to implement some voltage divider, which is then sampled by the analog input of the Core. Especially software-wise, using the DIN modules to send fixed CC values is dead easy. There is a code tutorial you might want to take a look at: you want to look at tutorial #010 "Scanning up to 128 buttons connected to DINX4 Modules"!

 

sounds like a waste of inputs to me. cant see where the problem with my solution is either. the rotary switch is connected just like a poti. to be fair it is rather annoying to solder 12 different resistors for one switch, but it works a treat!

 

@matcom3: nice to know and please keep posting your results here... :D

 

mOnO

Edited by mono
Link to comment
Share on other sites

One of the problems with using the pots and the analoge input is that it will be difficult to make each switch position output a specific value.  You didn't say how the CC values were going to be used but there may be cases where your system will output different CC values due to noise or temprature changes of the conponents.   Using the DIN connected to the switch you don't have this problem.  If you buy a DIN card from SmachTV the resistors are on the board.  Just wire the ribbon cable to the switch and its done.

 

Pete

Link to comment
Share on other sites

i agree, that in theory there will be differences between the resistors. the resistors will have tolerances as well. the ones ive used are 5%, but ive choosen the 12 resistor-values for a good reason. if you start with the first switch-position, the next position will give you a value, that is much greater then the one before. the absolute value of the switch-position doesnt really matter as long as your program can determine one of the 12 switch-postions! from that you can calculate your desired cc-value...;-)

 

mOnO

Link to comment
Share on other sites

Converting a digital signal to Analog and then to digital again is something you shouldn't do, if you have a choice.

I'd do what Ilmenator said: Connect those rotary switches to a din. Less parts, less soldering, less trouble.

If the "waste of inputs" is of concern, you can use gray encoders. Those put out binary values, so you will get 16 possible values on 4 lines.

Link to comment
Share on other sites

One of the problems with using the pots and the analoge input is that it will be difficult to make each switch position output a specific value.  You didn't say how the CC values were going to be used but there may be cases where your system will output different CC values due to noise or temprature changes of the conponents.   Using the DIN connected to the switch you don't have this problem.  If you buy a DIN card from SmachTV the resistors are on the board.  Just wire the ribbon cable to the switch and its done.   Pete
Question here… I need sonmething like 8 rotatory switches on my panel, the rotatory switches act like the button is allways pushed, will be a problem?, I mean, the system can work normally if all those digital inputs are closed? If so my problem will be solve and less work Thank you
Link to comment
Share on other sites

You just added another complication that we didn't know about.  You want 8 switches.  With this I can agree with your direction with using analoge inputs for determining the position of the 8 switches.  For some reason I thought that you had pots on each of the swtich positons and you were going to adjust each pot to output a specific value.  Don't ask where I got this idea because I don't know.

 

Your schematic diagram shown will work if each of the switch units have separate resistors (13 ea) for each switch.  Thats 104 resistors.  What I would do is take 13 - 470 ohm resistors and put them all in series and connect one side to VCC and the opposite side to ground.  This gives you a reference voltage for each of the switch positions.  Connect each resistor node to your switches.  Now the wiper side of each switch can connect to separate analog inputs of your core processor. 

 

Pete

Link to comment
Share on other sites

I just noticed that the schematic I was referencing in my last post was from "mono" and not you "matcom3".   There was talk about analog inputs not being terminated when switching values.  I was wonding if the capacitance of the inputs might be enough to hold the value for the time that it takes to go from 1 position to the next.

 

Pete

Link to comment
Share on other sites

You just added another complication that we didn't know about.  You want 8 switches.  With this I can agree with your direction with using analoge inputs for determining the position of the 8 switches.  For some reason I thought that you had pots on each of the swtich positons and you were going to adjust each pot to output a specific value.  Don't ask where I got this idea because I don't know.   Your schematic diagram shown will work if each of the switch units have separate resistors (13 ea) for each switch.  Thats 104 resistors.  What I would do is take 13 - 470 ohm resistors and put them all in series and connect one side to VCC and the opposite side to ground.  This gives you a reference voltage for each of the switch positions.  Connect each resistor node to your switches.  Now the wiper side of each switch can connect to separate analog inputs of your core processor.    Pete
Yes pete, you are right, my intention is to use analog inputs with one pot for each switch unit, your idea of the 13 resistors its brilliant, I will try it thank you vey much. I wonder if its possible to use the digital inputs solution, I mean if somebody know or try to let some digital inputs closed and if the system can work this way
Link to comment
Share on other sites

I just noticed that the schematic I was referencing in my last post was from "mono" and not you "matcom3".   There was talk about analog inputs not being terminated when switching values.  I was wonding if the capacitance of the inputs might be enough to hold the value for the time that it takes to go from 1 position to the next.   Pete
Yes… thats the reason of my worries
Link to comment
Share on other sites

The  solution with one set of 13 resistors  might change values of all switches a little, everytime you change the position of one.

A  dividers voltage will change, if the load is changed.

You could buffer all voltages, but that would mean using 12 op-amp channels (>=3 more chips).

 

To have a digital input shorted to ground all the time is no problem btw.

A small current will flow through the pull-ups, but they can take it.

Link to comment
Share on other sites

You are right about the volttage values will change depending on the load of the analog input impedence but this would be very small.  The resistors were just to know which position the switches were in, not to give an exact voltage as to the CC value.  Software in the core would need to be changed to look for a range of the input voltage for each switch position and output a specific value to the synth from a table lookup or hard coded in the software.

Link to comment
Share on other sites

@all: i was talking about a practical circuit to give an easy solution for the problem. it was not meant to be a start for a scientific / philosophical discussion about voltage dividers and stuff.

@kpete: thanks for that! this is exactly what i meant in my first posting. the resistor values are e12s. the difference between each step is big enough for the software to determine, which one out of 12 steps is selected. the absolute value doesnt matter at all and it has nothing to do with the cc-value, that you want to send either.

also i cant understand, why theres a capacitance on the analog-input / switch-output. in my diagram you can clearly see the 10k resistor pulled down (!) to GND. this ensures that, if the switch is between 2 contacts, the voltage on the analog input is pulled down (!) to GND. no open inputs, no capacitance, just GND. obviously the software needs to detect this and shouldnt send anything in that case.

i know, that it sounds a lot to use 13 resistors for one switch, but the benefit is, that only 1 analog input is needed per switch. in my case ive even connected these switches to analog multiplexers, that is 8 rotary-switches per analog-input. so theres plenty of rotary-switches you could connect to one mcu or in other words loads of money to spend on these switches.

@matcom3: in a practical use, i would go for smd-resistors anyway. for the smt-machine its quite easy to place 13 0805-resistors per switch "somewhere" near the switch, so i didnt worry too much on that. have built a prototype with 16 rotary-switches. it took me a while to solder more than 200 through-hole-resistors only for the rotary-switches, but im very pleased with the result. it works just fine and you get a very neat "vintage" feel with them. apart from that 12 switch-positions are exactly the amount of keys per octave and you cant beat that feeling with any rotary-encoder..:D

mOnO

Edited by mono
Link to comment
Share on other sites

i know, that it sounds a lot to use 13 resistors for one switch, but the benefit is, that only 1 analog input is needed per switch.

 

Using the Digital Ins (DIN) within the MIDIbox framework would cost you three processor pins for (almost) as many switches as you like, as the switches / buttons are connected to the parallel inputs of a chain of shift registers. Add another processor pin and you get virtually as-many-as-you-want digital outputs as well. You could even reduce the number of shift registers required by scanning the inputs in a matrix-style.

 

Of course, it is technically feasible to do it your way, and it has been proven to work before.

Link to comment
Share on other sites

i fully understand that, but you would still need 1,5 shift-registers per switch and you cant chain them that long, depending on the amount of other stuff you have to connect to the 3 processor-inputs for the din-chain. lets agree, that you could use either the digital or the analog-way. so theres plenty of room for "matcom3" to decide whichever is the easiest to go... :D

 

mOnO

Edited by mono
Link to comment
Share on other sites

am i missing something ? 12 inputs from 12 switch-contacts -> 12 inputs on the shift-registers = 1 (8-input) shift-register + 0,5 (4-input) shift-register. and theres i no way around, unless you are on about connecting the switch contacts in some kind of matrix form to the shift-registers...

Link to comment
Share on other sites

Well, you would actually need far less shift registers than 1,5 per switch if you were using the DIO_MATRIX module!

You are very right.  This is a digital way to do the same thing.  You connect the switches in a matrix.  In fact if you connect it up in a specific way you don't even need diodes.  In the matrix you could even go to 16 position switches and have 16 separate switches with just one DIO_MATRIX board.  To make it work you would take the 16 output chain wires (two 74HC595) and connect each one to the 16 positions of the switches.  If you have more switches, just parallel all the 16 wires from one switch to the next and to the next.  Now the wiper on each switch will connect to one of the inputs of the input chain (two 74HC165) of the matrix board.  The diodes are not needed because each switch will have only one of the 16 positions making contact to the wiper at any one time. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...