small screen for the raspberry pi 3

I thought I’d do some prep work for a project that I’d like to finish before the Christmas break:  a time-lapse rail kit for the Nikon D750 DSLR camera. I’ll be going to Arches National Park in Utah for that week and wanted to do some astrophotography and sunset time-lapse videos. Here’s vaguely what the rig will look like:

pi-lapse

This photographer/inventor David Hunt has done a pretty good job on his rig and has produced some stunning videos. I hope to take things up a notch since I have access to a 3D printer and a variety of extruded 80/20 aluminum rails from ActoBotics, for example.

Oh… and the entire rig will need to be portable since I’ll likely be backpacking it into the park. Fortunately, I have a sewing machine and a good supply of marine-grade canvas to create something to hold and carry all of this.

TFT

Fortunately, Fry’s Electronics sells some of what Adafruit has to offer and in this case, it’s a tiny TFT screen with a touchscreen built in. It’s technically called a “Pi Hat” since it connects right to the top of a Raspberry Pi 3, for example.

adafruit-1601

I’ve got it connected to a Raspberry Pi 3 and have inserted a new 4GB microSD card for this project and furthermore, have loaded Raspbian Jessie Lite for that image. Although my version won’t have a nifty graphical desktop like the photo above, it will still run touch-based graphical menus.

Python

Looks like I’ll be using the Python programming language for this project. I’d prefer JavaScript but I only have a few weeks to get this “production-ready”, so to speak.

Kivy

The next step in developing graphical menus which respond to touch is to install the Kivy  framework for Python. The menu should allow you to set some configuration options for the spacing of the photos, the number of photos for the series and things pertinent to stepping the camera along the rail using a motor. Finally, there would be start and stop features for each session as well as on-going status.

Nikon

The Nikon D750 has a remote-shutter system and I’ve managed to find a good third-party version of the cable which should come in handy for this. I’ve spec’d out that interface so I should be able to remotely fire off the camera from the Raspberry computer.

Overall

This should be a fun project. I hope I can finish it in the perhaps five weeks left before Christmas break.

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.

responsive developer mode

I found an Easter egg today. It wasn’t outside, leftover from months ago. It was hiding in my Safari browser all along, a poorly-documented keystroke which I tripped over today.

responsive-developer-mode

Cmd + Option + R

I was looking for the hotkeys in Safari in order to reload a page without using the cache. I’d guessed that it was some alteration of the standard Cmd + R combination for refreshing the page and was trying those combinations, only I got more than I bargained for.

Browser Options

From the interface, it looks like I can select different browsers, to include Chrome and even Internet Explorer.

browser-options

Screen Resolutions and Portables

Looks like I can change from the standard OS X to iOS as well, see what things look like on some of the iPhones, three sizes of iPad and a few screen resolutions for desktops as well.

Toggle It Back Off

And of course, you can toggle the mode back off again with the original key combination of Cmd + Option + R.

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

 

the matrix linode’d

Today’s review is about a pretty decent hosting company called Linode. Here’s the three-day timeline from idea to implementation:

  1. Thursday: decided to create a new info website about 3D printing, bought the domain name on GoDaddy and waited for the changes to take effect at midnight
  2. Thursday: created a Github repository to store the source for the website since I’m open-source like that
  3. Thursday: created an account on Linode, purchasing a “linode” for that
  4. Thursday: designed/created the initial local/development website layout/framework, collected images and content
  5. Friday: created (provisioned) the basic linode (virtual machine) for the website on production, provisioned a virtual drive, deployed Ubuntu 16.04LTS onto that, booted and remoted into that, ran updates, installed the framework, added the website, setup security and the firewall
  6. Friday: adjusted the DNS at GoDaddy to point to the new server, added more content
  7. Saturday: launched the website on Linode with the initial version
  8. Saturday: tweaked the settings to make the Node.js—based website start on bootup
  9. Saturday: added more content to the website

site

Not bad for an open-sourced 10-page (44 files) responsive website, if I do say so myself.

Please note that when I say “hosting company”, I really mean a “virtual server provider” so this is more like Amazon EC2 as a service offering. I didn’t just rent website space (like on Wix.com or WordPress.com), I rented an entire virtual server, if you will.

Comparison of virtual server versus website space

There are some advantages/disadvantages of renting a virtual server over just some website slot on a server somewhere:

Pros:

  • In theory, you could run several websites from a virtual server
  • You can run services in the background (like Node.js) and manage them
  • You can run multiple threads on the same server, like helper routines which do something other than serving up pages
  • You’re not limited to the set of templates that are available from Wix.com, for example
  • Your website runs separately from other websites
  • You get an IP address which is only used for your website

Cons:

  • You have to setup security yourself since you’re responsible for the entire server
  • The learning curve is steeper
  • You have to know I.T. things like setting up servers and installing software

Framework/software

Here’s a list of what I used for this website:

  • Node.js: Probably the most famous event-driven JavaScript runtime engine out there
  • Express: A minimalistic Node.js framework for separating code from content on a website
  • Bootstrap.css: A responsive stylesheet and component library for styling a website
  • PM2: A handy process manager for Node-based applications on a server.  After pulling new code, I might run the command pm2 restart AppName to restart the service

Documentation

Kudos to Linode for providing a detailed Getting Started guide along with several tutorial videos on the subject.

And further, a note of thanks to PM2 which seems to satisfy the requirements of bringing up and managing a Node.js application as a service within a production environment and their ample documentation.

Suitability

Is Linode well-suited for most website designers/developers? Probably not. On an I.T. complexity scale from 1 to 10 potatoes, I’d say they’re probably seven potatoes, perhaps. In this case, you’d have to be comfortable doing the following:

  • Using a web-based console to allocate and bring up/down a virtual server
  • Using ssh to remote into your virtual server
  • Navigating within a command line interface on a Linux computer or similar
  • Using ssh-keygen to generate a keypair
  • Using apt-get to update things
  • Editing files using nano
  • Managing services, reading log files
  • Remotely rebooting your virtual server
  • Setting up a firewall, testing and managing same
  • Applying code using git
  • Testing a website to verify that there are no 404 (file not found) type of errors, for example
  • And obviously, creating/designing a website in the first place and using a repository like Github for storing those files

That said, it was a perfect fit for me since I can do those things. In fact, the Linode-related part of this took no more than two hours since this is the first time I’ve used their interface. My next one should go much faster.

Observations

I will say that I’m impressed. Unlike Amazon AWS, Microsoft and Google, the people at Linode haven’t created an interface that’s overly complicated. It seems to work simply and to do the things you need to do and those are: 1) buy a virtual server, 2) deploy something onto it, 3) turn it on and 4) remote into it. I don’t think the “big three” have figured this out yet; their interfaces and the assumed workflow requires too much research, in my humble opinion.

Additionally, the PM2 software does a great job of working with the git-based code distribution model, allowing you to restart the Node.js app when it’s required and to start up automatically each reboot. There’s an easy-to-remember command interface like pm2 show AppName which tells you what you usually want to know.

At a cost of $5/month, it compares favorably to most of the well-known hosting providers out there. The basic linode will likely satisfy the requirements of the average Node.js application up to a reasonable level of simultaneous users, I’d suggest.

price

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