How is my MCP42100 digital pot working with no power or ground?

Hi, I'm new to electronics and Arduino and have been teaching myself online.
I'm working on a project to replace an analog joystick on an old console with a MCP42100 digital pot. I am interfacing it to a Teensy 4.1 using SPI.

I initially had trouble getting it working until I disconnected power and ground from pins 14 and 4, and left just the SPI lines and the lines to the console's pot lines.

In the pic:
1 - Blue CS from Teensy
2 - Green SCK from Teensy
3 - Yellow MOSI from Teensy
5 and 10 - "POT C" +5v from console
6 and 7 - "POT X" from console
8 and 9 - "POT Y" from console

This is working well despite pins 4 (GND) and 14 (VDD) not being connected on the MCP42100 but I don't understand why. Are the POT lines or the SPI lines powering it, and is this normal? Why would adding power and ground from the Teensy prevent it from working?

EEVblog #831: EEVblog #831 - Power A Micro With No Power Pin! - YouTube.

Every chip has internal ESD protection diodes. If at least one pin is connected to GND and at least one pin to VCC, then the chip might start working.

The breadboard power rails are:
Left side is +5v and ground from the console. This goes to the Teensy 4.1 Vin and GND pins.
Right side is +3.3v and ground from the Teensy 4.1's 3.3V and GND pins.
The Teensy specifies it is not 5 volt tolerant. I planned to run the digital pot control off 3.3 and keep the 5v (POT C) just on the PB0 (pin 10) and PB1 (pin 5) lines, assuming they are isolated from the control parts of the chip.

I made some changes to my layout, lifting pin 11 and 12 to the 3.3v power, and adding a ground line from pin 4 to the 3.3v rail's ground. This is all working well.

When I add a line from pin 14 (Vdd) to my 3.3v supply, it stops working. This is the part I don't understand. I verified the voltages on the rails with a meter.

Any help or illumination is appreciated!

Koepel:
EEVblog #831: EEVblog #831 - Power A Micro With No Power Pin! - YouTube.

Every chip has internal ESD protection diodes. If at least one pin is connected to GND and at least one pin to VCC, then the chip might start working.

Thanks, that is an interesting video, it must be what is happening here.
I still don't understand why adding 3.3v to pin 14 causes it to stop working. I added another post with the details.
I was assuming that the pot pins (PA,PB,PW) were isolated from the logic pins, and that I could put 5v on the PB pins (5 and 10) while running the chip logic pins off 3.3v from the Teensy. Is that accurate? If not, and considering the Teensy is not 5v tolerant, how should I handle the 5v POTC line plugged into the PB pins?

Koepel:
EEVblog #831: EEVblog #831 - Power A Micro With No Power Pin! - YouTube.

Every chip has internal ESD protection diodes. If at least one pin is connected to GND and at least one pin to VCC, then the chip might start working.

In the video, he wires his breadboard blue rail to -Vout and the red rail to GND. He treats red as ground and blue as voltage. Normally I see people use red as +v and blue as ground. What is this called and why would someone do this?

8bitandy:
In the video, he wires his breadboard blue rail to -Vout and the red rail to GND. He treats red as ground and blue as voltage. Normally I see people use red as +v and blue as ground. What is this called and why would someone do this?

For educational purposes, he should not have done that.

The GND should be black, and VCC (3.3V or 5V) should be red.

Teensy 4.1: Teensy® 4.1.
That is a ARM Cortex-M7 @ 600 MHz running at 3.3V and the pins are not 5V tolerant.

MCP42100 digital potentiometer : MCP42100 - Digital Potentiometers.
It runs at 3.3V and at 5V and has SPI interface.
The potentiometer is not isolated, all three pins (PAx, PBx and PWx) of the potentiometer must be between 0V and VDD (Datasheet, page 2, Resistor Terminals, Voltage Range).

A schematic might be helpful. A photo of a drawing on a piece of paper by hand is good.
If you have enough time, then you might try this: https://easyeda.com/editor.
If you want to spend your time wisely, then have a look at KiCad.

There is no way to use that digital potentiometer in a 5V circuit. It is not possible.
Can you tell what your project is ? Perhaps you don’t need the full 5V scale.
Can you replace the Teensy by a basic 5V Arduino board ?

Thanks Koepel for all this info. It is very helpful.

My project is to adapt standard USB controllers to an Atari console.

The original controller has 18 buttons plus an analog joystick. The buttons are handled by switches, 2 by direct grounding, and 16 by a 4x4 matrix keypad.
The analog joystick is handled by the +5v POTC line and the two POTX and POTY lines. Putting 0 to 100K ohms resistance across these lines is read as the x and y positions of the joystick.

The idea is to use an Arduino (chosen because it is popular and relatively easy to develop for) between the console and a modern USB controller.

I chose the Teensy 4.1 because it has built-in USB host, has a lot of pins and is fast. The Teensy USB host library has sample code that makes it very easy to enumerate and read all kinds of USB devices.

I'm using the keypad.h library and a basic 4x4 matrix keypad on the Teensy, and converting it to one of 16 keypresses using 4 CD74HC4066E 4x analog switches (16 switches total) to cross wires 1-8 on the console harness to simulate keypresses on the console's matrix keypad. I did it this way so I didn't have to worry about how the keypad is scanned, I just cross the wires just as the original controller does.

Not counting voltage or ground, I need at least 18 output (CD74HC4066E switches and fire buttons) 8 input (matrix keypad), 3 SPI pins and USB host.

The CD74HC4066E switches are working fine using 3.3v Vcc and control lines and crossing the 5v lines on the console harness. Is this in-spec?

I'd really like to stick with the Teensy if possible because I like the USB library and I have it working nicely. It fits a lot of functionality in a small size. I think I'm stuck with 5v on the console side.

Assuming the 4066s will work with 3.3 volts on the control pins, the only problem is the 3.3v SPI connected to the 5v 42100. Is it possible to convert the 3.3v SPI to 5v SPI using transistors?

[edit] or something like this? https://www.sparkfun.com/products/12009

[edit again] Looking more into the SPI spec, all three SPI lines in use appear to be output lines. Would outputting 3.3v high from the Teensy to inputs on a 5v MCP42100 cause a problem with the 5v intolerance of the Teensy, or does that only apply to input pins on the Teensy? What about outputting ground from the Teensy to a 5v wire on the console harness?

Rough layout

I took a look at the Teensy USB host library, that is a awesome library. And the Teensy 4.1 has many pins. You found the right things for your project :smiley:

8bitandy:
Assuming the 4066s will work with 3.3 volts on the control pins

If you assume that it will work, then I will assume that it does not work :smiley_cat:
Can you measure the signals with a oscilloscope ? You might need protection resistors in the lines between the Teensy and the 4066. The datasheet is vague about this situation with different voltages :confused:

Is your 4066 running at 5V ? And it does not work at 3.3V ?
Suppose the 4066 returns a higher voltage to the Teensy pins when running at 5V. Then a Quick and Dirty fix could be to lower the power to the 4066 with a diode (one or two). Maybe if you read all the datasheets, there is a voltage between 3.3V and 5V that makes everything work within the specifications.

8bitandy:
or something like this? https://www.sparkfun.com/products/12009

Yes, but there are other options as well.
Did you see this guide ? Bi-Directional Logic Level Converter Hookup Guide - learn.sparkfun.com.
They are bi-directional level shifters, because of that, they can shift levels downwards and upwards. Be sure to apply both powers (5V and 3.3V) to the module. They make the signal weaker, because the signal is pulled high with a pullup resistor. You might need to lower the SPI speed.
Other options: special level shifting buffers; a buffer with LVTTL inputs; a potentiometer that can be at a higher voltage than the digital signals; and many, many more.
Using transistors is not one of the options :frowning:

8bitandy:
Would outputting 3.3v high from the Teensy to inputs on a 5v MCP42100 cause a problem

What does the datasheet say ? It says: Digital Inputs, VIH is minimal 0.7VDD. If the chip operates at 5V, then it needs at least 3.5V input for a high.
That means that it does work in real life. However, since the voltage levels don’t meet the specifications in the datasheet, a little noise can disturb things.
When your projects is not working 100%, then you could be spending a lot of time, trying to find the cause. Therefor I prefer to use a level shifter.

8bitandy:
What about outputting ground from the Teensy to a 5v wire on the console harness?

Don’t let the magic smoke get out.

The GND of the Atari must be connected to the GND of the Teensy.

Thanks again Koepel!

I have the 4066s running off 3v3 with a 3v3 signal input, switching the 5v and GND from the Atari and it works. I'll look into a level shifter for the SPI interface to the 5v 42100.

It sounds like 5v intolerance isn't an issue since I don't connect to any 5v device using an input pin. Connecting an output pin LOW to a 5v line is OK as long as the GND between the devices is connected? I could use another 4066 instead if there is a benefit.

8bitandy:
It sounds like 5v intolerance isn’t an issue since I don’t connect to any 5v device using an input pin. Connecting an output pin LOW to a 5v line is OK as long as the GND between the devices is connected? I could use another 4066 instead if there is a benefit.

Understand, me does not <(-_-)>

If you want to do something, can you draw a schematic ? Also draw the GND lines and the 5V and 3.3V.

Suppose you output a HIGH 3.3V level to a chip which leaks current from 5V into that HIGH level. Then the Teensy will still get that current into its pin.
If a switch of the 4066 is open, then both pins of the switch can pass on a 5V (via the internal ESD protection diodes) back to the Teensy.

It is not clear what will happen. In the Netherlands we have a saying: “Gissen is missen, meten is weten” (to measure something is to know something, when you guess something then you are guessed wrong).

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.