My reprap 3d printer build

For issues with communication ports, protocols, etc.
D.J.Peters
Posts: 7169
Joined: May 28, 2005 3:28
Location: Germany

My reprap 3d printer build

Postby D.J.Peters » Dec 29, 2016 20:30

Last days I began build a 3D printer from scratch.

Under the hode I use a ATMEL MEGA 2560 and some cheap stepper motors and drivers.

For the first setup I use Merlin as base of my own g-code interpreter firmware.

It lifes here are my first output via RS232 with 250000 baud.

Code: Select all

connected
press [esc] to disconnect ...
start
echo:Marlin1.0.0
echo: Free Memory: 3795  PlannerBufferBytes: 1232
echo:Hardcoded Default Settings Loaded
echo:Steps per unit:
echo:  M92 X78.74 Y78.74 Z2560.00 E105.00
echo:Maximum feedrates (mm/s):
echo:  M203 X400.00 Y400.00 Z2.00 E45.00
echo:Maximum Acceleration (mm/s2):
echo:  M201 X1400 Y1400 Z100 E80000
echo:Acceleration: S=acceleration, T=retract acceleration
echo:  M204 S1400.00 T5000.00
echo:Advanced variables: S=Min feedrate (mm/s), T=Min travel feedrate (mm/s), B=
minimum segment time (ms), X=maximum XY jerk (mm/s),  Z=maximum Z jerk (mm/s),
E=maximum E jerk (mm/s)
echo:  M205 S0.00 T0.00 B20000 X13.50 Z0.30 E5.00
echo:Home offset (mm):
echo:  M206 X0.00 Y0.00 Z0.00
echo:PID settings:
echo:   M301 P19.86 I1.00 D98.93
echo:SD card ok
A small program put a big smile on my face :-)

Joshy

Code: Select all

#ifdef __FB_WIN32__
const PORT = "COM16" ' windows
#else
const PORT = "/dev/ttyUSB0" ' linux
#endif

const BAUD = "250000"

var hFile = FreeFile()
var result = open com(PORT & ":" & BAUD & "," & "N,8,1,CD,CS,DS,OP,BIN",as #hFile)
if result then
  print "error: can't open port: " & PORT & " with " & BAUD & " baud !"
  beep : sleep : end 1
end if

print "connected"
print "press [esc] to disconnect ..."
while inkey()=""
  while not EOF(hFile)
    dim as ubyte char
    get #hFile,,char,1
    if char>31 then
      print chr(char);
    else
      print
    end if
  wend
  sleep 100
wend
print "dsconnected"
close #1
sleep
Last edited by D.J.Peters on Jan 01, 2017 15:48, edited 3 times in total.
D.J.Peters
Posts: 7169
Joined: May 28, 2005 3:28
Location: Germany

Re: My reprap 3d printer build

Postby D.J.Peters » Dec 29, 2016 20:36

Why is inkey()="" ignored in the loop ?

I must interrupt it with [ctrl] + [c] here

Joshy
fxm
Posts: 7373
Joined: Apr 22, 2009 12:46
Location: Paris suburb, FRANCE

Re: My reprap 3d printer build

Postby fxm » Dec 29, 2016 20:50

Perhaps program always stays in the [while not EOF(hFile) ..... wend] loop?
D.J.Peters
Posts: 7169
Joined: May 28, 2005 3:28
Location: Germany

Re: My reprap 3d printer build

Postby D.J.Peters » Dec 29, 2016 20:57

fxm yes but after the last line "echo:SD card ok"
the firmware does not send more chars
and EOF(hFile) should return a value <> 0

I will do a deeper view on it.

Joshy
D.J.Peters
Posts: 7169
Joined: May 28, 2005 3:28
Location: Germany

Re: My reprap 3d printer build

Postby D.J.Peters » Dec 29, 2016 22:04

Looks like the NOT operator does not work in all cases

All are ok without NOT.

Joshy

Code: Select all

#ifdef __FB_WIN32__
const PORT = "COM16" ' windows
#else
const PORT = "/dev/ttyUSB0" ' linux
#endif

const BAUD = "250000"

var hFile = FreeFile()
var result = open com(PORT & ":" & BAUD & "," & "N,8,1,DS",as #hFile)
if result then
  print "error: can't open port: " & PORT & " with " & BAUD & " baud !"
  beep : sleep : end 1
end if

print "connected"
print "press [esc] to disconnect ..."
while asc(inkey())<>27
  var ok = EOF(hFile)
  while ok=0
    dim as ubyte char
    get #hFile,,char,1
    if char>31 then
      print chr(char);
    else
      print
    end if
    ok = EOF(hFile)
  wend
  sleep 100
wend
print "dsconnected"
close #1
sleep 3000
fxm
Posts: 7373
Joined: Apr 22, 2009 12:46
Location: Paris suburb, FRANCE

Re: My reprap 3d printer build

Postby fxm » Dec 29, 2016 23:00

[Do Untill EOF ..... Loop]
is always safer.
D.J.Peters
Posts: 7169
Joined: May 28, 2005 3:28
Location: Germany

Re: My reprap 3d printer build

Postby D.J.Peters » Dec 30, 2016 14:19

If I send a small G code string like "G28" & chr(10) to drive all axes at home positions FreeBASIC does not send it over the COM port.

On end of the program if I close the COM port or interrupt it via [CTRL] + [c] it flush all waiting chars and my stepper motors moves.

If I use any terminal program or the serial monitor from arduino IDE and type the same command "G28"

all chars are sended directly and the motor moves to the end stop switches.

solved: I changed the init string Does FreeBASIC needs a kind of flush command for waiting chars may be via Windows API ?

Joshy
Last edited by D.J.Peters on Dec 31, 2016 10:26, edited 1 time in total.
D.J.Peters
Posts: 7169
Joined: May 28, 2005 3:28
Location: Germany

Re: My reprap 3d printer build

Postby D.J.Peters » Dec 31, 2016 3:55

First run with PLA 180 grad celsius
https://www.youtube.com/watch?v=wQkvIrZiTNU

Joshy
D.J.Peters
Posts: 7169
Joined: May 28, 2005 3:28
Location: Germany

Re: My reprap 3d printer build

Postby D.J.Peters » Dec 31, 2016 10:23

Here are my working USB->RS232 init string vor any ATMEL/AVR controller.

Joshy

Code: Select all

#if defined(__FB_WIN32__)
const PORT = "COM16" ' <--- set your Windows serial port here
#else
const PORT = "/dev/ttyUSB0" ' <--- set your Linux serial port here
#endif
const BAUD = "250000"  ' <--- change it to your Arduino IDE setting
const INIT = "N,8,1,BIN,DS0,CS0"
print "open with DS0,CS0"
var hFile = FreeFile()
var result = open com(PORT & ":" & BAUD & "," & INIT ,as #hFile)
if result then
  print "error: can't open port: " & PORT & " with " & BAUD & " baud !"
  beep : sleep : end 1
end if
D.J.Peters
Posts: 7169
Joined: May 28, 2005 3:28
Location: Germany

Re: My reprap 3d printer build

Postby D.J.Peters » Jan 01, 2017 20:26

Some strange noise I can't locate the source
https://www.youtube.com/watch?v=n4pNX_3XHV4
I don't mean the normal noise from the stepper motors.

Joshy
BasicCoder2
Posts: 2894
Joined: Jan 01, 2009 7:03
Location: Australia

Re: My reprap 3d printer build

Postby BasicCoder2 » Jan 01, 2017 21:28

D.J.Peters wrote:Some strange noise I can't locate the source

Still it sounds very scifi :)

https://www.youtube.com/watch?v=CD-CPZ-vaWI
St_W
Posts: 1127
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: My reprap 3d printer build

Postby St_W » Jan 02, 2017 2:49

A very interesting project and according to your video it seems to work already quite well. Beside the software I would also love to hear some details about the hardware - did you use some publicly available designs and pre-built parts or did you create a custom design and created/collected the needed parts yourself? How does the machine work? What components are used? What type of system/hardware is used to control the machine? ... and similar things :-)
Unfortunately I can't help with the sounds due to (total) lack of experience with such machines.
D.J.Peters
Posts: 7169
Joined: May 28, 2005 3:28
Location: Germany

Re: My reprap 3d printer build

Postby D.J.Peters » Jan 02, 2017 9:03

I got all parts from eBay most of them are cheap china stuff.
5 NEMA 17 (clone) stepper motors 25€, 5 stepper drivers A4988 (with heatsink) 5€
RAMPS 1.4 controll 5€, ATMEL ATMEGA 3560 6€, Display 4x20 chars 3€, 2 x 40x40x10mm fan 2€, power supply output 5V,12V 5A 12€
heatbad 7€, hot end and extruder 6€ (it's crap I must replace it with a E3D V6 clone 20€)
GT2 Timing Belt 1m 3 x GT2 Pulley ... 5€
2 X Linear Rail Bar Shaft 300mm 8mm Lead Rod Screw Nut for Z-Axis. 15€
screws, washers, ball bearing etc 10€, SD card slot 1€ and many stuff laying around here.

Or you can buy a Do it your self complete kit serch on eBay "DIY RepRap Prusa i3 b" 180€

Of course you need filament (1KG 3mm PLA or ABS 25€)

For testing I use the open source Marlin 3D Printer Firmware https://github.com/MarlinFirmware/Marlin.

But next time I write all software self
a modern firmware
a 3D slicer that makes from triangle models layers for the printer
an CNC g-code generator (USB->RS232l and for offline printing via SD-card)

Joshy
D.J.Peters
Posts: 7169
Joined: May 28, 2005 3:28
Location: Germany

Re: My reprap 3d printer build

Postby D.J.Peters » Jan 03, 2017 19:46

The third run of my DIY printer project.
Sure it's cheap but after some tweaks and fine tune of the setup the first results are pretty awesome.
A perfect test cube of 4x4 cm for mensurement of all axis and steps from the motors.

youtube: https://www.youtube.com/watch?v=6EImHpYP0b8

Joshy
BasicCoder2
Posts: 2894
Joined: Jan 01, 2009 7:03
Location: Australia

Re: My reprap 3d printer build

Postby BasicCoder2 » Jan 03, 2017 20:29

Was the plastic cube hollow or solid?
What did it cost to build in the amount of plastic used?
I did drool over some 3D printer kits on sale at Jaycar but really couldn't justify to the wife actually buying one.
https://www.jaycar.com.au/arduino-3d-pr ... t/p/TL4100
https://www.jaycar.com.au/3D
https://www.jaycar.com.au/duinotech-min ... r/p/TL4076
.

Return to “Hardware Interfaces / Communication”

Who is online

Users browsing this forum: No registered users and 1 guest