posts tagged with the keyword ‘button’

2012.01.06

The Three Buttons

Always there are three: button A, button B, and button C.

2011.12.08

You probably know I’m a fan of Photo Booths, and while Sparkbooth is awesome software, you might want something free (and open source) so here’s “PhotoBooth” written in Processing.

This is all the code you need for the most minimal photo booth application:

/**
 * PhotoBooth.pde
 */ 
 
import processing.video.*;
Capture cam;

void setup() {
  size(1280, 720);
  cam = new Capture(this, 1280, 720);
}

void draw() {
  if (cam.available() == true) {
    cam.read();
    image(cam, 0, 0);
  }
} 

void keyPressed() {
    if (key == ' ') {  // space bar
      saveFrame("picture-####.jpg");
    }
}

Once you’ve got that, you can export it as an application from Processing.

(Note that I’m using a Logitech C910 webcam, so I’ve set the resolution to something that makes sense for that camera. If it looks weird with your camera, try 640×480 or something else.)

PhotoBooth Export Application

I generally use Mac OS X, but other operating systems are supported. This is one of the great things about Processing.

PhotoBooth Application

Over in the Finder you’ll see a standalone application named “PhotoBooth” that will run fullscreen when launched. (You can exit it by hitting the escape key.)

Spazz!

Once you launch it you’ll see some spazzy dude, wait, that’s me! You’ll probably see yourself instead.

Hit the space bar, and it’ll save a photo. Hit the space bar again and it’ll save another one. And on, and on.

PhotoBooth Photos

The photos will show up in the same folder as the application. They will have a random number in the name. It’s not sequential, but you can view by date created if you need them in order.

Here’s a more full version of the Processing code with a few extras commented out. Uncommenting them may prove useful for debugging or camera set-up.

/**
 * PhotoBooth.pde
 */ 
 
import processing.video.*;
Capture cam;

void setup() {
  size(1280, 720);

  // If no device is specified, will just use the default.
  cam = new Capture(this, 1280, 720);

  // To use another device (i.e. if the default device causes an error),  
  // list all available capture devices to the console to find your camera.
  //String[] devices = Capture.list();
  //println(devices);
  
  // Change devices[0] to the proper index for your camera.
  //cam = new Capture(this, width, height, devices[0]);

  // Opens the settings page for this capture device.
  //cam.settings();
}

void draw() {
  if (cam.available() == true) {
    cam.read();
    image(cam, 0, 0);
  }
} 

void keyPressed() {
    if (key == ' ') {  // space bar
      saveFrame("picture-####.jpg");
    }
}

And hey, I know that hitting the space bar ain’t cool… so you might want to use an awesome button instead.

This is a super-simple application, which basically takes some example code that ships with Processing and adds a bit to it. I hope to have a few more posts that talk about some changes you can make to this application. Stay tuned!

2011.10.17

One of the promises of 3D printing is being able to print replacement parts to things around the house that break. Since I’ve got access to a MakerBot Cupcake at Milwaukee Makerspace, I figured I’d give this a try, not just downloading some object from Thingiverse, but actually going through the entire process of measuring, designing and printing a part.

Light Switch v1
Light Switch Button v1

I got out the calipers and measured the light switch to determine the size of the replacement part I’d need to create, and then I used Sketchup to design the actual object at the correct width, height and depth per my measurements. Since the original part was long gone, I had to estimate how it should be designed, so I just used my best guess.

My first attempt (version 1 above) may have looked good, but even if it was a perfect match to the original, the fact that it was a very small part, and had to be printed on a older model MakerBot meant that the actual print was terrible. The part was just 10mm x 12mm x 6.7mm. That’s pretty damn small.

Light Switch v2
Light Switch Button v2

Version 1 just didn’t work. The hole that was meant to slide over the shaft of the light switch was too short, ill formed, and not even close to round in the inside. So for version 2 I changed the circular structure to a rectangle with a hole in it, as well as making it a bit thicker all around.

Version 2 was definitely better than version 1, but the hole still wasn’t looking too good, and the top (where the MakerBot finishes printing) was pretty ragged. I figured I could sand it down flat though if needed, which is why I ended up making it taller.

(Oh, I should mention that with version 1 I just printed it at the makerspace and then brought it home to test it out. It would have been awesome to have a 3D printer in the house, because I probably could have just kept tweaking it until I got it right, but as it were, I printed one, took it home, and then there was a week before I could try the next version. So yeah, this is why you need a 3D printer at home!)

Light Switch v3
Light Switch Button v3

So right after I printed up version 2, I was concerned it still might not work, so I quickly tweaked the file a bit to make it taller, and to remove the hole completely, with the idea that I could drill a nice clean hole at the appropriate size. Version 3 looked pretty good out of the Cupcake. Not great, not amazing, but pretty good… at least in comparison to the others.

Light Switch
Printed Light Switch Button

So here’s our actual printed object. Yeah, it looks pretty rough around the edges, at least from this view. I ended up using the Dremel on the top to get it a bit shorter and smoother, and then drilling a hole that would allow it to fit on the shaft. Of course, I don’t have metric drill bits, so I tried to find something close. This was my first real attempt at using the Dremel or a drill on a printed part. It wasn’t great. The Dremel doesn’t react the same way it does to metal or wood. Do I go slower or faster or what? I’m not sure… As for the drill, I tried to just hold the piece in one hand while drilling it. That was not ideal. Perhaps next time I’ll use the vice.

I know that in the photo it looks pretty sad, but it actually worked, so cosmetic beauty aside, this was mostly a success.

Light Switch
Light Switch Button in place

Here’s the light switch button in place. We can actually use the light switch without pushing the tiny shaft anymore, which is good.

So in the end, this part, even with the failed attempts, probably consists of less than 5 cents worth of plastic. This is the beauty of 3D printing at home. To get a replacement from the manufacturer would have involved me contacting them, ordering or asking for a replacement, and then having that replacement shipped to me. Even if I ended up talking to some nice person who could put one in an envelope and mail it to me at no charge, the postage stamp alone would have cost more than the raw materials needed to make the part.

Oh, you may have noticed the hole in the button. Yeah, I drilled it a bit too much. Also, the red doesn’t really match very well. I’ll probably print it again in white, or maybe glow in the dark plastic, which would make even more sense.

2011.10.13

Dual Button

Could the rumors be true? Supposedly, deep in the basement laboratory workshop of the secretive “2XL Makerspace” they’ve been hard at work on a dual button system the likes of which have not been seen before in this geographical area.

At least, that’s what all the rumor sites keep saying…

We don’t know if this photo has anything to do with some stealthy dual button device, but as soon as we find out, we’ll let you know.

See Also: The (Original) Button.

2011.07.01

Make

Those guys over at Make (who seem to be my new BFF) mentioned another button I made, which was inspired by Matt’s AWESOME Button post on Make, which in turn inspired Patrick from Milwaukee Makerspace to build a footswitch-style button, which got mentioned on Hackaday, which is where I saw the link to Flip’s 1-Key-Keyboard Project.

It’s getting a little circular in here…

So on the Zen Button post, Flip commented on his 1-Key-Keyboard Project, and noted that it had the same “dead-simple functionality” but was a much lower cost.

Make

The “dead-simple” part was also in the post’s description of my button, but I think that “dead-simple” had more to do with the parts and the build than the function, and here’s why I think that matters.

If you go back to the original AWESOME Button post, you’ll see a few people (including me!) wondered if you could use an Arduino instead of a Teensy. Why? Because the Arduino is cheap, and easy, and lots of people already have one.

But the Teensy is also cheap, and fairly easy, maybe just a wee bit more difficult, but still fairly easy, and you just plug the dang thing in via a USB cable and hey, what could be easier!?

But with ease of use comes a price. If you look at Flip’s 1-Key-Keyboard Project, it’s probably what he considered “dead simple” but to me, I see a list of parts including either a ATTiny45-20PU, or ATTiny85-20PU, or ATTiny85, or ATTiny45… and then there’s a few resistors, diodes, capacitors, some prototype-board, and a programmer that works with the Atmel AVRs.

Flip has done a great job writing up the project. I mean, I assume he has, but it’s way over my head. All the comments lead me to believe it’s pretty awesome. If you’re comfortable with everything he talks about, and it all makes sense, then that’s awesome too. Either way, I’m definitely glad Flip shared his project.

For those of us not ready to get that deep into AVR development, things like the Teensy or the Atmega 32u4 are simple enough to use that even beginners can get pretty far. Just in blog post comments and some emails I was able to help a few folks get their Teensys up and running.

Remember, everyone starts out as a beginner… but that’s not to suggest that you eventually need to get to the level where you’ll be using an AVR programmer with bare chips if using an Arduino or some other board does what you want with less hassle. Easy really is one of the main reasons the Arduino platform became so popular.

So if you ever see your project on Hackaday, try not to be discouraged by the commenters who are quick to point out how they would have done it better, faster, cheaper, and with 10 times the capabilities of what yours does, because while they were busy leaving discouraging comments, you were busy making something. :)

Cheers!

NOTE: Need a button? Now you can buy one! Visit our store or Etsy.

« Older Entries | Newer Entries »


buy the button:

Buy The Button