mobile app for the robo

I’ve written a new mobile app for the Robo C2 and Robo R2 set of printers by Robo 3D, a local San Diego—based company.

Robo-Home

Details

It’s written in the Adobe PhoneGap (Cordova) platform with Framework7 for the styling and scaffolding. It communicates to the underlying OctoPrint interface inside the printer itself. Rather than building several smartphone apps and being subject to the recurring annual developer fees by Apple/Google/Microsoft, I intend to serve it up in a more economical way: embed another single-board computer inside the printer.

PiZero

This will fit nicely on a $10 Raspberry Pi Zero W computer, as shown. It’s then powered by the USB 5V supply inside the printer and would be powered on every cycle. I’d then use my iPhone’s or iPad’s browser to simply connect to the app.

Progress

The app is fully-functional for the Robo C2 printer and sports a slick-looking interface.

Repository

Screenshots

And here are some obligatory screenshots of the app.

Robo-LeftPanel

Robo-Motors

Robo-Files

 

Advertisements

words are loaded pistols

That title quote is by Jean-Paul Sartre but I was torn between that one and the following for this post:

One great use of words is to hide our thoughts.

~ Voltaire

Scrabble tiles

Was thinking it would be fun to design/print a Scrabble set this morning. And while it was printing I thought it would be even cooler to print extra letters and use them for signage, say, on your desk at work or something. Pretty awesome toy if you think about it; you could have a mugful of letters on your desk and say how you feel on any given day.

I had to tweak Cura’s (slicing software) printer profile to get the holder to print within the print volume since it’s pushing the limits. And I used the new GetToDahChoppa program I wrote for the multi-color printing.

DSC_0227DSC_0214DSC_0225

get to dah choppa

Today’s post title comes from the Schwarzenegger movie Predator but the dialog has taken on a life of its own in the world of memes.

Get-to-the-choppa

GetToDahChoppa CLI tool

I’ve just completed another program written in the Go language compiler which will take an existing GCODE file for 3D printing and chop it into as many layers as you’d like.

Repository

Color by layer

You might be wondering why you’d like to do such a thing. One of the best reasons I could think of would be to print different colors on the same part. In this part example displayed, black filament is used from layers one through seventeen and white is used from layers eighteen and up. The result looks quite professional even if this is using the lowest quality setting on my printer and it took less than twenty minutes to finish.

DSC_0199

Saving an aborted print

Sometimes things go wrong. In the example below, my (costly) carbon fiber—infused filament spool ran out during the print job, noting that the printer arrived with a faulty run-out switch. For most people, they would just start over on such a part, wasting the plastic and the hours spent and begin again.

IMG_0213

Fortunately, you can now chop your original GCODE file to just print the missing top to save the day (and the part, of course).

IMG_0195

keeping busy

Sorry for what must seem like a brief interruption in posts but I’ve been busy lately. Perhaps three weeks ago I left my job at the pharmaceutical company and I’ve now picked up an evening gig two nights per week at a software coding academy in downtown San Diego, having started on Monday of last week there.

Parts

Of course, I’m continuing to print parts on the 3D printer. I just designed a pencil holder and a coin with the academy’s initials as part of the logo and have printed each as samples.

Software

I’ve recently created some programs and plugins in the 3D printer space.

Tutorials

I created a short fifteen-minute presentation for ES6 Let & Const and presented that on Tuesday evening and I just finished a tutorial on 3D printing for them as well. I’m now an instructor so I’ve been reading through their curriculum to get myself up-to-speed as quickly as possible.

Upgrades

I’m currently working on a pass-through for the Robo C2’s now unused filament holder hole through the back of the printer since the dual-spool upgrade has been so successful.

In conjunction with this is the second-extruder upgrade project as well as another to allow my Nikon D3200 camera’s remote shutter release option to be fired off by the printer itself. As part of this, I’ll be moving the speaker to the outside of the printer so that it can be heard better.

I’m continuing on the final implementation for the dual-filament run-out detection block which wants me to do some soldering.

Food

I’ve had some recent successes making tasty meals. One advantage to working less hours is that you now have the time to make great food instead of relying upon packaged dinners. I’ve made some convincing Indian meals from scratch and without a recipe which is new for me. And when I say “successes” earlier, I guess I mean to say that I’ve created what is to me some of the best food I’ve ever eaten (soup, chowder, chili, spaghetti sauce). I now have perfected mango lassi, another Indian favorite, and the basic smoothie recipe. I’ve learned to buy chicken in bulk and then to cook it in a variety of ways which keep it tender and moist while still ensuring that it’s thoroughly-cooked. I routinely pan-flip what I’m cooking like a pro.

Did I mention that I own a toque blanche and a chef’s uniform? I was fortunate enough to take some seminars at the California Culinary Academy. I would say that sauces and breads would be my specialties… or perhaps apple pie.

I’m now batch-making tea and iced mocha for several day’s consumption because I’m like that. I would be baking things to the extreme but San Diego’s weather has been so hot lately that I avoid the oven now when I can. Perhaps next week will cool down a little for that.

go figure

For years, if I needed to write a computer program, I’d have used one of the following: C, C++ or C#. Those have been the mainstays of programmers who needed an executable program for at least the two decades. Today, though, I’ve just written my first executable in a new language that’s surprisingly easy to work with.

Go

The Go language is like the new kid on the block of compilers. Like the ones mentioned before, it will take text and convert it into instructions the computer can do.

Probably the best thing about the Go language is that it’s entirely open-sourced. If you wanted to work on the compiler itself, you could do so.

SlicingInfo

The program I’ve just written is technically called a Command Line Interface (CLI) program and will display technical details inside the selected GCODE file for a 3D print job.

Repository

Typical session of the program in use:

$ SlicingInfo RC_3DBenchy.gcode
Slicer:          Cura_SteamEngine 2.3.1
Layers:          239
Quality:         low
Profile:         Low Quality Robo C2
Filament size:   1.75
Hotend temp:     190
Bed temp:        0
Supports:        False
Retraction:      True
Jerk:            True
Speed 1st layer: 10
Print speed:     50
Travel speed:    80
Infill pattern:  cubic
Finished.

dual-spool coolness, etc

Anticipating a dual-extruder upgrade soon for the Robo C2 printer—imagine printing in two colors for the same part—I’ve designed and printed a dual-spool holder for those two filaments. It’s an upgrade for the printer and works much better than the original holder.

SideView-C2andHolder

The original spool holder stuck out of that rectangular hole in the back of the printer, sometimes falling out during the middle of a print job. Aesthetically-pleasing but impractical, I’ve now replaced the original.

DSC_0062

I’ve created step-by-step instructions for creating two versions: one for the full kilogram rolls and one for the half-kilogram variety.

Repository

Stability

Another design challenge with the Robo C2 printer is the way that the print bed is cantilevered from the back of the printer. It’s a bit like a diving board and similarly wobbles at its front-most extremity as you’d expect. This isn’t really optimal for 3D printing because it results in poor quality with taller parts and especially those which are oriented toward the front of the printer.

robo

CantileverStabilityPlate

I’ve therefore designed a cantilevered stability plate to afix to the bottom of the print bed itself which should provide some firmness in this dimension. Eight M3 type aluminum bolts are the only thing needed other than this part.

Repository

da plane

Obviously, I watched too much television growing up. Every week on Fantasy Island, Hervé Villachaize’s character would point to the sky and make this exclamation.

da-plane

In a 3D printer, it’s really important to start printing on a known, flat plane. And yet, many print beds aren’t made of something rigid like glass so bigger parts end up shaped like the print bed itself. Even small deviations can mess up a print. It’s a problem to be solved, actually.

OctoPrint

The software that’s running on my Robo C2 printer is a fork of the popular OctoPrint open-source software. What’s cool about this software is that it will allow you to write plugins to adjust the way it works.

GCODE

The language the printer listens to during the print job is called GCODE. Think of it as a list of common instructions that almost all 3D printers use now.

Autoleveling

One of the GCODE commands in question is G29 and this tells the printer to run through an autoleveling routine. In some cases, the printer’s extruder will actually touch the print bed in several locations. In others, the extruder assembly will use a light plus a photoresistor to hover above the bed and to gauge its height above it. Using either method, the printer can make a reasonable “map” of the print bed and mathematically create a virtual plane to represent it. If the print bed is a little lower on one side, this routine should allow the printer to compensate for that.

Only…, it doesn’t really work that great, to be honest. Someone deserves a round of applause for trying to fix the problem but honestly, a manual approach is possibly the better way to go here.

Although these printers have a built-in autoleveling feature, manually leveling the print bed is preferred by those who are more advanced at 3D printing.

The Problem

I’m currently now working to manually adjust my print bed so that it is perfectly level and an exact height from the extruder. In fact, I have two replaceable print beds for the same printer so both of them need to be perfectly level and exactly the same height all around. To complicate matters, I anticipate designing and creating a third print bed for this which is heated. And that one should also be perfectly level and the same height as the others. The final goal will be to easily and quickly swap print beds without the task of fussing with any settings.

So now, having created a number of GCODE files over the last four months, I really don’t feel like editing them to remove that unnecessary G29 command. Once you’ve manually leveled everything, an autolevel routine is not only overkill but it can cause problems to the print quality. I needed a way of programmatically switching off the command when seen.

The Solution

I’ve created an OctoPrint plugin which helps to solve this problem. Assuming that I no longer need autoleveling at the start of each job, the plugin tells the printer basically to ignore any G29 commands. I now don’t have to edit countless GCODE files or worry if someone sends me a file—the printer will dutifully ignore this command.

Github:  Toggle Autolevel plugin

 

so many operating systems, so little time

Sometimes you need to do many things with the same hardware. Say, for example, you might need both Windows 10 and a Linux-type of operating system on the same computer. Here are some of your options for this.

You might say, “why would I want that?” There are times when you want to try out something new. You might need to test software compatibility with something you don’t have currently. You might purchase some new software or a printer which isn’t compatible with your current setup. Or, like me, you might be endlessly curious about the possibilities. You might want to create a smartphone app and need to see how that looks on a variety of phones.

Boot from a “Live” media

In this case, you have Ubuntu on a CD or on a USB thumb drive. You boot to this media and select the live option from the menu (“Try Ubuntu without installing”). You then get a Desktop experience running Ubuntu (Linux) on your existing hardware and you don’t even have to install it in the classical sense. Once you shutdown this system and remove the media, nothing whatsoever has changed on your original hard drive.

TryUbuntu

I’ve used both methods (CD and USB) and will attest that the latter will boot up faster than anything you’ve seen before, I’d guess.

Pros:

  • It’s very fast to boot this way from the USB drive.
  • You can try another operating system without making any changes whatsoever to your existing computer.
  • It makes short work of hacking a Windows-based computer if you don’t know the password(s) and accessing the files on its partitions.
  • It seems to be wonderfully compatible with a variety of computers and laptops without fussing with drivers.
  • Each session takes advantage of all the available RAM.

Cons:

  • Unless you change the defaults, any changes to your Desktop and configuration are lost upon restarting this session.

Set up two partitions and select one upon startup

In this case, you shrink the size of your existing hard drive’s partition to make room for another operating system.  You then install the new operating system to this second partition.

Upon restarting the computer, you then select which partition (operating system) you’d prefer.

GRUB

This technique is often called “dual booting”.

Pros:

  • The settings you change will be saved from one session to the next.
  • In many cases, you can access files on the other partition(s) if you know where to look.
  • You can take advantage of fast hardware like that on an Apple computer to use other operating systems like Linux.
  • Technically, you could install Windows 7 on one partition and Windows 10 on another.
  • This technique can be extended to many operating systems on many partitions.
  • Each session gets all the available RAM.

Cons:

  • You have to reboot in order to get back to the other operating system to use its tools and software.
  • In the case of OS X, major version upgrades usually try to overwrite the menu at the beginning which would normally allow you to select the other partitions. It’s almost as if Apple doesn’t want you to do this and breaks things on purpose, of course. If you’re technically-minded, you can fix this each time however.

Set up a virtual manager (VM) and “spin up” an operating system

This seems to be the preferred and newest method these days. You run a virtual machine manager, create a virtual computer using this technique and then install the new operating system to this.

QEMU

You then boot up the virtual computer and you see this as a window on your Desktop.

XP

Pros:

  • You can copy/paste from a Windows application into a Linux session’s Terminal session or any similar combination of from/to.
  • For demonstrations, you can easily show that something works with multiple operating systems (without rebooting or bringing multiple laptops).
  • Depending upon how much hard drive space, RAM and processor speed you have, you could potentially run several virtual machines at once.

Cons:

  • Technically, it’s the most challenging of the various options and the learning curve is steep.
  • It may require more RAM memory than what you currently have for this to run well.

Progress so far

I have plenty of experience using the first two methods above (live- and dual-boot) but have recently been working with the VM option, as described below.

Dual-boot MacBook

I’ve setup my MacBook Pro to boot both OS X and Ubuntu. It seems to work great so far. I hope to next setup a VM so that I can emulate a Raspberry Pi computer within the MacBook itself (for development purposes).

HP Laptop

I’ve setup my HP laptop to boot Ubuntu and have added a VM which has Windows 10 loaded in it. Remarkably, the Windows 10 install actually works better than the original (native) installation on this laptop.

Multi-boot Raspberry Pi computers (IoT re-purposing)

Since the Raspberry Pi (3 and Zero) computers have an easily-replaceable microSD card in them, I now have a small library of different images with which I may boot any individual computer. It’s just important to label each to avoid confusion.

So I might pull the microSD card for the robotic tank project out of a Raspberry Pi, replace it with the card for the closed ecosystem or for a different project altogether. Once it boots, it’s now a completely different computer, if you will.

microSD

Multi-boot 3D printer

Technically, the Robo C2 printer has a Raspberry Pi computer inside so it makes it easy to boot to different versions of the software. This is useful when you’re modifying things to add on new features, for example.

Smartphone software on a workstation

I’ve also had the opportunity of installing Android on a standard Dell Vostro 200 desktop computer. (It’s good for testing software and websites.)

Cloud-based alternatives

There are entire services available at Microsoft, Amazon and presumably Google in which you “spin up” a virtual computer and remote into it.

Amazon’s offering is called EC2 and I’ve had the opportunity to use it in the past. In the span of two hours, I was able to spin up or “instantiate” a virtual SQL Server in a datacenter somewhere, to upload a corrupt database, fix it there and then to download it back to me. I then killed that virtual server. The total cost was something like $4 to “borrow” their virtual hardware for a couple of hours. Compare this to the cost of purchasing an actual server, paying for Microsoft licensing, waiting for everything to arrive, setting it up, etc. I literally saved thousands of dollars with a service like this.

Microsoft’s offering is called Azure. I can’t say that I’ve used it yet but it works essentially in the same way that EC2 does: define an instance, spin it up and remote into it.

Looks like Google’s offering is their Compute Engine. It sounds like they’re trying to play “catch up” to both Amazon/Microsoft on this one.

There’s another player in this space, MacInCloud.com appears to be offering remote sessions into what are likely discreet/physical Apple computers. For all practical purposes, it would likely behave like a virtual computer might.

Private cloud

And finally, I had the opportunity to re-purpose about eight Dell Vostro 200 computers from work into a MaaS (metal as a service) private cloud. The underlying layer of software which did the cloud part is called OpenStack which allows you—like Amazon itself perhaps—to be the host for spinning up virtual servers.

It takes a lot of work to get the initial one or two computers running for this. But then, using a concept called Juju charms, you select what are essentially recipes of things to install which have complicated inter-dependencies and it seems to make it all work for you. Seeing these things run is pretty impressive given that this is in the free, open-space world.

The future

It’s hard to guess what’s next in this series of events. We may soon be running a VM with Windows 10 on a wearable single-board computer like the Raspberry Pi 3 or similar. In theory, then, you might wear a pair of Google Glass(es) or the Microsoft HoloLens which would interface with the Pi computer via Bluetooth. Given the lack of a keyboard, presumably the interface might be like the Amazon Echo/Alexa service: you ask for something, the system must recognize the command, submit it to a server and display the results or iterate through them via voice.

And yet, given the augmented reality (AR) side of things, you might say “keyboard” and a virtual reality keyboard could appear on the physical horizontal space in front of you and you just “type” on an imaginary keyboard to input data.

The interfaces could evolve to project these virtual keyboard-type interfaces onto an imaginary glass wall in front of you, much the same as you see in sci-fi movies these days. These glass-like devices probably would incorporate an outward-facing camera to catch and interpret your hand movements into discreet commands like typing, page-forward, scroll-down, dismiss window, etc.

GoogleGlassHololens

j.a.r.v.i.s.

Imagine being able to have a conversation with your 3D printer much in the same way that the Tony Stark character of Iron Man did with his butler-esque virtual companion J.A.R.V.I.S., as voiced by the very talented Paul Bettany.  How cool would that be?

jarvis

So I thought I’d work on an upgrade to my Robo C2 printer to add this capability.

Amazon Echo (Alexa)

Fortunately, Amazon has a product called Echo with an underlying personality & service named Alexa. Since they’ve made the source code and service available to developers, I’ll be using this to get started. For the commercial product, you’d say “Alexa…, what’s the local weather?”, perhaps and she might “read” a brief report for you. And by “read”, I mean:  “a text version of the weather report queried response would be rendered into sound using a female’s voice and played on a speaker”. (We love to anthropomorphize these things now that computers are getting so smart.)

Raspberry Pi

The Robo C2 printer has a Raspberry Pi 3 inside and I’ll be incorporating this into the project; I’m fairly familiar with how this computer works.

Since the price of the official Amazon Echo is about $100, this strikes me as being too expensive since all I really need is a single board computer, a microphone, a storage card and a battery. The Raspberry Pi Zero W fits that description and weighs in at a mere $10.  Technically, I’ll also need a speaker but since I’ve just upgraded the Robo C2 with sound events then I intend to push my generic Echo’s sounds over to the printer to play them there. This will help in the illusion that I’m talking to someone/something “over there”.

Wake Word

The Echo technology out-of-the-box recognizes the spoken word “Alexa” so that it might then attempt to turn your subsequent spoken commands into something recognizable, a “skill”. I’ll be updating it to recognize the spoken word “Jarvis” instead.

Custom Skills

Beyond the included skills, the service allows new user-defined skills to be created and then they’re part of Alexa’s talents, if you will. I shall be creating custom skills so that I might then do a number of tasks with the printer, hopefully to include sending a new job to print. It would also be good to know the status of an existing job without necessarily reading any of the available displays/consoles for this information.

From what I understand, these new skills are a collection of intents and utterances with optional slots as variables.

OctoPrint

The underlying printing software behind-the-scenes on this printer is called OctoPrint. It’s suggested that it’s already compatible with Alexa so we’ll see if that’s accurate.

Size

It should be rather small and handheld. The board itself is about the length of three quarters. I have two different microphones for this—I’ll try to use the smaller of the two. Initially, I’ll use a barrel type of USB charger but I’ll then knock that down to a smaller style when that’s working. I’ll likely solder the accessories if they seem to be happy. And then finally when I’ve settled on the accessories and such, I’ll design and print an enclosure for it. I may or may not include a wake-up button.

PiZero

Custom Voice

I would like to replace Alexa’s voice personality with sound events from the J.A.R.V.I.S. movie character. I’ll see what it will take to make this happen. By keeping his responses to a few generic ones, I might just replace the outbound render-to-text routines so that they just pull from the stock responses as recorded and stored.

Progress

  • The sound event upgrade is now on the printer (imagine a Robo C2 printer making R2D2-like sounds to let you know when something has occurred)
  • I have all the parts I need for Jarvis
  • I’ve created a developer’s account on Amazon and have created my Alexa service for Jarvis
  • I have the Raspberry Pi Zero W computer’s operating system installed
  • The AlexaPi source code is installed and the service is running
  • The microphone appears to be working as expected
  • I need to read through the various tweaks required since I’m running on a Raspi Zero instead of a different version
  • Re-purpose the onboard LED on the Pi to work for the voice recognition notification
  • I need to install the new wake word for “Jarvis” instead of “Alexa”
  • I need to create one or more skills for things I need the printer to do like report status, turn off/on the webcam or to start/stop a job
  • Record and store patterned responses from the Iron Man series of movies to be played on the Raspi 3