Welcome! Log In Create A New Profile


Marlin operation and connection to other boards

Posted by dquerol 
Marlin operation and connection to other boards
January 28, 2021 06:12PM
As a biologist from Nicaragua, over the last 13 years I have been following and enjoying the RepRap evolution.
I started with the McWire, as we had no access to parts (etching my PCBs and recovering components from old equipment). Today it is considered a useless effort, as I realized in 2015, even using new Gen7 electronics.
Today, after evolving towards a Prusa based design in 2015, and with mostly locally recycled parts, building a 3D printer is easy.
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.
For the first time I realized both the complexity and multiplicity of Marlin alternatives when you go beyond the config files.
However, I have been unable to find documentation on the coherence, logic and parameters for the individual building blocks of Marlin.
Has anyone of the old hands written down the structure, links and entry points to control the main functions of Marlin:
• Receiving digital sensor input (endstops)
• Receiving analog sensor input (thermistors)
• Interphase with the Screen, input mechanisms, and sound output
• Control of stepper motors
• Control of other external equipment (D8-D10)
Both the boiler and the Kiln are working, but I need to connect a Arduino Nano (50 meters away, with a series of I2C sensors), via serial port, and have not been able to modify the Marlin to receive the data.
Could someone help?
Re: Marlin operation and connection to other boards
January 29, 2021 02:22AM
... I'm using an ArduinoDue with Marlin4Due to control big industrial ultrasonic cleaning machines (3 to 5 basins, up to 3m traveling, switching ON/OFF the US-senders,measuring basin-temps, controlling/switchin pneumatics, react on failure states) and an aditional USB-multi-I/O-board.

But I've not modified the Marlin4Due, but a program on the PC for the communication with the ArduinoDue and the I/O-board.

All the "controlling" is done in the PC-software and the Marlin4Due is only used to move (G0 and G1 moves) and switch some I/O-ports ("M42 P.. S.." with P the pin number and S the ON/OFF value 255/0) ...

Aufruf zum Projekt "Müll-freie Meere" - [reprap.org] -- Deutsche Facebook-Gruppe - [www.facebook.com]

Call for the project "garbage-free seas" - [reprap.org]
Re: Marlin operation and connection to other boards
January 29, 2021 07:09AM
If you want to investigate the logic of a firmware, make sure to have a look at Teacup firmware. That's as lean and simple as one can get it. Lean means not only fairly easy to understand, it also results in outstanding performance.

If you want to control a boiler, assumedly its temperature, using a full blown printer firmware is a bit a stretch. You'd use just like 5% of its capabilities. For a similar project, ISTAtrol, I started from scratch. Including software-USB it fits on a much smaller ATtiny2313 (or ATtiny4313 for some extra logic).

Generation 7 Electronics Teacup Firmware RepRap DIY
Re: Marlin operation and connection to other boards
January 29, 2021 10:33AM
Thank you, Traumflug and VDX. So there is no consolidated description of Marlin logical flow. I looked at Teacup, but it is like starting again from 0. As I said, I have the kiln 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 now want to do the measurements at the kiln (in a Nano) and send the processed data back to the Marlin/Mega.

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();

Vielen Dank fuer eure Hilfe.

P.S. I attach the Kiln/Marlin code if you want to have a look at it
open | download - Marlin_caldera9Kiln9PorTiempoOhumedadMOK.zip (600.7 KB)
Re: Marlin operation and connection to other boards
January 29, 2021 01:07PM
I have no idea how Marlin works. How about looking at a dedicated kiln firmware? Just from a quick googling: [create.arduino.cc] and [github.com]

Generation 7 Electronics Teacup Firmware RepRap DIY
Sorry, only registered users may post in this forum.

Click here to login