Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Total Newbie with exciting project - help!

Status
Not open for further replies.

maxxx

New Member
Hello, first time poster here, have read a few project posts and am very encouraged to have found - and become a member of - this forum. I hope that you guys can help me!

My project involves car electronics / stereo. I wish to use my stock cassette radio to control an after market stereo. Basically, I have a hidden after-market "brain" that is ready to accept several functions from the factory steering wheel controls. As you can imagine, the steering wheel controls include a + and - momentary toggle switch for volume.

However, I would like to crack into the wiring of the volume knob (rotary encoder) on my factory cassette radio and use it to control the volume of my hidden stereo brain. In other words, I want to convert the varying sine wave outputs from the rotary encoder into momentary pulses of "+" when moved clockwise (for volume up) and momentary pulses of "-" when turned counterclockwise (for volume down). The rotary encoder has detectable detents as you turn it in either direction, so if I turn it over three detents clockwise I wish that to translate effectively into pushing the volume "+" button three times. Are you with me?

If you don't know how rotary encoders work, i will explain: the rotary encoder has a wire going into it ("I", main pulse 5V) and two wires coming out of it ("A" and "B"). What happens inside: There are contact surfaces all around the rotary knob (detents, you can feel them as you turn the knob, and the knob rests in these detent positions), but they only come in contact with the board at two different points (let's assume 3 o'clock and something slightly past 9 o'clock). Once one of the multiple contact surfaces on the knob comes in contact with these two points (the origin of the two output wires, A and B), a sine wave is output through each wire. If you turn the knob clockwise, the sine wave output on A might be slightly ahead time-wise than the sine wave output through wire B. I assume this is a result of the position of the contacts and which closes first. Thus, the difference in phase of the two sine waves (on wires A and B) tells the system that the knob was moved clockwise. The reverse would be true when the knob is turned counterclockwise.

Is it possible to find a pre-fab circuit that can output a momentary pulse to my "+" or "-" volume-button-receiving input wires when it receives input from the clockwise or counter-clockwise turning of the rotary encoder? If so, please advise!!! If not, i will have to put something together on a circuit board. Assuming the latter option, read on:

So, on both wires "A" and "B" I have a continuous pulse (sine wave, albeit slightly out of phase with one another) once the knob is in resting position (a detent). The way I see it, I need to first interpret the two sine waves output and use a process of elimination so that when turned clockwise there is only sine wave (or pulse) output on one wire, and likewise the other wire for counterclockwise movement. The following circuit seems to provide this:

Electronic Device And Electronic Circuit: Rotary encoder converter circuit

Next, I need to somehow convert that pulse signal of clockwise movement to momentary DC output to my volume "+" input wire. Bearing in mind that this momentary DC output needs to be reliably sensitive to each turning (detent) of the rotary encoder, such as when i want to turn the volume from position "5" to "6" (one DC pulse to "+" volume input) vs. turning from position "5" to position "8" (three DC pulses to "+" volume input).

Is this clear enough? Please let me know if you can help, or if I have been unclear.

Thanks in advance!
 
*yawn* Where's the EXCITING project?

Yes, that circuit will do it - sorta. You are actually going to have to turn the knob two detents to get a single pulse for your switch, but that might not be a problem.

So, on both wires "A" and "B" I have a continuous pulse (sine wave, albeit slightly out of phase with one another) once the knob is in resting position (a detent).

No, you don't have a continuous pulse when the knob is at rest. You only get the pulses when you turn the knob. The output is called "quadrature encoding".

That circuit with the 74HC74 flip-flops will work, just make sure your voltages match. Measure the voltage across the volume control buttons. That's going to determine Vcc for the flip-flop and encoder.
 
Thank you for your response, stay awake for this please! ;o)

My situation is actually more complicated, I am just figuring out. This probably changes everything, I don't know.

Again, a brief description of the project: I have a fancy after-market head unit (Alpine VPA-B222) in the back of my car that I would like to use the factory cassette radio (1999 VW Passat, originally made by Clarion) to control. The factory radio has a rotary encoder, whereas the aftermarket unit can accept simple toggle control for volume, like the "+" and "-" buttons on the steering wheel.

The volume control for the aftermarket head unit works this way: The head unit puts out a 5V signal which, when grounded at a resistance of 500 oHm, it understands to be a toggle of "+" for volume. Similarly, when the same 5V source is grounded at a different resistance, 600 oHm, it understands this to be a momentary toggle of "-" for volume.

Now, my factory radio has a rotary encoder for its volume, which I would like to use to momentarily ground the 5V wire at 500 oHm for each (or every other) detent clockwise, and similarly ground at 600 oHm for counterclockwise movement. The biggest problem with this, I imagine, is the fact that the rotary encoder makes contact with each detent regardless of clockwise or counter-clockwise movement, and thus both outgoing wires (A and B) have voltage (sine wave) present, and it is the phase of the signal A vs. B that identifies the direction it is turned.

So, I can't just input 5V DC into the rotary encoder and attach a 500 oHm resistor to A and a 600 oHm resistor to B and tie them to ground.

I think I need to leave the rotary encoder the way it is (which is attached to the factory radio circuit board and handling pulse/sine wave instead of simple DC). However, I figured I can use the pulse outputs from the rotary encoder (A and B) to somehow result in presenting ground - at two different resistances - to the 5V output from the aftermarket head unit that I am trying to control.

If I use the encoder converter circuit linked above, this at least gives me a pulse on wire X when turned clockwise and no signal on Y, and vice versa when it is turned the other way. This is a start. Now, is there a not-so-clunky/not-so-noisy relay that will close with a 5V pulse? If there is, then I think the solution is then relatively simple. Would I need to know the frequency of the pulse output by the rotary encoder? Will the voltage drop as a result of passing through the encoder converter circuit linked above?

Please consider and let me know! TIA
 
Your original circuit is fine, you just need a couple of transistors to ground the 500 and 600Ω resistors. This resistor thing is a standard way to reduce cabling.

It's not a sine wave, it's a square wave. They do make sine wave encoders, but those aren't used in car stereos.

Here's the circuit with the transistors. I put the 500Ω on the clockwise side, because that's the one that turns it up.
 

Attachments

  • vol.GIF
    vol.GIF
    5.1 KB · Views: 826
Duffy and Diver, thank you. I have some more questions about the proposed circuits, but, before I ask, I just want to share with you what I'm seeing from my rotary encoder.

My DMM is a basic Velleman DVM850BL. According to my DMM, there is a main 4.85V input into the encoder. Whether this is DC or square wave, I am not sure, but if the DMM measures square wave info as DC anyway (which it probably does when the frequency is high enough) there seems to be no way to tell.

The encoder does not close briefly to wires A and B when passing in between detents, but instead it closes on every other detent. So, when resting in one detent there is 0V on output A and 400mV on output B (not sure why both are not 0V). On the next detent both A and B show 4.85V. The next detent is back to 0V & 400mV, etc. alternating. So, I could have a problem if turning the volume one detent results in constant output of 4.85V, which my head unit might consider to be equivalent to holding the "+" volume button, resulting in runaway volume increase. I also doubt I could be sure to rest on "even" detents!

Please consider this and let me know if the circuit you have suggested can be altered in such a way as to momentarily ground the head unit wire at 500 oHm (for maybe half a second or so) in response to a constant 4.85V input, and do it again when the input goes back to 0V (or 400mV) and then to constant 4.85V again (indicating the turning of the knob over several detents). Do you know what I mean? Or am I down the wrong path?

I wanted to share these details because it sounds like my encoder behaves slightly different than you had predicted earlier. Thanks in advance for your valuable advice, I appreciate the help.
 
You have an old car and a very old car radio. They might stop working tomorrow.
New ones are a lot better.

My car is 3 years old and I ordered the improved sound system with it. Hundreds of Watts of power, component woofers and tweeters and a very powerful sub-woofer. It plays CDs and MP3s. I could spend weeks designing a sound system to equal it.
 
I think you need to take another look at those outputs. What you are describing isn't quadrature, one should be high and the other low at some point.

The input to the encoder will be DC, not a square wave.
 
Thanks Duffy, I think it might be high and low reflecting quadrature, in other words output B does vary from 4.85V to .40V and output A varies from 4.85V to .006V (which I thought was an error, but I suppose it is what it is). I hope this enough info to prescribe something! Otherwise, can you suggest any other probing I should do? TIA
 
So, when resting in one detent there is 0V on output A and 400mV on output B (not sure why both are not 0V). On the next detent both A and B show 4.85V. The next detent is back to 0V & 400mV, etc. alternating.

This isn't quadrature, like I said. You last post tells me exactly nothing.
 
Sorry, I'll try to be clearer: As the knob moves over detents, every second detent produces a variance in voltage on wires A and B (I'll call them "odd" or "even" detents, as it alternates). When the knob rests in an odd detent both wires A and B show 4.85V. When the knob moves to an even detent wire A shows 0.006V and wire B shows 0.400V. The next detent is back to 4.85V, etc.

Sorry if this explanation is redundant, I just wasn't confident that I had put it as clearly before. In any case, does this appear to be quadrature? If not, what does quadrature produce on wires A and B, and how would it look on my DMM?

Thanks in advance.
 
A quadrature output looks like this -
File:Quadrature Diagram.svg - Wikipedia, the free encyclopedia

So, both low, then the first one's high and the second one's low, then both high, then the first one's low and the second's still high, then back to both low again.

Check to see if you are missing some transitions between the detents. Otherwise you may have some unusual encoder I'm afraid I don't know anything about.
 
Last edited:
Thanks Duffy. I don't think there is a way for my DMM to measure this quadrature signal. I assume this square wave (or pulses, I don't know the right term) is at such a high frequency that my DMM measures it as DC. What tool could I use to see this signal?
 
A DMM. Please re-read what I tried to tell you earlier.

you don't have a continuous pulse when the knob is at rest. You only get the pulses when you turn the knob.
 
I regret that I am so thick when it comes to understanding this. I will again attach my DMM to wire A (and then B) out of the rotary encoder and report what I see when the knob is between detents. Can you tell me what I should see on the display, assuming it is quadrature?

Or, based on what I've reported already, are you sure it is NOT quadrature?

I just want to make sure that I am providing the correct observations.

I really appreciate your attention on this, and your patience!
 
Last edited:
Turn it v-e-r-r-y s-l-o-w-l-y. If it's like any of the ones I've ever used, one line will change state before the other one, and it will follow that characteristic pattern -

AB
---
00
01
11
10
00

Look on this page under "TRUTH TABLES, Clockwise Rotation, Quadrature 2-Bit Code" -
**broken link removed**
- that shows a table for the typical switch outputs for an encoder of the type that's usually used.

And you're not that thick, you were right about that circuit sending the volume all the way up if the encoder stops in certain positions.

First thing is to figure out what the output of that encoder is. A picture might help...
 
Eureka! I'm up to speed. It is quadrature.

In following your very useful explanation in the post above, I realized I needed two DMM's. Borrowed my friend's this afternoon, got back to the workbench and voila, upon slow turning clockwise wire A has voltage before wire B, and vice versa during slow counter-clockwise motion. Whew!

Do you still need me to provide a picture? I think I'm ready to move on and consider your circuit diagram.
 
Ok, moving on to the next chapter of newbie questions...

Duffy, re. your circuit diagram:

In wiring up your suggested circuit, I understand input wires A and B, but for the VCC should I tap into the wire that is also ingoing into the rotary encoder? It seems to be +/-5V.

What is the meaning of the terms U1A and U1B? just for illustration I imagine?

Is there any particular brand of 74HC74 (e.g. phillips) that is better than the other? What about 74HC74 vs. 74HCT74?

Are you sure I need the 10k resistors on the outputs? or are they arbitrary? I'll use them if you think I should, not meaning to bother you for the theory behind it or anything.

The 2N3904 seem to be a basic transistor (whatever that means!! bah-hah, I just googled the part number, and that's what came up). Do these perform as momentary switches? As discussed before, I need the momentary effect, so perhaps I need to add another piece of hardware. Any ideas what might provide this?

Thanks in advance!
 
Yes, tap into that +5V line and ground. The circuit will not draw much current, it will be fine off the encoder like that. U1A and B just indicate that there are 2 flipflops in that one chip. The 10K resistors are necessary to limit current, a bipolar transistor like than has an inherent .7V drop base-to-emitter, the chip wants to put out the full 5V. A 2N3904 is a good general purpose transistor that is easy to obtain and cheap. Any 74HC74 is fine, HCT will also work, it's just a slightly different flavor of silicon.

I will sketch out a drawing of what you need for the momentary effect, this will use a CD4093 schmitt-trigger gate with a cap and a diode to kill the signal after a certain time period - maybe .25s? About how long can you hold the button down before it auto-increments the volume?
 
Sounds great!

I am not sure how long the button can be held before auto-incrementation. I think a working value of 0.25s is good. However, I shall develop this circuit so as to plug it in after I have "programmed" the two units to work together. During programming for all buttons, I must hold it down until the unit gives feedback (lit LED) that it has "learned" the input. Once I get that in place, I will introduce the circuit that shortens the input to 0.25s.

Look forward to your ideas, thanks again.
 
Status
Not open for further replies.

Latest threads

Back
Top