Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add additional ADC chips #162

Closed
lurch opened this issue Feb 1, 2016 · 15 comments
Closed

Add additional ADC chips #162

lurch opened this issue Feb 1, 2016 · 15 comments
Milestone

Comments

@lurch
Copy link
Contributor

lurch commented Feb 1, 2016

A little "reminder" issue, as requested #41 (comment)

As I mentioned at #156 (comment) it'll hopefully be fairly straightforward to also add classes for the MCP3001, MCP3002, MCP3201 and MCP3202 ADC chips too.

@pcopa
Copy link

pcopa commented Feb 1, 2016

Yes this should be simple, just a matter of adjusting the channel count. This would address all the spi ADC chips (that I know of).

@lurch
Copy link
Contributor Author

lurch commented Feb 7, 2016

And looking at https://raw.githubusercontent.com/RPi-Distro/python-gpiozero/master/docs/images/composite_device_hierarchy.png it would seem to make sense for MCP3001, MCP3002, MCP3004 & MCP3008 to inherit from MCP30xx; and MCP3201, MCP3202, MCP3204 & MCP3208 to inherit from MCP32xx?
Or would that just be taking things too far for the sake of 'neatness / symmetry' ?
(Is this something that can be squeezed into 1.1 ?)

@waveform80 waveform80 added this to the v1.2 milestone Feb 8, 2016
@bennuttall
Copy link
Member

  • MCP3001
  • MCP3002
  • MCP3004
  • MCP3008
  • MCP3201
  • MCP3202
  • MCP3204
  • MCP3208

@bennuttall
Copy link
Member

I'm adding these now. Got MCP3002 and MCP3202 in.

MCP3001 and MCP3201 seem to have two input channels but +/- rather than CH0/CH1 - I'm not sure what that means. Is it that one to read an input as 0->max, the other max->0? (if that makes sense?)

@bennuttall
Copy link
Member

Reading up on datasheets it's definitely one channel, I just don't understand what the IN+ and IN- are. I'll add them as I have them, and they can be fixed before release if there's something else needed.

@waveform80
Copy link
Member

That means that like the 3301 they operate in differential mode only (and I'd guess they don't require any input in that case); i.e. you're expected to connect both. However, if the chip's like the other 32xx and 30xx's it won't support fully signed operation; i.e. IN- will only be for background noise compensation, not for measuring a fully negative value.

@waveform80
Copy link
Member

Have a look at the existing MCP3301 class and that should shed some light on things.

@bennuttall
Copy link
Member

Yeah, just spotted it! That makes sense.

I was going to leave the channel parameter in, even though it has to be 0, just so the arguments were the same as the others, but I see you removed it from MCP3301 so I will too.

@waveform80
Copy link
Member

Yeah, not much point having a parameter you can't do anything with :)

@bennuttall
Copy link
Member

Yeah

@bennuttall
Copy link
Member

Pushed - please take a look!

@waveform80
Copy link
Member

I think you need to remove differential=False from the xx01 constructors; those chips will very likely operate in differential-only mode; i.e. firstly you shouldn't be able to specify differential and secondly its value should be True.

@waveform80
Copy link
Member

Yeah, just skimmed the data-sheets and they're both differential only. Also, because both of them require no input at all you'll need to push MCP33xx._send up into MCP3xxx and override it in the xx01 classes to just return [0, 0] (to allow two bytes worth to be received without sending anything).

@bennuttall
Copy link
Member

Like that?

@waveform80
Copy link
Member

Yup, that's the first bit - now you need to deal with the fact they don't expect any inbound data (and will only send back two-bytes worth when the SPI CLK activates)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants