Hi,
I am new to the Arduino scene,so please bare withe me if my questions seem obvious! …but was wondering if i could get any thoughts on the following please:
I have a bluetooth controller for my iphone which controls the volume with two separate switches, one for volume up and one for volume down. The range of the volume covers 15 switch activations. For my project I need to control the volume using a rotary motion, so for this I have a 10 turn potentiometer and a Arduino Uno.
I think I understand the basic principle of how this needs to work, for every 68 step increase (of the 1024 step resolution) of the potentiometer, the volume up switch needs to be activated. As well as this recognising a decrease in steps to activate the volume down switch. Does this sound right?
Could anyone please point me in the right direction how i should begin setting this up and coding it or be able to show me some example of code of maybe a similar project.
Any help and advice would be much appreciated and sorry if i am covering obvious ground!
Thank you!
You are on the right track but the problem is the volume level will eventually get out of sync with the dial setting. It will still work, but you will sometimes have to turn the dial all the way to one end to get it to sync back up. I hope this makes sense.
You could use a rotary encoder where every click in one direction is a volume up press, and every click in the other direction is a down press.
A couple things I would worry about: you may have some speed limitations on how fast you can change the volume on your bluetooth remote (if you send 15 volume-up signals in a tenth of a second will it read and act upon all of them?). You may want to put a delay in your control loop.
Also, a ten-turn pot is going to be way more sensitivity than you need. You’ll be spending all of your time cranking that thing around to test your ADC (2/3 of a turn per volume level change).
For code, take a look at the AnalogInOutSerial example code in the arduino IDE, and read and understand the page on the [map() function, it’ll be very useful in handling the scaling from the ADC to your volume level for you.](map() - Arduino Reference)