GopherCon 2021: Sebastian Spaink - 3D Printing Gophers with Go

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
my name is sebastian spike and welcome to my talk 3d printing gophers with go um yeah over the past two years i've been 3d printing as a hobby and i've become obsessed with it i think it's amazing you can create just about anything out of just a pile of plastic and i've been able to create some cool stuff like dinosaur skulls to more boring practical things like pegboard trays and there's still a whole lot more i like the print and another obsession of mine is the programming language go so of course i started looking at ways i can incorporate these two obsessions so i started 3d printing a horde of adorable gophers and while i was doing that i found other ways you can incorporate go with 3d printing and that's what i want to share with you today so my main goal for this talk is for me to share with you to help you discover a fun new way to use go in a popular hobby and this talk is meant for an audience of anyone so if you're a 3d printing enthusiast or a complete beginner i'm hoping that you could take something away from this talk and at the end be able to 3d print your very own adorable gopher so i want to start in the basics and talked about look what is 3d printing so a very generic term like a definition for it is it's just the construction of a 3d object from a digital 3d model using a specialized tool known as a 3d printer and that's really that's all there is to it where it gets more exciting is when you talk about the actual technology behind a 3d printer so as i mentioned i'm just a hobbyist and so i don't have any actual professional experience 3d printing so i won't be showing you how to 3d print a bridge or make spaceship parts but instead i will be sharing the noble art of how to create a gopher and when you're talking about the technology behind a 3d printer as a hobbyist there's two main ones that are available one is fdm 3d printer which is stands for fused deposition modeling and another one called an sla 3d printer which stands for stereolithography and what i like to do is go into some detail of how these 3d printers work so here we have a diagram illustrating the highlights of a fdm 3d printer i just kind of and this particular one is operated solely by gophers and so how we want to look at it is in the top you have this input material called filament and this filament gets pushed down to through some extruders down to a hot end because a filament is it could be made of a lot of different materials but it's key characteristic is the fact that it melts when it's heated rather than burning so it's going to get heated up and melted and then pushed out through a nozzle in you know perfect dimensions for and deposited on top of a print bed where the nozzle and the print bed will both be in motion and it'll be drawing the shapes layer by layer in order to construct a gopher and at the end you'll end up with something looking like this so i used some fancy multi-colored filament for this one but you can actually still see the layers inside the final result in gopher showing how it's built up from you know bottom to top and it slowly rises from the build plate and at the end once it's cooled down you have yourself a gopher in contrast the sla 3d printer works kind of in the opposite way where instead of the input material going to the build plate you have the build plate going to the input material which is in this case a liquid a kind of it's a big old basin of uv curable resin and the build plate's going to lower down into that resin at a certain height right above the bottom and then the uv light will project a certain shape onto the build plate then curing it and it will rise and lower again and we'll do this until out of the nothingness rise a perfect looking gopher and then unlike fdm printer where at this stage you'd be done you can take it off the build plate there's actually a lot of post processing that needs to happen with an sla 3d printer and it's because the resin is toxic you can't handle it safely without having gloves and the appropriate safety material so it's i find it a little bit more yeah it's a little bit more difficult at posting an fdn3d printer but you can end up with a gopher looking something like this and the res the sla printer is actually capable of a lot smaller layer heights so you don't you can't see the layers they are there but they're so small that they aren't visible at all so here you can actually see both of them next to each other a the fdm 3d printed and the resin printed one and so also one of the things uh if you notice the fdm printer tends to be better for doing very large scale things as far as like being able to get because the input materials are cheaper in the cases that i've seen than the sla 3d printer but so now that we've seen just like in a general high level overview of 3d printers work i think it's time to answer the important question of how can go help with all of this so i think you know looking throughout the 3d printing process there's like three main steps that go can be involved in that kind of involved the entire process from beginning to end one where go can be used to control your 3d printer it can help start a 3d print it can also help you create a 3d model and it can also help you monitor your 3d printer because you know 3d prints can take a very long time so as fun and exciting it might sound sit next to your 3d printer for hours whispering it sweet nothings you do have to be able to remotely monitor it and that's where go can help us so let's dive in by first looking into how we can control a 3d printer using go in order to discuss that you need to understand the 3d printer's firmware so on your 3d printer there's some firmware which is the link between the software and the hardware that will help actually control your 3d printer and a very popular open source firmware that is most likely running on your 3d printer something called marlin there's other ones available like clipper but in my case i'm using marlin and it's very configurable and it takes something called g-code as input so you can communicate with this firmware by using this programming language known as g-code and g-code looks something like this it's a very it yeah it's in a programming language in a sense and all these the syntax is broken down in this type and number format where you're going to have this type of number associated together that gets related to a task so your firmware knows what this command and this instruction is associated with and the types that are possible is g type where it's a related to a geometry category of instructions based on linear movement and then there is the m-type which is related to some miscellaneous function categories and then the number is i don't know if there's actually a sense behind the number but yeah so you're going to have these two associations and they can also accept some parameters but let's look at some practical examples of g-code to understand a bit what i'm talking about here so here's some some g-geometry type category g-codes we have g28 which is a special one which you'd most likely see at the beginning of the 3d print it brings your machine axis home so that any movement afterwards will come will go from that zero position and you can make the components move by sending them g1 or g0 commands and providing an x y or z axis as a parameter and it will move in that direction and there's also a special axis e which stands for the extruder and that will tell how much filament will get extruded out and then f here will do it'll describe how fast the movements will take so what we can do here so how go can be involved is so g codes can be doing most of the heavy lifting obviously but where we can use go is we can use it to communicate the g-code to the 3d printer and your 3d printer has a microcontroller with a serial port so we're going to have to do some serial communication with go in order to send this these gcode commands over to it use go to connect to a 3d printer and by doing the serial communication and let's look at a practical example of how that is accomplished so in my case the environment setup that i'll be using is a raspberry pi this can be connected to a micro usb port which is then connected to the microcontroller's serial port and on the raspberry pi i'm running linux and on linux you're going to the 3d printers will be represented as a special device file and this special device file can just be accessed by using the standard os library and you can open up just like a regular file you do need to define some flags make sure that you're not being set as the controlling terminal terminal so that you don't get any special signals sent from your 3d printer and that you can read and write from it with that you need to use some uh this special structure called term ios in order to set your configuration because you need some add some extra details depending on your motherboard that you're connecting to you need to be able to set the correct baud rate which is the speed of communication that you're going to be communicating over the data channel and so this particular number i kind of pulled out of the internet just looked at my 3d printer and said okay this is the one that's associated with it and with this term ios structure you can set the yeah set the configuration correctly and once this configuration is defined you can set it onto the special device file by using a system call this ioctl so you pass it the file descriptor and you pass it the configuration structure and say hey this is how i want to communicate with the special device file something i wanted to point out here is interesting so we actually have to use an unsafe pointer to make the system call which is not something i usually do my daily work with go try to avoid using unsafe pointers but you have to in this case for two reasons you need to circumvent the type conversion that go offers so because you're kind of giving over a chunk of memory to the system operating system saying hey you can do it with this whatever you want and we need to also prevent the garbage collector from cleaning it up before that this the operating system is done with it so kind of unrelated with the actual server communication but kind of an interesting tidbit and here it is kind of broken down the entire uh program so we open up the serial device we set some configuration and we set it onto that device and now we can start reading and writing and we start writing out our g-code and we can start reading it out into a buffer so overall i found this kind of complicated luckily the internet provides this open source package called term serial that has made it a lot easier so behind a hood it's actually doing what we just described but with this package we can make the code look a lot simpler in this main function all we have to provide is the special device file name and the baud rate and then we can open up the port and write out g-code command so here i've got a brief pre-recorded video kind of demonstrating um that program running so here we send the g28 code so you can see the 3d printer homing itself and you notice that it kind of like detected the barriers its limits by hitting on all the axes and right now seeing where the z-axis is as far as it can go using this special bl touch and then the next couple of commands is going to be moving in the x y and z direction 40 millimeters and kind of see all the pieces moving around and then you can kind of imagine in an actual 3d print all these pieces are going to be moving around in order to draw out layers which we'll be looking at more later um so that that covers the first category of g-code the linear movement so we've seen how we can actually get things moving which is an essential part of 3d printing and then the next category is going to be the miscellaneous functions so these are important so the two main important ones i wanted to highlight here are ones to hot the heat up the hot end and build plate so you can start melting the filament correctly so it has to be at a perfect temperature in order to make sure that depending on what kind of filament you have to make sure it melts correctly and then you could also hit up the build plate where this is actually an optional thing but heating up your build plate is very useful in order to improve adhesion of the actual print so that it doesn't warp or roll off the bed and what i would like to do now is i want to show you another practical example uh showing how you can heat up you know seeing this this miscellaneous functions in action but in order to do that we need some way to visualize the temperature increase so luckily there's another g-code commands another miscellaneous ones m105 m155 that will help us gather the temperature so we can make use of this to illustrate that the previous commands were actually working so m105 is kind of just a basic one where we just get a single temperature report and it will tell us what the current temperatures are of the tools and then m155 is an improved version of it in a sense if you want to get time series data where you want to see that temperature actually increasing and changing over time and it takes in a time interval as a parameter and it will report this temperature every two seconds in this case so let's take this and create a new demo so what my intention here is is to make use of the go program we looked at previously to set and send the g-code commands over serial and have it run on the raspberry pi which is connected to the 3d printer and then alongside it also have another go program running to get and parse that temperature report and then send it over to the influx data database which if you aren't familiar with is a database that's good for doing time series data and it comes with a fancy dashboard to help show that data changing and so let's dive into that so let's look at seeing how we can create a program to read and parse this temperature report the first part is very basic or at least very similar to the first program where we're just writing out a g-code command over serial and 155 and say hey run this give us the report every two seconds and we'll read the results into a buffer and the actual cost i simplified it here for the sake of putting it on a slide but the actual code is actually running at this reading into a buffer and go routine which gets triggered on a time interval also every two seconds like let's you know get the new temperature report and read it in but uh so then the temperature port that we're going to get kind of looks like this is going to be this cryptic string line that we're going to receive where we have this key in value pair where t is associated with the hot end temperature and b is associated with the build plate temperature and then the values is going to be this actual slash target where the actual is going to be the current temperature and the target is going to be the temperature that you set with those m104 m140 commands and what we're interested in is we want to get that actual temperature so that i can demonstrate to you that this miscellaneous function actually worked and that it's increasing the temperature of the nozzle and build plate so what we can do and go we can just make use of some regular expressions very straightforward as far as like just made up this regular expression to grab the t and grab the actual temperature and then dump the key value and convert into a float so that we you know we can work with it and send it along to the time to the influx database so that we can see it change and then we can do the same thing with the b build plate i'm sure you could probably come up with a more clever regular expression but this is like most simple straightforward way i could think of uh okay so we've got the temperature report being reported every two seconds we're getting this temperature report we know how to parse it now let's send it over to the influx database so that we can visualize that change so we can keep an eye and actually make sure that it's working um and so in case you've never used an inbox database before what you need to be aware of is something called line protocol this is the text-based format that defines a metric that defines like the data point that we're interested in with that's holding the temperature data and in the most broken boiled-down way of looking at it it's just going to be a measured measurement name that describes the data point and it's also going to have a key in value where the key is going to describe that value and that value is going to be the temperature you're going to so to help illustrate it i've got this so here we got this temperature report and here's broken down as a line protocol where we i just call it tools temp and then we have the hot end equals to 20 and build plate equals to 20. so 20 in this case is actually just the idle temperatures in celsius and zero at zero because the user hasn't set an actual target temperature but then that would change to be like 200 or 50 or whatever the user sets it as and now we can now we're ready now so now you understand how line protocol works now we're ready to send it up over to the influx database and there's actually multiple ways of doing this and the most simplest way i want to start off with is showing that you can send it with a rest api so here we're going to like concatenate a string to create the line protocol also very crude way of doing it i think but you know we know what the structure looks like we push it together and now we can write it out to a body for order to send it to the rest api um and in order to send it to the rest sidebar you do need to have influx database set up and i won't go into detail exactly how we need to do it but it's written in go and you actually end up with a single binary that can be run in all the popular operating systems and there's more documentation online that you can look at of how that works but you also greeted with this wizard which you'll need like two key bits of information so i'm trying to make it like as simple as possible we're just like this is open source project you've started up you get this wizard and you need to come up with an organization name to define your workspace and you need to define a bucket in order to have a named location where you're going to send this line protocol and then as i mentioned we can just use rest api in order to accomplish that so we just have this endpoint with that bucket name with that organization and this url is like running it locally and we all you need is an authorization token make sure it's secure and then you can just start sending your line protocol over to this influx database so here we have another pre-recorded video of showing this in action and what we're going to have is going to let's we're going to execute the program we just kind of described before where it's going to be on a loop and a go routine kind of checking the temperature report every two seconds and it'll be sending it over to the influx database and then we're going to use the previous program to set with em send some m104 and m140 commands in order to set the temperature of the build plate and the hot end and here you gotta have it sped up and you're gonna see this gauge increasing and stopping once it's reached that designated temperature and that's it so with that we've kind of already and with that we've got yeah that kind of covers the entirety of the controlling your 3d printer and also kind of touching the monitoring aspects as well so you know because we're able to already move our components and heat them up properly we are you know we also saw how we can monitor it but let's now look at the more exciting bit of actually creating and preparing a 3d model because that's the whole fun of a 3d printer is you want that end result you want that little plastic knick-knack to bring you comfort so let's look at making an important 3d model so how you go about doing it is the obvious thing is you go onto the internet and find your perfect 3d model and i've put some two links here sites that i've used in the past good luck because there's a lot of talented artists out there creating some amazing looking 3d models but there are cases of course where you're going to give a kophercon presentation and you're looking for like the perfect gopher that you want to present so you have to create one yourself and so there's some tools that i'm familiar with blender and tinkercad that provide a user interface for you to craft yourself a 3d model of a gopher and at the end of all this you're going to end up with an sdl file this is the standard file format that gets shared so if you go download something or you want to make one yourself you want to end up with an stl file that will describe the geometry and your 3d object in a bunch of triangles so there's actually a fun so while using user interface it's exciting it's even better if we get to use go itself to create a 3d model and i stumble upon this amazing package called sdfx that provides an api to define 3d objects using go and it does and it outputs an stl file exactly what we need to get in order to 3d print something uh it uses some magic behind a hood called sdf which stands for sign distance functions these are mathematical functions and describe primitive shapes like boxes and spheres and with that we can frankenstein ourselves a beautiful gopher so let's look at some practical like let's go ahead and start doing that so what i want to do now is kind of show you a practical example of how we could build a gopher using the tool set available to us with st vex uh so let's start very simple uh defining a sphere of a radius of 45. so 45 is a number i just pulled out of the midair and when it showed rendered it looked great so i went with it and then we call another function called render stl and we can render this sphere into an sdl file and if you preview it you end up with this sphere and it's even already blue so it already looks a lot like a gopher but let's take it further and what we can do is we can define more primitive shapes and we need to take those primitive shapes and move them around and put them where they need to be in order to give that idea that it's a gopher and so how this works we have we have got this transform 3d method that takes in a matrix and so if you're familiar with 3d modeling or you know working the perhaps of games this stuff looks pretty familiar to you but if you're not familiar with it it all you really need to do is to find a vector that defines an x y and z and provides some numbers in there to help define where those objects will live in the world space and we'll be making use of this translate 3d and rotate 3d functions in the upcoming slides so let's start with eyes we can define a smaller sphere and then transform it and translate it to the correct location of these x y and z coordinates and then we can add some pupils and we can make use of another method called difference 3d to carve out a smaller sphere from those highs to give that idea that we have pupils and we end up with this beautiful shape where we have a gopher with two eyes so let's look at another iconic feature of a gopher and we can define some teeth by using a box 3d so another primitive shape as long as as well as some spheres for the mouth and the nose and then we move them around oh and i forgot to mention earlier at the very bottom here we also have the union 3d so throughout this you're going to be defining your shapes and you're going to be gluing it all onto like the main sphere body so that's like the whole thing that we're doing here we're taking these perimeter shapes and we're just slowly you know like clay model building up a gopher and so we end up with this so it's already looking very much like a gopher in my opinion like this is this is all the iconic features of one but we can take it even further and we can add some arms uh it provides a capsule 3d function as well so we get kind of like a pill shaped uh object and we'll be making use of the rotate 3d method calls here where you're going to have to provide the vector of what axis you want to rotate at and then also the degree of rotation and then you'll need to move it to the correct location using the translate 3d methods and with all that together and you stick on you can end up with two arms so these two pill-shaped arms i thought looked very gopher-like uh and then we can take this pattern and build up on top of it and just keep it going and you can end up with a full bonafide looking um gopher uh so with once you have this he is almost ready for 3d printing uh the only thing is he's very spherical so if you want to end up trying to 3d print him you're going to have to use something called supports which are these extra structures around a gopher around a 3d print in our gopher in this case uh to help make sure that it's not 3d printing in air but i've always had difficulty 3d printing very spherical shapes like this where you're going to end up and during the 3d print suddenly it's going to roll away because the supports aren't strong enough to hold it in place so what i would like to do is let's cut off the bottom a little bit of its bottom off so that it has more [Music] adhesion to the build plate so we can cut off there's a this cut 3d method and then we can end up with this easier to 3d print gopher so he's going to be sitting on the build plate nice and secure and he's now fully ready for 3d printing uh but you know you're probably wondering like you know i went on and talked about g-code for quite a long time at the beginning and now i'm talking about this stl file format so an seo file format isn't actually a g-code it's a bunch of triangles described in geometry so okay so here we have a preview uh of showing the um of a slicer called cura that can slice the stl and this is what i was using to show the gopher slowly coming up as we're adding bits and pieces to it and you can use it to slice and here actually provides a preview screen of how it looks like sliced and you can notice here we've got kind of like almost looks like tears coming out of its eyes and this is a support structure to keep its eyeballs in place while you're 3d printing it and we kind of have this little gif showing all the layers that it slices so each of those layers is like described in g-code of how to print that layer and you'll end up with this so this is our programs this is the this is our gopher's 3d model described as g-code and you're going to have this majority middle code describing the movement of where uh the nozzle and the build plates location where everything needs to be and some of that miscellaneous functions to heat up and yeah everything we saw before so with this g-code we are now ready to 3d print a gopher i did decide that while our very circular and spherical gopher was you know beautiful and perfect in its own way i wanted to take it to the next level and use i used a tool that was more familiar with blender in order to give it more of an hourglass shape and give it some other uh you know tiny little detail changes and also the benefit that this this model doesn't need any supports um i uploaded this model for free on this website so if you want to 3d print this particular gopher you're welcome to and yeah so so here we are so we have now seen how we can control a go control a 3d printer using go and now we have a go for we want the 3d print so the next step is to go ahead and start 3d printing some gophers and then the final subject i want to cover is monitoring a 3d printer so let's see what we need to actually do during a 3d print so why would you want to monitor a 3d printer um through prints can take a very long time so that gopher i showed the beginning of slide took six hours to print while in this more extreme example here i took i 3d printed this live size cave bear skull over the course of six days where each part took about two days each and yeah so you can imagine during that time i wasn't just sitting there watching my 3d printer as exciting as that might be and you need to be a and it's very important then during this 3d printing process to be at a quick glance to know what is happening and be able to do it remotely so you don't have to be sitting next to your 3d printer the entire time and you know some important things you want to monitor like you know is it done or not should i come in you know should i go to wherever your 3d printer might be and you know change it out and get the next print started is the hardware all operating correctly is the temperature is all correct is there enough filament and what layer is currently being printing as well and that's an important one when you are dealing with supports and you're unsure if there's going to be a an issue uh at you know like the meeting point between the support and the actual object and making sure that things don't uh break down so like for example this cave bear skull i was concerned that the teeth might fall off so i was wanting to make sure that i was there at the correct layer and so when you're talking about monitoring a 3d printer if you use a 3d printer you're most likely aware of this very popular open source tool called octoprint and it's amazing it's a very feature-rich fully uh allows you to fully remotely control and monitor your 3d printer and it comes with a very snappy web interface in order to watch it all happen it's actually written in python so it's not in go so i won't be showing any of its source code but it works very similar to what we went through previously in the beginning of this talk where it connects to 3d printer using gcode and over serial communication and then it's going to be getting like temperature reports and sending it out to its dashboard opposed to influx data and what we can do here is i want to make use of this you know very well implemented tool and let's build up on top of it because it provides a rest api so it allows us to access all the data that it knows about and transform it so what i want to do is here we have a screenshot of the octoprints snappy web interface and it's very useful it has a lot of good information but it's a little bit overwhelming so i kind of wanted a custom dashboard where it just highlights exactly what i need and that's where i want to use go so while we could have rewritten octoprint entirely and go let's make use of this pre-existing tool and use some go in order to scrape this data and send it over to the influx data dashboard and we can make use of a tool called telegraph so telegraph is a open source project written in go that i'm actually helping maintain as a full-time software engineer and it's is a it's described as an agent for collecting a reporting metric so it can accept input data and output it to influx database very similar to kind of what we did in the first and the monitoring the temperature project but it makes it easier because it already has some functionality pre-implemented it comes with a whole bunch of plug-ins so it's kind of this plug-in based infrastructure of all the functionality is segmented off into individual plug-ins so it's kind of this batteries included situation where you have a single binary with a lot of functionality that gets enabled by configuring it using a tomml which is this it's a configuration language similar to yaml or json if you have heard of those and you can use that to configure it so what i want to do now is i want to show a practical example of how you can monitor your 3d printer and then make use of telegraph in order to do so to give some more details about telegraph telegraph works with plugins as i mentioned and there's four different categories input plugins which are help you collect metrics from 3d third-party apis such as octoprint there's also processor and aggregator plug-ins which we won't be discussing but they're there to help you transform metrics and then there's output plug-ins to help you write out to various destinations in our case the influx database and then it kind of works in this flow here input plug-ins to output plug-ins very basic very straightforward and now what i want to do is let's make our own plug-in to work with octoprint and that's something i actually did already and i already wrote an octoprint plugin that but i kind of wanted to take you on a journey in a sense and let's rewrite this plugin from scratch to show you exactly how it works and we can build up on top of it it's completely written in go it's a little bit unique in the sense of majority of plugins in telegraph it's an external plugin and an external plugin works slightly differently the fact that it is a separate binary that gets managed by telegraph by using an internal plugin called exec d and here i kind of got a diagram illustrating what i'm talking about we have this you know this red box is illustrating a separate binary and it communicates with this exec d plug-in that knows how to talk with this binary than you know and that's managed by telegraph and what also here another terminology of i that you'll be exposed to when talking with external plugins is go shim and the goshim is a utility tool to help you build up a a plugin an external plugin it allows you to make use of some internal telegraph features and it makes it seem like you're actually writing an internal telegraph tool and so yeah this is where i can describe so go shim so if you're writing with go this is kind of just a utility to help you so we're not going to be worrying about reading or writing from a tamil config we're not going to be worrying about communicating exec d plug-in what i'm going to be focusing on is simply let's gather some data from the octoprint plug-in and making that work and here's the data here's a flow chart showing it working where we're going to be focusing on this blue box let's make this octoprint external plugin which is going to gather from the rest api and gets managed by telegraph and outputs to this swanky dashboard so in order to make an input plugin all you need to be worrying about is this interface and you're going to be implementing a gather method that takes an accumulator structure so this gather method is going to have all the functionality in it it's going to be called over at an interval by telegraph and this accumulator structure is what's going to be storing the line protocol so instead of concatenating some strings you're going to be in using the structure in order to define these data points there's also a sample config and a description those are just there as helper for describing what your program what your plugin is all about so we won't actually be looking at that because we already know so here's the accumulator in action it can add fields uh and here we take the key and feel values where we have the name and what we're concerned about here is the temperatures and with the accumulator uh set up the other important aspect is the actual like the user interface as far as your plug-in is concerned the tomwell configuration so you have to define a structure for this for this user input of data to get unmarshaled into and in our case for octoprint we just need a url and an api key in order to make our api calls and the so if you've ever seen it before it's just like these two brackets and then this key and value structure getting from the data from the rest api i mean it's very basic and straightforward kind of um implementation where you've probably seen how go works with this before we call in this endpoint unmarshaling into a printer state for example here and same thing for the temperature data so this is actually everything you can end up with from the very basic octoprint rest api and luckily octoprint also provides plug-ins similar to telegraph and it can extend its functionality and the community is provided these two other data endpoints layer progress and filament management that i want to quickly extend this octoprint plug-in with and uh so yeah so these like filament manager is a really cool one to be able to actually find and use because that's something that i've had issues with where if you're 3d printing a very large object and you're concerned that you're going to suddenly run out of filament this thing actually helps you keep track of it so you don't have to keep yeah manually keep track of weighing your spool this will actually take care of it and in order to integrate that into our octoprint plugin you need to set up a external database in this case i set up a postgres database which also a lot better documentation out there that i can share with you now but here's like a general example of this unit the user interface this plug-in exposes an octoprint that you can configure and register your filament spools into and then here there's a screenshot of how it looks like in the back end where you got a bunch of filament spools and the weight and what it's going to be after printing and then the actual go code it's just going to be a sql statement you're going to call to select that information and at the end you're going to have this gather function that's going to be filled with this functionality where you're going to get the layer progress the printing state the temperature data and the current filament data and all this is going to be pumped into the accumulator and send along the pipeline over to the influx data database where we can actually make some use out of it um yeah it's also important to mention right so we've got the we saw the configuration of the telegraph plug-in external plug-in and then you also need to configure the actual telegraph binary to say where your external binary is and where that configuration is so that it knows to launch that as a demian because the benefit of external plugins that i didn't mention before so you don't actually have to write it in go you could write it in rust if you wanted to but yeah i prefer using go in this case and then we need to configure the influx database output plugin and the influx database dashboard comes with some very nice utilities in order to make that easy for you to help generate pre-generate it and it will kind of look like this some basic tomwell configuration uh and what we end up with is this demo flowchart here where we've kind of extended it from the first one where it's not just the rest api anymore we're also reading from the plugins from octoprint but and yeah here's a quick preview of the dashboard but let's see it in action of an actual time lapse of a gopher being born uh so here we have the dashboard being populated with the octoprint external plugin being run and we can see the state and we're going to see the right now the nozzle and the plate temperature being set and the state's going to turn from operational to printing and as soon as the temperature is correct yeah and then i've overlapped a video of the printer of a gopher slowly rising out of nothingness and the layers increasing as it gets completed and that yeah through the movie the magic of uh you know video that six hour print turned into 10 seconds and if you see here the filament remaining filament also decreased once it was done and that's it so yeah we've printed a gopher with go so those uh yeah broken down in three different steps and how you can do it i hope you enjoyed this talk and i'm hoping to see a whole lot more gophers out in the wild
Info
Channel: Gopher Academy
Views: 89
Rating: undefined out of 5
Keywords:
Id: vXpz5fUOH5A
Channel Id: undefined
Length: 40min 5sec (2405 seconds)
Published: Fri Dec 17 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.