Posted on Leave a comment

French fries a la Doosan

French fries a la Doosan

 

DHR Engineering was created as a company for developing new tools and solutions, and the spirit of innovation still thrives in our team. It sounds entirely realistic for us to dedicate a whole weekend, outside of working hours, to have fun with something related to the company’s daily tasks. On that account, we decided to organise a homemade hackathon and make some french fries with the help of the DOOSAN six-axis robot.

Introduction

Project Goals

  • Program a six-axis robot to fry potatoes in a standard deep fryer and serve them.
  • Record a video of the robot in action.

Why We Did It

  • To demonstrate the capabilities of DOOSAN and its applications in various fields.
  • For fun! The opportunity to solve a new, interesting problem with a 24-hour dealine tested the team’s creativity and the capabilities of the machines we have at our disposal.

Action Plan

  • Brainstorm and outline the different actions the robot will need to perform for successful cooking (e.g., opening the refrigerator, transporting the fries, frying, etc.).
  • Purchase and modify various materials and tools to be used (e.g. a box for transporting raw fries, a deep fryer, etc.); for each item, design interface parts to facilitate the connection between the robot’s gripper and the respective object.
  • Set up the “kitchen” – positioning of the robot, deep fryer, refrigerator; prepare for video recording.
  • Program the robot – determine the sequence of movements, find the right settings and speeds.
  • Test, debug, and record the video.

Ready! Set! Go!

With great enthusiasm, we began discussing exactly what we wanted to achieve and how to do it. Some steps were suitable for the robot, while others were left for ourselves to save time. Here is the final result of our brainstorming:

Preparation (human tasks)

  1. Arrange and anchor all objects included in the process (the robot, the fryers, various containers).
  2. Pour the oil in the fryers and heat it up.
  3. Prepare the boxes with raw french fries in the refrigerator.
  4. Place a bowl for the finished products.

Frying the French fries (robot movements)

  1. Open the refrigerator.
  2. Grab the first box with raw fries.
  3. Close the door.
  4. Remove the lid from the box.
  5. Drop the fries into the deep fryer net.
  6. Leave the box aside.
  7. Grab the fryer net and immerse it in the hot oil.
  8. After a certain time, repeat steps 1-7 for the next box of raw fries.
  9. After a certain time, grab the fryer nets with the cooked fries and empty it into the bowl.
  10. Take the salt shaker and season the potatoes.
  11. Serve the potatoes in a special basket.

From the list, it is evident that a special interface was needed for each of the following items: box, lid, deep fryer, salt, serving basket, refrigerator. We started designing and printing the parts.

Design and Fabrication of 3D Parts

Interface

In order to perform all the necessary operations for frying the potatoes, we first needed to determine how the robot would manipulate each item in the process. To ensure repeatability and a secure grip, we decided to use a dovetail clamp assembly wherever possible – it allowed for fixed positioning in two planes and provided a secure grip during the robot’s movements. To each item that the robot needed to grasp, we attached (bolted or glued) a 3D-printed complementary dovetail component – this way, the robot was able to grasp most of the items with the same interface.

Jaw Design

As we mentioned in the first article from our 3D printing series, the jaws of the gripper can combine multiple operations in one. In our case, we used the front of the jaws to grasp the dovetail clamps, while the middle cylindrical part was designed for the salt. By chance, the refrigerator door had a very convenient geometry and a simple bolt, sticking out of the jaws, was enough for the robot to open the fridge. Not the prettiest solution in the world, but hey, we needed it to work ASAP!

Since the gripper had only two positions for the jaws – open and closed – we needed to model a slight overlap when the jaws were fully closed to ensure that the robot wouldn’t drop the item it carried.

Manufacturing of 3D Printed Parts

We had limited time and several printers at our disposal. To accelerate the process, each part was printed separately, as soon as its design was complete. This, of course, led to a few unsuccessful designs that needed to be adjusted and reprinted – an iterative process that is common in the engineering field. The most complex parts were ready in less than 90 minutes.

Kitchen setup and programming the robot

Once we started the 3D printers, we went on to set up the “kitchen”- half of our workshop was rearranged, we moved the robot and brought a few tables. Various parameters were taken into account, such as the robot’s reach, order of movements and framing and light for the video.

The programming of the robot was a tricky task as well. Like most six-axis robots, the Doosan has two movement modes – “linear” and “joint”. The linear movement allows for better control over the trajectory and was used for accurate positioning and gripping the objects we manipulated. The joint movement, on the other hand, is designed for shortest and fastest operation between two predefined locations. That mode was used for transition between the different steps in the process. We started with a few steps, outlining the workflow and added or adjusted the list with each test iteration. Speed of movements (directly related to inertia of the carried objects) was also something we had to figure out by trial and error.

Testing, debugging and video

The most intensive part of the whole adventure was when we started testing the kitchen setup. As expected, various problems popped up – some of the printed parts didn’t fit the containers, some weren’t strong enough and we had to enhance and reprint them.

The most important lesson we learned though, was that it is crucial to fix everything very well to the ground. There were several occasions where somebody would accidently displace a table by a few centimetres and all the robot positions would run off. That was a hard lesson to learn but a valuable one.

Finally, after a long and intensive day, we were ready for the real test: recording a one-shot video of the robot, going through all the steps and delivering freshly made French fries … After three long minutes it was done and we sat down to enjoy some delicious, effortlessly-made French fries!

Conclusion

To sum it all up, it was a great weekend! Three ingredients were necessary for it to happen: a dedicated team, the powerful Doosan robot and the incredible 3D printing technology!

As always, we will be more than happy to help you with anything related to automation, robots or 3D printing (or cooking)! Let us know in the comments!

Posted on Leave a comment

Case study 3: Strengthen the Z-axis in 3D printed parts

Case study 3: Strengthen the Z-axis in 3D printed parts

Figure 1 – the same 3D printed detail without (left) and with (right) enhancement

Technology of 3D printing

“3D printing” is the general term for several technologies that use a layer-by-layer deposition of material to produce a complete part. At DHR Engineering, we utilize the method of Fused Deposition Modeling (FDM), which relies on the deposition of molten plastic filament in layers to build the desired part from them (read more about it in our first article). Once a layer is complete, the printer moves vertically to the next layer, where it prints the corresponding geometry. To achieve a successful print, it is important to find the right settings for the filament heating temperature and the vertical distance between the layers. Ideally, the current layer will heart up the printed one and the distance between the two will be small enough, so that the new filament will adhere tightly without compromising the existing geometry.

 

Figure 2 – FDM working principles. Source: https://www.makerverse.ai/

 

Anisotropy and what to do about it

Despite numerous attempts and improvements in the technology, 3D-printed parts are anisotropic. The strength and tensile properties in the vertical Z direction are typically 4-5 times lower than in the other two planes (source). Similarly, parallel to the printed layers (in the X and Y directions), the part may have significantly lower resistance to shear loading. Due to these characteristics of 3D printing, additional methods are sought to enhance the mechanical properties of functional parts. Here are some of the most popular solutions:

  • Changing the geometry – The best way to avoid layer separation of the part is to eliminate the forces acting there; this solution is applicable primarily in the initial planning phase, where there is sufficient design freedom.
  • Changing the printing orientation – For simpler parts, rotating around the X or Y axes may solve the problem by moving the part’s weak point instead of the forces acting on it. However, this method does not work for parts with multiple perpendicular loadings.
  • Thicker parts – If the applied forces are relatively small, thickening certain elements of the part can improve its strength enough to withstand loading even at its weakest point.
  • Metal inserts – Using metal inserts in 3D printed parts is indeed worth a discussion in its own right. In this article we will focus on the use of standard bolts. Incorporated in the printed part, they bear the load instead of the plastic, significantly improving the part’s mechanical properties. Despite the  drawbacks of this approach, which include more complex design and printing, as well as the need for additional processing and assembly, the added work is totally worth it.

 

Figure 3 – using metal inserts to strengthen the 3D printed parts in the vertical axis

 

Benefits of using metal inserts

Including metal components in the design of 3D printed parts helps in several ways:

  • The forces created by tightened bolts compress the layers of the part, increasing the friction between them and thus increasing the maximum shear load.
  • The bolts distribute the load over a larger area/more layers, effectively reducing the forces acting on each individual layer.
  • The bolts themselves bear a significant portion of the loads acting on the part. For example, in shear loading perpendicular to the Z-axis, a reinforced part can withstand much higher loads compared to a purely plastic part because the force would need to break the bolt itself.

Figure 3 depicts a 3D printed bearing housing used at DHR Engineering workshop. The part is supported on one side only (cantilever), and the combined static and dynamic load is approximately 1200 N. The cylindrical portion of the part, where the metal shaft resides, is printed parallel to the Z-axis of the 3D printer.

During operation, various forces, acting in different planes, are generated. Perpendicular to the printing axis, the part exhibits excellent mechanical properties under tensile lading because the forces act within the plane of the plastic filaments. However, parallel to the Z-axis, tensile forces attempt to separate the layers, which is the weakest point of any 3D printed part.

To prevent layer separation under the current loading conditions, we decided to add two M4 bolts along the Z-axis and increase the load-bearing capacity. After successfully testing the part at its nominal load, we gradually increased the load. During one of the strength tests, to our surprise, the part failed through the layers (Figure 1, Figure 4). This demonstrates that the bolts have increased the part’s resistance beyond that of the plastic and have transformed the weakest plane into the most reliable one.

 

Figure 4 – the enhanced part broke through the layers where typically is the weakest point

See you soon!

In this article, we have once again shown that 3D printing offers much more than it may seem on the surface. The demand for complex, yet reliable parts will only increase but at DHR Engineering we are always up for a challenge!

We would be glad to help you as well!

 

Posted on Leave a comment

Case study 2: Pneumatic tool for cleaning the CNC table

Case study 2: Pneumatic tool for cleaning the CNC table

 

Figure 1 – pneumatic tool demonstration

 

Perhaps the biggest advantage of six-axis robots is their versatility. Being programmable, they can be set up for countless operations, using a variety of different end-effectors. There are companies specialised in developing end-effectors for gripping, inspecting, scanning, welding or glueing. However, because of availability or cost reasons, sometimes it is more convenient for the users to create their own tools to perform a specific task. An example for such a case is a simple 3D printed nozzle for cleaning the CNC mill table that DHR Engineering developed.

 

Figure 2 – 3D printed nozzle mounted on the Schunk gripper

 

Why are metal chips such a problem?

During every milling operation, metal waste accumulates in the form of chips of various sizes. Given the tight tolerances that modern machines work with, it is crucial that all surfaces in the mill are well cleaned. The presence of chips can lead to displacement or distortion of the workpiece, resulting in unacceptable inaccuracies in the final product. The accumulation of a large volume of chips interferes with the normal operation of the machine, making movements difficult and hindering automation. It is common practice for the operator to monitor the cleaning of the tools and work surface. This task can be automated with a six-axis robot and a 3D printed nozzle, allowing for a continuous process from loading the blank to the finished part.

 

Design specifics

In designing the tool, we tried not to make it more complicated than necessary (you can see the 3D model in Figure 3). We planned to use the robot’s controllable pneumatic lines and only needed to send the air in the right direction. The nozzle we created is a plastic cube with suitable mounting and pneumatic holes. The main specifications we considered are listed below.

  • The nozzle had to fit the gripper geometry and the existing mounting holes. We 3D printed the threaded mounting hole, and the overhanging detail is designed to rest on the wall of the gripper for easier positioning.
  • The part required an interface for connecting to the pneumatic system of the robot. With this particular robot, the pressure is 6 bars, and the connection to the gripper is made through a standard 1/8-inch connector. This thread is also 3D printed.
  • The nozzle exit hole required an optimal size and position to provide a strong stream towards the milling table. In Figure 2, it can be seen that the nozzle is directed perpendicular to the jaws, allowing the gripper to be positioned very close to the milling table during cleaning.
  • The detail had to be sturdy and easy to print; a simple design, small size, and light load – the ideal moment to use the services of 3DHR, which would cost you only 2 BGN.

 

 

The entire process of creating the nozzle takes a total of 3 hours. This includes conceptual and technical design, creating the 3D model, printing, installation, and programming the robot. We can reuse the finished 3D model again if we need to change the dimensions, create a second nozzle for another robot, or replace a damaged or worn part.

 

Conclusion

Whether it’s small details like our #Doosan robot nozzle or large, complex prints, 3D printing will certainly be part of the future for many industries. If you’ve never worked with plastic parts, now is the perfect time to start and stay ahead of the competition!

On our website, you can upload a 3D model and automatically get a price and time estimate for printing your parts!

We would be happy to answer any questions – please contact us!

Posted on Leave a comment

Case study 1: Plastic jaws for a pneumatic gripper

Case study 1: Plastic jaws for a pneumatic gripper

 

Automated CNC machines have long been the standard equipment in the metal working industry but connecting all the different operations in a fully automated flow still requires human intervention. Companies like DoosanRobotics have developed six-axis robots that, with the help of various end-tools (grippers, suction cups, etc), can complete many complex tasks, reducing the need for human labour in repetitive tasks. However, can these robots cope with the most common operation – loading and unloading parts from the CNC mill?

What are the barriers ahead of a fully automated workshop?

For most parts the manufacturing process is divided into two steps – processing the upper and side surfaces (1) and processing the bottom surface (2). For a robot to be able to bridge the gap between the two operations, the robot needs to be equipped with a suitable tool which can handle the blank and the processed component precisely and securely (one such tool is the Schunk gripper). Usually two sets of gripper jaws are used – standard parallel jaws to hold the blank and custom made jaws that fit onto the partly processed part (for example, a cylindrical detail on one side of the part created with the first operation in the mill). 

The custom jaws are often made of aluminum blocks with the exact shape that needs to fit in cut inside. The preparation of those jaws requires investment of time and money on its own. Once manufactured, the aluminum jaws allow almost no changes to the design of the part they hold, and if changes are made, the jaw set is no longer usable. Also, in some cases, the process cannot be automated because the standard and custom jaws need to be manually swapped between operations. The modern solution to all of these problems is 3D-printing.

Figure 1 – forces acting on the jaws during use

 

Quick, easy, cheap

In the first article of the series we described the requirements that a metal part should fulfil in order to be replaced with a 3D printed one. In the case of the gripper jaws, all of the conditions are met:

  • Gripping and moving small to medium sized parts exerts forces less than 1500 N and the plastic jaws will have no problem withstanding those. That includes cyclic loading as well – the set of jaws we currently have at the workshop have been used for more than 20 000 cycles.
  • The ambient temperature in the workshop is about 25 degrees Celsius.
  • We need just a few sets of jaws so no large batches are produced.

But why would we want plastic parts after all? Here are some good reasons: 

  • 3D printing allows for very complex designs without manufacturing overhead. This gives us the capacity to create jaws with multiple interfaces that will be able to grip the processed part in all stages of its production. As can be seen on Figure 2, interfaces can be located on both sides of the jaws (flat interface on one side, curved interface on the other side), maximising the number of shapes that can be manipulated with the set.
  • The manufacturing time for a set of jaws with dimensions of 100 х 40 х 15 mm is only 2 hours, with zero additional processing required. According to the calculator on our website, the price is 35 BGN as of March 2023.
  • In case the design of the processed part is altered in any way, the plastic jaws can be easily modified in the 3D model and reprinted in just a few hours. Similarly, a new set can be created if the jaws are damaged or worn out
  • The plastics are way softer than metal and the printed jaws can never scratch or damage the processed part. The part appearance is the first sign of a good (or bad) quality work

Figure 2 – interfaces on both sides of the jaws – flat (inside) and curved (outside)

 

The secrets of good design

Making a good tool requires careful design in various areas – manufacturing, use, reliability, maintenance. Here is what we took into account during the creation of the plastic jaws:

  • To reduce manufacturing time, warehouse management complexity and downtime lost in replacing jaws between different operations and parts, we wanted to include as many interfaces as possible in the jaw set. On Figures 2 and 3 you can see the three interfaces we managed to combine – cylindrical grip for the shape after the first operation; flat surface on the inside for the blank; a second flat gripper with different size available if the outside interface is used. The combined jaw set lets us automate the whole manufacturing process for the part on Figure 3 – loading the blank, swapping orientation after the first operation and unloading the finished product after the second operation.

Figure 3 – the same jaw set can be used for multiple operations

 

  • A very important design consideration is the calculation of cyclic and peak forces that act on the jaws. Both the geometric design and 3D printer parameters are based on that calculation. On Figure 1 you can see the main forces acting on the jaws – vertical forces that appear during lifting (red) and horizontal forces due to gripping the part (blue). Taking into account the force calculations and following the best design practices, we developed the appropriate geometry. Regarding the print itself, we used 80 % infill density and the reliable PETG plastic. Also, the filament layers are parallel to the horizontal forces, where the most strength is required.
  • Doosan collaborative robots can achieve repeatability of 0.1 mm. We needed a secure and precise way to mount the custom printed jaws to the robot in order to maximise its capabilities. As the 3D printing technology still cannot support such small tolerances, we used a well known trick to get the job done – metal inserts (Figure 4). A dedicated slot was left at the back of each jaw for tight tolerance (h7) inserts – they guarantee that the relative position between the robot and the jaws is always the same.

Figure 4 – precise jaws mounting thanks to the locating inserts

 

Conclusion

The 3D printed gripper jaws are definitely a success – we have been using them for months in our workshop with zero problems.

Next week’s topic is related to a seemingly insignificant activity – cleaning the mill table. Even though many operators overlook that part of the job, the presence of metal chips restricts automation and may cause misalignments and scraped parts. We have a simple yet effective solution to offer. 

See you next week!

Posted on Leave a comment

Introduction to 3D printing

Introduction to 3D printing

 

The rise of 3D printing

3D printing is a method of creating three-dimensional objects, typically made of plastic, by adding multiple layers on top of each other. The object’s design is created on a 3D modelling software and then printed using specialised machines called 3D printers. These printers melt and deposit plastic filament layer by layer, building the part from the bottom up.

While the technology was first used in the 1980s, it became more popular and accessible to hobbyists around 2005. Since then, there have been numerous 3D printer suppliers, new materials with various properties, open source management software solutions, and a large community of people supporting and developing the technology.

Initially, 3D printers were mainly used for artistic projects such as figurines or souvenirs. However, buyers soon realised the potential for more practical parts that could replace damaged components or expand the possibilities of finished products. A vivid example of this is the numerous improvements that buyers make to their 3D printers, such as dust covers, holders, and electronic boxes.

 

Advantages

There are three main reasons why 3D printing is currently unbeatable in the production of small batch plastic parts: freedom of design, production speed, and low cost.

Unlimited design

Unlike conventional machining technologies that rely on material removal, 3D printing is an additive process. Here are some of its advantages:

  • During the printing process, the machine has access to every point of the model – it is possible to create a hollow, fully enclosed spherical part with specific shapes on the inside;
  • Some printers can include two or more different materials in the same part – that can be used for multicoloured designs or if special mechanical properties are required;
  • The geometrical complexity does not affect the print – all the necessary information is in the 3D model; since the printer builds the part layer by layer, every complex shape is just a combination of simpler 2D polygons;
  • Various printing parameters can be modified within the printer management software. Changing the part density or layer thickness, for example, can make the final product dense and strong or almost hollow and hence lighter and cheaper.

Saves time and money

Once a 3D model is complete, the only operation left is the printing itself. The lack of additional steps saves lots of time and effort, especially when an unexpected design alteration is required and the part has to be remade. The printing usually takes only a couple of hours (depending on its size) and no operator or subsequent processing are needed. The process is relatively inexpensive (low cost of materials and tools compared to traditional machining) and easily automated. For example, on our website you can upload an .STL model and immediately see the price and delivery time. This significantly reduces the overall ordering time as well as the possibility for human error.

 

Applications of 3D printing

With the development of new plastic materials and advanced printers, 3D printed parts are becoming a reliable alternative to some metal parts used in various industries. The technology is not an one-size-fits-all solution but great results can be accomplished if the following conditions are met:

  • The parts are subjected to light to moderate loads; even though there are multiple engineering grade plastics (PETG, ABS, Nylon) their strength can’t compare with the strength of metals;
  • The parts are loaded in no more than two perpendicular directions and the printing orientation is chosen appropriately – because of the way 3D printed parts are made they are weaker in the vertical direction (where layers are added on top of each other); loading and printing orientation are important factors during the design process;
  • The parts are not subjected to high temperatures – most plastics lose their mechanical properties at about 70 degrees Celsius;
  • The number of printed parts is relatively small; with orders larger than 10 000 units, other technologies, such as injection moulding, become more cost-effective.

 

Conclusion

The 3D printing technology is not a replacement for the standard CNC machines, but rather a complementary tool that can bring significant reductions in both manufacturing time and cost for specific parts. There are many opportunities for optimization in the CNC machining workshop, as many of the parts and tools there meet the criteria mentioned above.

In the upcoming articles we will present some curious use cases of 3D printed parts within the machine building industry. Stay tuned!

What is your experience with 3D printing! Or maybe you have a question? Tell us in the comment section!

Posted on Leave a comment

3D printer automation with OctoPrint

3D Printer Automation with Raspberry Pi

Following our previous post, we continue our 3D printer upgrades series with the most popular remote control modification – OctoPrint!

OctoPrint GUI on standby

What is OctoPrint and why do you need it?

OctoPrint is a free and open source software, that allows users to monitor and control printers through a web based GUI. Although you could install it under Windows , it usually runs on a Raspberry Pi computer with the Octopi operating system. Given that the core software includes plenty of useful tools and the OctoPrint community has developed a number of cool plugins, we are sure this upgrade will greatly improve your 3D printing experience.

OctoPrint grants you:

  • remote access – With core OctoPrint you can, for example, set temperatures, upload G-code and start/stop each connected printer in your local network. Imagine being able to start a print job with a few mouse clicks from the comfort of your desk (or bed, for that matter).
  • monitoring – If you choose to invest in a camera for your OctoPrint, you will be able to watch your 3D printer in real time. This is quite useful if you are in a different room and want to make sure the printer is working fine. Nobody likes a ruined print but having your shop on fire because you left the printer unattended is a far bigger problem. Along with the added safety, the camera lets you make time lapse videos of all your prints – great for showing your friends (or customers!).
  • additional functionality – There are some OctoPrint plugins that allow you to control the GPIO (general-purpose input / output) pins of the Raspberry Pi. This means you could extend the reach of the software beyond the printer itself,  adding sensors or controlling lights / fans, turn on/off the main power, etc.
  • plugins – Being open source, OctoPrint has a great number of free plugins. Some of them modify existing OctoPrint features (TheSpaghettiDetective plugin lets you control your printer from anywhere through your smartphone) and some add new functionality (PrintJobHistory lets you keep detailed information and an image of past print jobs). No matter what you want to achieve, chances are somebody has already made it for you!
* Before you read on, make sure your 3D printer is supported by OctoPrint. Most of the printers are, but this is the list if you need to check.
 

Installation and setup guide

Step 1: Buy hardware

There are only a few pieces of hardware that you need to get OctoPrint up and running:

  • Raspberry Pi – The official OctoPrint website recommends Raspberry Pi 3B, 3B+ or 4. If you have a Raspberry 2 around, you can follow this guide. On the other hand, if you are buying a new one, the brand new, (up to) 8 GB RAM Raspberry Pi 4 might be an overkill for the task at hand. We are using the 3B version and (except for some long time lapses) everything works fine, including the live stream and the plugins we have installed.
  • Raspberry Pi camera – The Raspberry Pi camera is not a requirement but it greatly improves the remote control experience. One that will work out of the box is the official camera from the Raspberry Store but you can use a USB camera as well. If you get the Raspberry Pi camera module, make sure the connection strip is long enough for your project. The default length is about 20 cm so we had to order a longer replacement in order to connect the camera on the print bed to the Raspberry outside the box.
  • SD card – Raspberry Pi itself does not have a memory storage (like the hard disk your PC has). It uses a micro SD card to store both the OS and all other files you use. We recommend using a 16 or 32 GB card. You can read more here.
  • USB cable – You need a USB cable to connect the Raspberry Pi to your printer. For Ender 3 that is USB A (male) to USB B mini (male). Check if your printer comes with a cable and if not have a look at the USB port on the printer to determine what size exactly you need.
USB A to USB B mini
  • Power supply – Raspberry Pi can be powered from a PC / laptop USB port, but if you want it to work independently, you need a power adapter. You can get one from the official website or check the details on their webpage and buy one at your local store (look for the USB micro option). We use a 5 V / 3 A power supply.
Power supply with USB micro plug

Step 2: Download software and burn the SD card

Once you have the computer itself you will need to install the OS – in our case Octopi. To do that, download the Octopi OS image as well as Etcher – a tool to burn the OS on the SD card. Open the download location of the Octopi and extract the archive. You should see a file with an “.img” extension. Insert the SD card in your PC and open Etcher. Select ‘Flash from file’ and the .img file you have just extracted. Then choose the appropriate drive where the SD card is and click Flash!

Etcher ready to flash the SD card with Octopi OS

Step 3: Prepare the Octopi OS

After Etcher is done, a pop-up window might appear, prompting you to format your SD card. You must not do that but instead click cancel and open the SD card folder instead (if you click Format disk the card will be swept clean and you will have to start over). 

Do NOT format your SD card

Once in the ‘boot’ folder, locate the ‘octopi-wpa-supplicant.txt’ file and open it using a text editor (such as Notepad).

The boot directory with octopi-wpa-supplicant.txt marked

What we are doing here is setting up automatic wifi connection for our Raspberry PI computer. To do that you need to uncomment (remove the # signs) the four lines in the WPA/WPA 2 block and replace the text between the quotes to match your network credentials. You can copy and paste the block multiple times if you want to give the Raspberry access to more than one network (don’t forget the bracket } at the end).

Also, make sure you select the correct country code at the end of the file (you can replace the currently active ‘GB’ with the two-letter country code for your location).

Setting up the wifi network access

Save the file and close the editor.

One last thing: in order to enable remote access through the secure shell (ssh) you need to create an empty file called ‘ssh’ in the boot directory. To do that, check the ‘file name extensions’ box from Windows explorer options menu. Then create a new text file and delete the .txt extensions. Confirm the change and you are done. You can now eject the SD card.

Enabling ssh connection

Step 4: Connect and set up

Insert the SD card in the Raspberry Pi, plug in the printer and connect the power. There is no ‘On/Off’ button so as soon as you plug in the power USB, your Pi will turn on with the OctoPrint server following – give it a minute to load.

To access the GUI you need to open a browser and go to http://octopi.local . Alternatively you can type the IP address of the Raspberry Pi directly (something like 192.168.1.5). If you don’t know that IP address you can use one of many software tools to scan the network (we recommend Angry IP scanner) or connect to your router and check there.

Typical router interface with client list - look for octopi.local

On your first login you will need to go through the setup wizard, choosing name and password as well as some other options. Chriss Riley has a great video on installing OctoPrint in case you would rather watch than read

So, here you are – OctoPrint is ready to go!

On the left you have the Connection panel where you will select the USB port in which your printer is plug in. Below that is the State panel which shows you if the printer is currently running, remaining printing time, etc. Next is the Files panel where you can upload G code files and select a print job.

The section on the right consists of tabs where you can, among other things, set and monitor the temperature of the tool and the bed or control the printer axes and stream live video if you have a camera installed.

The Temperature tab with the tool and bed tempratures graph
The Control tab with webcam stream window and printer jog controls

Step 4: Installing plugins

OctoPrint plugins can be easily accessed through Settings (wrench icon) / Plugin manager. To add new ones click on ‘Get more’ button at the bottom.

Getting new plugins

Here we list some of the plugins we use to optimize our work:

  • Navbar Temp –  Brings the tool and bed temperatures from the Temperature tab to the navigation bar where you can easily see them at all times. More, Navbar Temp lets you run a custom Linux command and display the result on the Navbar. Check the bonus section at the end to see how we added a custom sensor to the printer enclosure!
  • Access anywhere / The Spaghetti detective – A great tool that allows you to expand your reach and control the printer from anywhere in the world! Timelapse videos, G code upload and AI failure detection are also available! 
  • Printjob history – A very useful tool to keep track of past prints. If you collect information on the printer settings, times and materials you can easily debug problems and see what changes lead to good or bad results. 
  • Full-screen webcam – This plugin is a simple one but makes printer monitoring so much more comfortable! 
  • GPIO control – This plugin lets you create a custom button for the GUI that controls a specific GPIO pin. Great for controlling a power relay for a LED lamp or the printer power supply (check the bonus section of this post to see how it’s made).

Depending on your specific requirements and setup, you might find other OctoPrint plugins useful. We recommend you have a look at the Octoprint plugin repository and pick the ones you like.

Bonus 1: Temperature and humidity sensor

In our previous post we built a 3D printer enclosure in order to keep the inside temperature high and improve the ABS print quality. In order to check that the design really works we added a temperature sensor and connected it to OctoPrint. That way we can always check the conditions inside the enclosure directly from our main control window.

We selected the Adafruit HTS221 – low voltage (3 ~ 5 V), high range (-40 ~ 120 deg C), accurate and cheap temperature / humidity sensor, that will easily connect to the Raspberry via the I2C protocol. There are many other sensors that you can choose from depending on your goals and measurement requirements (check the DHT11 / DHT22).

If you choose the HTS221, check the guide below on how to make it work on Raspberry Pi. If you are using a different sensor, you can jump straight to how to link the data to OctoPrint.

To make HTS work via the I2C protocol we need to install several software packages. We tried to summarize the articles* listed at the bottom so that you can quick and easy set the system up. Assuming you have already installed Octopi, run the following in your project directory:

sudo apt update
sudo apt-get -y install python-pip3

sudo apt-get update
sudo apt-get upgrade
sudo pip3 install –upgrade setuptools
pip3 install RPI.GPIO
pip3 install adafruit-blinka
pip3 install adafruit-io
git clone https://github.com/adafruit/io-client-python.git

sudo apt-get install -y python-smbus
sudo apt-get install -y i2c-tools

sudo pip3 install adafruit-circuitpython-hts221

Finally, run

sudo raspi-config

select Interface options and Enable I2C protocol.

Reboot the Raspberry Pi.

*
https://learn.adafruit.com/adafruit-io-basics-digital-output/python-setup
https://learn.adafruit.com/adafruit-hts221-temperature-humidity-sensor/python-circuitpython

Here is the sample python code (i2c_test-single.py) we used to read data from the sensor:

import time
import board
import busio
import adafruit_hts221

i2c = busio.I2C(board.SCL, board.SDA)
hts = adafruit_hts221.HTS221(i2c)

print(round(hts.relative_humidity,2),’ %’)
print(round(hts.temperature,2),’ C —‘)
time.sleep(1)

Note: ‘board’ library is part of the Adafruit package. If you get a ‘no module board’ error, you should not install it with a command like ‘pip install board’ because there is a different standalone library called the same way and your problem will not be solved. Instead, try to install all required Adafruit packages.

Connect the sensor to OctoPrint

In order to access your sensor data, you will need to install the Navbar Temp plugin (check Step 4 above). The other thing we will need is a python script that will print() the data you want to display to the console (print it only once; Navbar Temp has internal cycle that checks your script every few seconds to update the data). Once you have those you go to OctoPrint / Settings / Navbar Temperature plugin / custom command and add the command that you would use to run the python script for the sensor as if you are typing in the Raspberry terminal. In our case we want to run a python3 file called i2c_test-single.py located at /home/pi/io-client-python3/ (this is the same file we showed in the ‘Install software for HTS221’ section). The resultant data is shown in the red rectangle.

Adding custom commands to Navbar Temp

The only problem we had was that the custom command update time was so long that at the beginning we thought it doesn’t update at all. After reading the (free and open, you can download it from github) Navbar Temp source code, we found that the update time is 30 seconds. In order to fix that we had to manually edit the Navbar Temp init file. Here are the steps:

  • connect to the Raspberry via ssh (either through Windows 10 Power shell or via Putty)
  • locate the Navbar Temp folder typing the following:

cd /
sudo find -path ‘*navbartemp’

  • with cd go to the navbartemp directory that you just found
  • open the __init_.py file with nano and change the interval in on_after_startup function to 2 seconds

if self.cmd_name:
interval = 5.0 if self.debugMode else 2.0

  • do the same in on_settings_save function
  • Press Cnrt+X to exit and save with the same name
  • Restart OctoPrint. Much better!
Ssh into the Raspberry (via PowerShell)
Edit on_after_startup
Edit on_settings_save

Bonus 2: Power ON / OFF switch

Another handy feature we added to our OctoPrint ‘command center’ was a button to turn on and off the main power supply for the printer. You still need to run the Raspberry all the time to support the OctoPrint server.

We are using a 5V relay module that is connected to the Raspberry Pi and the GPIO control plugin we mentioned above. 

Note !!!
As this section deals with high power electronics, in case you have any doubts what you should do, please find a professional who can help you.

On the hardware side, you need to connect the relay to the Raspberry Pi as follows (you can choose different GPIOs as long as you change the number in the plugin):

VCC (relay) -> 3.3 V (Raspberry)
GND (relay) -> GND (Raspberry)
IN (relay) -> GPIO14 (Raspberry)

Then, disconnect the power cable from your 3D printer and the main power supply. You need to remove the outer most protective layer and find the live wire (usually red or brown) and cut it so that you can insert the relay in the circuit (if you cut all wires, just reconnect them). On the relay, use the common terminal (COM) and the normally open terminal (NO; with ‘normally open’ the relay will keep the circuit disconnected until you send a signal to the IN pin) – insert the wires and turn the screws. Make sure they are well connected and reconnect the power cable to the printer.

Hardware setup for the Power On/Off switch

Next, open OctoPrint / Settings / GPIO control and click the blue plus icon on the right to create a new button. Choose an icon, label and the appropriate GPIO pin (the same  that you connected the relay to; in our case GPIO14). Make the active state LOW – at least in our case the relay is ON when the GPIO is LOW (no voltage). Click save.

Setting up the OctoPrint button with 'GPIO control'

On the left side of the main screen you should see a GPIO control panel with your button. When you turn it on, you should hear a ‘click’ sound from the relay, even if the printer is not connected to the main power. If that works, plug in the power and see if the magic happens.

The finished power button

So that’s it for now. We hope this guide will help you optimize your workflow. Combined with the 3D printer enclosure, the printing process becomes more fun and less work.

See you in our next blogpost!

Happy printing!

Resources

Adding the Raspberry Pi to the enclosure box calls for a nice box to put it in. You can find our custom design for the model 3B on GrabCad – https://grabcad.com/library/raspberry-3b-enclosure-1

Printable Raspberry Pi model 3B box

We designed a mounting system for the camera as well – the time lapse videos are much nicer to watch if the print you are looking at doesn’t move. With Ender 3 this means that the camera must be attached to the print bed. The design you can see below has four different axis you can tweak. It is attached to the metal frame below the print bed (we had to drill a hole for that to work). Another option is to mount it on one of the bed leveling knobs. We ordered aluminum parts from the laser cutting shop as the 3D printed ones melt and bend when heated. 3D models and DXF drawings can be found here – https://grabcad.com/library/raspberry-camera-holder-for-3d-printer-1

Camera mount attached under the printer bed
Camera mount system on print bed
Camera mount system attached to the Y axis frame below the print bed