Using custom RAMPS firmware to solely control temperature
April 26, 2019 04:23AM
Hey all!

I hope someone can help me with some examples to program my ramps board to solely control temperature. But first, some background information:

I am NickelC and I have a passion for new technologies and innovations, which is why I am currently studying mechanical engineering at my local university. For my current project I must transform a KUKA robotic arm into a useable 3D-printer and since I cannot send any G-code from my RAMPS board to the KUKA controller I have decided to try something else. I would like to control my 3D-printer by sending signals from the KUKA controller to my RAMPS board and in theory, it works as follows:

First of all, as usual, to be able to print I have to create a 3D-model with the help of CAD software. Then, I use specialised software to create a toolpath for the robotic arm to make sure it moves my hot end like a regular 3D-printer. After these steps are completed, the toolpath will be uploaded into the controller of the robotic arm, and the real deal begins. After the robotic arm has completed its starting procedure it needs to send various signals to my RAMPS board, starting with a signal to heat up the nozzle and heated bed. Furthermore, during the actual process of 3D-printing, I’m interpreting the speed of the robotic arm to send a signal to my RAMPS board to activate the different extruder motors (stepper motors) with the correct flow rate.

Unfortunately, I can’t seem to successfully program the first step of heating my hot-end and heatbed and I can’t seem to find any examples which correlate to this, could anyone help me get started? I’m using the Diamond Hotend with a single 12 40W heater cartridge in collaboration with a 100K NTC thermistor. For the heated bed I am going to use a 230V 450W silicone heater but unfortunately this heater hasn’t shipped yet. So, at this point the hot-end is more important. Additionally, I believe that my extruder motors are functioning correctly although I haven’t been able to this with the robotic arm running.

As for my experience with Arduino, it is not a lot, but I am eager to learn. I have recently used Marlin to setup a 3D-printer and about one year ago I followed a few different classes which taught Arduino programming, but my Arduino knowledge has been declining since.

Edited 1 time(s). Last edit at 04/26/2019 04:28AM by NickelC.
Re: Using custom RAMPS firmware to solely control temperature
April 27, 2019 09:45AM
Why don't you just look into connecting pwm output from the kuka controller directly to a hot-end? Wouldn't that be simpler than writing custom firmware for a ramps to take custom commands output from the kuka controller?
Re: Using custom RAMPS firmware to solely control temperature
May 01, 2019 04:07AM
Unfortunately, the pwm output is already in use, so it would indeed be easier, but it is not possible in my situation.
Re: Using custom RAMPS firmware to solely control temperature
May 02, 2019 10:29AM
I managed to program both the heater/ thermistor and the stepper motors correctly, but unfortunately it created a new problem.
I can't control them simultaneously due to the limitations of the Arduino (and probably my coding, since I used the delay functions).

I noticed that the Arduino + RAMPS combination with the standard Marlin software is able to control all the different functions at the same time. It is able to control the stepper motors, the extruder, and the heaters simultaneously.
So, how does the Marlin software do this? Did they solely use the millis function instead of the delay function?

Can i fix my code by replacing the few delay functions with the millis function?
Re: Using custom RAMPS firmware to solely control temperature
May 02, 2019 11:05AM
Timers and Interrupts (they are a headache to setup, eg [www.robotshop.com] ) But very useful.

There is a master timer that make sure that the steppers all move correctly and regularly and the temperatures get checked regularly (serial is also interrupt drive and some even have end stops setup that way)

the main code loop takes in new gcodes and works out what to do with them getting the data ready for the next interrupt

Sadly I cant give specifics on the interrupts as I've not actually look at that part of the code... very much... It the core of the beast as it were.

Search for ISR in the marlin code, you will find lots of interesting stuff

Edited 2 time(s). Last edit at 05/02/2019 11:13AM by Dust.
Re: Using custom RAMPS firmware to solely control temperature
May 06, 2019 11:06AM
Thank you for the link to the timers and interrupts! With your help I have been able to replace all the delay functions with a timer.

However, unfortunately, my code still doesn't perform as desired. I still can't control the heater/ thermistor and the stepper motors simultaneously, even though all the delay functions are gone sad smiley

Anyone any tips? I'm using the steinhart formula for the thermistor and a PID controller for the temperature. Could the Arduino have too little processing power for these calculations?

Please note that I am not using a lookup table for the thermistor.
Sorry, only registered users may post in this forum.

Click here to login