Thursday, February 21, 2013

Robotics 2: First Demo

For my Robotics 2 class, my project is to have an ST Robotics R17 arm take a picture of you and draw it. Tomorrow is our first demonstration for our class, so as a first milestone, we fed it a picture of a circle, which it then scales and draws on paper. (See below for how it works.)

Unfortunately, the arm thinks in Forth, which is an ugly, archaic programming language from the 1970s which uses reverse Polish notation for basically everything. (If you've never heard of RPN, look it up on Wikipedia and prepare to chuckle.) We don't really want to do ALL of our work in Forth; but luckily, there exists a reasonably pleasant LabVIEW wrapper which allows us to pass Forth commands to the robot. That way, we can do all the thinking in a less stupid language.

First, the image is processed a little bit. We start off by reducing it to a binary image rather than one with all those confusing colors - this isn't very hard, since our test image is a black-and-white circle. We then find all the contours - also easy, since there's only of them - and approximate it as a whole bunch of points not too far from each other. Then we can just output to LabVIEW a whole bunch of (x,y) coordinates - the vertices we want to hit. These (x,y) coordinates are scaled so that we can draw on paper of the size we want rather than the size of our computer screen.

Here's where the Forth comes in, and it's a little ugly. We have to create what's called a "route" in Forth, which is just a whole bunch of points in a list. There's a shockingly large amount of obnoxious syntax that goes into this, but that's not very interesting to read about. Just know that it sucks.

Once the route has been made, we're ready to send commands to the robot. The arm calibrates and goes home so that it has somewhere to start, and turns its wrist down so that it's ready to write. Finally, we send it on the path we told it to go on. It automatically smooths out the corners, which is very polite of it. (Thank you kindly, Robot.) That's as far as we've gotten thus far, but expect more status updates later.

Next steps include: Having it draw more interesting shapes, having it detect multiple contours, allowing it to use different colors, and having it shade in or cross-hatch regions.

And would you believe my team thinks Robotticelli is a dumb name?

Tuesday, January 1, 2013

Backlogging: Old CAD renders

One activity that I've particularly enjoyed is CADding - sometimes for practical purposes, usually just for fun. Here are some of my old renders from assemblies I've built in the past. (The software used is SolidWorks 2012.)

One of my very first CADs, as practice: just a bell I found lying around.
The underside of that same bell. It's slightly more interesting than the top.
My old Gameboy Color (special Pikachu edition, of course).This one was also just for fun, and probably my proudest CAD.
The actual Gameboy has since been retired after sustaining significant injuries.

An actually useful CAD: Antoine the Ant, my Design Nature transporter project from first semester. This was built by me and three teammates; I was responsible for the legs. The final product was a remote-controlled ant which could walk around and pick up objects with its jaw, in a game targeted toward nine-year-olds. And yes, we got real nine-year-olds.
Back to the just-for-fun designs: My laptop charger. I believe this one was over winter break after my first semester.
A proposed idea for a loft for my sophomore dorm. This was built for the first ASME/Olin CAD-A-Thon in spring 2012. (I'm not sure of the proper name.) In retrospect, this it was an awfully inefficient loft, but it had some fun ideas in it. I liked the idea of jungle gym-style rungs to climb up, and I am remiss that our current loft doesn't have a fireman pole.

Unfortunately, I haven't been CADding as much lately as I'd like to, so hopefully I'll find an excuse to get back into it.

Starting with Arduino: Potentiometer-Controlled LED Dimmer

So actually, the event that catalyzed the starting of this blog was that I've started tinkering with an Arduino. I received an Arduino last week, and then the other day I went to RadioShack to pick up a couple components: some resistors, LEDs, switches, wire, a photosensor, a crummy little speaker, and a pot, so nothing fancy.

Today, I began messing around with my new toy. I've connected a 10kΩ potentiometer to the analog input, and a red LED (with a small resistor) to the digital output. The code is incredibly simple: it reads the value of the potentiometer, on a scale of 0 to 1023, and maps that to a more usable scale of 0 to 20. (Let's call that mapped value "x.") Then there's a simple pulse-width modulation, where the LED is turned on for x milliseconds, and then turned off for 20-x milliseconds. That way, the illusion of dimming is created, so that the LED's brightness appears to vary as the potentiometer is turned.

The LED lit brightly...

...and more dimly.

Unfortunately, my potentiometer kind of sucks, since I was buying on a budget. The bottom 10% or so reads to 0, which is unfortunate, because that means the LED turns off way too fast at the end. C'est la vie - all the parts are in place, and I've learned a little about interfacing with an Arduino, which is pretty neat. Now I just need to figure out more things to make.

The Obligatory "About This Blog" Post

This blog is really for me more than it is for anyone else. It should be reasonably self-explanatory: When I make things, I'll post them here. This will allow me to go back later down the line and check out stuff I've done. This may be used for inspiration for new projects, for a portfolio, or just for reminiscing - I don't really have a long-term plan. So, let's see where this adventure takes us!