Appropedia needs your support - Please Donate Today
Using Franklin on a CNC Router Parts 3-D printer
| By Michigan Tech's Open Sustainability Technology Lab.
Wanted: Students to make a distributed future with solar-powered open-source 3-D printing.
- 1 Electrical System
- 2 Configuring Franklin
- 3 Troubleshooting
- 4 References
This section describes the overall electrical system on the current CNCRouterParts 3-D printer
The existing CNC machine already contains the motors, inductive sensors, stop switches, stepper drivers, sensor interface board and motor interface board. Beaglebone green, main interface board, fan, hot end and thermistor were added.
A volcano hot end is selected because it has bigger heating element for better heat transfer when extruding filament with bigger nozzle and layer height. The hot end already contains the fan, heater cartridge, and thermistor cartridge. The fan and 40 w heater cartridge needs at least 4 A 12 V power supply. The thermistor used was a Semitec 104GT2.
According to CNCRouterParts, the stepper drivers are similar to this one  but they are rated for 50 V and 4.2 A. Franklin timing setting must be adjusted to work with the stepper driver timing requirement. Stepper driver input also needs extra current to drive the optocoupler inside of it. Make sure 2000 pulse/revolution is set for all driver. For Z axis, the current setting should be maximum (4.2A). For X and Y axis, the current setting should be half of that (2.84 A). For extruder, the lowest current (1 A) should be fine.
Sensor interface board
Make sure the two slide switches on the board (SW1 & SW2) is on the ON position to enable the inductive sensor output.
Main interface board
The design files can be found in (OSF, to be added later). The custom designed board contains ATmega1284p running on 16 MHz crystal, logic level shifter for translating 5 V logic on ATmega to 3.3 V logic of beaglebone, logic buffer for providing the current needed to drive the stepper driver, and two power transistors for driving hot end and fan. Other open source 3-D printer electronics can also be used provided they are equivalent to the previous requirement and the microcontroller used is ATmega328p, 1280, 1284p, or 2560. The easiest way to use other electronics is to use Ardunio board and connect them to the beaglebone through usb.
Header P2 output description (connected to motor interface board):
|P2||ATmega||Motor interface board||Connected to||P2||Atmega||Motor interface board||Connected to|
|1||PD2/D10||Terminal Block 1||Z1 Step||2||PD3/D11||D5PUL/Terminal Block 14||Z1 & Z2 Dir|
|3||PD4/D12||D1PUL/Terminal Block 2||X1 Step||4|
|5||PD5/D13||D1DIR/Terminal Block 3||X1 Dir||6||PD6/D14||D5DIR/Terminal Block 16||Z3 & Z4 Dir|
|7||PD7/D15||D2PUL/Terminal Block 4||Y Step||8|
|9||PC0/D16||D2DIR/Terminal Block 5||Y Dir||10||GND||GND||GND|
|11||PC1/D17||D3PUL/Terminal Block 6||E Step||12||GND||GND||GND|
|13||PC2/D18||D3DIR/Terminal Block 7||E Dir||14||GND||GND||GND|
|15||PC3/D19||D4PUL/Terminal Block 8||X2 Step||16||GND||GND||GND|
|17||PC4/D20||D4DIR/Terminal Block 9||X2 Dir||18||GND||GND||GND|
|19||PC5/D21||Terminal Block 10||Z2 Step||20||GND||GND||GND|
|21||PC6/D22||Terminal Block 11||Z3 Step||22||GND||GND||GND|
|23||PC7/D23||Terminal Block 12||Z4 Step||24||GND||GND||GND|
Header P3 output description (connected to sensor interface board):
Note: All sensor is active low, except emergency switch could be both depend on press to stop or release to stop
|P3||ATmega||Sensor interface board||Connected to||P3||Atmega||Sensor interface board||Connected to|
|3||PB3/D3||PL_SENSOR1||X1 min||4||PB4/D4||P_24||Soft emergency stop|
Header P1 output description (connected to beaglebone green):
|P1||ATmega||Beaglebone green||P1||Atmega||Beaglebone green|
Terminal Block output description:
|ADC1||PA7/D31||One lead of thermistor (The other lead to GND)|
|HOTEND/FAN1||PA4/D28||Heater Cartridge negative lead (The positive lead to 12V)|
|HOTEND/FAN2||PA5/D29||Fan negative lead (The positive lead to 12V)|
The beagle bone is connected to the main interface board through header P9. Be careful not to reverse the connection!
This section describes configuring Franklin on the beaglebone green to work with the CNCRouterParts 3-D printer
- Download Franklin image from  and write the image file to a uSD card using 
- Insert the uSD to the beaglebone and turn it on. The led on beaglebone should flash in wave pattern. Wait until all the led turn off. Then remove the power to the beaglebone and remove the uSD card.
Connecting to Debian
- Connect the beaglebone to computer using microusb cable and create ssh connection to 192.168.7.2 using programs such as this  using username "debian" and password "reprap".
Connecting beaglebone green to the internet
- After connected, the next step is to get the beaglebone connected to the internet. The easiest way to do this is to use ethernet cable to connect beaglebone to the computer. If using windows, we can share the wifi internet connection to the ethernet connection with beaglebone. To do this, find the properties dialog of the wifi connection, click sharing tab, and click "Allow other network users to connect through this computer's Internet connection". Select the ethernet connection to the beaglebone in the dropdown list. Then click ok.
- Next, on the ssh connection to debian, type "sudo nano /etc/network/interfaces" and change the line "iface eth0 inet static" to "iface eth0 inet dhcp". Then Ctrl+X to exit and choose yes to save. After that type "sudo ifdown eth0" and then "sudo ifup eth0". Wait until there is a message saying "bound to x.x.x.x". If not, try the last two commands again.
Modifying Franklin timings
- Default franklin timings is for the Athena printer. The timings must be modified to be used with the stepper driver of this printer.
- After connected to the internet, first type "sudo nano /etc/apt/sources.list" and comment out all lines containing "192.168.8.2" by inserting '#' in front of those lines. Ctrl+X to exit and choose yes to save.
- Next, type "sudo apt-get update". Wait for it to finish. Then download the franklin source code. Type "git clone https://github.com/mtu-most/franklin". Wait for download to finish, then type "sudo apt-get install build-essential debhelper python3-all dh-python gcc-avr arduino-mighty-1284p arduino-mk ruby-ronn closure-linter doxygen doxypy graphviz". Wait for the install to finish.
- Go to the franklin folder. Type "cd franklin/firmware". Then "nano arch-avr.h". Add a line "#define STEPS_DELAY 60" before line "#ifdef FAST_ISR". Also change the line "#define TIME_PER_ISR 75" to "#define TIME_PER_ISR 180". Change "#if 1" to "#if 0" and at last, change the line ""\t" "ldi 18, 40" "\n" \" to ""\t" "ldi 18, 0x3c" "\n" \". Ctrl+X and choose yes to exit.
- Next, type "cd ..", then type "cd server/cdriver". type "nano space.cpp". Change the line "int max = 0x7e << 7;" to "int max = 0x1e << 7;". Ctrl+X and choose yes. then type "cd ..". type "nano driver.py". Change the line "dist = 1000 #TODO: use better value." to "dist = 3000 #TODO: use better value." Ctrl+X and choose yes.
- With beaglebone green still connected to the internet, go to the franklin folder. Then type "make" to compile the franklin. Wait until done. Then type "sudo bash". type "dpkg --install /tmp/*.deb".
Disabling the internet connection
- The edit made before to connect to the internet must be reversed. type "sudo nano /etc/network/interfaces". Change line "iface eth0 inet dhcp" to "iface eth0 inet static".
- Remove the internet sharing in windows. Go to wifi connection properties, click sharing tab, and uncheck "Allow other network users to connect through this computer's Internet connection".
- To turn off the beaglebone, type "sudo poweroff".
Flashing fuse bit of ATmega
- If using the custom made main interface board, the fuse bit of ATmega1284p must be flashed first to use the on board 16MHz crystal and disable JTAG. Skip if using other Arduino board.
- Connect the main interface board to the beaglebone green. Supply 5V power to the main interface board through the terminal block. The beaglebone green should also turn on as well.
- Create ssh connection to debian as described before. type "sudo bash". go to franklin folder. in franklin folder type "cd server/bb". then type "./setpin 30 0x37 >/dev/null". next type "./setpin 31 0x37 >/dev/null".
- Then flash the fuse bit. type "avrdude -C +/usr/lib/franklin/bb/avrdude.conf -c bbbmelziO4 -p atmega1284p -U hfuse:w:0xd9:m" followed by "avrdude -C +/usr/lib/franklin/bb/avrdude.conf -c bbbmelziO4 -p atmega1284p -U lfuse:w:0xe7:m"
- After that type "./setpin 30 0x2e >/dev/null". next type "./setpin 31 0xe >/dev/null".
- Remove power to the main interface board.
Franklin first run
- Connect all the electrical system according to the picture in this guide and connect the main interface board to the beaglebone. Make sure not to reverse any connection to the headers on the main interface board.
- Turn on the system and connect the beaglebone to the computer through ethernet cable.
- Use a web browser to go to http://192.168.76.2:8000/admin
- Check Show setup on the top right of the Franklin web interface
- If the microcontroller on the interface board has not been flashed yet, we will do this in this step. Select "/dev/ttyS4" from a drop down list and select "Melzi from BeagleBone (atmega1284p, bridgeboard v2)". If using other Arduino board, select the correct board with the right serial port. Click upload button next to it. Wait until a message showing the status of upload appears. If failed, check if the connnection between beaglebone and the microcontroller is correct.
- Cycle the power to the microcontroller. Then go to Franklin web interface
- Go to setup page and import this configuration file . Change the extension of the configuration file to .ini first.
- That's it. Before doing anything, check if the direction of each motor is correct and the inductive limit switch is working. We don't want the machine crashing into the sensors. Depending on the wiring of the motor the direction could be reversed. The easiest way to check this is just to move the X, Y, and Z axis a little bit by typing in the box in the user interface and see which direction the motor is moving
- If the motor is not moving, check if the soft emergency switch or hard emergency switch are on their correct position. Check if you can hear a small sound from the motors. There should be a sound if the stepper driver is active and connected to the motor even when the motor is not moving (at least for CRP5042). If no sound, the stepper drive must be disabled or not powered. Make sure the enable pin is driven low (ENA+ and ENA- both low).
- If the inductive sensor is not working, check if the led indicator on it is on when there is a metal in front of it. If not, it might not be powered. Check if there is 12V power to the sensor interface board. If it is on, check if the slide switch (SW1 & SW2) on the sensor interface board is on the on position. The inductive sensor output is active low, so make sure inverted is checked on Franklin.
- If using other main interface board, make sure the board can drive the optocoupler inside the stepper driver. see  for wiring connection tips. Use logic level converter where appropriate to convert 5V to 3.3V and vice versa. The clock for the Franklin firmware must be 16MHz or there will be timing issue.
- If printer not detected on Franklin, wait for a while as sometimes it takes time for the Franklin to detect it. If not, cycle the power to the main interface board. If still not detected, reflash the microcontroller on the main interface board.
- If the motor movement is not accurate, make sure the stepper driver is set at 2000 pulse per revolution and the current settings is sufficient for each axis. Also check if the steps/mm settings in Franklin is correct.
- If while printing the layers is shifted at random height, try using Cura 15.04.6 with start and end gcode defined in . It was tested to work using this version of Cura
- If there is extrusion problem while printing, make sure the filament is placed directly on top of the extruder. Some common problem encountered is: filament got stuck in the spool, the extruder couldn't pull filament from spool due to friction with bowden tube (if using bowden tube) or other object, the fan is not cooling the hot end which makes the filament got stuck, drive gear grinding the filament.