the19thbear
Posts: 8
Joined: Fri Nov 25, 2016 8:10 pm

Pi3 as a digital pot/audio matrix

Fri Oct 19, 2018 8:21 pm

Ok.
Warning!
I have no experince with code, and I only have basic electronics knowledge, but have built DIY kits in the past and can follow signal flow in a schematic, and can tell a resistor from a pot/transistor etc.

So I have been toying with an idea.
I have an analog device, that does not have memory, but I would love it to have memory:)

Could I use a pi3 with a GPIO shield to control it?

I want something like this:

Analog device control pot (pot/switch etc) send to Pi3, and then to analog device circuit board.
The pi3 would be in between.

My idea would be to take a specific pot on the device, and note its ohm value, and note if the pot was linear etc and then emulate that on the pi.
I would then desolder the pot and in its place, would place a pot that is not connected to the device, but goes directly a pi3 in port on a gpio (or similar). Then the pi3 would control a transistor (or whatever) that is connected to the solder points where the original pot was soldered in.

So basically I want the pi3 to function as a digital pot. (many pots and switches actually, about 53 total).
I *DONT* want to digitize any of the devices analog signals. I only want to control them.
What specific shield could be used?
What about the transistor thing?
Could you point me in the right direction post some links etc, pretty please:)

Thanks!

drgeoff
Posts: 8602
Joined: Wed Jan 25, 2012 6:39 pm

Re: Pi3 as a digital pot/audio matrix

Fri Oct 19, 2018 11:47 pm

The following does not have any circuit schematics or code, just a basic principle.

Put a resistor between an analogue audio output stage and an analogue audio input stage. Put a bipolar transistor or FET as a switch between that input and ground. When the switch is open the audio passes through. When closed the audio is shorted to ground ie no audio. Turn the switch on and off very quickly - much faster than the highest frequency in the audio. Filter the audio from that input stage with a low pass filter just high enough to preserve preserve the highest audio frequency. By varying the mark to space ratio of the switching waveform the amplitude of the audio from the filter can be varied from 0 to 100%. You have a digital volume control of an analogue audio signal.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5798
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Pi3 as a digital pot/audio matrix

Sat Oct 20, 2018 6:38 am

Replace the pot with a digital pot. https://uk.rs-online.com/mobile/amp/c/s ... tiometers/ for a fair selection of them.
Note that they tend to be a bank of resistors that get switched in and out, so they come as break before make, or make before break options. Choose carefully to avoid clicking.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

the19thbear
Posts: 8
Joined: Fri Nov 25, 2016 8:10 pm

Re: Pi3 as a digital pot/audio matrix

Sat Oct 20, 2018 7:12 am

Thanks drgeoff and 6by9!

drgeoff:

I think i need to see a schem of that, any direction you could point me to?:)
But thanks!


6b9:
This seems like a very clean solution. I am worried by the clicking. Do I avoid that by selecting the right digital pots?
Is anything else needed pr pot? (im thinking about the total cost here), other than a computer and wires?

Something that is very important for this project, is lag (the pot should react very fast, under 3ms or so), and it should have no stepping.

I found a pot that is a quad pot and has 1024 values. As for resolution, i think that is fine, and will produce no stepping. https://uk.rs-online.com/web/p/digital- ... s/1610584/

How will i know if it will produce clicking? (make break etc)

I only need 100k lin pots for this projects, and then some switches, but I assume the switch could be programmed to tell the digital pot to just fully open and close, and thereby act as a switch, digitally.



And on a side note: It would be amazing if all the pots could send/recieve midi as well, but that will be done in code by the computer, and I have no idea of how hard that actually is to do:)

Thanks!

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5798
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Pi3 as a digital pot/audio matrix

Sat Oct 20, 2018 8:55 am

It's a digital pot that inherently has a fixed number of steps.

Datasheet - http://www.farnell.com/datasheets/2254573.pdf
It looks like they may have improved the performance since I looked at them (that was just over 20 years ago!). No reference to switching behaviour in the datasheet.
Do check the voltage range that you need to present to the digital pot - it looks like it is limited to +/-2.5V supply rails, which isn't a very big signal.

For simple switches, you may as well look at the old 4000 series analogue switches. http://www.farnell.com/datasheets/2254573.pdf is a 2 way switch. There were a whole family of them from simple on/off switches up to 1 to 16 way switches.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

the19thbear
Posts: 8
Joined: Fri Nov 25, 2016 8:10 pm

Re: Pi3 as a digital pot/audio matrix

Sat Oct 20, 2018 12:38 pm

Thanks!

I looked at the schematic of my device, and sometimes the pots are connected to +15v and other times -5.
I couldnt seem to find a single digital pot that covered from -5 to +15. I guess I would need different pots (some +15 in specific places, and some -5 in other places?). Or maybe it doesnt matter, since the whole +15/-5 i just a matter of polarity?

Look at this as an example:
https://www.mouser.dk/ProductDetail/Mic ... 4zUg%3d%3d

It has a supply voltage of 1,8 to 36 volts.
It also has 256 steps, which is ok. Not amazing, better than normal midi, which has 128 steps.

Would this pot work in cases where it is connected to +15v and -5v?
It doesnt have to go from +15 to-5 in the same connection. The -5 is one pot, the +15v is another pot.

If this could be used, I guess I would move on to the whole coding and hardware aspect.
Since i want to connect about 54 pots/switches to the pi, what shield should i use?
I'm thinking that i can get around with this, by doing some multiplexing, and not be needing physically 54 inputs?
Or would an arduino be better for this?
And then there is the coding part!!! what am i thinking! I know nothing about it!
Heheh:)
I'm trying to find out the cheapest way to get this done, and to see if it makes sens to do at all. It is a hobby project, so i dont mind learning lots of new stuff by doing this.

Thanks again:)

Return to “Graphics, sound and multimedia”