SDI/SDO multiplexing with MCP4161

Hi,

I'm trying to hook up two MCP4161 digital potentiometers to an Arduino Uno. I'm using the example for the MCP4261 found here: GitHub - teabot/McpDigitalPot: Fork of dreamcat4's Arduino library for the Microchip MCP414X/416X/424X/426X that uses the standard Arduino SPI library

Now, the MCP4261 used in the example has the SDI and SDO on separate pins, which are connected to pins 11 and 12 on the Arduino. However the MCP4161 has SDI and SDO multiplexed on one pin. Now since I'm a beginner, I don't really know how to hook it up. I tried looking in the datasheet and on the web for instructions, but didn't find anything specific. I only found out that a resistor has to be used. So can someone please tell me how to determine what resistor size I need and how to connect it?

EDIT: Actually there is a wiring diagram in the datasheet showing how its done, by connecting the SDI/SDO pin on the chip to the SDI pin on the Arduino directly, and to the SDO pin on the Arduino via a resistor. It does not specify the correct value for the resistor, it only says that it must be sized to ensure VIL and VIH of the device. According to the datasheet, these are the Schmitt trigger low and high thresholds. I don't know how to determine these though. I found this page: Digital Potentiometer - 10K - COM-10613 - SparkFun Electronics where it is mentioned that a 4.7 kohm resistor is used. If no-one has any better advice, I will try hooking it up with that size and see if I can get it working.

Do you need to read from the pot? If not then you don't need a resistor at all.

However if you look at fig 6-1 in the data sheet it shows three ways to hook it up, second option is probably what you need, the resistor goes between the MOSI and MISO pins (shown as SDO and SDI on the host controller).

it only says that it must be sized to ensure VIL and VIH of the device.

I think you just have to stop too much current flowing in case of a level clash, 470R or 1k should be OK.

I must say that looks like a very complicated chip if all you need is a simple pot though.


Rob

Graynomad:
Do you need to read from the pot? If not then you don't need a resistor at all.

However if you look at fig 6-1 in the data sheet it shows three ways to hook it up, second option is probably what you need, the resistor goes between the MOSI and MISO pins (shown as SDO and SDI on the host controller).

it only says that it must be sized to ensure VIL and VIH of the device.

I think you just have to stop too much current flowing in case of a level clash, 470R or 1k should be OK.

I must say that looks like a very complicated chip if all you need is a simple pot though.


Rob

Thanks for the advice,

I don't need to read anything from the pot, I just want to use it to replace an analog pot and control the resistance with the Arduino (the pots will replace the analog pots for steering and throttle in an RC transmitter, in order to control an RC car via PC) instead of controlling it by hand.

The second option in fig 6-1 is just the one I am looking at. It says the third option is for Host Controller Firmware SPI, and the second for Hardware SPI. Since I have never done this before I don't know which option to use. Do you mean I should skip the resistor since I don't want to read anything, or should I use one of the resistors you mentioned anyway?

It is a bit more complicated than I thought it would be actually. The reason we chose to use this particular chip in our project is because we could easily find a code library for it. But of course, there may well be better options out there.

I'm not familiar with the chip, but briefly looking at the spec sheet I'd say the third option is good for you given that you don't need to read from it.

Arduino ---> pot
MOSI ---> SDI/SDO
MISO ---> not connected
SCK --- > SCK
any pin ---> CS

In this case you don't need the resistor.


Rob