Tapping into common ground rotatory encoder pins

Go To Last Post
27 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi!

I have came across a proplem that i need to partitially control another device i have zero control over.

It does use rotatory switch with a push button, from what I did inspect it does pull the lines low(gnd) and pull ups enabled by the micro in the said device to get the line high, so every other turn of the knob does ground the lines(depending on the direction one pin after another).

What the proplem is i can control the device in every other position of the knob(when it's not pulling the lines to gnd), is there anyway to control the device in every position of the knob without pulling it off and re-wiring?

PS. And if someone is wondering why, im building "universal" steering wheel control kit which let's one replace headunit of car with tablet or phone while retaining steering wheel controls, but did get request of controlling the main volume directly rather than the source volume(phone/tablet)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Are any of the lines NOT over-ridden by switches?

 

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ka7ehk wrote:

Are any of the lines NOT over-ridden by switches?

 

Jim

Sadly no, which did lead into the issue that i simple cannot push the lines high while the switch is pulling those directly to the ground, since it would make short circuit. I could not figure anything else out than to take the knob out of the circuit board and put nfet in line with the ground of the knob, so I can ultimately deactivate it, which is just not good solution to this proplem.

That is actually why I wanted to consult people who does have way more knowledge than me.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well the problem is at least one line is low by the existing switch, so that line can never be high, unless you can open the circuit some place between the  wheel and the controller.

 

Jim

Your description reminded me of the 007 movie where the agent could control his car with this phone.

 

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
stack gold/silver https://www.onegold.com/join/713...

 

 

 

 

Last Edited: Fri. Jun 28, 2019 - 04:45 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes ,two of the line are actually direct gnd, one for push button and one for turning the knob ->

  1. Input of the mcu, pulled high(for button press)
  2. Gnd.(button)
  3. Input of mcu, pulled high("output A of knob")
  4. Gnd(common)
  5. Input of mcu, pulled high("output B of knob)

 

I assume there is really no "real" solution to the issue without taking the knob of the board?

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just "ruminating" a little here, not knowing all of your requirements in detail...

 

I wonder whether or not the problem might be just "sufficient interface" rather than being able to unambiguously take over the system. 

 

  1. Is it bad if the driver is able to take over the functions with the steering wheel controls?

  2. Does not the problem really become driving with a soft interface that tolerates grounded lines?

  3. Or, is the problem that the rotary encoder hard-grounds unpredictable lines in the system? Momentary switches seem less of

      a problem (e.g. point 1) but encoder sits for an extended time, grounding one or more of the lines that you would need to use.

 

West Coast Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm confused, are you controlling a vehicle's steering, or a radio's volume?

 

The original input clearly wasn't designed with the expectation of adding an additional input system.

 

Even if you were to put your micro / transistors / Opto-iso / whatever in parallel to the original switches, and add some low side resistors, (non-trivial, one still needs valid logic levels with added short circuit protection for the secondary driver), it is possible that the secondary driver's signals, intermixed with the original control signals, could really screw up the decoding and input interpretation.

 

That's not a big deal for a radio volume.

That is a huge deal of drive - by - wire steering!

 

An option for you to consider, albeit perhaps harder to install, is to insert a micro as the man - in  - the - middle.

The original switch goes to the micro.

Your tablet / phone secondary input goes to the micro.

The micro then decides how to prioritize the inputs and feed recognizable, meaningful, inputs to the original PCB where the switch was connected.

 

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

1. No it's not bad if driver is able to take over control, what he should be able to do is to use steering wheel buttons or the knob simultaneously without any other action needed in between at any point.
2. Honestly can't be 100% sure what you are asking to answer the question(English is not my native language)
3.the switch does hard ground the input lines of the mcu in every other turn of the knob, so it's 3.3v(provided by pullup), or gnd forced by switch, until one turns the knob again by one step, when it turns 3.3v again.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

My item (2) was wondering whether or not you could do it if your interface were able to electrically tolerate the grounds? For example, if the outputs were open collector/drain so that they could just pull down. Pulling down on a line that is already ground hurts nothing. 

 

I suspect that DocJC's suggestion of "micro in the middle" is probably the only sane solution.

 

West Coast Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

DocJC wrote:

I'm confused, are you controlling a vehicle's steering, or a radio's volume?

JC

Well basically "radio" volume, not trying to control the car steering for God sake, even thought it would be possible since my car can park itself.

Originally I wanted to remote control tablet/phone via steering wheel controls(play,pause etc), which i got working great in my car, but what i was requested to do is to control main volume of digital signal processor(from it's remote control which add huge benefits) instead of the source volume(tablet/phone).

And yes, the device was not designed to be controlled externally as it is remote control itself.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

the device was not designed to be controlled externally as it is remote control itself.

That makes it easier, but a little bit more expensive.

 

Buy a second remote control!

 

Now the User can use one remote as usual.

 

You hack the second remote, destroy the case, remove the original switch, etc., and just add to it connections from your micro, which has a BT/WiFi connection to your phone / tablet.

 

 

JC 

Last Edited: Fri. Jun 28, 2019 - 07:34 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You could add 1K in the ground connection of your knob.

Doing so allows your micro to force any line high or low

The micro is set to input (non-forcing) when knob control is desired .

However if the knob connects more than 1 wire to gnd at a time (likely), this idea won't work----you'd need to put in a resistor to EACH switch line.

You WILL need to make some sort of wiring change.

 

The micro in the middle idea is the nicest...since you can unplug it later & restore the original setup if someone requires you to do so.

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There seem to be two general types of rotary encoders.   One is the older expensive well-designed, well-documented, mostly-metal heavy-duty type; and the other is new, mostly-plastic, cheap, and all-but-undocumented.  If your rotary encoder did originally cost more than a dollar (any kind of dollar, or a euro) then it is most likely the old kind.

 

The older expensive encoders allow the technician to see 0 volts/ground on the either the A or B or both outputs as the shaft is turned.  The newer cheap encoders [as far as I can tell] use very small value capacitors built into the encoder's inner design to make very-brief pulses to ground when the shaft is turned.   Usually a network of resistors and capacitors is connected to the A and B outputs in order to stretch the pulse so that the microprocessor can "catch" it.  

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There seem to be two general types of rotary encoders.

I think he is talking about the volume knob type, not the spinning motor shaft type.   They are all straight switches, as far as I've seen (for something like a 20 clicks/turn style).  

https://www.ttelectronics.com/TTElectronics/media/ProductFiles/Encoders/Datasheets/EN11.pdf ​​​​​​​

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

DocJC wrote:

the device was not designed to be controlled externally as it is remote control itself.

That makes it easier, but a little bit more expensive.

 

Buy a second remote control!

 

Now the User can use one remote as usual.

 

You hack the second remote, destroy the case, remove the original switch, etc., and just add to it connections from your micro, which has a BT/WiFi connection to your phone / tablet.

 

 

JC 

I should have been bit more specific, it is wired remote control.
I did not have time to inspect how it talks to the digital signal processor when i had the test device from friend, but I suspect that the volume control is made via voltage so one can't wire two of these in parallel, removing the knob from other and leaving another intact(I base my quess on the fact that there are two types of the remotes for the device, basic one with 2 potentiometers only and this better version with touchscreen, encoder switch and alot of bonus features, so volume being controller via voltage between remote and DSP would make most sense to me)

avrcandies wrote:

There seem to be two general types of rotary encoders.

I think he is talking about the volume knob type, not the spinning motor shaft type.   They are all straight switches, as far as I've seen (for something like a 20 clicks/turn style).  

https://www.ttelectronics.com/TTElectronics/media/ProductFiles/Encoders/Datasheets/EN11.pdf ​​​​​​​

The knob is exactly like one in the datasheet.

Hmmn, Im starting to believe that the "man in the middle" is only real solution to make it really work seamless, the said remote costs bit less than 300€ which is why I wanted to try avoid pulling anything off from it's PCB, but i guess since I have no control over that device, it's what it is if i want to make it work.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There is a small clip i did take earlier the music is playing via the tablet since my usb cord was too short but in reality it would play from the car speakers, https://drive.google.com/open?id...

 

Got basic prototype done allready(well without the main volume control which was requested later on), only need to implement HID over gatt to make it better so that it doesn't matter which device is connected to my "adapter", since currently it demands my application installed on the device to take over the media actions.

 

i just cant believe no such device actually seems to exist yet(too small marked i guess?), well at a proper point of time i will open source it all including schematics of the pcb. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just wanted to let you know the man in the middle for the volume control is working great, found a good place to cut the traces on the PCB so that the mcu inputs on the remote does still make a use of the original pullups on the PCB, just provided my own pullups for the knob.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


The actual rotary encoder switches, works different from motor shaft encoders.  The switches only operates (closes the contact for a brief angle of rotation) while moving from one detent position to the next.  On the detent position, they are completely open, allowing the two channels (lines) to be pullup with any resistor to some VCC.  This is rather very confused for the first time you see it, since you expect the encoder to obey the 2 bits grey coding, up, down (and stay down) on certain detent positions.  This "pulse down only while travelling between detents" is exactly to allow more than one rotary switch to be used in parallel, or, a microcontroller simulating the function of the rotary switch in parallel with the actual panel rotary switch, without any other hardware in the middle.

 

Check the following image to see that channels are open (high) while on detent position, no matter what.

 

If your switch operates like that, no problem to insert anything else in parallel with the switch two channels (A/B), considering this "external thing (uC)" would leave both channels in up level (open or pullup) after generating the virtual rotation.  The best way to program the uC (AVR) two pins (to go in parallel with the switches) as INPUTs, disable pullup, set pin output register as LOW.  Obviously nothing will be low since the pin is programmed as input, but the output register inside the chip will be low.  Then when needing to pulse low the uC chip, just reprogram that particular pin as output for some time, it will make a pull down to ground on that pin, then after the time reprogram as input.  You see, just by programming as input or output, keeping the output pin register as low, you have some kind of switch only to ground that can be turn on or off.  Doing this in parallel with the existing real encoder switch, is like having a second switch in parallel (the uC) controlling the thing by software.   The actual pullup for the channels is already in place, in the circuit being controlled, the real rotary encoder switch needs that, and it must be there already.

 

 

 

Wagner Lipnharski
Orlando Florida USA

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I can confirm what wagnerlip says. The first time I used a rotary encoder control, I also expected a standard quadrature output, but the switches were all open in the detente positions. Took me a while to work out what was happening.

Four legs good, two legs bad, three legs stable.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0



I can confirm what wagnerlip says.

I wonder if it is always true---the 15 ppr diagram in the middle might show otherwise.  From the construction, I'm not sure if the "clicky/bumpy" portion is particularly  aligned with the encoder contacts/wheel, other than bumping along as you turn it. 

 

 

notice here, the #pulses & #detents are  independent...you can even request zero detents & 20deg pules:

 

 

 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Tue. Aug 13, 2019 - 10:28 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

wagnerlip wrote:

The actual rotary encoder switches, works different from motor shaft encoders.  The switches only operates (closes the contact for a brief angle of rotation) while moving from one detent position to the next.  On the detent position, they are completely open, allowing the two channels (lines) to be pullup with any resistor to some VCC.  This is rather very confused for the first time you see it, since you expect the encoder to obey the 2 bits grey coding, up, down (and stay down) on certain detent positions.  This "pulse down only while travelling between detents" is exactly to allow more than one rotary switch to be used in parallel, or, a microcontroller simulating the function of the rotary switch in parallel with the actual panel rotary switch, without any other hardware in the middle.

 

Check the following image to see that channels are open (high) while on detent position, no matter what.

 

If your switch operates like that, no problem to insert anything else in parallel with the switch two channels (A/B), considering this "external thing (uC)" would leave both channels in up level (open or pullup) after generating the virtual rotation.  The best way to program the uC (AVR) two pins (to go in parallel with the switches) as INPUTs, disable pullup, set pin output register as LOW.  Obviously nothing will be low since the pin is programmed as input, but the output register inside the chip will be low.  Then when needing to pulse low the uC chip, just reprogram that particular pin as output for some time, it will make a pull down to ground on that pin, then after the time reprogram as input.  You see, just by programming as input or output, keeping the output pin register as low, you have some kind of switch only to ground that can be turn on or off.  Doing this in parallel with the existing real encoder switch, is like having a second switch in parallel (the uC) controlling the thing by software.   The actual pullup for the channels is already in place, in the circuit being controlled, the real rotary encoder switch needs that, and it must be there already.

 

 

 

The knob/encoder whatever it is in the end of the device I'm trying to take control of , does not operate like that, it's either 3.3v or gnd until the knob is rotated again, no pulses just transitions from high to low or other way around.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

JoniS wrote:

The knob/encoder whatever it is in the end of the device I'm trying to take control of , does not operate like that, it's either 3.3v or gnd until the knob is rotated again, no pulses just transitions from high to low or other way around.

 

Like this encoder? A "1/2 Cycle" quadrature encoder.

 

http://henrysbench.capnfatz.com/henrys-bench/arduino-sensors-and-input/keyes-ky-040-arduino-rotary-encoder-user-manual/

 

Note that 1/4, 1/2 and Full Cycle quadrature designations apply ONLY to detented encoders.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

sbennett wrote:

JoniS wrote:

The knob/encoder whatever it is in the end of the device I'm trying to take control of , does not operate like that, it's either 3.3v or gnd until the knob is rotated again, no pulses just transitions from high to low or other way around.

 

Like this encoder? A "1/2 Cycle" quadrature encoder.

 

http://henrysbench.capnfatz.com/henrys-bench/arduino-sensors-and-input/keyes-ky-040-arduino-rotary-encoder-user-manual/

 

Note that 1/4, 1/2 and Full Cycle quadrature designations apply ONLY to detented encoders.

 

Yes, exactly like that one.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Interesting the fact that on the link above for the discussion about the KY040, one user commented that it works exactly as I commented, while in detent both channels are up...  The encoder is the very common found on eBay or China, with a little circuit board, resistors to make the pullup to +5V and ground to the common pin on encoder.  Below the comments from the DHI user:

 

dhi June 13, 2016

@Jorge

Rotating the encoder one step takes the signal a full period, starting at A and B both in the HIGH state, both changing to LOW, and both changing back to HIGH again. If you apply the logic on both transitions, you will do a double +1 for every clock-wise transition:

1. A and B are both HIGH (initial state)
2. A changes to LOW, B is still HIGH, so +1 because A changed and B != A
3. B changes to LOW, no effect
4. A and B are now both LOW
5. A changes back to HIGH, B is still LOW, so +1 because A changed and B != A
6. B changes to HIGH, no effect
7. A and B are both HIGH (final state)

For every counter-clock-wise transition, you will instead do -1 twice:

1. A and B are both HIGH (initial state)
2. B changes to LOW, no effect
3. A changes to LOW, B is already LOW, so -1 because A changed and B == A
4. A and B are now both LOW
6. B changes to HIGH, no effect
5. A changes back to HIGH, B is already HIGH, so -1 because A changed and B == A
7. A and B are both HIGH (final state)

If you only apply the logic when A goes from HIGH to LOW (or vice versa), you should get the correct behavior.

Wagner Lipnharski
Orlando Florida USA

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, exactly like that one.

Again the exact, detent position may not be specified relative to the switches, other than another detent will occur approx 18 degrees (or whatever the encoder uses) from the current detent position.   May be some datasheets specify an angular tolerance limit between the switch angle & detent angle.  It would be highly dependent on how the two mechanisms are designed.

 

I did find one from panasonic where they did indicate where the stable positions would lie relative to the switching---most others made no specific mention.

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Thu. Aug 15, 2019 - 02:50 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

wagnerlip wrote:

Interesting the fact that on the link above for the discussion about the KY040, one user commented that it works exactly as I commented, while in detent both channels are up...  The encoder is the very common found on eBay or China, with a little circuit board, resistors to make the pullup to +5V and ground to the common pin on encoder.  Below the comments from the DHI user:

 

dhi June 13, 2016

@Jorge

Rotating the encoder one step takes the signal a full period, starting at A and B both in the HIGH state, both changing to LOW, and both changing back to HIGH again. If you apply the logic on both transitions, you will do a double +1 for every clock-wise transition:

1. A and B are both HIGH (initial state)
2. A changes to LOW, B is still HIGH, so +1 because A changed and B != A
3. B changes to LOW, no effect
4. A and B are now both LOW
5. A changes back to HIGH, B is still LOW, so +1 because A changed and B != A
6. B changes to HIGH, no effect
7. A and B are both HIGH (final state)

For every counter-clock-wise transition, you will instead do -1 twice:

1. A and B are both HIGH (initial state)
2. B changes to LOW, no effect
3. A changes to LOW, B is already LOW, so -1 because A changed and B == A
4. A and B are now both LOW
6. B changes to HIGH, no effect
5. A changes back to HIGH, B is already HIGH, so -1 because A changed and B == A
7. A and B are both HIGH (final state)

If you only apply the logic when A goes from HIGH to LOW (or vice versa), you should get the correct behavior.

 

The logic was there at the very top(I stopped reading at that point)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

You should check the actual data sheet of any encoder, since they can vary..that will say whether the detent position is guaranteed to match the switching points (or maybe it is not guaranteed to have any relation--some can just use a bumpy collar that is press-fitted on when detents are desired).  For example, you could order some encoder with no detents, yet 24 or 18 switching position.  You could have an encoder that gives 24 detents & only 12 pulse per spin.

   

 

 

Here is an actual encoder datasheet...but I don't see any mention of exactly where the detents are located ---is there a general assumption?

https://www.ctscorp.com/wp-content/uploads/288.pdf

 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Thu. Aug 15, 2019 - 04:45 AM