Pages: [1]   Go Down
Author Topic: Up/Down Button Volume Controller to Rotary Knob  (Read 955 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I have just got a Rev 3 Uno (have been playing around with Arduino boards for a while) and am trying to achieve the following, hope someone will be able to help! smiley


I want to change my push button controlled speaker controller (one click button for volume up and another for volume down). I want to change this to be a rotary style volume controller instead.

So far I have thought about using a couple of transistors to act as the trigger switch. I will insert the transistors in replace of the up/down switches and when a high signal is sent it should close the switch, right? Then when the high signal is removed will it then open again?


I am also thinking of using the BarGraph tutorial found here to visually show the rotation - http://arduino.cc/en/Tutorial/BarGraph

Is it possible then to trigger the transistors based on weather the pot is turning clockwise or anticlockwise? If turning clockwise it would light up the first led on the bar graph and trigger the transistor for half a second (simulating the press of the button).

It would continue lighting up the LEDs and triggering another 0.5 second burst of the switch via the transister every time another led is activated. The volume down may be more complicated as it would need to trigger the other transistor based on LEDs turning off. So say i turned the pot up so it lit up 5 LEDs and then wanted to decrease the volume so rotated the pot anticlockwise so one LED went out. This would cause the volume down transistor to trigger and close the volume down "button" for half a second like before.

Hope this makes sense, many thanks in advance!

Jack
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 76
Posts: 7305
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

All those are possible. I see three separate projects:

1) Find out how the push buttons work. They may be simple as connecting an input to ground when pushed or more complex. At the least, find out how they work. You don't need transistors in most cases to let arduino press the buttons.

2) Learn how to sense a rotary encoder and use that to produce some serial port outputs. Later these outputs can be changed to button pushing.

3) Learn how to visualize the rotation. I don't know what screen you are thinking about, a small LCD or computer screen or something?

For part 2, I would recommend my phi_interfaces library, which senses rotary encoders and almost all other types of buttons out there. If you use a different library, then different types of buttons will need another library, and yet another library. Phi_interfaces will do all button types in one library with the best learning curve.

http://liudr.wordpress.com/libraries/phi_interfaces/
Logged


Queens, New York
Offline Offline
Faraday Member
**
Karma: 108
Posts: 3785
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
Is it possible then to trigger the transistors based on weather the pot is turning clockwise or anticlockwise? If turning clockwise it would light up the first led on the bar graph and trigger the transistor for half a second (simulating the press of the button).

Yea but it depends on the rotary Pot, if it logs the data as positive in the clockwise and negative, counterclockwise. If it can do that then all you need to do it use an IF/else statement to say, "hey, im getting a positive number, pulse pin 5(up), and likewise for a negative number on pin 4(down)" Most buttons are either brought to ground to trigger, or pulled up, so you need to see what will trigger your buttons.

Thats all you really need to do.

Make sure the grounds on the ARD and speaker circuitry are connected, that is a MUST
« Last Edit: November 30, 2012, 04:25:04 pm by HazardsMind » Logged

Created Libraries:
TFT_Extension, OneWireKeypad, SerialServo, (UPD)WiiClassicController, VWID

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you both for the quick responses. smiley

HazardsMind -

That seams quite simple smiley when you say rotary pot could that be just a normal one like a 10k pot shown in other examples here or am i missing something?


liudr -

Do you think it would be better to use a rotary encoder compared to the pot? I was wondering about using one but I thought it would be easier using a pot for the limited rotation and I can follow the bargraph project better.

I was thinking I would use the bargraph project but arrange the LEDs in a ring formation around the pot, like the board made by Mayhew Labs for rotary encoders. Thanks for the link to your library I will have a good read through the site. smiley

The buttons are just normal push to make that triggers something inside the speaker box. I just need to touch the wires together raise/lower the volume. How can this be done using just the Arduino to "push" the buttons?

That certainly gives me something to stick my teeth into!

Jack

Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 76
Posts: 7305
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You will need IC that decodes rotary encoders to output on one pin for one direction and output on another pin for opposite direction. You can search for rotary decoder IC or just use arduino to decode it, with a library such as mine or someone else.

Wires touching is not giving me enough details as how to emulate it with arduino. You need to first find the ground of your speaker, then measure voltage of both wires before they touch and after they touch while the speaker is on. Then with it off, measure continuity between ground and whatever wire that shows 0V to ground when the speaker is on.

Also, your LED ring idea may not fly. Push buttons only increase and decrease volume so rotary encoder will only do that too, not to set the actual volume by its orientation.
Logged


Queens, New York
Offline Offline
Faraday Member
**
Karma: 108
Posts: 3785
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry, I was thinking rotary encoder, I dont know why I said "Rotary Pot"?, sorry for the confusion.  Because a rotary pot won't continuously give you data, well not the correct data you need. You want the encoder to give you data when it is being rotated CW/CCW, and return back to zero when it is not being rotated.

Now there is also the matter of the negative data, the analog pins dont read negative values, so as liudr said,
Quote
You will need IC that decodes rotary encoders to output on one pin for one direction and output on another pin for opposite direction.

Logged

Created Libraries:
TFT_Extension, OneWireKeypad, SerialServo, (UPD)WiiClassicController, VWID

SE USA
Offline Offline
Faraday Member
**
Karma: 41
Posts: 3783
@ssh0le
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

http://www.piclist.com/images/www/hobby_elec/e_ckt10_3.htm

the up/down circuit provided is the easiest way I know of, last time I used it I took the outputs of the flip flop to switch the bases of transistors, those opened and closed the circuit where the buttons used to be
« Last Edit: December 01, 2012, 01:00:20 am by Osgeld » Logged


Pages: [1]   Go Up
Jump to: