Teaching Alexa to 3D Print

Sometimes a gadget like Alexa or Google Home is a solution looking for a problem. Then the problem you’ve been looking for hits you square in the face. I’ve confessed before that I have an oscilloscope problem. I also have a microcontroller development board habit. It appears now I have too many 3D printers. I recently finished building my latest one, an Anet A8 I picked up on Black Friday. While calibrating it, I found myself juggling a screwdriver, a pair of pliers, and trying to operate the thing all at one time. I realized I had to come up with a better way.

I don’t know if it qualifies as an addiction yet, but I also have an Alexa in every room (although I call it “Computer” because I’m a Star Trek fan) and a Google Home device almost everywhere. Why can’t I get one of these assistants to operate my printer for me? What are assistants for, after all, other than telling Dad jokes?

You’d think adding voice control to a 3D printer would a bit difficult. With the right tools, it is actually pretty easy. Luckily those tools aren’t anything special… if you want a set up like mine, where Alexa controls your 3D printer, read on.

The Plan

Obviously, the Alexa is going to be my voice control input so that part is taken care of. You could use Google Home, too. What would have been the hardest part a few years ago is now perhaps the easiest part, paradoxically.

The second part of the puzzle is Repetier Server. You could probably use Octoprint (Tom Nardi just wrote a great guide for setting up Octoprint), but I use Reptier. If you haven’t used either, these programs create a Web page that allows you to control your printer from a browser. They also provide a Web-based API. That means you can send commands to your printer remotely just by forming a valid web request.

You might be able to guess the third part of this equation: If This Then That or IFTTT. You’ve probably used this before. It is something of a Swiss Army knife for routing web events to different web services.

With these three items — a voice control assistant, a web server that controls your printers, and an IFTTT account, you are almost there.

[embedded content]

 Details

It is easy enough to get IFTTT to take a trigger phrase from your assistant and do something about it. For Alexa, you have to say “Alexa, trigger mumble mumble” which would send “mumble mumble” to IFTTT. The problems is, what to send?

There are three things you’ll need to accomplish to get something like “Alexa, trigger 3D printer home” to work. First, your Reptier Server needs to be accessible from the public Internet. Yes, hackers might take over your printer, but I’m willing to take that chance. Since IFTTT will send web requests to your server from outside your network, you have to do this to work with IFTTT.

Second, you need an API key from your copy of Repetier Server and the “slug” name of your printer. You might think this would give you some relief from print-happy hackers, but no. It is easy enough to find the key and the printer names. The “slug” is a short internal name for each printer that the user doesn’t necessarily see.

The third thing is, you need the commands you want to send the printer. For example, homing is G28. You can send any G code you like or even multiple G codes.

Implementation

You should open your printer server to the Internet using some non-standard port. For example, Repetier Server normally is on port 3344. You might want to expose port 9999 instead. That isn’t bulletproof security, but it can’t hurt. How you do this depends on your network. Check your router for “Port Forwarding” and direct requests on your chosen port to the IP address of Repetier Server. If you need more guidance just Google your router’s model number and “port forwarding”.

Since your external IP address is probably not static, you will also want some dynamic DNS forwarding to associate a URL name with your external-facing machines. I have my own DNS servers, but Duck DNS works well. There are plenty of others, too.

Try your commands from a web browser to make sure they work. The first command you can send is just to get information. As an example let’s say your server is at the fake address dyn.hackaday.com:1430. Try this URL from your browser:

http://dyn.hackaday.com:1430/printer/info

You’ll see something like this (broken up for readability):

{"apikey":"1ca77731-aaaa-4c31-a44a-65deadbeefb8","name":"Repetier-Server Free",
"printers":[{"active":true,"name":"Monoprice Select Mini","online":0,"slug":"Monoprice_Select_Mini"},
{"active":true,"name":"Printrbot Plus","online":0,"slug":"Printrbot_Plus1"},
{"active":true,"name":"Anet A8","online":1,"slug":"Anet_A8"}],"version":"0.86.2"}

You can probably deduce that the big hex string is your API key (this one’s fake). You can see my three printers which the server knows as Monoprice_Select_mini, Printrbot_Plus1, and Anet_A8.

Next, try to do a printer home. You should jog the print head somewhere so you get a dramatic homing when it works. Try this (substituting your details for the bold text, of course):

http://dyn.hackaday.com:1430/printer/api/Anet_A8?apikey=1ca77731-aaaa-4c31-a44a-65deadbeefb8&a=send&data=%7B%22cmd%22:%22G28%22%7D

The URL encoded characters after “data=” are actually these characters: {"cmd":"G28"}. You can probably enter them that way into your browser and it will convert them, depending which browser you use. Repetier won’t send anything exciting back to the browser, but if all went well, your printer should home.

By the way, forwarding an external port to your 3D printer is a security hole. For a normal set up, you could ask Repetier to authenticate users or keep the service safe with, say, port knocking, VPN, or some other secure scheme. The problem is IFTTT — the thing we’ll use in the next step — is going to need to talk to the printer from outside and it isn’t going to know how to authenticate or otherwise open your ports.

If you were serious about using this and serious about security, you could write a small web service that would do something smarter to authenticate you and then forward the request to Repetier which would no longer be outside-facing. However, whatever authentication method you use would have to be one that IFTTT could handle without exposing your secrets (in other words, just passing a password in plain text isn’t the answer).

In my case, I didn’t feel too worried that during the times my printer is on that someone would scan all the ports I expose looking for 3D printing servers and start printing spam on my printers.

If Then

Once you have your web service working and accessible, you can open up IFTTT. Sign in and go to the My Applets page. Click New Applet. You’ll see “if + this then that” and you want to click the plus sign.

From the list of services, find Amazon Alexa (the search box works well). When you click that service, pick “Say a Specific Phrase”.  From there you will tell IFTTT what you want Alexa to listen for after the word “Trigger.” For example, you might enter “3d printer home.” For some reason, the text has to be all in lower case and sometimes you have to spell things like they sound so Alexa will understand. For example, “anet” required me to say “Ahhh-net” which was too hard to remember, so I changed that pretty fast.

Press “Create Trigger” and you’ll now see a plus sign between the word “then” and “that” — press it. Find the service called Webhooks and click it. There will be a single choice called “Make a web request.” Click that.

In the URL box, you can put the whole string you had working in your browser. You can use the non-URL encoded characters here. For the method, select GET and the content type is application/json. You can leave the body field blank. Click Create Action and then Finish. That’s it!

Profit

Now to home your printer just say “Alexa, trigger 3d print home.” IFTTT doesn’t give you much in the way of diagnostics, so if it doesn’t work, you’ll have to play around a bit. I actually changed mine to “3d printer” but I probably need to change it again since I have more than one I need to command.

You can add as many of these commands as you like. For example, the commands “M140 S50 M104 S190 T0” would heat your bed and extruder up to 50 and 190 degrees. You could turn on the fans, home the Z axis (my favorite), or anything else you can do in G code.

You can also do some things that aren’t in G code. For that, you’ll need to read the Repetier API documentation. For example, the copyModel command can start a job, and stopJob might be handy if you are across the room and notice the print has fallen off the bed. For that matter, if you are watching over a web camera and you have an Alexa nearby, that might be really handy!

This is a quick and easy way to add voice control to your printer. You might find it is one of the better uses for your virtual assistant. It would be nice if there was a more secure way to expose the service. Also, I am aware most people use Octoprint and that should be able to pull the same trick. If you’ve managed either of those, please tell us how you pulled it off in the comments below.

What's Hot Today!

Dream Maker Pens – 3D Printing Pen for 3D Drawing, Arts & Crafts, Home School Teaching and Includes VIP FREE Templates, Template Club Access, ABS Plastic Filament – 3D Printer Replacement

Elevate Your Art and Design Time to the Next Level with a Superior 3D Pen!

3D pens offer the opportunity to truly unleash your creativity in more ways than you could possibly imagine. With 3D pens, you can create art out of thin air, making stand-alone structures and pieces with just the push of a button. The ability to make instant freestanding art frees you from the confines of mediums such as canvases and paper.

Why Dream Maker Pens?

Unfortunately, the rush to manufacture and sell 3D pens has resulted in a watered-down market full of inferior products that have a wide range of issues, ranging from device safety to general usability. The Dream Maker Pen was designed with one goal in mind – to solve these problems!

Finally — a Reliable, Safe, and Easy to Use 3D Pen for All Ages

  • Clog Free & Reliable Design
  • Comfortable & Ergonomic design for maximum comfort
  • KID SAFE! Our lead designer has 3 kids and he wanted the Dream Maker to be safe to use by all kids – relax parents we’ve got you covered 🙂
  • High Quality plastic filament rods included for free
  • Patent Pending USB based power adapter
  • Professional, Super FAST (English Speaking) Customer Service

What’s Included?

  • 1 Awesome Dream Maker 3D Pen
  • 3 High Quality ABS Plastic Rod Filaments
  • USB Power cord and Wall Adapter
  • Fantastic (understandable) instructions
  • Design Templates and Design Book PDF
  • Private 3D Design Template Club Access
  • Awesome Customer Service
  • 100% No Questions Asked Guarantee. If you are not happy, we will give you a full refund (no questions asked)

Unrivaled Customer Service and Pricing

SO ORDER NOW – and get your very own 3D pen that is unrivaled in safety and performance! And consider getting one for your Family or Best Friend!

Product Features

  • ARTIST TESTED – hours of research and development to create a perfect, clog free design
  • VERY COMFORTABLE – designed for left & right hands, small or large & hours of painfree and comfortable drawing and creativity
  • FREE PLASTIC RODS – ready to use right out of the box, 3 full plastic filaments included for free!
  • FREE STARTER DESIGN TEMPLATES – book full of instructions and templates of fun 3D projects to help you start creating immediately
  • PERSONALIZED LIFETIME CUSTOMER SERVICE- You Love Them Or Your Money Back For Life – We Keep Our Promises To Our Customers And Treat You Like Family!

Click Here For More Information

What's Hot Today!

How This Fashion Entrepreneur Is Teaching Kids 3D Printing

2015-11-10-1447172755-2443999-35556a29e1138495fb6d8c0c4f093ae3_original.jpg

The gender gap between men and women is closing quickly in many industries across the country. However, the tech industry remains notoriously male-dominated and unrepresentative of the larger population. One of the most pernicious problems that the industry faces is the lack of young women interested in and taking advantage of classes on various kinds of engineering.

Most discussions aimed at fixing this deeply-rooted issue often turn into talks about the industry’s image problem, without realizing that an issue of this magnitude cannot be fixed by the PR department. In order to truly address the underlying issues that prevent many women from being actively involved in all aspects of the tech world, we ought to find ways to nurture girls’ interest in the industry from an early age.

One entrepreneur has found a way to teach girls engineering by making it entertaining and tangible through a nonprofit approach. KiraKira is the brainchild of Suz Somersall, founder of a successful jewelry company that carries her name. In teaching herself how to 3D print jewelry designs for the company, Suz saw an opportunity in teaching other girls how to design and “print” their own jewelry.

In the past year, Suz has turned her attention to inspiring kids to pursue careers in STEM, as well as supporting young women learn about various aspects of engineering. She launched the nonprofit and is currently in the middle of a Kickstarter campaign that aims to open popup schools in NYC, San Francisco, and Charlottesville, VA to teach young girls how to ideate, design and print their own jewelry.

2015-11-10-1447172780-5128317-ad2dc5156f60299d9560cf041fb012d6_original.jpg

The overarching goal of KiraKira, as well as other programs such as Girls Who Code, is to create spaces where young girls can learn and practice coding, engineering and 3D printing. It is clear that people fall in love in science through practicing it and not merely reading about it. These spaces aim to become incubators of future talent and potential for girls of all backgrounds.

When discussing complex issues such as diversity in tech, it is important to remember that “marketing” solutions only address symptoms of the problem and often ignore the bigger (and far more serious) picture. If we really do want more women in tech, we ought to change the way we teach them science and engineering from a young age. It is time to close the gender gap, break down the remaining barriers and achieve true equality of opportunity that starts with education.

2015-11-10-1447172815-35265-b1f3817e6fc3fedd36be5b86f6206bb2_original.jpg

What's Hot Today!

3D ThinkLink Aimed At Teaching At-Risk Students 3D Design and Printing Skills

3D ThinkLinkLynda Mann and Allen O. Cage are the co-founders of the YouthQuest Foundation, a 501(c)(3) organization headquartered in Chantilly, VA., created to provide opportunities for at-risk youth – particularly high school dropouts. The Foundation is focused on academic and vocational development and teaching fundamental life skills.

Now YouthQuest has created a Kickstarter campaign to fund the 3D ThinkLink Initiative, and it’s a plan to use 3D design and printing classes to teach critical thinking and problem-solving skills to those students.3D ThinkLink 2

Launched in early 2013, the initiative is all about helping students prepare for their continued education or to gain employment in STEM-based occupations.  The group’s goal is to raise $8,000 to publish and package an introductory 3D design and printing curriculum, which will include Moment of Inspiration 3D modeling software, a course syllabus, a set of comprehensive lessons plans, supporting videos and student handouts.  The classroom curriculum will be priced at $5,000 and will service a teacher and 10 students. The group also plans to offer a single-user, self-directed package for home use, and that curriculum will be priced at $650.

Once they’ve completed the course, the students will have earned a completion certificate following a performance-based assessment. YouthQuest says they hope sales to online subscribers will serve as a new source of revenue to support their work with at-risk youth – and to introduce a new generation of students to the power of 3D printing.

Darin Janoschka

Mann says this curriculum will be based on the lessons developed during the years spent teaching students in National Guard Youth Challenge programs.

“We’ve seen over and over again that our training does much more than introduce students to the fast-growing technology of 3D printing,” Mann says. “It improves their problem solving skills, stimulates creativity, reinforces STEM education and builds self-esteem. Plus, it’s a lot of fun for them to discover how to turn their ideas into 3D-printed reality.”

The group says anyone who backs the Kickstarter campaign can rest assured that they’ll be helping at-risk kids learn to think differently and make better decisions through 3D programs. The campaign is set to run for 30 days, and 3D ThinkLink will deliver all rewards to their backers within 60 days of completing the funding for their $8,000 goal.

Mann adds that the curriculum packages and videos will be created, in-house, by the group’s Director of Instruction, Tom Meeks.

You can see all the details of the 3D ThinkLink project and the rewards on the group’s Kickstarter campaign here… Will you be supporting the 3D ThinkLink Initiative on Kickstarter? Let us know in the 3D ThinkLink Initiative forum thread on 3DPB.com.  Check out the Kickstarter pitch video below:

What's Hot Today!