-
Notifications
You must be signed in to change notification settings - Fork 10
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 support for MCP3304, 13-bit 8-channel ADC #1
Conversation
Thanks for the pull request. |
According to the datasheet (http://ww1.microchip.com/downloads/en/DeviceDoc/21697F.pdf) the MCP3304 operates at 4.5V to 5.5V. This means running out of spec on machines like the Raspberry Pi or level converters + special power supply. How are you operating the MCP3304? |
You caught me :) Technically I am running the MCP3304 out of spec, powering it at 3.3V from the Raspberry Pi (I have purchased some level shifters, but haven't got around to trying them out yet), ideally could power with 5V and convert to 3.3V, nonetheless it does seem to be working well for my purposes on 3.3V (using for homebridge-lightsensor-analog, only 1 channel, low sampling rate, maybe why I haven't noticed any problems). |
I'll order an MCP3404 and test. If all is OK the PR will be merged. |
Sounds good. As another data point I've finally tested the MCP3304 with the level shifters (5V on HV, 3.3V on LV) on the SPI bus (CE0, MOSI, MISO, SCLK) and powering with 5V: seems to be working well (channel 0 tied to unfiltered ~5.0V, 1 to ground, 7 to a photodiode, others floating):
|
@rxseger Sorry about the delay here. I have a few MCP3304s now and hope to test this PR soon. |
@rxseger Thank you for this pull request. It has been merged and is now available with mcp-spi-adc v0.4.0 on npm. I made a few small tweaks before publishing, I hope you don't mind. One thing of note that was modified is the default clock frequency for the MCP3304. There are two datasheets for the MCP3304 at Microchip. This one from 2008 and this one from 2011. The timing specifications on page 4 of the 2008 datasheet state that the maximum clock frequency at VDD = 2.7V is 1.05MHz. The 2011 datasheet no longer specifies a clock frequency for VDD = 2.7V. For all other supported chips the default clock frequency is the clock frequency at VDD = 2.7V so the same was done for the MCP3304. |
Adds support for the MCP3304 chip, datasheet here: http://www.microchip.com/wwwproducts/en/MCP3304
This is a 8-channel ADC, similar to MCP3208 and MCP3304, but 13-bit instead of 10- or 12-bit. It also optionally supports differential inputs (using the 4 channel pairs) but this PR only adds 8-channel single-sided input support. Tested on a Raspberry Pi 3.