MCP41010 Digital Pot

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: MCP41010 Digital Pot

Post by Benj »

Hello,

We don't seem to have one of these devices handy at the moment but I have ordered one this morning and it should be with us early next week. If I can find a problem then I will fix it in both v9 and v8. Hope this helps.

cardacSA
Posts: 12
Joined: Thu Nov 03, 2022 9:55 am
Contact:

Re: MCP41010 Digital Pot

Post by cardacSA »

Hello there Benj... SIR.!!! I thank you very very much...
I really appreciate all the help I will get...
I really look forward to what you find.... I want to purchase FLOWCODE 9 .. maybe even tomorrow 18th November 2022 - but definitely by Saturday... 19th November 2022...
I have spoken to Alf Dobson... I will attempt to call him again in the morning.... to finalize how to do the purchase...

Thanks Ben Rowland...!!!! ... very much appreciated...!!


Also I have an encoder... from china out.!! I have attempted to connect it... to the same processor as in the PICTURE... but I cannot get it to work.. correctly... does one have to.... use the .. detect any changes ... mode.. or can one just fire into .. using .. the read mode... ???

Eventually - I just used an INT on B0.. the INT pin... to get plainly pulses from like the A pin...

I wonder... does this whole shebang... depend heavily on the ... type and manufacture of the actual rotary encoder...???..

thanks again Ben .. Sir.... hope you can get it to work...

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: MCP41010 Digital Pot

Post by Benj »

Assuming it's a quadrature encoder there is a component to help you with this.

This wiki page has examples you can refer to.
https://www.matrixtsl.com/wiki/index.ph ... :_General)

Here is a basic schematic for wiring the encoder to the micro to provide a bit of filtering.
EncoderCircuit.jpg
EncoderCircuit.jpg (58.95 KiB) Viewed 35588 times
Edit, sorry I got the circuit a bit wrong so now showing the corrected version which I've also put onto the wiki page.

chipfryer27
Valued Contributor
Valued Contributor
Posts: 618
Joined: Fri Jun 06, 2014 3:53 pm
Has thanked: 184 times
Been thanked: 195 times
Contact:

Re: MCP41010 Digital Pot

Post by chipfryer27 »

Hi

I have used the examples given in the WiKi and they work fine for almost all generic rotary encoders I tried. I can't remember off hand, but there were three examples and all three worked, but one I needed to "jigger" with, but I'm putting that down to me.

You can easily test these components by using a simple multimeter to check for make/break connections as you rotate. If you bought "Cheaply from China" then it's a good idea to verify they actually work before you try to decode them.

As Ben mentions above, you can see a lot of noise as they transition so take that into account before deciding the component is broken or doesn't work. I used the "CfC" ones just to prove a concept then discarded them from project due to build quality.

You mentioned in a previous post you had access to a scope. You might want to scope the outputs as you rotate with and without Ben's circuit. I find that if I can "see" what's happening physically I can understand the code needed better.

Regards

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: MCP41010 Digital Pot

Post by Benj »

Digital pot still not arrived yet, I'll chase it up with the purchasing team.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: MCP41010 Digital Pot

Post by Benj »

Digital pot arrived today so will have a go at getting it working for you.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: MCP41010 Digital Pot

Post by Benj »

I think I may now be seeing the problem, the existing MCP41XX component is for the four digit MCP parts e.g. the MCP4131.

It looks like we need a new component for the MCP41XXX devices as their command set is quite a bit different.

I'll create a new component for v9 and hopefully that should allow you to proceed.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: MCP41010 Digital Pot

Post by Benj »

The new component is now available in v9. You can get the new components by clicking on Help -> Library UPdates and then changing Files in use to Full Database.

Let us know if you have any problems.

cardacSA
Posts: 12
Joined: Thu Nov 03, 2022 9:55 am
Contact:

Re: MCP41010 Digital Pot

Post by cardacSA »

Hello Benj.... yeah - thanks for that ... I have just installed V9 - and am still getting used to how it all works... I saw ... and downloaded the .. fcpx file.... A also ask.. may I take that file - and stick it into the V8 ... I have...?? Would it work there... as well...

AGAIN... - thanks - ever so much... for doing this MCP41XXX file.... I really appreciate it... very much...

The QUAD ENCODER ... maybe the unit I have is NOT COMPATIBLE to how the FLOWCODE component works...??? I cannot ... whatever I do.... get it to work..?? with the A / B ... outputs, or wires...???

The STEPPER component... I also cannot get to work.. I have 5 wire steppers, and 4 wire steppers.. I have made up using a ULN2803A chip - a driver for the 5 wire stepper... and the "coils" of the assignations as per the component - I attach to the inputs of the ULN2803... the outputs of the ULN2803 are tied to the coils - with a common wire - going to +12V.. (seems to be okay with that voltage). I cannot get the stepper to work...??
If I try the 4 wire stepper.. I need seemingly ... a power driver board .. with like 4 inputs and 4 outputs... I have tried - but no works...??
If I use an 8825 driver board... that defeats the whole object... cause then I just need a pulse generator - and an output pin...to give the DIRECTION signal... BUT that is not in the realm of the STEPPER component..??? or am I incorrect.???

..... and sorry Benj... for dropping / duplicating the forums .. into V9 ... can we use either V8 forums - for both V8 and V9 - and vice versa.???

Thanks - very much to all... for responding... I APPRECIATE - NO END..!!!
bye for now...!!

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: MCP41010 Digital Pot

Post by Benj »

Hello,
may I take that file - and stick it into the V8
Sorry this likely won't work, the easiest way to use in v8 would just be to use the SPI master component, the device is very simple to control.

Initialise the SPI master component and then when you want to adjust the pot do this.
Spi.jpg
Spi.jpg (28.6 KiB) Viewed 35453 times
The QUAD ENCODER ... maybe the unit I have is NOT COMPATIBLE to how the FLOWCODE component works...???
Can you draw up a schematic or sketch of how you have connected the encoder and maybe a link to the encoder you're using. Seeing your test project may also help us to nail down what the problem might be.
The STEPPER component... I also cannot get to work
The stepper component has two modes of operation which can be set via the component properties, either direct pins to transistors or FETs or via a driver with step and direction inputs. Again show us a schematic and your test project file and hopefully we can help.

cardacSA
Posts: 12
Joined: Thu Nov 03, 2022 9:55 am
Contact:

Re: MCP41010 Digital Pot

Post by cardacSA »

Hello Ben ... okay - sorry - so late... however I wanted to check with you ... the value of 0x11 .. is that for the COMMAND BYTE of the MCP41XXX chips..
So I see .. two bits.. C1 ... then C0 .... and P1 ... and P0 ...
so I think.??? C1 = 0 .. C0 = 1 ... then P1 = 0 .. and P0 = 1... ?? is this correct.???

and then the VALUE to be used... must range from 0 - 255 ... defined as a BYTE value...??

I hope that is correct..??

Kindest Regards

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: MCP41010 Digital Pot

Post by Benj »

Hello,

Yes that's correct.

Post Reply