Welcome! Log In Create A New Profile

Advanced

Second Serial in Marlin for remote sensors

Posted by dquerol 
Second Serial in Marlin for remote sensors
January 30, 2021 08:47AM
As a biologist from Nicaragua, over the last 13 years I have been following and enjoying the RepRap evolution.

I have grown fond of Marlin and the Arduino Mega/Ramps1.4/2004 RepRap Discount as a solid interphase for uses beyond 3D printing. Building a Lymann/Mullier Filament extruder a few years ago is an example.

So I decided to start from the Arduino Mega/Ramps1.4/Marlin configuration in order to control an industrial Boiler and a Wood drying Kiln.

Both the boiler and the Kiln are working with Marlin, sensing wood humidity, relative humidity, etc, controlling fans and extractors, with a menu and reports on the screen, and running variable drying schedules from the SD card (Modified GCODE instructions).

My only problem has been interference and Clock failure when using I2C or measuring very high resistances (10 to 2000 MOhm) (low voltages) with long cables.

I need to connect an Arduino Nano (at the wood kiln, up to 40 meters away, with a series of I2C sensors), via serial port, and have not been able to modify the Marlin to receive the data.

Let me simplify my question:
How can I initialize and read/write from/to a second Serial port in Marlin?

For example using the Z-Min and Max pins:
Digital pin 19 (RX1) Z-MAX
Digital pin 18 (TX1) Z-MIN

Something like this, but inside Marlin:

void setup() {
// initialize both serial ports:
Serial.begin(9600); //Serial monitor
Serial1.begin(9600); //Remote arduino Nano
}

void loop() {
// read from port 1, send to port 0:
if (Serial1.available()) {
int inByte = Serial1.read();
Serial.write(inByte);
}
Re: Second Serial in Marlin for remote sensors
January 30, 2021 05:54PM
I do not know. But here a good place to look and ask if you can't find.

[forum.arduino.cc]

(Marlin is written in Arduino C, unless you are running ARM powered controllers rather than Arduino powered controllers).
Re: Second Serial in Marlin for remote sensors
May 14, 2021 07:46AM
Hi ;
Did the way you explain , be implemented? i'm going to try the same thing
Re: Second Serial in Marlin for remote sensors
May 15, 2021 01:06PM
Nobody gave me leads, so I reprogrammed main with what I needed (no gcode), with small parts of Marlin (Pins.h, Messages, Setup, etc)
Sorry, only registered users may post in this forum.

Click here to login