Categories
Uncategorized

uArm Swift Pro Plotting

urm-swift-pro-00

We recently got a uArm Swift Pro robot arm at Brinn Labs and I’ve been putting it through its paces. It comes with software called uArm Studio that lets you do a lot of things, but for this post I’ll focus on drawing (or “plotting”) using a pen.

heart-bw

One of the tools I’ve used in the past with the Egg-Bot was StippleGen2 from our friends at Evil Mad Scientist Laboratories. StippleGen2 is a program written in Processing that takes an image and converts it into a series of lines, or more specifically, a single line, which is suitable for plotting.

Above is the image I started with, an “8-bit heart” as I call it. It’s a simple black and white image of a low-res heart. (Great for Valentine’s Day, right?)

heart-tsp

After running the heart through StippleGen2 and choosing the appropriate complexity of the line drawing I wanted, I saved out the file as an SVG format vector file. Perfect for plotting. (In fact, since it’s a single line, the z axis never has to move up once it starts.)

uarm-studio

I fired up uArm Studio and chose the Draw/Laser feature, and then loaded in the SVG file. I did have to scale it up a bit, as I still don’t have the exact dimensions I should use for artwork in uArm Studio.

Once the file is loaded, you hit start and there’s a step where you set the z axis so it know where the pen hits the paper. At this step, I wish there was a little more control over how the z axis moves. I think the smallest increment is one millimeter, and I think it should be smaller. (Most CNC software has some adjustment to how much you move things, so I can see adding in 0.5mm and perhaps 0.2mm as well.)

urm-swift-pro-01

While the uArm Swift Pro is awesome, I’m still going to be a little critical… One of the issues I’ve come across in the Draw/Laser part of the software is that the speed seems to be hard-coded, with no way to adjust it to go faster (or slower.) As someone who understands G-code and how CNC machines work, I found this a little annoying…

urm-swift-pro-03

So I set about to find a solution. I first posted a message on the forum, but then Chinese New Year hit and it seemed as though it would be two weeks (or more) before I got an answer. I had dug around and found that the G-code created by the Draw/Laser part of the software generates a file and drops it at ~/uarm/Temp/files/gcode/tmp_pen.gcode and I assumed that by editing the feedrate in that file, I could speed things up… I was right!

urm-swift-pro-04

My first attempt was to connect with the arm using Universal Gcode Sender, which in this case was not universal, and failed to properly talk to the arm. I dug around a bit more and found simple_stream.py which is a Python script to stream G-code to a device. Sadly, it was not compatible with Python3, but luckily, I’ve been writing a lot of Python lately, so I fixed it.

After I got it working (that is, after much hacking at the original code) I found that I could easily speed up the drawing to half the time. In this case, 5 minutes with the Python script versus 10 minutes with uArm Studio. For TSP art, great precision tends not to matter too much, and I think I could speed it up even more.

I’ll work on cleaning up my Python code and seeing if I can get it online in case others want to muck around with it.

Update: Code is here: https://github.com/raster/uArm-GCode-Streamer

Categories
Uncategorized

Rectangle Chaos

rects-01

I started playing around with the #plottertwitter thing and wanted to do some creative coding with Processing, and at least one person asked about the code, so I’ve included it below.

rects-02

Instead of drawing a rectangle, I’m creating a shape, and then varying the position of it a bit more with each row that is drawn. I reused some code I’ve used plenty of times before that keeps track of where things are drawn so the code knows when to start a new row, and when the screen is filled. After it draws a screen full it will save a PDF and exit.

Once you have a PDF (which is a vector file) you can make your plotter (or laser cutter, or CNC machine) do what you want with it. I typically bring the PDF into Inkscape and make any adjustments needed before I save it out in a format suitable for the machine I’ll be sending it to.

Find the code on Codeberg: Rectangle-Chaos

If you make something cool with this code, let me know! I’d love to see what you come up with.

Categories
Uncategorized

I blowed that snow with a battery…

snow-blower-01

Let me tell you about my history with snowblowers… Around 2000 I got a used snowblower from a rummage sale. It was corded, but I had extension cords, so I wasn’t too worried. The seller let me plug it in and test it. It worked! and it was like $15 so I got it.

The first time I tried to use it I went out to the garage, tried to fire it up, and it wouldn’t run. Dead. I took it in the house to work on it in the basement, and no luck. I let it sit in the basement, went outside and shoveled for hours, and tried it later in the day (still in the basement) and it worked fine! After much investigation I discovered it didn’t work well in cold weather. Yeah, a snowblower that didn’t like the cold. I kept it in the basement and used it occasionally but to be honest it was small and under-powered, and I got sick of extension cords.

Fast forward to 2013, new house, new places to blow snow away from, including the section between the garage and the alley, and part of the alley. My family has a way of saving old things, even when they get a new one, so someone got a new snowblower and gave me the old one, which was a monster of a blower that my grandfather used to own. This one too, sucked instead of blowed. It was gas powered, but had an electric start, and despite being a large metal beast, seemed to die a lot in heavy snowfall. It also didn’t like to start. And worst of all, I had to pull my car out of the garage just to get it out of the garage. I gave it away last year…

snow-blower-02

So instead of using a 20 or 30 year old snowblower that uses gas, and oil, and filters, and all the things I hate, I got an electric snowblower that uses a 40 volt Lithium battery. Battery technology has improved tremendously over the past decades and if I can avoid gas engines and extension cords, I’m all for it.

We now have a Greenworks G-MAX 40V 20-Inch Cordless Brushless Snow Thrower. I got to use it today and it worked. Cutting the first path took a bit of time, but with a 20 to 40 percent step-over, it did a good job with 15 centimeters of snow. The 4 amp-hour battery was enough to do the sidewalk and most of my two neighbor’s sidewalks, but it ran out of juice before I could do the alley, so I went in the house, charged it to about half-charge while I had breakfast, then did the alley.

I should note that I specifically wanted a “small” blower, and the 20″ model allows me to maneuver it around the cars in the garage with ease. This means I don’t have to move a car into the snow covered alley to clean the alley. It’s a win in my book. It’s also mostly plastic so it’s easy to lift if I do have to carry it, which came in handy getting down the steps to the sidewalk.

This is not a blower that will have you powering through deep snow at a fast walking pace, you’re going slow, or you’re knocking your step-over rate down quite a bit after the first path, but for the size of it, that’s understandable. I don’t have a 50 foot driveway or the space for a large monster blower, so I’m happy with what we’ve got now… it’s better than shoveling, because to be honest, I’m gettin’ too old for that shit.

I’ll probably get another 4 amp-hour battery, just so I don’t have to recharge mid-job, and with two spare 40 volt batteries in the summer, I may see if I can run my 36 volt Neuton lawn mower with them as well.

Update: I did get a second battery… and eventually a Greenworks Lawn Mower, and I am happy with both of them.

Categories
Uncategorized

Raspbian on Intel

eeepc-raspbian

Back in 2007 I got an Asus Eee PC, one of the fist netbooks, which were tiny laptops that (typically) ran Linux. It served me well for quite a while and I eventually turned it into the controller for my RepRap.

After I had it for a year or so my partner’s old laptop died and we were looking for a (cheap) replacement, and by that time you could get netbooks that ran Windows. Granted, it was Windows XP, but hey, it was over a decade ago. She used it for a few years until I got her a (used/cheap) MacBook Air and her old Eee PC 901 sat in my office doing nothing.

In the most recent cleaning fit I found it and was about to drop a lightweight Linux onto it (probably Lubuntu or Xubuntu, which I’ve used in the past) but then I remembered there was a Raspbian Pixel distro for Intel machines (aka “Mac and Windows” computers) so I burned a disk, booted it up, and it was like the old days of install Linux on dodgy hardware! Manual disk partitioning, errors, multiple tries, but in the end, it worked!

So I’ve now got a laptop running Raspbian Linux. And since it’s old hardware it probably runs at a speed close to a modern-day Raspberry Pi, but has a built-in screen, keyboard, trackpad, speakers, etc. It’s like a portable Pi. (Sort of.) The one tricky thing is that when installing software you need to grab the Intel version, not the ARM version… but other than that, it’s like a Pi without the GPIO stuff. I can see it being useful for developing and testing things in a Pi-like environment with Raspbian. Maybe I’ll use it for something.

Categories
Uncategorized

Python is (supposedly) Easy!

I decided that in 2019 I would dive into Python. I’ve used Python before, but I’m not at the level I want to be with it. I’ve developed a comfort with Perl over the last 20+ years, and it’s lived up to the name of “Swiss army knife” or “Swiss army chainsaw” of scripting languages. I’m sure I’ve written hundreds (thousands?) of Perl scripts to get things done over the years.

Python has been a bit different. I nearly jumped into Python in my former career when we were about to embrace Zope, but that didn’t happen, so I didn’t really get into Python. I started using Python a lot more seriously when I realized that support for Python on the Raspberry Pi was pushing way ahead of Perl on the platform. Add to that the stuff happening with CircuitPython and it’s the direction I want to go.

So let’s get started! First of all, I had to get Python3 installed, as Mac OS X ships with an older version. This is similar to how things worked with Perl, so I got Homebrew running, got Python3 and PIP working, and started writing some Python.

I also found Mu, a simple Python editor for beginner programmers (probably through Adafruit) and it seemed like a nice little editor to experiment with, and worked with CircuitPython.

python-001

I should note that learning a new (computer) language is probably easier now than it was 25 years ago. I remember printing out documentation and reading through it, highlighting things to try when I got in front of a computer. Twenty-five years ago I didn’t have a laptop or an always-on Internet connection, and the resources were not quite as abundant. Anyway. I wrote some code!

Above is a simple Python script to list every file in a folder. This is (or should be) dead simple and is needed in many scripts. When I ran it in Mu, it showed some output, but not all of the output I expected. I ran it again, and it showed something different. I ran it again, and got output I did not expect.

python-002

So I did what anyone who knows the command line would do, and ran the script there. It worked as expected. Perhaps it’s a bug in Mu? I searched the issues in GitHub, and did some general web searches, and didn’t find anything. Weird. I liked Mu and didn’t want to abandon it, as I want to use it with CircuitPython, but is there some weird buffering bug?

I remembered that one of the most amazing things about when I first started using Perl was how fast it was. At least compared to AppleScript or UserTalk at the time. Maybe I’m going too fast…

python-003

I added one line to slow things down. I know that in other Python scripts I’ve used or written in the past few years that time.sleep was often used. Adding in a slight delay made the expected output get outputted. Weird. Whatever. Now I know… I guess?

When I started with Perl I wrote a bunch of simple scripts to learn the language. (I’ve done this with Processing, Arduino, and other languages/environments.) When I learned how arrays worked in Perl I wrote a script named “array.pl” and kept it around as an example. Same with “hash.pl” and “time.pl” and so on. As I was learning things I’d reference these files to get a quick look at how a function worked.

python-004

I wrote a script named “random.py” and it was dead simple, with just 3 lines, and the first line didn’t really do anything but I’m in the habit of using shebang lines because I’ve been around the *nix block a few dozen times. So really, two lines, an import and a print.

python-005

When I tried to run a Python script just slightly more complex than “Hello World” I got an error… Python nerds may have figured out what went wrong at this point.

python-006

Just for fun I dropped the code into Mu and tried to run it… of course you have to save your script before you can run it so… Ahhh, I guess I cannot name my script after an internal function/file that Python uses. At this point I’m just angry, and disappointed that now I have to somehow know what is and is not an acceptable filename for a Python script. I’m sure in the future I’ll name one wrong and it won’t work and I’ll spend more time than I should trying to remember this. (Hopefully I’ll find this blog post.)

python-007

I changed the name to random-test.py and it worked fine. Damn you, Python! But I remain undeterred, and I plan to continue on with Python. In fact, all of the stuff above is part of replacing an old Perl script I had running on Raspbian to be written in Python. So… progress! Welcome to 2019, Python.