Octoprint + Wemo

Ξ March 21st, 2016 | → 0 Comments | ∇ Uncategorized |

Since I setup Octoprint on my 3d printer I’ve wanted to find a way to turn the printer completely off (power stop) when a print had finished.  The scenario is when you’re on a long print and you’re not necessarily going to be in the same room when it finishes, but when it finishes you’d like it to turn off the printer when it’s done.  This keeps my mind at ease that nothing bad in the wiring should happen and the cooloff of the hotend is sure to occur when there’s no power to the printer.  It’s a Win-Win.  I’ve achieved just that and also have set up controls in the UI for turning the printer off and on.  I’ll tell you how to do it:

First of all, I’m assuming you’re using the amazing piece of software known as octoprint.  For my install I put it on a raspberry Pi 2, but it could be installed on any linux distro for this setup.  Next enters Wemo, the remote controlled outlet switch.  Belkin’s software for the mobile phone is terrible, but we’re only going to use that for a short while in order for it to get your wifi setup.  With a combination of the linux distro on your raspberry pi and a piece of software called “Ouimeaux,” we’ll get things automated.

372

It is pretty straight forward to setup your wemo.  Download the app, install, send the wifi credentials to the switch and you’re done.  That’s the easy part.  The next part is setting up the controller package on your raspberry pi.  First download the latest package of Ouimeaux on GitHub.  At the time or writing I installed 0.7.9.  It doesn’t take too much to setup and get it working correctly.  See this page for details.  To install you’ll untar/gzip the package on your pi and make sure you have python (required for octoprint anyway) and run the setup with elevated credentials.  Once you go through the setup process, check to see if you can find the switch by running the following commands in your shell:

//look for your device
wemo list
//check the status of your device
wemo status
//check the status of the specific device
wemo switch switchname status
//turn the switch on
wemo switch switchname on
//turn the switch off
wemo switch switchname off

If you’re not seeing the device, you might either need to connect up to it with the mobile app again or recycle the power.  It took a few times to be able to see it.  Also make sure you are connected to the same network with the wemo as your raspberry pi.

If all has gone well so far, there is only a bit left more which is the configuration in octoprint.  These changes will take place in the config.yaml file which is under the “.octoprint/” directory of the user that octoprint is running as (mine was  under /home/pi/.octoprint/).

We’re going to add new commands here so that we can tap into them via the GUI as well as a plugin.  Open your favorite editor and add in some new commands and actions like so:

server:
  commands:
    printerShutdownCommand: wemo switch printer off
    printerStartCommand: wemo switch printer on
    serverRestartCommand: sudo service octoprint restart
    systemRestartCommand: sudo shutdown -r now
    systemShutdownCommand: sudo shutdown -h now
  firstRun: false
  secretKey: REDACTED
system:
  actions:
  - action: shutdown
    async: true
    command: sudo shutdown -h now
    confirm: You are about to shutdown the system.
    ignore: true
    name: Shutdown
  - action: reboot
    async: true
    command: sudo shutdown -r now
    confirm: You are about to reboot the system
    ignore: true
    name: Reboot
  - action: restart
    async: true
    command: sudo service octoprint restart
    confirm: You are about to restart OctoPrint
    ignore: true
    name: Restart OctoPrint
  - action: printerShutdown
    async: true
    command: wemo switch printer off
    confirm: You are about to shutdown the printer.
    ignore: true
    name: Shutdown Printer
  - action: printerStart
    async: true
    command: wemo switch printer on
    confirm: You are about to start the printer.
    ignore: true
    name: Start Printer

Once we have that, let’s head on over to the octoprint plugin github and download the zip for the plugin “AutomaticShutdown“.  We’re going to tweak this plugin slightly in that we’re going to run a different system command when the print finishes.  Open up “octoprint_automaticshutdown\__init__.py” and change the following line:

def _shutdown_system(self):
		shutdown_command = self._settings.global_get(["server", "commands", "systemShutdownCommand"])
to:

def _shutdown_system(self):
		shutdown_command = self._settings.global_get(["server", "commands", "printerShutdownCommand"])

You can also look in the other files to make edits to the labels if you want.  For instance I changed the js file included with the plugin to read out “shutdown printer” instead of system or the like.

That should be all you need in order to set this up.  Go ahead and reboot just the octoprint service and you should see the new sections in the UI:

3-21-2016 2-12-24 PM

3-21-2016 2-12-02 PM

Enjoy!

Original post by m00ch

 

3d Printer Crazy

Ξ March 15th, 2016 | → 0 Comments | ∇ Uncategorized |

The past 4 months have brought on a new hobby for me: 3d printing.  It’s something you really have to witness to behold the magic of it all.  Seeing an object on the screen come to life layer by layer is an experience I hope everyone gets to enjoy.

With that being said, I’ve had my troubles as well.  Last christmas I was given a 3d printer from monoprice as a gift (Monoprice Architect).  It’s a flashforge creator clone.  And by that I mean exact duplicate since the board and several other parts say flashforge on it.  Out of the box it is a fantastic printer, but after working with tons of PLA I wanted to try some other plastics out.

My only upgrade so far has consisted of parts used to go with the printer (LEDS, octoprint, etc.) and a glass bed. The glass bed is fantastic.  Gives a really nice surface to it and all around looks amazing.

The problem was with the bed that came with the printer.  It is a plexiglass, non-heated bed that leaves the user wanting more.  My long goal was to find a new heated bed for this printer.  However, that was the same idea that came to mind of every other person who got this 300$ printer last christmas.

I tried my hand at flashforge usa parts store.  They were out of stock and for 3 months I had it on backorder.  No go.  Next up was flashforge china.  I THOUGHT I had gotten the right part.  It was for a flashforge creator according to the website, but they shipped me a flashforge creator pro heated bed plate.  Well shucks.  The creator pro board has three leveling screens instead of two.  What to do…

Before I got a new bed, I needed to upgrade the 3.2A power supply that came with the printer.  In no way  would it sustain any sort of wattage that was needed here.  Amazon to the rescue.  I received the popular Meanwell 350-24 prime for 40$.

Next up was finding an aluminum plate for the printer.  I’ve scoured the internet and I found on amazon they are selling magnetic build plates from a company called “Maghold.”  Yes please!  Here’s a video and a link to the item.

I received the plate, it looks fantastic.  Really nice piece of steel.  However, I ordered one that went to a 2015 creator / creator pro.  APPARENTLY, the board I received from flashforge was a 2016 board.  Who knew.  Again, the holes were Juuuuust off.  So that’s messed up.  I carefully used a file and made the wholes a little wider on the board.  It fits snug on the build plate now so all I need to do now is drill three holes on the build plate arm (wood) that is attached to the z-axis.  I’m wanting to do that without having to remove the damn thing, because it looks like a nightmare to try and do.

Once I get that installed it’ll be a much needed upgrade and better than the OEM plate.

Next up was the fact that these printers have MK10 extruders installed.  There’s been several versions of the MK bowden extruders.  My coworker had a 2013 flashforge creator model with an MK7 and had problems with feeding exotic filaments into it and having it gunk up.  This was apparently fixed with an MK8. Since then, various manufacturers have been changing the model due to cutting costs or fixing issues and what my printer was shipped with was an MK10 hotend.  The nozzles are wider (6mm I think) and they have a thicker PTFE tube that resides inside the nozzle to go to the aluminum tube from the hotend.  For most PLA usages this is fine, but I’ve seen complaints on the forums that this was a poor change due to the fact that you’re unable to heat your extruder above 240C without having problems with the filament melting too much inside and clogging, as well as the fact that you can’t run the filament faster than 65mm/s.  Meaning you’re stuck with being in that range.

A relatively new market has been the all metal hot ends.  These replace the PTFE tube which causes some grief as well as keep a clean, clear path for the filament to reach the nozzle, without giving any to filament creep back up the tube.  A company called Micro-Swiss in Minnesota makes them.  I  had previously thought the printer had an MK8 so I made the purchase to buy a new aluminum tube from them.  Turns out it was an MK10.  Who knew.  Regardless, these guys were fantastic at customer service.  They allowed a return on the hotend and shipped me out a new hotend for the MK10.

Here’s the before hot end.  Notice the thick PTFE tube.  This can be the cause of many issues:
DSC02469(mk10 on left, mk9 on right)

And this is the new hotend.  It’s solid metal throughout:
3-17-2016 1-01-26 PM

All in all, parts so far have been around 200$ which.. for a 300$ printer originally isn’t too bad.

When everything arrives I’ll update with screenshots to show it’s glory.  It’s been a long road, but I’ve learned much along the way and I see the light at the end of the tunnel.

Original post by m00ch

 

It all starts with a post

Ξ March 14th, 2016 | → 0 Comments | ∇ Uncategorized |

Here begins the mochery blog.  A place for nerdery, coding, and all things techy.  Throughout the next days, months, years I’ll be posting content I find on the interwebs and discuss new tech articles I find on reddit or other means.

sosayweall

Original post by m00ch

 

ytawradawd

Ξ March 7th, 2016 | → 0 Comments | ∇ Uncategorized |

Original post by m00ch

 

Roooo

Ξ March 2nd, 2016 | → 0 Comments | ∇ Uncategorized |

// ==============================================================================
//  This file is part of the Microsoft Dynamics CRM SDK Code Samples.
//
//  Copyright (C) Microsoft Corporation.  All rights reserved.
//
//  This source code is intended only as a supplement to Microsoft
//  Development Tools and/or on-line documentation.  See these other
//  materials for detailed information regarding Microsoft code samples.
//
//  THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
//  KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
//  IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
//  PARTICULAR PURPOSE.
//
// ==============================================================================
//snippetAzureAwareWorkflowActivity
// This namespace is found in the System.Activities.dll assembly.
using System.Activities;

// This namespace is found in the Microsoft.Xrm.Sdk.dll assembly
// located in the SDKbin folder of the SDK download.
using Microsoft.Xrm.Sdk;

// This namespace is found in the Microsoft.Xrm.Sdk.Workflow.dll assembly
// located in the SDKbin folder of the SDK download.
using Microsoft.Xrm.Sdk.Workflow;

namespace Microsoft.Crm.Sdk.Samples
{
    /// summary
    /// This class is able to post the execution context to the Windows Azure
    /// Service Bus.
    /// /summary
    public class AzureAwareWorkflowActivity : CodeActivity
    {
        /// summary
        /// This method is called when the workflow executes.
        /// /summary
        /// param name="executionContext"The data for the event triggering
        /// the workflow./param
        protected override void Execute(CodeActivityContext executionContext)
        {
            IWorkflowContext context = executionContext.GetExtensionIWorkflowContext();

            IServiceEndpointNotificationService endpointService =
                     executionContext.GetExtensionIServiceEndpointNotificationService();
            endpointService.Execute(ServiceEndpoint.Get(executionContext), context);
        }

        /// summary
        /// Enables the service endpoint to be provided when this activity is added as a
        /// step in a workflow.
        /// /summary
        [RequiredArgument]
        [ReferenceTarget("serviceendpoint")]
        [Input("Input id")]
        public InArgumentEntityReference ServiceEndpoint { get; set; }
    }
}
///snippetAzureAwareWorkflowActivity

So this is a test to see if the text looks normal or not.  If it is, then we’re good.  If not then we might have a problem.

Original post by m00ch

 

  • Rumours and Lies