Replies: 2 comments 4 replies
-
I don't have time to help you with the code-aspects of this, but if you're seeing "all the time: 0 ohms (closed) between black and yellow" then it sounds like black and yellow might both be ground? I.e. don't try connecting black to ground and yellow to power, as you'll short out your Pi! And it sounds like this is a passive component anyway, so it wouldn't seem to make sense that it needs "power"? To measure a resistance using an ADC you'll need to use a potential-divider circuit, see e.g. https://devxplained.eu/en/blog/resistance-measurement and the "Reading Resistive Sensors" section of https://learn.sparkfun.com/tutorials/voltage-dividers/all
In which case perhaps it's easier to simply use "separate" devices that are already natively supported by gpiozero? 🤷 |
Beta Was this translation helpful? Give feedback.
-
Well no, I wouldn't connect it straight from power to ground. There would have to be a resistor (10k ohm should be fine) on the ground line. I'm getting the impression you're not familiar with resistor ladder buttons. There is no comparable control available on the market that would work directly with the Pi GPIO, and gpiozero does natively support the MCP3008 ADC that I was considering using, so I'm not sure what you're suggesting. |
Beta Was this translation helpful? Give feedback.
-
I recently purchased a fancy schmancy control for a vehicle media player. It has dual concentric shafts:
https://www.crutchfield.com/S-4MnIrGMnjiL/p_068258A/RetroSound-258A.html
These are used on RetroSound head units, but are also available separately from RetroSound as a service part. They have 8 terminals:
They're soldered to a small circuit board that has a resistor ladder. The wire that actually connects to this board only has 4 conductors instead of 8 (it's an RJ11 jack). So they managed to get the functions of 3 switches and 1 rotary encoder into just 4 connections.
However none of this is documented anywhere, and RetroSound isn't inclined to educate me, so I'm trying to figure out how this wiring works.
There's 4 resistors on the circuit board (see photo, attached):
So far, I've figured out:
yellow
andgreen
/black
andgreen
yellow
andgreen
/black
andgreen
yellow
andgreen
/black
andgreen
yellow
andgreen
/black
andgreen
red
andblack
/red
andyellow
(obviously this pattern is reversed in the other direction)black
andyellow
What I'm deducing from this is that
yellow
is power,black
is ground,green
is the 3 switches with resistances of 0 ohms, 6.8k ohms and 22k ohms each, andred
provides the rotary encoder signal with resistances of ∞ ohm (open), 82k ohm, 30k ohms and 47k ohms (with 30k being the result of 82k and 47k in parallel). None of these can ever be activated simultaneously with the exception of pushing the inner shaft switch while turning it, which would be mutually exclusive since those 2 functions are on 2 separate wires, so that's the full extent of the options.Cool!
Now how do I make that work with gpiozero? I was thinking of using an MCP3008 ADC, but I'm not sure how to convert values to button presses, and especially how to turn 4 resistance values into a working encoder functionality. I love the idea of being able to hook up 4 of these controls (12 switches and 4 rotary encoders!) to a Raspberry Pi by using just 4 pins of the GPIO, but I'm way out of my depth when it comes to gpiozero coding.
Beta Was this translation helpful? Give feedback.
All reactions