Re: CNCmilling and Dual-Head-3Dprinting firmware/Software?
Quote:
Originally Posted by
hfjbuis
That depends on your drivers. External drivers often have optocoupler inputs. If so, you probably can connect both mega boards to the same driver.
The mega2560 has onboard drivers without optocoupler inputs and unfortunately can't connect both mega boards to the same driver.
But I have not thought of that idea before, good one, thanks.
Quote:
Originally Posted by
wyzarddoc
It would not be a program "merge" as much as changing a lot of variables with a hardware switch and 1 long program
That's the idea. But is it possible?
I checked the mega2560 datasheet and it does not have programming SLOT's functionallity!
(Then it would have bin simply 2 seperate programs in 2 seperate slots without changing a lot of variables, also adding a hardware switch to select wich program to run.)
Mega2560 has a Flash memory of 256-8=248KB
* Marlin firmware is 120KB
* Gbrl firmware is 82KB?
It could fit in the chip. (And there are a lot of unused mega2560-pins for a selection hardware switch.)
In which code files of Marlin and Gbrl should the "changing a lot of variables" be done?
Re: CNCmilling and Dual-Head-3Dprinting firmware/Software?
Quote:
In which code files of Marlin and Gbrl should the "changing a lot of variables" be done?
There is a section where the settings are read from eeprom.
File settings.c
Quote:
// Reads Grbl global settings struct from EEPROM.
uint8_t read_global_settings() {
// Check version-byte of eeprom
uint8_t version = eeprom_get_char(0);
if (version == SETTINGS_VERSION) {
// Read settings-record and check checksum
if (!(memcpy_from_eeprom_with_checksum((char*)&settin gs, EEPROM_ADDR_GLOBAL, sizeof(settings_t)))) {
return(false);
}
} else {
return(false);
}
return(true);
}
This could be changed to "alter" settings after they are read or store/retrieve the settings at/from a different eeprom address.
As a proof of concept, you could set the required configuration by running a (configuration) file that contains all the settings.
All this requires that you can run the mill using the Marlin firmware by just altering settings!
Re: CNCmilling and Dual-Head-3Dprinting firmware/Software?
You lost me there :confused:
Quote:
Originally Posted by
hfjbuis
All this requires that you can run the mill using the Marlin firmware by just altering settings!
1) I expected to do a change in the Marlin firmware file(s) to be able to also mill with gbrl. Because 3Dprinting-Dual-Head(XYZA1A2, heating3x, TempSense3x,Fan) is more complex than Milling(XYZ,Spindle).
2) I could find a file in the Marlin directory "settings.cpp" that starts with EEPROM settings but differs a lot from GBRL. ("// Change EEPROM version if the structure changes".)
3) Is it possible for an other aproache like not to EEPROM the codes together but to program all files of Marlin and Gbrl in the controller and by a switch selection is made which part (Marlin or Gbrl) is run?
Code:
If switch=0 Then
Gosub Marlin
Else
Gosub Gbrl
EndIf
Marlin:
<Marlin code>
Gbrl:
<Gbrl code>
Re: CNCmilling and Dual-Head-3Dprinting firmware/Software?
Quote:
Is it possible for an other aproache like not to EEPROM the codes together but to program all files of Marlin and Gbrl in the controller and by a switch selection is made which part (Marlin or Gbrl) is run?
Technically it is possible. You have to rename all duplicate files, rename duplicate routines if the code is different and change the eeprom storage so that both program's can store their own settings. It probably would take a few months to do!
Re: CNCmilling and Dual-Head-3Dprinting firmware/Software?
Quote:
Originally Posted by
hfjbuis
Anything else is possible (we walked on the moon) but requires a lot of work.
Quote:
Originally Posted by
hfjbuis
Technically it is possible...It probably would take a few months to do!
Now I understand the complexity of it, thanks for being straight forward.
I will leave that programming to the proffesionals and will check in the future if it exists.
That leaves me with 2 previous options mentioned in this thread:
1) Use 2 Mega2560
2) Use multiple CNC-controlleres with like a Dsub-25 connector.
a) PCBtype
b) PLUGtype
c) CABLEtype
I mentioned earlier that I thought of switching between different CPU boards before with a universal header but my kids will also use it and should be simple to do.
Do you have pinlayouts and/or pics how you did or will do it on your machine?
Re: CNCmilling and Dual-Head-3Dprinting firmware/Software?
Quote:
Do you have pinlayouts and/or pics how you did or will do it on your machine?
No it is on my to do list and waits for some other projects to be finished first. Basically I want to use as little as possible self made electronics. The boards I make are just replacements of wiring.
CPU side:
I want CPU boards with no electronics, just wiring CPU pins to a main board.
The main board will be powered by 24V and supply the CPU power 3V3 and 5V.
The main board will have an ESP32 or ESP8266 Wi-Fi board to connect the RX/TX of the CPU board, I prefer WiFi connections.
The main board will do the level converting to the CPU by using FET modules.
Lathe side:
The main board will do the 5V level converting for the all drivers and sensors by using optocouplers.
The spindle will be driven by step/dir (servo) for position modes and 10V for speed modes and manual mode, selectable by a control pin (CPU side) and a switch (Lathe side).
I will use a PWM to 10V module for the conversion of PWM to 10V
The CPU board will be connected directly to a D-Sub25 connector
For the lathe I will use D-Sub25 connectors and D-Sub25 parallel port cable(s)
The steppers are connected using GX16 4 pin connectors
The servo motor has its own cables
For the lathes I will make a board to connect the sensors and switches.
I will do both lathes the same way so that components can be used interchangeably and in future the mill will also get the same boards.
Re: CNCmilling and Dual-Head-3Dprinting firmware/Software?
Nice configuration!
Same here for the24V that I will use on the Mega2560 to have sufficient power for the steppers drivers.
The mega2560 comes with MOSFETS for spindle etc. but to power mine(100Vdc type high speed with power supply and speed control) I use a 24V relais.
I checked my old cable wires bag and found 6x D-Sub25 parallel port cables that I will use to switch between controllers for now.
I noticed your ESP32 or ESP8266 Wi-Fi boards setup that is also possible on the Mega2560?
Re: CNCmilling and Dual-Head-3Dprinting firmware/Software?
Quote:
I noticed your ESP32 or ESP8266 WiFi boards setup that is also possible on the Mega2560?
I used ESP8266 modules in the past. Now I use Arduino Uno and Mega boards from Robotdyn that have an onboard ESP8266.
The Mega board:https://robotdyn.com/mega-wifi-r3-at...micro-usb.html
The ESP8266 sketch and manual:https://github.com/MetalWorkerTools/...%20Connections
In future I am going to use arm boards without onboard WiFi. I add an ESP module to the main board so that all boards I want to test can be connected by WiFi.
Beware that the gcode sender also has to support WiFi connections (UGS can). I stumbled about this program that makes a virtual COM port for a WiFi connection. I have tested it and it works for me.
https://www.hw-group.com/software/hw...al-serial-port
Re: CNCmilling and Dual-Head-3Dprinting firmware/Software?
Quote:
Is for lathes only?
No, the ESP sketch is just a transparent converter. It doesn't alter any messages, just transmits them. I use it on my lathes, rotary table and grinder.
Quote:
Just some info, I ordered the "female Dsub-25 with nuts" because all my old cables had "male Dsub-25 with bolts"!
A female connector is a bit more protected to short circuits. I prefer a female connector on the side where the signals are active.
On my lathe, there is no voltage on the connector. A short on that connector will do no harm. So the lathe has a male connector. For that same reason, the CPU board also has a male connector.
The main board is fitted with Female D-sub 25 connectors because it has live signals. I use Male to Female parallel port cables.