3D printer operation without a computer
Hello, dear habravchane!
So my move ended, the candidate minimum was handed over, the first reel of plastic ended and it was time to write the promised article about the electronic stuffing of my printer.
This article will focus on the automation of my 3D printer PRUSA I3, namely the connection of the screen, buttons (instead of the encoder) and the card reader and the power supply system for all additional electronics.
I ask for details under cat.
I would like to immediately make a reservation that I took the elements for these cards from my stocks. What was at hand.
Everything is simple here. A 5 volt stabilizer (I took the L7805CV with an output current of up to 1.5A) to power the arduins and display. Strapping - two capacitors. The stabilizer is connected to 12 volts. From it through a resistor we connect an LED to indicate operation. The voltage regulator for 3.3 volts (LD1117A33 with an output current of up to 1A) is connected to 5 volts to power the SD card. The strapping is also - two capacitors (well, and by analogy, the LED is through a resistor).
The specific values for the capacitors are selected according to the specification of the stabilizers, the values of the resistors according to the current consumption of the diodes and the supply voltage (or experimentally).
On RAMPS there is a place for soldering diode D1. When it is connected, 12 volts are fed to the Vin pin of the arduins and goes to the stabilizer on the arduino. At first, I soldered it, and everything worked together, but after a few minutes the printer just turned off and without connecting the USB cable it could not be turned on (the stabilizer probably overheated or burned out). Therefore, it was decided to unsolder the diode and connect an external stabilizer.
To power the memory card, you need 3.3 volts, the logical levels of the card are also 3.3 volts. In ready-made modules called SDRamps, a stabilizer is used (we have already assembled it) and a level converter chip (5-> 3.3). Since I did not have such a chip, it was therefore decided to use a conventional resistive divider.
The card is connected in SPI mode. Used: 3 lines SCK, CS, MOSI from arduino to the map through dividers; MISO line directly from the map to the arduino; 3.3 volt power is also connected; land; and I also connected a card availability detector. The cardholder was removed from the old smartphone, but you can use the SD-microSD adapter (but it does not have a card availability detector).
Any character display is suitable, starting from 2 lines of 16 characters. The more rows, the more data can be displayed on it. You can also connect a graphic display SPI LCD 128x64 (Controller ST7565R graphic Display Family). We connect according to the scheme described here . 4 data lines, RS, Enable, 5 volts, ground, and a 10kΩ trimmer for adjusting contrast.
Since I did not find an encoder, I decided to get by with a button interface. Any 3 buttons will do. True, you will have to edit the firmware, but more on that later.
As I mentioned in a previous article, this mosfet is very hot due to improper operation. I replaced it with an APM2509N taken from a video card. The table’s nutrition paths were also extended. The lacquer coating was neatly cut off with a scalpel and soldered with a thick layer of solder. The previous mosfet was heated so that after 30-50 minutes it was possible to burn a finger about it. And the new one was heated to 38 degrees in 6 hours. And yes, the mosfet is without a radiator.
The table is now heated to 100 ° C in 15-17 minutes (before 30 minutes). And the LED on the table began to shine somehow brighter (or maybe it just seems).
The output from the 5-volt stabilizer is connected to any 5V pin on RAMPS.
The card reader is connected to the AUX-3 connector (RAMPS pins on the left, SD on the right):
D50 (MISO) pin - DO (MISO);
pin D51 (MOSI) - divider - DI (MOSI);
pin D52 (SCK) - divider - SCK;
pin D53 - divider - CS;
3.3 volts (with stabilizer) - VCC;
GND - GND (VSS);
and in the presence of SD Detect, connect to it the pin D43 of the AUX-4 connector.
The buttons and display are connected to the AUX-4 connector.
Display (RAMPS pins on the left, display on the right (data bus starts with D0)):
pin D16 - RS;
pin D17 - Enable (E);
pin D23 - Data 4 (D4);
pin D25 - Data 5 (D5);
pin D27 - Data 6 (D6);
pin D29 - Data 7 (D7);
5 volts - VDD;
GND - VSS;
A tuning resistor is connected to 5 volts and ground, and the output to the VO pin (contrast);
The pin of the RS display is connected to ground;
If there is a backlight, we connect 5 volts through a 1.8k ohm resistor and ground.
The buttons are connected to the ground and:
pin D31 - Up;
pin D33 - Down;
pin D35 - Click;
By default, these pins are configured in the firmware. To connect to others, you need to fix the pins.h file in the firmware.
To start supporting SD cards, a character display and buttons in the firmware in the configuration.h file, uncomment the line:
In this case, ULTIPANEL, NEWPANEL, SDSUPPORT and ULTRA_LCD are automatically detected, which are responsible for the operation of the display, buttons and card reader.
The printer name displayed on the screen is specified by the line:
The number of characters and lines of the display is set by the LCD_WIDTH and LCD_HEIGHT parameters, respectively:
To support buttons instead of encoder in ultralcd.cpp file
With the correct assembly, after uploading the firmware, you can remove the USB cable into the desk drawer and print from the SD card.
That's all for now. As usual, I look forward to questions and comments.
PS In the near future I plan to put auto-calibration on the table with a servomotor. And assemble the frame of the second printer.
So my move ended, the candidate minimum was handed over, the first reel of plastic ended and it was time to write the promised article about the electronic stuffing of my printer.
This article will focus on the automation of my 3D printer PRUSA I3, namely the connection of the screen, buttons (instead of the encoder) and the card reader and the power supply system for all additional electronics.
I ask for details under cat.
I would like to immediately make a reservation that I took the elements for these cards from my stocks. What was at hand.
Let's start with food.
Everything is simple here. A 5 volt stabilizer (I took the L7805CV with an output current of up to 1.5A) to power the arduins and display. Strapping - two capacitors. The stabilizer is connected to 12 volts. From it through a resistor we connect an LED to indicate operation. The voltage regulator for 3.3 volts (LD1117A33 with an output current of up to 1A) is connected to 5 volts to power the SD card. The strapping is also - two capacitors (well, and by analogy, the LED is through a resistor).
The specific values for the capacitors are selected according to the specification of the stabilizers, the values of the resistors according to the current consumption of the diodes and the supply voltage (or experimentally).
On RAMPS there is a place for soldering diode D1. When it is connected, 12 volts are fed to the Vin pin of the arduins and goes to the stabilizer on the arduino. At first, I soldered it, and everything worked together, but after a few minutes the printer just turned off and without connecting the USB cable it could not be turned on (the stabilizer probably overheated or burned out). Therefore, it was decided to unsolder the diode and connect an external stabilizer.
Card reader
To power the memory card, you need 3.3 volts, the logical levels of the card are also 3.3 volts. In ready-made modules called SDRamps, a stabilizer is used (we have already assembled it) and a level converter chip (5-> 3.3). Since I did not have such a chip, it was therefore decided to use a conventional resistive divider.
The card is connected in SPI mode. Used: 3 lines SCK, CS, MOSI from arduino to the map through dividers; MISO line directly from the map to the arduino; 3.3 volt power is also connected; land; and I also connected a card availability detector. The cardholder was removed from the old smartphone, but you can use the SD-microSD adapter (but it does not have a card availability detector).
Screen
Any character display is suitable, starting from 2 lines of 16 characters. The more rows, the more data can be displayed on it. You can also connect a graphic display SPI LCD 128x64 (Controller ST7565R graphic Display Family). We connect according to the scheme described here . 4 data lines, RS, Enable, 5 volts, ground, and a 10kΩ trimmer for adjusting contrast.
Buttons
Since I did not find an encoder, I decided to get by with a button interface. Any 3 buttons will do. True, you will have to edit the firmware, but more on that later.
Mosfet on a heated table
As I mentioned in a previous article, this mosfet is very hot due to improper operation. I replaced it with an APM2509N taken from a video card. The table’s nutrition paths were also extended. The lacquer coating was neatly cut off with a scalpel and soldered with a thick layer of solder. The previous mosfet was heated so that after 30-50 minutes it was possible to burn a finger about it. And the new one was heated to 38 degrees in 6 hours. And yes, the mosfet is without a radiator.
The table is now heated to 100 ° C in 15-17 minutes (before 30 minutes). And the LED on the table began to shine somehow brighter (or maybe it just seems).
Connect
The output from the 5-volt stabilizer is connected to any 5V pin on RAMPS.
The card reader is connected to the AUX-3 connector (RAMPS pins on the left, SD on the right):
D50 (MISO) pin - DO (MISO);
pin D51 (MOSI) - divider - DI (MOSI);
pin D52 (SCK) - divider - SCK;
pin D53 - divider - CS;
3.3 volts (with stabilizer) - VCC;
GND - GND (VSS);
and in the presence of SD Detect, connect to it the pin D43 of the AUX-4 connector.
The buttons and display are connected to the AUX-4 connector.
Display (RAMPS pins on the left, display on the right (data bus starts with D0)):
pin D16 - RS;
pin D17 - Enable (E);
pin D23 - Data 4 (D4);
pin D25 - Data 5 (D5);
pin D27 - Data 6 (D6);
pin D29 - Data 7 (D7);
5 volts - VDD;
GND - VSS;
A tuning resistor is connected to 5 volts and ground, and the output to the VO pin (contrast);
The pin of the RS display is connected to ground;
If there is a backlight, we connect 5 volts through a 1.8k ohm resistor and ground.
The buttons are connected to the ground and:
pin D31 - Up;
pin D33 - Down;
pin D35 - Click;
By default, these pins are configured in the firmware. To connect to others, you need to fix the pins.h file in the firmware.
To start supporting SD cards, a character display and buttons in the firmware in the configuration.h file, uncomment the line:
#define REPRAP_DISCOUNT_SMART_CONTROLLER
In this case, ULTIPANEL, NEWPANEL, SDSUPPORT and ULTRA_LCD are automatically detected, which are responsible for the operation of the display, buttons and card reader.
The printer name displayed on the screen is specified by the line:
#define CUSTOM_MENDEL_NAME "This Mendel"
The number of characters and lines of the display is set by the LCD_WIDTH and LCD_HEIGHT parameters, respectively:
set the display size
#ifdef ULTIPANEL
// #define NEWPANEL //enable this if you have a click-encoder panel
#define SDSUPPORT
#define ULTRA_LCD
#ifdef DOGLCD // Change number of lines to match the DOG graphic display
#define LCD_WIDTH 20
#define LCD_HEIGHT 5
#else
#define LCD_WIDTH 20 // менять эти
#define LCD_HEIGHT 4 // два параметра
#endif
#else //no panel but just LCD
#ifdef ULTRA_LCD
#ifdef DOGLCD // Change number of lines to match the 128x64 graphics display
#define LCD_WIDTH 20
#define LCD_HEIGHT 5
#else
#define LCD_WIDTH 16
#define LCD_HEIGHT 2
#endif
#endif
#endif
To support buttons instead of encoder in ultralcd.cpp file
we find lines
//manage encoder rotation
uint8_t enc=0;
if(buttons&EN_A)
enc|=(1<<0);
if(buttons&EN_B)
enc|=(1<<1);
if(enc != lastEncoderBits)
{
switch(enc)
{
case encrot0:
if(lastEncoderBits==encrot3)
encoderDiff++;
else if(lastEncoderBits==encrot1)
encoderDiff--;
break;
case encrot1:
if(lastEncoderBits==encrot0)
encoderDiff++;
else if(lastEncoderBits==encrot2)
encoderDiff--;
break;
case encrot2:
if(lastEncoderBits==encrot1)
encoderDiff++;
else if(lastEncoderBits==encrot3)
encoderDiff--;
break;
case encrot3:
if(lastEncoderBits==encrot2)
encoderDiff++;
else if(lastEncoderBits==encrot0)
encoderDiff--;
break;
}
}
lastEncoderBits = enc;
change to
//manage encoder rotation
uint8_t enc=0;
if(buttons&EN_A) {
encoderDiff = 1;
delay(10);
}
if(buttons&EN_B){
encoderDiff = -1;
delay(10);
}
With the correct assembly, after uploading the firmware, you can remove the USB cable into the desk drawer and print from the SD card.
That's all for now. As usual, I look forward to questions and comments.
PS In the near future I plan to put auto-calibration on the table with a servomotor. And assemble the frame of the second printer.