Hi, I'm rather new to Arduino and C++ programming. I've spent the past several days reading about rotary encoders and using them as an input with the Arduino. I seem to grasp how they work as a sensor, but I want to do something a little different.
I have a signal processor for my car called an Audison Bit One. I am using it to interface with my factory stereo head unit.
Many newer cars have built in, volume sensitive equalization in them that essentially cuts the bass output as volume goes up.
Normally you would set your output level from the head unit to it's maximum unclipped level, and leave it there and use the speaker level signal from the radio to feed the BitOne. Then you would use the volume control on the processor to adjust volume.
My car has steering wheel controls, and I am attempting to interface the Arduino with them. Ideally, when it sees the Volume Up or Volume Down buttons, I would like it to (obviously) turn the volume up or down on the BitOne while leaving the setting on the factory radio alone; essentially functioning as my master volume control.
My idea was to read the input voltage for the steering wheel controls with an AnalogRead(), and compare it to certain values. If it sees Volume up, Volume Dn, or Mode it does one thing, otherwise it uses a Digitalwrite() on a PWM output pin to allow the other functions to work normally.
I had thought about using a continuous rotation servo to control the knob, which seems easy enough to control with a PWM output. But if I could avoid using a noisy mechanical piece, that would be better, as that may cost me points in car stereo competitions. Also, I'd like to keep the entire package as small as possible, as I may attempt to integrate it into a HUD at some point.
Where I feel I may run into a problem is that the rotary encoder pins (2 pins, high or low on each one) stay set depending on position....so I would need to continuously send a signal to the board (on the BitOne controller). If I set an output to HIGH or LOW, does it stay set, or does it only stay set for a short period of time?
I plan to use interrupt pins to read the input from the steering wheel, and even if I used a loop to continuously write the proper values, when the interrupt gets called it would screw up the timing and may turn the volume up or down unintentionally.
I haven't yet written the code for it, but I ran some simple coding, and got my voltage values (0-1023) for each button by reading inputs and sending the outputs to the serial monitor. I also used my multimeter and got actual voltages for each button.
I plan to desolder the rotary encoder and remove it from the board if possible, since I don't believe it would work with the RE still attached.
I'm using an Arduino Uno, btw.
Thanks.
Jay