Little yellow robot in one day

2016-05-29 10.24.26bThe robotics team I mentor with, the TerrorBytes, decided to put on a robotics competition for local teams and guests: a one-quarter scale version of this years FIRST Robotics Competition game, Stronghold.

I didn’t have much time to work on a side project, but I was able to clear one day’s schedule, so I woke up early and queued the music. I built just a “toaster bot” (meaning all it can do is drive — no other mechanisms), but the drive system is fairly nice, and it came together well. I’m going to make this a very quick overview post on the design and fabrication of the bot. Apologies, but I took zero pictures of the build process. Also, I’d show you a video of it, but I drive it my phone, which won’t record and let me drive at the same time. You can spot it rolling in the competition highlight video at the end of this post, though.

Mechanical:

2016-06-19 21_16_56-wheel-free-v2.scad - OpenSCADThe chassis and wheels are 3D printed. It uses a pair of gearmotors I got from Ax Man Surplus a while ago, which directly drive the main wheels. These wheels have a strip of mouse pad hot-glued to them for fantastic traction.

The secondary wheels are also driven by the motor via a GT2 belt; both wheel models include a GT2 pulley as part of their design. I found a way to fuse bulk GT2 belt into the necessary loops; I posted about that here.

The secondary wheels house a 608ZZ bearing held by a 5/16″ bolt. This is a neat trick that exploits the fact the 8mm inner diameter of the bearing is basically equal to 5/16″. The bearings allow the wheels to freely spin with little resistance or wobble. The sides of the wheel are rounded to allow these wheels to skid better during steering, and the gear-like pattern was to grip into irregular terrain.  I originally had all four wheels covered in mousepad material, but it was impossible to turn, since this design relies on two of the wheels skidding horizontally. As to their construction, the main wheels are single pieces, with some diameter subtracted off to account for the mousepad material. The secondary wheels are two part — an outer wheel with a space for a bearing, and a pulley that screws into the wheel and also holds the pulley in place. 

2016-06-19 21_15_07-wheel-free-v3.scad - OpenSCADThe secondary wheels are mounted into slots in the chassis, allowing you to tighten down the bolt and nut at varying degrees of tension. I found that having a tensioner was essential to dialing in correct performance, especially when I changed motors later on (see below).

The design of the chassis wasn’t very amenable to 3D printing, as the large flat area had a tendency to warp. One thing I added in anticipation of this were horizontal threaded rods for structure stability. This allowed me to correct any chassis flexing and add lots of rigidity cheaply.

I designed the chassis in Sketchup (which is definitely NOT the right tool for the job, but I know it well, and I haven’t made time to learn something better yet). The wheels were designed in OpenSCAD, as I needed to model the GT2 pulleys with correct geometry, and I was able to adapt existing code for this. I spent a fair bit of time modeling the motors, as it was a little challenging getting the hole placement using just digital calipers. In the end, I was able to get it exact with a little trigonometry.

2016-06-19 21_14_15-Babybot2016-1.skp - SketchUp Make 2016I made proper standoffs for the electronics boards to screw into, but I had to abandon most of them since i didn’t account for the length of bolt on the secondary wheels. I ended up breaking off all my nice standoffs and just screwing the board into drilled holes. It holds just fine. The battery pack is unfortunately two-sided, so I couldn’t just bolt it down. It’s held in with a twist tie so I can get it loose to replace batteries when needed.

Once it was finished, it worked, but the motors were woefully underpowered. I was about to give up and leave it as-is until I found that the gearmotors I was using were apparently somewhat standard, as I was able to find strong 60RPM ones on Amazon with the exact same form factor and screw holes. I ordered them, and a drop-in replacement transformed it from an underpowered baby to a slow, methodical, but unstoppable beast.

Electrical:

It’s a fairly standard Arduino robot with some tweaks. First, I somehow didn’t have ANY Arduino motor controllers when I went to build it, and no time to wait for shipping. I did happen to have a single L298 motor control module from back before I understood shields, so there was some additional manual wiring of the Arduino to the motor module. On the plus side, this module is rated for way more power than the shield, in case I need it.

Also, the motor control module features its own 5V regulator, which was useful once a short circuit during a demo killed the one on board the Arduino. I was able to snip out the Arduino’s dead regulator and just wire the 5V line from the motor module to the Arduino, and it fired right up. (I also soldered on a replacement regulator, but that’s just so I could reuse the Arduino later if I need to.)

Commands are received via a cheap HC-06 bluetooth serial module connected into the analog in ports. (I used the analog ports because this is based on a design used by the TerrorBytes with the Arduino motor shield; the shield only exposes the analog ports, as the digital ones are all used by the shield itself.) I didn’t bother wiring the bluetooth RX line, as control is one-way, so it’s unneeded. Also, the device claims to only support 3.3V levels while the Arduino is 5V, so it might kill it? I’ve seen others feed this module 5V signals without issue, though. Better safe than sorry.

I also threw a cheap voltmeter on to monitor battery levels. This runs off the voltage it’s measuring, so it’s really easy.

Power was originally toggled by plugging/unplugging the battery minus to the Arduino ground pin, but I discovered by accident that the robot can drive when flipped upside down, and the pin was ripped from the wire while driving upside down throgh grass. As a result, there’s now an actual power switch, and all pins are hot glued in place.

Power simply comes from the 8xAA case, providing 12V.

Software

The initial version of the Arduino code was written by a TerrorBytes student; I simply adapted it to my wiring and robot design. The drive station software was initially a Python script designed to read gamepad values on a PC and send them over serial.

App Inventor

My “code” crammed into App Inventor

This worked fine, but I wanted to drive it from my phone, so I used Google App Inventor (now hosted at MIT) to make a simply joystick emulator. I ran into several issues doing this — App Inventor does not have any multi-touch support, so I couldn’t actually simulate two joysticks. Instead, I ended up having it do something that FIRST robotics calls “arcade drive”, where a single stick is used to input both steering (X axis) and power (Y axis). I actually ended up mining the control equations from wpilib, the library that runs on all FIRST Robotics Competition robots (see check_drive here for a python variant of the code, which I ported to App Inventor’s puzzle-piece coding system).

Timeline

Because I only had one day, everything was pipelined: 3D printing of pieces was continuous and done in parallel with design. I started with the motor mount, printing just enough to see if the motor could go on. While that printed, I did the wheels in OpenSCAD. When the motor mount prototype finished, I started a wheel printing while I did a test fit. I worked on the chassis design while wheels were printed/tested iteratively.

giphyFinally, the chassis design was done, and I started the 2-hour print. I was concerned that chassis issues could sink me given how little time I had to dedicate to this, so I also designed a side-bracket variant of the chassis that I could bolt to wood; this would print faster if needed. In the end, however, I was able to cut and drill enough stuff on the initial printed chassis that I was able to make it work.

In the end, I was able to assemble all the bits and get basic movement by the end of the day. I had to wait overnight to be sure the belts I glued would cure, so I did cheat and spend a few minutes the next day mounting them.

Also, the drive software was initially a Python script designed by TerrorBytes students for use with a PC drive station. I developed the phone app for driving separately, taking care to design it to be backwards compatible with the Pythons script’s simple 4-axis protocol.

Result

Here’s the final bot in all its glory:

2016-06-19 20.04.26bIt competed fairly well in the competition, making it to the first round of eliminations. Ultimately, it was defeated by robots built in more than one day…

See if you can spot it in the competition highlights reel:

Code and design files

 

AC power control without touching AC power

2015-11-04 10.49.30bIn this article I’ll show a simple 3D design for a servo mount to control a light switch for about $3, plus some electronics to drive it with a neat little interface. This article explains how I used it to regulate my air conditioner, but the basic bracket allows control of any U.S. standard wall switch.

I just moved into a new office and there’s a window-mounted air conditioner. There’s a remote control to set the target temperature, but the unit isn’t smart enough to turn off at night. Instead, there’s a physical wall switch so you can turn it off with your actual physical hands, like a barbarian.

2015-11-02 16.00.07b

I’m not going to put up with a hot office in the morning, nor will I let the unit blow cold air all night and weekend when nobody’s around.  Instead, I will Build Some Crap.

Details after the break. Continue reading

How to make a ton of clear LEDs into diffuse LEDs

2015-11-01 02.41.35.mp4_snapshot_00.03_[2015.11.03_16.22.52] - labeled

Step 1: Make a rock tumbler out of some threaded rods, bearings, a motor, and a spaghetti jar:

2015-10-29 16.34.04b

Step 2: Get sand. If you don’t live in a beach/desert, you can probably get some for free from a landscaping supply place. (They charge per ton, so when you ask for a cup, they will think you are a crazy person and just give it to you.)

Step 3: Chuck the LEDs and sand into the thing and run it overnight.

That’s all.

Here’s what not to do:

  • Use an orbital sander to wiggle the jar. It’s super load loud and doesn’t do much.
  • Add water. This just gives you corroded LEDs that arent even diffuse.
  • Run it with so much power that centrifugal force sticks everything to the sides and it vibrates itself off your desk overnight.
  • Run it with so little power that it stalls.
  • Fail to own a variable power supply so that your only choices are 12V and 9V (see above).
  • Make your first shaft coupler out of gaffer tape. I ended up designing and 3D printing a simple shaft coupler.
    2015-10-29 20.45.18b

Video:

Generating 3D-printable pieces directly from EAGLE PCB designs

2015-10-24 19.52.06-design2

NOTE: Everything involved in this post is available for download here.

2015-10-24 19.46.08bI while back, I made this PCB that acts as a big daisy-chainable two-digit 7-segment display using the WS2803D and discrete LEDs. The pic to the right is a shot of the first use of these PCBs: a big sign that says “4561”.

It works great, interfaces easily with AVR/Arduinos, and is cheap to build.

One thing that’s not great about it is the amount of light leakage from the LEDs — if you put some kind of light diffuser in front of it, you see all kinds of reflected and refracted bits of light. Here’s a shot of a clock I made out of these boards with white gaffer tape as a diffuser:

2015-10-24 01.10.03c

Look at all those random patterns of light…it’s shameful.

Today I figured out a simple way to 3D print a light mask for this board using design elements straight out of EAGLE! Here are the high-level steps:

  1. In a new layer in your EAGLE board layout, draw the stuff you want to 3D print.
  2. Do a series of conversions to get that EAGLE layer turned into an OpenSCAD script and then a STL for printing.
  3. Print, jam on board, enjoy a better looking display.

Here’s a shot of the light mask applied to the left two digits of the clock:

2015-10-24 19.58.30b

Full directions after the break. Continue reading

The Pandaphone

2014-12-21 23.10.18I was looking for a gift for my friend’s son, who’s about a year old.  I realized that everything I was looking at was just various enclosures with chips that made sound and light…that’s the kind of crap I can do!

So I built a theremin-type thing. It plays notes based on how close you are to its ‘eyes’, which are an ultrasonic distance sensor, and the nose is a small speaker.

Video:

Build log after the break.

Continue reading

TerrorBytes Countdown Clock

2014-12-06 12.03.15bThe masses have spoken! After my wildly successful debut as a blog post writer, Tyler and I have collaborated to create a post so exciting that we may just increase our readership to tens of people!

This project started as an idea of Tyler’s. He, my husband, and I all volunteer as mentors for a high school robotics team, the TerrorBytes. The team participates in the FIRST Robotics Competition, which has very strict rules about building times and deadlines. This makes it beneficial to have a countdown clock. Last year, Tyler made one online that we would display at meetings. It was not ideal because it relied on internet and we didn’t have internet that was reliable. Tyler came up with the idea for a physical sign based on an AVR chip and some jumbo 7-segment displays.  The result is the TerrorBytes countdown clock!

Read on for the build log. Continue reading

Cheap PCB turns 10-pin AVR programmer to 6-pin

wowI’ve been using this cheap $4 AVR programmer to upload Arduino code to bare AVR chips.  The only issue is that it uses the 10-pin programmer interface, which takes up a lot of PCB real estate on my projects.  Instead, I wanted to use the more efficient 6-pin connector standard.

I looked on eBay for a cheap 6-pin programmer, but they don’t appear to exist.  All I find are the same programmer I have, but with an awful, gigantic, ugly adapter that’s designed to go on the project side:

ugly adapter2
Fig.1: Lame adapter for losers.

So you run a giant fatty 10-pin ribbon cable and have this thing jutting out of your project.  That suuuuucks.

Instead, I developed a tiny (half inch square) PCB designed to accept the programmer on one side and a 6-pin ribbon cable on the other.  Because it’s so small, it’s crazy cheap to fab with OSH Park ($1.60 for three), and the headers cost virtually nothing.  Now I can snap it into my programmer and use 6-pin cables, or pop it out and use 10.

I over-engineered mine, hot-gluing the exposed conductors and rounding the corners, but really, none of that’s necessary.

You can get the Eagle design files on GitHub, or order one from OSH park.

bIMG_1928

TinyBuddy: A host board for the ATTINY84

IMG_1902bI’m going to be making a large 7-segment display clock later, and I needed a control board for it.  Rather than purpose build something, I set out to make a generalized board I could reuse with various projects based on the Arduino-compatrible ATtiny84 microcontroller.

The result is the TinyBuddy: a general host PCB for the ATtiny84. Features two buttons (plus reset), a power LED, activity LED, 16MHz crystal for accurate timekeeping, and USB or DC barrel jack for power. The pins are one-to-one correlated to the pins of the bare chip, so it’s a drop in replacement on a breadboard.  While the prototype (pictured here) used micro-USB for power, I designed a second revision that uses entirely through-hole parts for easy construction. It can be fabricated for about $7 through OSH Park!

You can find the Eagle design files for it on github, or order it directly from OSH Park (Rev1 with micro USB, Rev2 with barrel jack).

IMG_1900bSome build history after the break.  Continue reading