Need Support for MCP4142-104E/SN Potentiometer

HI

I want to control(Read/write) MCP4142-104E/SN Potentiometer

I am unable to compile it for Spark Core

Here is Arduino Files:
MCP4241.c
MCP4241.h

@trafficmaster88, if I am correct about the part number, you may have better luck porting this Arduino library:

Let me know if this is the correct library and if you need help porting. :smile:

2 Likes

No, its different

http://m.rs-online.com/h5/mobile/uk/catalog?url=%2Fweb%2Fp%2Fdigital-potentiometers%2F7240107%2F

HI

Any update regarding it, I am delayed, and left with no choice except to replace spark core

@trafficmaster88, the library I pointed to above IS compatible with your device:

This library is broadly compatible with the other devices in this series. They are: Microchip MCP4131, MCP4132, MCP4231, MCP4232, MCP4141, MCP4142, MCP4241, MCP4242, MCP4151, MCP4152, MCP4251, MCP4252, MCP4161, MCP4162, MCP4261, MCP4262.

If you wish, I can port it for the Spark and post the code to a github repo. It won’t take me long (possibly tonight). :smile:

Hi, Sure, I wouild like to get it ported, thanks for you help

Also how can I learn to get it converted form Arduino to Spark Core, I am interested to known few basics of porting Only if you have time

@trafficmaster88, porting libs that are not toooo close to the Arduino hardware is not that hard.
If you got some programming experience (C or Arduino or Wiring or similar) you should be able to get into it quite quickly.
Some things that might help you getting around some of the differences between Spark Wiring and Arduino Wiring can be found in this thread

and this GitHub repo

@ScruffR beat me to the punch… again! :stuck_out_tongue_winking_eye:

1 Like

After what happened at the other thread, I have to redeem myself :flushed:

1 Like

@trafficmaster88, I ported the library for the Core. I compiled it using Spark CLI.

The example is setup for the single wiper of the MCP4142. Make sure you follow the SPI wiring outlined in the example. The default SS pin is set to A2 but you can change that. Also, the default SPI speed is set for 9MHz which should work but you can step it down to 4.5MHz if it doesn’t. Just follow the comments in the example. Let me know how it goes! :grinning:

4 Likes

Hi thanks for quick response and your work

I will update you ASAP i test it with the Core

1 Like

Hi, I have tried my best to resolve the system, but I am not getting the way to write the values of the POTs.

Also I have 2 MCP4241 Connected to the same Spark Core

Let e know how t send you private messages, I would like

@trafficmaster88, to use two MCP4241, you will need to use two different CS (chip select) lines and make two instances of the PCP4241 object. I don’t know what you have tried so far and how you have wired you hardware so it is difficult to help.

Hi, I can’t share the complete thing publicly, Is there any way to send you private message.

@trafficmaster88, click on my picture and you will see a private message button.

can’t find the Button, may be its not available to new members

@peekay123

I ended up using your library here https://github.com/pkourany/MCP4261_Library to get the MCP4151 100K 256 step digital pot up and running on the Photon with absolutely zero problems :wink: That’s really nice after trying a different chip and 3 different libraries on the Arduino Uno all of which did not work right for me.

I see you have some timing code for the Core built in and I was wondering if that code is necessary for the Photon or not.

Thanks for the creating this library port! Should this work on the Electron with zero issues also?

@RWB, glad it worked for you! Which timing code are you referring to?

Never mind about the timing code :blush: I must have saw that in a different library, its was timing division for the Core.

While I have you here though can you clarify this code here in the .ino file:

Do I need to measure resistance for Terminal A to Terminal B and actually put the reading into the fAB_ohms variable?

@RWB, for really good accuracy, the answer would be yes. :wink:

1 Like