Reference for my 3D printer

This 3D printer was built back in 2015, I am adding this post here because I don’t remember much about it and i would need to rebuild it today for a certain project i have in mind.

My 3D printer, Prusa i3 with RAMPS 1.4 and a heated bed, started off with the config file from the FolgerTech i3-2020, the 0.4mm Brass Extruder Nozzle, 30mm M6 Tube, FILAMENT 1.75 mm

The entry that comes with the config files has a problem with DEFAULT_AXIS_STEPS_PER_UNIT, by default it comes with the values { 80, 80, 4000, 104.4 }, the third one (Z axis) has a problem that my rods are different, and the last one for the ext ruder has double the value assuming we have microsteps, So i reverted to the one in the 1.1.5 that is already installed, namely

define DEFAULT_AXIS_STEPS_PER_UNIT   { 80, 80, 2580, 52.2 }

The Z axis probably needs more refinement though, as the higher the build, the more problems you have close to the top

In this config file, I have the MOTHERBOARD set to BOARD_RAMPS_14_EFB instead of 33, this is all good for the 1.1.5 and the 2.0.x, previously they were numbers, and they probably still are (Value of this)

define BOARD_RAMPS_13_EFB 33 // RAMPS 1.3 / 1.4 (Power outputs: Extruder, Fan, Bed)
 define BOARD_RAMPS_13_EEB 34 // RAMPS 1.3 / 1.4 (Power outputs: Extruder0, Extruder1, Bed)
 define BOARD_RAMPS_13_EFF 35 // RAMPS 1.3 / 1.4 (Power outputs: Extruder, Fan, Fan)
 define BOARD_RAMPS_13_EEF 36 // RAMPS 1.3 / 1.4 (Power outputs: Extruder0, Extruder1, Fan)

Extruder and heat bed

Even though i use a solid state relay for the extruder, the heated bed uses an automotive relay switch, so PWM is a big no no, we will need to comment the line where it reads define PIDTEMPBED, we also MIGHT WANT TO (only if needed) to fix some stuff in config advanced file.

if DISABLED(PIDTEMPBED)
 #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control
   #if ENABLED(BED_LIMIT_SWITCHING)
     #define BED_HYSTERESIS 2 // Only disable heating if T>target+BED_HYSTERESIS and enable heating if T>target-BED_HYSTERESIS
   #endif
 endif

the above means, check every 5 seconds, the rest is self explanatory in the code comments

Next, the end-stops, Z_PROBE_OFFSET_FROM_EXTRUDER for example (Height) is the most important one, as the others will simply print in the wrong location on the bed which besides loosing bed space is not really a problem

Could not find this setting in Marlin 2.0, pending further investigation

Now, the bed size, the whole bed is 20CMs, but there are screws at the edges, so I will go with 19 and add some 0.5 offset

Remember to uncomment “PROBE_MANUALLY” since i don’t have a probe ATM, also uncomment LCD_BED_LEVELING and leave RESTORE_LEVELING_AFTER_G28 uncommented (and leave ENABLE_LEVELING_AFTER_G28 commented the way it is)

LG UL550 vs the ASUS VP28UQGL

Update: the official winner in this is the ASUS, mainly for having built in speakers
Update: After buying the LG for myself and the ASUS for a friend, The ASUS does pivot 90 degrees as well !!! the only real advantage i see in the LG is the IPS display (Color accuracy for graphics designers that you will not be able to detect with the untrained eye)

Because the place where i buy my monitors currently only has 2 4K monitors in the 27″ category, I had to compare them to pick one, for most people the ASUS is the clear winner, unless you are a graphics designer, then it is the LG (IPS has better color), I will probably buy the LG because of it’s Pivot feature (UPDATE-They both have pivot), but most people would want the ASUS, in any case, here are the specs for both side by side

The reason the LG is more expensive is because it has IPS, IPS has only one advantage, color, and only to a degree that affects a graphics designer, in fact, IPS has disadvantages too compared to TN (twisted nematic).

Feature ASUS VP28UQGL lg ul550
PRICE 259 JOD ($249 at amazon) 275 JOD ($326 at amazon)
SIZE 28 (620.93 x 341.28 mm) 27
Response time (True native) TN is usually faster, but not mentioned 5ms
Response time (GTG) 1ms 1ms
Panel Type TN (twisted nematic) / LED IPS (in-plane switching)
Resolution 3840×2160 3840 x 2160
Pixel Pitch (mm) 0.160mm 0.1554 x 0.1554 mm
Refresh Rate 60Hz 60Hz
USB Video no no
USB HUB no no
HDMI 3 (2.0) but can only find 2 in manual, manual is for whole series 2 (No mentioning, but most likely 2.0a or 2.1)
DP 1 = 1 (1.2) 1 (No mentioning of Version)
HEADPHONE 1 1
BRIGHTNESS 300cd/㎡ 300cd (typ) / 240cd (Min)
CONTRAST 1000:1 (MIN/TYP) 700:1 (Min.), 1000:1 (Typ.)
COLOR 10BIT (1073.7M) – 94%sRGB IPS has better color
HDR   10
Power Consumption (Typ.) <31 36 – 41
POSITIONS Tilt : Yes (+20° ~ -5°), Pivot(Not auto) Tilt (3°)/Height (Lower and raise)/Pivot(Not auto)
VESA MOUNTING NO YES
NVIDIA/AMD Radeon FreeSync Radeon FreeSync™
SPEAKERS` YES 2W X 2 NO
Buttons Joystick Joystick
power adapter Internal (Thicker, and less heat management) external, 19v, 2a
dimensions with stand 660.4 x 672.5 x 226.3 mm 622.6 mm x 572.2 mm x 230.0 mm
dimensions without stand 660.4 x 380.8 x 62.2 mm 622.6 mm x 371.0 mm x 45.8 mm
Blue light filter Yes No
OSD Nicer and easier Does the job perfectly, but less nice

The stand is also something i like about the LG, even though it takes more space on the desk, the space is not completely taken by the stand, the half oval shape allows you to put your things on the table within the stand, it also has some height adjustment (just a bit, for the portrait pivot mode mostly so it is not so much a standing desk in any way) that allows me to raise it a bit when i need to for more comfort

Arab Bank Jordan Swift and BIC

After some research, It turned out that the Arab bank of Jordan has a unified SWIFT code (Same as BIC) for all their branches, which is ARABJOAX100, you will need to combine that with your account number which is 13 digits, all other swift codes for the branches are obsolete

بعد البحث، تبين ان كل فروع البنك العربي تستخدم سويفت كود (بيك كود) موحد وهو
ARABJOAX100
، جميع السويفت كودز القديمه للفروع القديمه غير مطلوبه، بالاضافه الى السويفت كود ستحتاج الى رقم حساب وهو رقم من 13 خانه (بالاضافه الى شحطتين تفصلان الارقام)

An account number would have the format

xxxx-xxxxxx-xxx

رقم الحساب يكون على النسق

xxxx-xxxxxx-xxx

Are the ESP32 and ESP8266 5V tolerant (Yes they officially are)

This is a very old question, ever since Espressif removed the 5V tolerant statement from their datasheet no one felt safe connecting 5V directly to the digital input pins, but the news is out now, according to the CEO of Espressif himself, their boards are indeed 5V tolerant ON THE DIGITAL INPUT PINS

What pins are 5V tolerant exactly?

The IO pins in input state (sink) are 5V tolerant, Yet the power supply to the chip must be 3.3V (Most boards come with a regulator for this so it should not be a problem). other models do not come with a regulator, and in such a case, you will need to add the regulator, but even then you do not need a level shifter for the digital inputs. for the ESP32, The ones without an onboard regulator usually go for as little as $2.5 (5 boards for $12) , while the ones that come with a voltage regulator and a serial to USB adapter will set you back around $4.6 (3 for $14)

When pins on the Espressif microcontroller are set as output, they will use 3.3V logic, whether or not the difference in voltage between high and low will register on the other microcontroller/device is an issue related to the other microcontroller, from my experience, Arduino Uno works just fine.

Also note that analogue pins are a different story, the ADC pins use the power provided to the chip as a reference voltage. so a voltage divider is still required.

so in short, if you connect the 5V supply to the VIN pin (going through the onboard regulator), and use 5V logic on the digital pins while they are in input mode (Sink) you should good, and this is not just me, this is an official statement.

You may be wondering why is it not the in datasheet then ? The answer is, it used to be in the datasheet, but the company faced problems with people powering the chip itself with 5V so they omitted it to avoid confusion,

This is excellent news for someone like me who has to go through the hassle of logic level converters whenever coupling Arduino with ESP chips.

Before the CEO of the company made those statements, many people did their own experiments and found those results, but there were still doubts as to whether the results were conclusive or whether there was more to the story, a convincing experiment by ba0sh1.com did demonstrate that it was indeed 5 Volt tolerant on the input pins,

Where did i get this from

Swee-Ann Teo, who after my research seems to be from Espressif made the following statements

  • On whether ESP8266 is 5V tolerant, he had this to say on a facebook post by hackaday

“i can reply officially here: it is 5V tolerant at the IO. while the supply voltage is at 3.3V.”

  • On whether ESP32 and ESP8285 are also 5V tolerant

“ESP32 and ESP8285 are both 5V tolerant as well. but for ESP32, it is a very complicated matter. it supports 1.8V operations too… i don’t know where to start…”

  • When asked why this information is not in the datasheet, he responded

“the reason is too many users took it to mean that the chip is 5 V tolerant. When we say 5 V tolerant, we are only referring to the IOs. So some users mistook this to make that they can power the chip entirely off the 5 V supply. The correct usage is to use 5 V open for these 5 V tolerant pins, and only via only drain configuration.” And then elaborated on the matter with “I understand, but the time needed to do the iterations when mistakes were made, was too long. when the product was launched 5 V WiFi modules (with DCDC) were the norm. Many users saw “5 V” written in the specs and thought it could be a 1-1 replacement for such modules.”

  • One user asked if the tolerance towards 1.8 volts of the ESP32 was relevant to enabling battery operation, the response was no, specifically, Teo responded with

“actually not. but many memory devices are moving towards 1.8V operations, and we would be compatible with them as well.”

The facebook post where this is all written is here.

WiFi for Arduino

Even though this looks like a long post, I have composed it for a friend and unlike mostly everything else on this blog, this is not just for my own reference, so it should be easy to follow and understand (I hope).

What for ?

This is a very valid question, Why would i use a slower Arduino and connect it to WiFi using an ESP8266 you ask, why not just use the ESP8266 or even ESP32 as both the WIFI and the microcontroller to run our code?
There are many situations where you would want to, the most common of which is the analogue and digital pins on an Arduino board, the friend I am writing this tutorial for is looking to use the 50 digital pins on an Arduino Mega Pro Embed as select lines for 50 Arduino pro mini boards, another might be the analogue pins on an Arduino (8 or 16 depending on the board), so digital and ADC pins on an Arduino might be needed.

You might ask why not an ESP32, it has a bunch of digital and analogue pins, the answer is that sometimes they are not enough, especially when you find out that the analogue pins on the ESP32 are divided into 2 groups, one of them is not usable if you enable WiFi.

Another valid reason is all the shields that have Arduino libraries but those libraries do not function with ESP, which is probably even more common of a problem than the pins problem.

So in short, even though the need might not arise very often, it does exist.

The ESP8266 as an Arduino WIFI shield

Arduino does not come with WiFi, there are shields from Arduino that provide WiFi, and those shields are based on ESP8266 which is a very cheap WiFi enabled microcontroller. but there is nothing stopping you from using any ESP8266 board and connecting it to your Arduino,

Which one: They should all work, and you probably already have one since you are here, I am personally using the slightly more expensive $4.6 boards that come with a USB-TTL chip and power regulator built in, if you want to use the cheaper boards (esp8266-01), you might want to connect it to the 3.3V output of your Arduino, but you will still need a level shifter, I would expect you also have a UART USB to serial board.

Price: models from the 01 ($2.5 each when you get 5 boards for $12 ) up to the 12E or 12F ($4.6 each when you buy them as 3 for $14). not bad for a WiFi enabled microcontroller !

Communication between Arduino and ESP8266

Arduino can talk to the shield either via UART or via SPI (Given the libraries written for this), SPI is up to three times faster than UART, but most of the time your application, be it sensor data or the like, will not be able to flood any of those 2 buses, In this post, I will cover both, SPI first then serial.

The components (hardware)

1- ESP8266 (Any variant should do)
2- Logic level shifter, since Arduino is 5V and ESPs are 3.3, I have been told that the ESP 12E and 12F are 5 volt logic tolerant, but I would think going with a logic shifter might save me something down the road, hours of debugging, or a new board, or something i fail to foresee
3- An Arduino, I am using a mega, but an UNO should do just fine (I will cover it)
4- Wires to connect all the above, and probably a breadboard (I like to solder things to a universal PCB board, but not everyone likes to do this)
5- A power supply, in my case a couple of micro USB cables and a 5V source that is my a power supply.

Software on the ESP8266

1:SPI: If you are going with SPI, you will need to flash JiriBilek / WiFiSpiESP onto your ESP8266, fortunately, this comes with an ino file that you can use your Arduino software to flash directly

2:UART-Serial: If you are going with serial, you might want to go with jeelabs / esp-link, mind you, Arduino themselves forked this before for their own WiFi shields, but since then, the jeelabs esp-link has added many features, so i would recommend you go with the original jeelabs.

Software on Arduino

1:SPI: if you have installed the SPI software from above on your ESP8266, the accompanying Arduino software would be JiriBilek / WiFiSpi, The library implements almost the same functions as the Arduino WiFi library.

2:UART-Serial: there is no library to go with this case that is beyond your regular serial bus if you want to exchange serial info, so if this is a 3D printer, software on your PC should be able to translate the data into serial, and it would be transparent, but what if you want to use WiFi from within Arduino, like a client that downloads pages or sends post data to pages,

Choice of UART-Serial vs SPI

UART-SERIAL, has certain advantages and disadvantages, with serial, i can simply update the software on the Arduino over the air over WiFi, I can get serial messages and use WiFi at the same time both as client and server, SPI on the other hand is faster, but it is not out of the box compatible with serial messages. Another disadvantage of SPI is that it needs a bit of extra code to allow the board to boot

Implementing WIFI over SPI

SPI – The hardware, how to connect

The H.SPI (On the ESP8266) is connected to the SPI on the Arduino like you would connect any SPI bus, with the addition of a logic level shifter (Red part in the photo), We connect Clock to clock, Slave select to select line, MOSI to MOSI and MISO to MISO, there is nothing to it. I have added a table for the Uno (Same for Arduino Pro Mini) and the Mega for your convenience

 NAME | ESP8266 | MEGA | Uno      | Logic Analyzer |
 SS   | D8      | D53  | D10      | CH0      | SS
 MOSI | D7      | D51  | D11      | CH1      | MOSI
 MISO | D6      | D50  | D12      | CH2      | MISO
 SCK  | D5      | D52  | D13      | CH3      | SCK

Now assuming you are done with the connection above, it is time to load some software.

SPI: Installing the WiFiSpiESP on the ESP8266

First, we need to load the software to ESP8266, the JiriBilek / WiFiSpiESP comes with a .ino file, so all you need to do is load that into Arduino studio, connect your esp8266, compile and upload, now this part is done, no modifications are needed to this code since all the control is passed on to the Arduino, compile and upload.

If you are having trouble uploading the code or selecting the board, my 12E board works in Arduino studio as NODEMCU V1.0, if you don’t have any ESP8266 boards in your boards list, you will need to add it, there are many tutorials on using Arduino with esp8266.

SPI: software on the Arduino

On the Arduino side, you will have to include the library (WiFiESP), then include it in your code, the library should be readily available in your libraries menu of your Arduino Studio.

NOTE: Both the library and the software you installed on your ESP need to have the same release number (0.2.5 at the time of writing) or it would not work, the software is hard coded not to work if they don’t match, you will be presented with the error (Protocol version mismatch. Please upgrade the firmware) in your serial console during runtime, I know this because a couple of weeks ago, I contacted the author (Jiri) through GitHub, and he brought both versions of the software and the library current so that they would match, it was a small thing but if you ever get this error in the future, you know where to go, he was quick to fix it within hours.

Now to the Arduino code, inside the library, there are examples, all you need to do is upload one of those examples, most likely, you would want to start off with the WiFiWebClient, this example that comes with the library needs to be modified in two locations, the first is the credentials to your WiFi, and the other is to change the server you are connecting to from www.example.com to wherever that web server is. this should get you started on most projects.

In my case, I have had to modify a few things in the script to make it work, first of all, a short delay needs to be inserted before we check if the WiFi is connected, the other is to not have it die but rather try again if it is not for a set number of times

WiFi using UART-Serial

UART-SERIAL should be the as easy, I should be back here

The ESP8266 has a TX and RX pin that should be connected in reverse to the ones on the Arduino, RX (Receive) should be connected to send, and send to receive, both boards need to share a common ground (reference voltage), and an Arduino mega should be able to provide 3.3 volts with sufficient current for the ESP8266 if you plan to power the ESP from the MEGA, if you have an ESP8266 with an onboard voltage regulator, you can simply add it to the power supply directly through the VIN pin (rather than the 3.3V pin)

Uploading jeelabs esp-link to the ESP8266

Start by downloading the zip file from GitHub,

Phone charging speed sometimes slow

1- Low quality or damaged wire

The most common reason for this is your cable, a charging cable that has higher resistance (worse thinner or damaged wire) will tell the phone to charge slower, reason for that is that your phone does not want to overwhelm a cable beyond it’s capacity and cause it to burn or even cause fires, but how does the phone know, well, ohm’s law will let it know, a voltage drop at the wire end once a load is attached (the charging is a load) tells it all it needs to know. then the phone can determine a safe current to draw.

2- Phone is already nearing a full charge

Because of how lithium batteries work, a phone can not charge the upper 10% (Or more) at full speed, speed is reduced as the phone gets full to protect the battery from degradation

3- Battery is overheating

Your phone will charge a hot battery slower, so if your phone is sitting in sunlight or is hot in general, it will charge at reduced speeds, this as well is to protect the battery from degradation or even becoming a hazard.

4- Your power brick capabilities

Power bricks are voltage and current regulated power supplies, but they lose capacity over time and degrade, sometimes, their connection with the cable is not clean, or the plating on the pins has worn out, or the spring like mechanism of the pins no longer holds the pin tight against the pins on the USB cable, sometimes it has low capacity to begin with by design

5- Your phone has a Quick Charge capability but your wall adapter does not

Many modern phones, especially on the higher ends have a fast charging feature, where the power brick provides a higher voltage rather than a higher current, your phone will first negotiate this capability with the charger, if your charger does not support this feature, rest assured, it won’t work, and the phone will fall back to 5V charging.

If you have any questions about this matter, feel free to ask me in the comments section

Related

Prolonging the life of your phone or laptop or tablet battery

Is Arduino pro mini 3.3V 5V logic tolerant ?

No and yes, at your own risk.

You can run the whole board on 5V (AT YOUR OWN RISK), but that has to be done at the VCC pin (With an external regulated power supply) not the RAW pin, it will still run on an 8Mhz clock (The resonator is 8MHZ, you can’t change that without changing the resonator), and you will lose the voltage regulator (Since it is 3.3v) and use an external one.

Why can’t i, i hear you cry, the answer is simple, the CPU’s reference voltage is 0-3.3V when running on the built in regulator or 3.3V, if you step the voltage up on VCC to 5V regulated, and disconnect RAW altogether, and don’t care about the lower speed, then there you have it, it should work.

If any of my 3.3V Arduino boards gets fried this way, I will let you know, but for now this works for me.

Everything about the Arduino Mega 2560 Pro Embed

In this post, I am simply making a reference of the Arduino mega 2560 Pro Embed so that i can find the info easily when i need it again

The Arduino pro mega embed is basically the same MCU (CPU) as the Arduino Mega, but instead of using it for shields, it is better suited for a printed circuit board.

Where to get it

The board is all over the place, Amazon, Ebay, and other providers, I found one on amazon for $11.71 and people seem to be happy with the seller,
$11.71 – Mega Pro Embed on Amazon
mind you, buying it through this link will earn me 2% of the sale.

Size and installation

The Arduino Mega Pro Embed is a third (1/3) of the size of the MEGA at 38X55mm, the length of the Mega pro embed is the same as the width of the MEGA, and the width of the mega pro is a third of the length of the MEGA

There are 2 mounting holes on the board, making it east to mount with a couple of standoffs if needed, the same standoffs you would use to mount a PC motherboard into a case.

Chips (Logic)

The MCU is the same (ATmega2560) with almost all of it’s pins broken out, it has a TTL USB adapter CH340G (Drivers here).

PINS

The board has 86 pins (Regular Mega has 96, the additional ones are either duplicated or not functional), the Mega Pro Embed has the following 86 pins

2 VIN
2 GND
2 5V
2 3.3V
1 AREF
1 Reset
54 Digital (14 of which are PWM capable)
16 ADC
4 UART bus
6 ICSP Pins are directly connected to digital pins D48 – D53 (Duplicates)

Power

It accepts power in the range of 7-9 (18V peak for a very short time) 7 is recommended, it has two voltage regulators, 5V and 3.3V (800ma each)

Frequency

The board has 2 resonators, 12Mhz and 16Mhz, the 12 is for the CH340G while the 16 is for the ATmega2560

Specs

Microcontroller ATmega2560
USB-TTL converter CH340
Power Out 5V-800mA
Power IN. 5V
Power IN. VIN/DC Jack 5V
Power Consumption 5V 220mA
Logic Level 5V
USB Micro USB
Clock Frequency 16MHz
Operating Supply Voltage 5V
Digital I/O 54
Analog I/O 16
Memory Size 256kb
Data RAM Type/Size 8Kb
Data ROM Type/Size 4Kb
Interface Type ISP
Operating temperature −40С°/+85С°
Length x Width 38×54mm

SPI

The board’s logic is 5V
MOSI – D51 or ICSP-4
MISO – D50 or ICSP-1
SCK (Serial Clock)- D52 or ICSP-3
SS (Slave) D53 – set as output as the library does not support slave.

I2C

20 (SDA), 21 (SCL) MEGA 2560 board has pull-up resistors on pins 20 – 21 onboard.