Anyone tried to make a 3D Printer controller?

What are you developing?
xebbmw
Posts: 15
Joined: Tue Aug 02, 2016 3:34 am

Re: Anyone tried to make a 3D Printer controller?

Post by xebbmw » Thu Sep 28, 2017 12:25 pm

spon! wrote:
Wed Sep 27, 2017 3:52 pm
Hi there! That's what I'm doing! :lol:
I've been reading this thread and thinking that maybe we can use a low cost board holding a blue pill for the most common 3d printers (mendel 90, prusa i3, kossel delta, etc), so I made a little board with 4 stepper drivers, 3 mosfets and 2 thermistors, based on the SinapTec board (http://reprap.org/wiki/SinapTec). The goal for the board is to be DIY-able and very low cost. You can see it here: https://github.com/pscrespo/Morpheus-STM32 .
What are your thoughts about it?

(non-native english speaker, I apologize in advance for any writing mistakes)
I would recommend you to add more fans to your design. At least one for cooling the printed part and maybe one more for cooling the stepping drivers from the electronics.

ag123
Posts: 798
Joined: Thu Jul 21, 2016 4:24 pm

Re: Anyone tried to make a 3D Printer controller?

Post by ag123 » Thu Sep 28, 2017 1:08 pm

victor_pv wrote:
Thu Sep 28, 2017 4:02 am
About the L6470 if I remember right they do have step, dir and en pins, but can also be driven completely with SPI.
But even the STM 3d printer board uses step and dir pins to drive them.
What I believe they lack is the current adjustment Vref, and that has to be adjusted with SPI.
Check the datasheet to confirm.
one of the disadvantages of L6470 as mentioned in this implementation is
https://github.com/hendorog/Marlin_L6470
Arc support not optimised - the L6470 forces all position moves to complete to zero velocity before the next one can be sent. The result is small blobs at each vertex.
if you discount that little disadvantage the L6470 apparently seemed easier to interface with 3.3v devices (STM probably considered or even have products interfacing with STM8 / STM32 mcu which pretty much runs at 3.3v) and it seemed pretty advanced
http://www.st.com/en/motor-drivers/l6470.html
http://www.st.com/content/ccc/resource/ ... 255075.pdf
it sports commands / features such as registers for setting speeds / acceleration / deceleration etc, and the commands seemed literally 'fire and forget' types of commands such as GoTo_DIR (DIR, ABS_POS) and the motor controller takes care of acceleration, speed limit, deceleration and count steps.
the mcu (e.g. stm32) could literally go parse the next command and simply monitor if the previous command has completed before issuing a next command. for the 'cheaper' stepper drivers it is just dir and step pins and the mcu would be busy doing all that motion acrobatics. in addition, the price would be no 'funky acrobatics' etc :lol:
Last edited by ag123 on Thu Sep 28, 2017 1:18 pm, edited 1 time in total.

User avatar
spon!
Posts: 3
Joined: Fri Sep 02, 2016 7:00 pm

Re: Anyone tried to make a 3D Printer controller?

Post by spon! » Thu Sep 28, 2017 1:11 pm

RogerClark wrote:
Wed Sep 27, 2017 9:17 pm
You do not use the top copper very much, i.e. only a few red colour tracks
Actually, they are bridges, I wanted to make a single sided PCB but needed those. I'm still learning to use gEDA/gaf, does it have another way to draw bridges?
victor_pv wrote:
Thu Sep 28, 2017 3:42 am
I just submitted the first running version of stm32duino HAL for Marlin to the official 2.0 bugfix branch.
That's great news! Unfortunately, my cat decided to learn how chew-able electronics are and stole from the table my only bluepill (note to self: next time buy more than one) so I have to wait until the new one arrives... yeah, that's my luck...
victor_pv wrote:
Thu Sep 28, 2017 3:42 am
I noticed you don't have any connector for a display or an SDcard.
I thought that if someone needs an el-cheapo board, maybe doesn't want to attach a display :) but I left unused a SPI (A4 to A7) so I can add a header.
xebbmw wrote:
Thu Sep 28, 2017 12:25 pm
I would recommend you to add more fans to your design. At least one for cooling the printed part and maybe one more for cooling the stepping drivers from the electronics.
You are right, didn't think of that. I'll try to add them asap.

ag123
Posts: 798
Joined: Thu Jul 21, 2016 4:24 pm

Re: Anyone tried to make a 3D Printer controller?

Post by ag123 » Thu Sep 28, 2017 1:31 pm

@spon!

my little 2c thoughts are that if L6470 is used after all
https://github.com/hendorog/Marlin_L6470
the motor driving codes may well be simplified rather significantly to an extent of translating the g-code commands into the motor commands for each motor and then 'fire and forget' and simply monitor for whether the last command has completed executing and issuing a next command
and g-codes such as
https://www.simplify3d.com/support/arti ... -tutorial/

Code: Select all

G1 X0 Y0 F2400 ; move to the X=0 Y=0 position on the bed at a speed of 2400 mm/min
G1 Z10 F1200 ; move the Z-axis to Z=10mm at a slower speed of 1200 mm/min
G1 X30 E10 F1800 ; push 10mm of filament into the nozzle while moving to the X=30 position at the same time
may literally be simply setting the speed / acceleration / deceleration registers and dispatch commands to the individual motors
the downside is that L6470 is rather pricy
https://www.ebay.com/sch/i.html?_nkw=l6470&_sacat=0
they literally costs 2 - 4 blue pills or maple minis each :lol:
https://www.ebay.com/sch/i.html?_nkw=stm32f103&_sacat=0

victor_pv
Posts: 1741
Joined: Mon Apr 27, 2015 12:12 pm

Re: Anyone tried to make a 3D Printer controller?

Post by victor_pv » Thu Sep 28, 2017 2:05 pm

ag123 wrote:
Thu Sep 28, 2017 1:31 pm
@spon!

my little 2c thoughts are that if L6470 is used after all
https://github.com/hendorog/Marlin_L6470
the motor driving codes may well be simplified rather significantly to an extent of translating the g-code commands into the motor commands for each motor and then 'fire and forget' and simply monitor for whether the last command has completed executing and issuing a next command
They do have a problem, that I noticed reading the datasheet a while back, and that github accounts mentions, confirming what I suspected: the L6470 will not accept another command until the motor has completely finished the previous one and come to a stop. What that means is that the movement becomes jerky. There are comments in that repo about how arcs do not work fine because of that, since the motors complete stop at each little vertex, and cause globs. I had hoped that there was a way around it when I read the datasheet, but at least Hendorog wasn't able to find a way around apparently.
I had thought that perhaps the busy flag would trigger at some point that would allow the next command to pipe to the L6470, so the motor would not stop as long as there is another command to execute, but doesn't seem possible.
That may explain why STM chose to drive them with step/dir pins in their own 3d printer board.

ag123
Posts: 798
Joined: Thu Jul 21, 2016 4:24 pm

Re: Anyone tried to make a 3D Printer controller?

Post by ag123 » Thu Sep 28, 2017 3:02 pm

i'm halfway thinking if there may after all be some way to solve the little blobs at each vertex problem.
while there are 3 motion motors e.g. x, y, z, there is also the extruder motor (assuming a single filament)
just as with x, y, z there is acceleration, constant speed, deceleration, we can possibly set the registers for acceleration, constant speed, deceleration for the extruder as well. other possible ways may include reducing the number of steps the extruder takes say vs the x, y, z motors, so perhaps for a move it is intended to extrude 10mm of filament, we may stop that at 9mm instead
the trouble with this is that it would take a lot of effort to tune the print and is very much an art
and for an easier implementation one could perhaps start with a 'geometric' implementation and later fine tune the extrusions etc in the code later
one trouble with such a fine tuning approach may well be that the print may be slower and takes (much) longer
the main attractiveness of L6470 is that it performs a significant part of the motor control logic this offloads the mcu e.g. blue pill / maple mini
programming could as a result be (much) simpler than if the mcu needs to do all the motor control computation acceleration, constant speed, deceleration and step timing and counting, but of course if the mcu has all that control it can do things that may be 'impossible' on the command based L6470 motor driver

xebbmw
Posts: 15
Joined: Tue Aug 02, 2016 3:34 am

Re: Anyone tried to make a 3D Printer controller?

Post by xebbmw » Thu Sep 28, 2017 3:47 pm

victor_pv wrote:
Thu Sep 28, 2017 2:05 pm
They do have a problem, that I noticed reading the datasheet a while back, and that github accounts mentions, confirming what I suspected: the L6470 will not accept another command until the motor has completely finished the previous one and come to a stop. What that means is that the movement becomes jerky. There are comments in that repo about how arcs do not work fine because of that, since the motors complete stop at each little vertex, and cause globs. I had hoped that there was a way around it when I read the datasheet, but at least Hendorog wasn't able to find a way around apparently.
I had thought that perhaps the busy flag would trigger at some point that would allow the next command to pipe to the L6470, so the motor would not stop as long as there is another command to execute, but doesn't seem possible.
That may explain why STM chose to drive them with step/dir pins in their own 3d printer board.
In order to avoid the issues the with L6470 and to use less pins from STM32F1, would it be a good solution then to use TMC5130 stepper driver? But in this case the changes to firmware are required as per this reported issue https://github.com/trinamic/TRAMS-Firmware/issues/2

victor_pv
Posts: 1741
Joined: Mon Apr 27, 2015 12:12 pm

Re: Anyone tried to make a 3D Printer controller?

Post by victor_pv » Thu Sep 28, 2017 4:07 pm

I'm not sure from reading the datasheet if the 5130 can start the next move without coming to a complete stop, but the code may show.
As trinamic said, that requires a complete rewrite of stepper.cpp.
There are already quite a lot of changes going on to stepper.cpp to run fine with the 32bit MCUs, so adding support for the SPI mode in the latest version of stepper.cpp may take a while, but I think it would be great.
We will see where that goes.

For a minimum board like Scon is making, the F103CB has enough pins. But using an RET or an VET MCU is not much more expensive anyway, so I don't really see any limitation on using more pins.
I'm designing a board around a VET MCU and can have 8 steppers 6 fets, 4 thermistors, 2 sdcards, LCD, and have pins to spare.

alce
Posts: 6
Joined: Sun Jul 30, 2017 8:30 am

Re: Anyone tried to make a 3D Printer controller?

Post by alce » Thu Sep 28, 2017 4:32 pm

Here is another fw for stm32f46re nucleo. I fixed the adc to work with multiple sensors and I've been printing couple of days now. I am really pleased with the print quality even at high rates. I could not get the adc dma to raise an interrupt so the temperature readings can seem little bit noisy. I am using A4988 for xyz. The cheap A4988's I got seem little too wimpy for mk8 extruder so I am using drv8825(w/ diode fix and 3cm fan). Some of the fets I had in there were working but I also saw couple instances where they started reaching very high temperatures for unknown reasons. I ended up wiring external 2 channel relay module I had instead. I am going to try using 4x "High power MOS Field Effect Tube Trigger switch" instead. Also the nucleo started crashing when I added 2 ohm heated bed most likely because of voltage drop.

https://filebin.ca/3bxb4sEv8Oa7/main.bin
https://filebin.ca/3bxbM2u3kznT/config.default should be saved as config.txt on sd card to be read.

xebbmw
Posts: 15
Joined: Tue Aug 02, 2016 3:34 am

Re: Anyone tried to make a 3D Printer controller?

Post by xebbmw » Thu Sep 28, 2017 6:45 pm

victor_pv wrote:
Thu Sep 28, 2017 4:07 pm
I'm designing a board around a VET MCU and can have 8 steppers 6 fets, 4 thermistors, 2 sdcards, LCD, and have pins to spare.
Do you mean here STM32F1 or STM32F4 VET board?

Post Reply