Welcome! Log In Create A New Profile

Advanced

HOW TO USE MCP3426 /M3426 IN MARLIN

Posted by chitrarasan 
HOW TO USE MCP3426 /M3426 IN MARLIN
December 07, 2023 04:30AM
Hi
I am chitrarasan , I like to add a laser distance sensor to my printer for bed leveling which gives analog output 0-12v,for which i was looking for a solution to read analog input using marlin firmware and MKS monster 8 v2, buy the time i found M3426.cpp file under features/adc/mc3426.cpp .in comments its mentioned that we can read analog output of any sensor using mcp3426 ,which is a 16-bit ADC,Is there anyone who already tried it with any analog input and also suggest which 3d printer control board has mcp3426 module inbuilt,or how to add a module to existing monster 8

Edited 1 time(s). Last edit at 12/07/2023 04:31AM by chitrarasan.
Re: HOW TO USE MCP3426 /M3426 IN MARLIN
December 08, 2023 03:31AM
This was added to support the OoenPNP motherboard Opulo Lumen REV3 and REV4

It has almost no integration with Marlin other than adding gcode G3426

* M3426: Read 16 bit (signed) value from I2C MCP3426 ADC device
*
* M3426 C channel 1 or 2
* M3426 G gain 1, 2, 4 or 8
* M3426 I 0 or 1, invert reply
*/

their control program uses this directly
Re: HOW TO USE MCP3426 /M3426 IN MARLIN
December 08, 2023 05:44AM
Thanks for the reply, I too found that, now I am using MKS monster 8 v2 which has I2C port GIVEN AS ALTERNARE for emulate from SD card as iam using SD card for firmware can we configure those pins to read i2c from other device


.******************************************************Marlin firmware************************************************
// Use one of these or SDCard-based Emulation will be used
//#define SRAM_EEPROM_EMULATION // Use BackSRAM-based EEPROM emulation
//#define FLASH_EEPROM_EMULATION // Use Flash-based EEPROM emulation
#define I2C_EEPROM // Need use jumpers set i2c for EEPROM
#define MARLIN_EEPROM_SIZE 0x1000 // 4K
//#define I2C_SCL_PIN PB8 // I2C_SCL and CAN_RX
//#define I2C_SDA_PIN PB9 // I2C_SDA and CAN_TX
***********************************************************************************

i am thinking like can we create custom Gcode (like m342) ,which when sent from slicer will read i2c data and send back.i2c values read. I am new to marlin so sorry if i am wrong about what i ask .
Sorry, only registered users may post in this forum.

Click here to login