Categories
Uncategorized

Barcode Binary Card Reader

Sensors

I recently prototyped a device to read cards (physical cards with printing on them) for a project. I used five SparkFun Digital Line Sensor Breakout Boards attached to a 3D printed mount and wired up to an Arduino.

Card and Sensors

The cards have five blocks at the bottom, which are either black or white, representing 1 or 0. Using ones and zeroes allows us to create a binary encoding scheme, so with five positions we use 1, 2, 4, 8, 16 for the values and can represent any number from 1 to 31.

Sensor Mount

I started by grabbing the image of the sensors from the SparkFun product page and dropping them into Inkscape (sized appropriately) so I could design the barcode part of the card, and so I could design the mount for the sensors.

Sensor Mount

Once I had a 2D design in Inkscape I exported it as a DXF file and used the linear_extrude command in OpenSCAD to create a 3mm tall plate, and then added another plate. It wasn’t perfect, but it was fast. I started the 3D printer while I got to work soldering…

Sensors

Sensors

Sensors all soldered up, mounted to the plate with 3mm screws, and wired to an Arduino via a breadboard. All of this is still prototyping stage. It doesn’t look pretty, but it worked and it was enough to test things out and do a demo.

Cards with Barcodes

Here’s an example of some card templates. Can you determine what number is being passed by reading it in binary? Since we’ve got 5 positions we can have 31 different cards… If you needed 63 cards, you would need 6 positions (and one more sensor.) 127 cards? That would be 7 positions and two more sensors. Any more than that and you might consider using the SparkFun Line Follower Array which has 8 sensors on a single board.

Card and Sensors

The total time to create this prototype was just a few hours from starting a design in Inkscape to 3D printing a piece, soldering up and mounting the sensors, and writing the code. (I also wrote a simple Processing application which read the serial output from the Arduino to display the card data on screen.)

Categories
Uncategorized

The Detonator

The Detonator

It’s The Detonator! What is The Detonator you ask? Well, for Maker Faire Milwaukee we build a fire poofer, which is a device that shoots flames into the air. Workmate John McGeen started the poofer build and we finished it up at Milwaukee Makerpace. Along the way we experimented with a torch, candles, and grill igniters, until Dan the Blacksmith finally added a pilot line and some steel wool.

Fire Poofer

The Detonator went through a few revisions, but I’ll walk through the construction of it for this blog post. We brainstormed a few different ideas to trigger the poofer, but in the end I went with something simple than I knew would work reliably for the entire weekend. (And it did!)

Laser Cut Parts

I started by using MakerCase to design a box I could laser cut. I used 3mm black acrylic because I have a lot of it, and I made the box the size that worked with the acrylic I had. The image shows the acrylic (gray parts) and one piece of 1/4″ wood (which is tan in the image.) The wood piece went on the inside, right under the top acrylic with the hole for the button.

The Detonator Guts

Since I wanted The Detonator to withstand being pressed, slammed, and pounded on by hundreds of people over the course of two days, I also built a wooden box that fit inside the acrylic box. This added strength and weight to it.

Vinyl

I didn’t just want a plain black box, so I added some bright yellow vinyl to it. I cut the vinyl with a Silhouette Cameo. The image above shows how I determined wrapping the vinyl around the edges.

The Detonator - Vinyl

Here are the vinyl pieces I cut. I added cut outlines around the pieces so I’d be able to line it up correctly. It worked pretty well. (I didn’t take time to measure or mark things, but that would be a recommendation.)

The Detonator - Illustration

Above is my final “pretty” illustration of The Detonator. Below is a very black photo of The Detonator. I’m fairly pleased with how it turned out, especially since it was a rush job to build it.

The Detonator

The Detonator Connectors

There are four connector posts, but only two got used in the end. I originally had just the two in the center, but ended up splitting them and adding extra posts so I could split power between 12 volts (well, 18 volts, sort of) for the solenoid, and 4.5 volts for the grill igniters. We ended up ditching the grill igniters, so in the end I only needed one pair of connectors. Oh well!

The Detonator Guts

Here’s the inside! There’s a Pololu A-Star 32U4 Micro mounted on an Adafruit Perma-Proto Half-sized Breadboard PCB with some screw terminal connectors, which is connected to a relay board. The board I used had four relays, but since we didn’t use the grill igniters I could have used a two relay board. (Also, relay boards are super-cheap on ebay.) There’s also a relay controlling a beeper that beeps a countdown. (See the video below.)

Overall The Detonator was a quick build. and there’s a few things that could have been a bit more polished. For instance, I cracked the acrylic a bit when I drilled more holes for the connection posts. In an ideal world I would have laser cut a new piece, but I didn’t have time. I also could have made the code a bit simpler after removal of the batteries for the grill igniters, but hey… The Detonator turned out good for a quick fire poofer controller!

Categories
Uncategorized

Teensy++ 2.0 LED Pin

Teensy++ 2.0 LED Pin

Yes, this post is actually titled “Teensy++ 2.0 LED Pin” because it’s really specific. This is the solution to a problem that took me a while to fix. Actually, it didn’t take a long time to fix, it just took a long time for me to figure it out and implement it. (Maybe it did take a long time for me to fix…)

Anyway, when using most pins on a Teensy++ 2.0 (and probably every other Teensy) with Arduino code, you may have an issue using the LED pin as an input, because it functions differently than all the other pins. You might say “Hey, just use another pin!” but the project I did required every single pin on the Teensy++ 2.0. (Yes, all 46 pins!)

The code is below. The LED pin is sort of treated opposite of how other pins are treated. You short it with +5v instead of ground, and swap the risingEdge and fallingEdge typically used with the bounce library.

// LEDPinButton

#include <Bounce.h>
 
Bounce buttonD6 = Bounce(6, 80); // LED Pin - tie to +5v instead of GND
Bounce buttonD7 = Bounce(7, 80); // Normal Pin - tie to GND
 
void setup() {
  pinMode(PIN_D6, INPUT);        // LED Pin - use INPUT not INPUT_PULLUP
  pinMode(PIN_D7, INPUT_PULLUP);
}
 
void loop() {
  
  buttonD6.update();
  buttonD7.update();
 
  // D6 - LED Pin - tie to +5v instead of GND
  // use risingEdge instead of fallingEdge
  // a
  if (buttonD6.risingEdge()) {
    Keyboard.set_key1(KEY_A);
    Keyboard.send_now();
  }
  if (buttonD6.fallingEdge()) {
    Keyboard.set_key1(0);
    Keyboard.send_now();
  }
  
  // D7 - Normal Pin - tie to GND
  // b
  if (buttonD7.fallingEdge()) {
    Keyboard.set_key1(KEY_B);
    Keyboard.send_now();
  }
  if (buttonD7.risingEdge()) {
    Keyboard.set_key1(0);
    Keyboard.send_now();
  }
  
}

You can also grab this code from github.

Categories
Uncategorized

Laser Maze 2015

Laser Maze - Photo by Eric Schneeweis

You may remember the Laser Maze from Milwaukee MakerFest in 2013, or maybe you experienced it at Maker Faire Milwaukee in 2014. Well, it’s coming back! Somehow I volunteered to design & build the hardware for Laser Maze 2015!

Laser Pointers

Step 1: Acquire lasers.

I’ve got a big pile of laser pointers, so far so good. Now, I should mention I didn’t do the set-up in previous years, and I don’t have much to work from, so I’ll be making a bunch of decisions, and if they are terrible, let me know.

In the coming weeks I’ll be designing a 3D printed mount for the laser pointers. It will hold the front half, so we can unscrew the back half to change batteries without removing the laser from its position. There is a zip tie on the laser that slides and rotates into place to hold the button down. (A simple design, we’re going for simple on this whole thing.)

Scoreboard

The scoreboard is an Adafruit 1.2″ 4-Digit 7-Segment Display. I’ll probably use a Teensy 3.1 as the controller, and there will be a big green start button and a big red stop button. You press start at one end of the maze and the counter begins… and when you get to the end you press stop and you know your time from the scoreboard.

Oh, and the laser pointers… they bounce off some mirrors and hit solar panels connected to the Teensy. When you break the beam the voltage from the panel drops (which is recognized on the Teensy) and you get penalized. We’ll add time to your total as well. So if you’re 10 seconds into it and break a beam, the timer will suddenly display 20 seconds instead of 10 (or whatever, we’ll figure out the math later.)

There should also be a buzzer of some kind, for the start, stop, and breaking of the beam. I’m just using a piezo for prototyping, but we’ll make sure we have something LOUD for the event.

There are some notes about everything on the laser maze wiki page, but I’ll keep documenting here as I go.

Categories
Uncategorized

Turntable Electronics

Electronics

I finally got the electronics for my Turntable Drawing Machine working. It wasn’t easy…

I decided to use a DC gearmotor controlled by an Arduino and potentiometer for the speed. I did a quick test of this with a Leonardo and a DRV8835 Dual Motor Driver Shield for Arduino. It worked fine for controlling the speed of the motor, but I didn’t really want to use the shield, so I used a DRV8835 Dual Motor Driver Carrier I had on hand. (Since I’m only using one DC motor, I probably could have used a DRV8838 Single Brushed DC Motor Driver Carrier.)

Pololu has an easy-to-use Arduino library for the DRV8835 Dual Motor Driver Shield which worked fine for the shield, but doesn’t (I mean didn’t) work with the DRV8835 Dual Motor Driver Carrier. I ended up hacking the library a bit to make it work. All was well until I added a servo. Since the Arduino library for the shield is hard-coded to use pins 7, 8, 9 and 10 there’s an issue because the default Arduino servo library disables PWM control on pins 9 and 10. I then changed the library to not use pins 9 and 10, but that still didn’t quite work… Seems that the servo library and the motor control library both need to use timers, so there’s some weirdness there…

I ended up digging through the forums and eventually found some useful posts and a link to ServoTimer2.zip. (It’s worth noting that there are a number of ServoTimer2 libraries, but I tried this one and it worked.)

Once I had the ServoTimer2 library in place, getting it to work with the my hacked ‘DRV8835DualDriver’ library was simple. (I’m saying “simple” but it took a few hours of screwing around with things that should have worked but didn’t) If I had used one of the Arduino Megas I had lying around, I probably could have avoided some of the issues the Servo library causes.

Alright, well… electronics seem good! Next step is to build things, and get the turntable portion constructed to test if the DC gearbox will work out. I think it will, as it’s got plenty of torque, and there shouldn’t be much resistance.