My first serious R dunno project is to Co trolley a turning target. I am going to use a rotary switch with different value resistors to give a different value to decide which function to run.
The controller uses 3 rotary switches to set 1) number of exposures 2) how long the targets face 3) how long the targets are away (edge).
This with feed 3 analog input pins and the value on the pins will be interpreted as what values to use. It will have upto 10 values per each parameter - exposure, face n edge
This code will use a for.. loop with a n output sent for each face or edge. Interrupts will be set to push button switches to override the set sequence if needed
Hi
Sorry for the confusion. It is a target controller gor a shooting range (om replacing the old analog/relay/H - bridge with arduino to control the motor).
On the controller, there are a series of resistors connected so as to provide different currents for each time slot.
1 = 10k
2 = 20k
3 = 30k etc at 5v or 9v
I want to be able to measure the current and assign a value ie 1, 2, 3 etc depending on the resistance. This will be used to direct a case statement to execute a preset number of exposures of the targets
I would wire each rotary switch like a potentiometer. The lowest terminal would connect to Ground and the highest terminal would connect to +5V. Fixed resistors of 500 or 1k ohms would connect between adjacent pairs of terminals. On a 10-terminal switch connect Terminal 1 to Ground and via a 1K resistor to Terminal 2. Connect a 1k resistor between Terminal 2 and Terminal 3. Connect a 1k resistor between Terminal 3 and Terminal 4. ... Connect a 1k resistor between Terminal 9 and Terminal 10. Connect Terminal 10 to +5V.
Connect the switch wiper to your analog input. You should get 0 for Terminal 1 and 1023 for Terminal 10. The 8 other terminals will get you roughly evenly spaced values between them: 114, 227, 341, 455, 568, 682, 796, 909
Thankyou johnwasser. That is most useful - I have a shed load of 10k resistors which I was hoping to use instead.
Please forgive my lack.of electronic knowledge as I spent out if my IT career as a programner/analyst, but hoping to broaden my experience via the arduino
johnwasser:
I would wire each rotary switch like a potentiometer. The lowest terminal would connect to Ground and the highest terminal would connect to +5V. Fixed resistors of 500 or 1k ohms would connect between adjacent pairs of terminals. On a 10-terminal switch connect Terminal 1 to Ground and via a 1K resistor to Terminal 2. Connect a 1k resistor between Terminal 2 and Terminal 3. Connect a 1k resistor between Terminal 3 and Terminal 4. ... Connect a 1k resistor between Terminal 9 and Terminal 10. Connect Terminal 10 to +5V.
Connect the switch wiper to your analog input. You should get 0 for Terminal 1 and 1023 for Terminal 10. The 8 other terminals will get you roughly evenly spaced values between them: 114, 227, 341, 455, 568, 682, 796, 909
John, you need to study the rotary switch wafers and how the switch operates. As you turn the switch, the wiper will EITHER open the current connection before closing the connection to the next resistor. OR it will connect to the next resistor while it is still connected to the current resistor. And will then disconnect from the resistor, while retaining the new connection.
In every case, there will be a time period where the resistance will net be what you describe. A potentiometer will be a continuous change in resistance with no bumps.
My rotary switches are break before make and I am intending the values from them to be sent WHEN I press a separate button, dominant expect to have any problems with values changing
How about using potentiometers that have detents? With one end to 5v and the other to gnd, read the wiper with an analog input and look for the appropriate value that corresponds to that detent's voltage. You'll need to look for a non-overlapping range of counts for each detent since the actual voltage may vary slightly on the same detent and will vary between different potentiometers of the same value.
Now the only reason for using multi-position switches, is where you need a visual indication for the setting on the switch itself.
If you have a display, you just have buttons to step up or down and the current figure appears on the display.
You can use a menu system to minimise the number of buttons - as on your computer monitor - if you do not want to adjust the settings too often.
And LCD displays are real cheap!
Mind you, you can use (binary) thumbwheel switches - 10 to 16 positions for each switch, built-in direct indication on the face, three of them can be Charlieplexed to five Arduino pins with diodes.
This pot will do the job nicely with no wiring of separate resistors. It has a "0" position and 10 "clicks", so just right for "It will have up to 10 values per each parameter".
Potentiometer Linear B10K 11 detent positions Mouser 313-3000F-10K $1.97
Those pots sound a great idea, however u need a printer so the user knows which position gives which value.
my electronics knowledge is very basic but as I have a 2X 20 LED display that will be the next progression, then onto setting ti
info n exposures using up/down switches to set values n the display to show them
will be building tge rotary selects this week n hopefully have it sorted by the weekend job n family allowing
Thankyou for all your help so far