jajberni / MCP342x_LoPy

MicroPython driver for the MCP342x ADC.
MIT License
3 stars 3 forks source link

MCP342x_LoPy

MicroPython driver for the MCP342x ADC.

This is a python library for the MCP342x ADC designed to operate with PyCom boards. It is based on Steve Marple's MCP342x Python Library, which depends on the SMBus python library. This one doesn't depend on the SMBus library, since it uses native I2C communications.

The MCP342x communicates with the PyCom board using the I2C bus. The default I2C address of the device is selectable in the range of 0x68 to 0x 0x49.

Connecting the board

The current board uses Grove connectors. Alternatively you can use normal jumper cables and solder them to the breakout pins on the board.

The default connection is to the 3.3V, GND, SDA (white) to P22 and SCL (yellow) to P21. Other pins can be assigned when defining the I2C bus in the main program.

The 4 channels of the MCP3424 are available with screw terminals.

Testing the library

Upload the boot.py, main.py and lib/MCP342x.py to your PyCom board. The demo script will stream the measurements on the serial console at 1Hz.

Functions

This library provides a class MPC342x with the functionality for reading each channel in the ADC.

TODO: complete documentation.