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!
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?
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.
All those are possible. I see three separate projects:
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.
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.
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.
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
That seams quite simple 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.
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!
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.
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,
You will need IC that decodes rotary encoders to output on one pin for one direction and output on another pin for opposite direction.
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