Let's Break Some Cables

Originally posted April 11th 2017 by Tommy Goode on the Tiny Cables Medium publication.

My sleep schedule is an absolute wreck. I often go to sleep at 6am or later and sleep past 2pm. It hasn’t caused any issues so far, but it’s not something I want to become a permanent part of my life.

Don’t worry, this is about Tiny Cables. I promise.

There’s a bright light that shines into my bedroom from the parking lot at night. It doesn’t help my (already messed-up) sleep schedule, so I hung a blanket over the window.

Natural light is a strong “wake up!” signal to the human body. If I could build something to pull back the blanket in the morning, I might have an easier time getting up. Excited at the prospect of a new project, I started researching plans for an automatic curtain-opening robot.

Soon after I ordered supplies for the bot, Andrew received the first batch of Tiny Cable samples and we started discussing ways to evaluate their quality. Of course we would plug them in and make sure they worked, but we needed to try to push their limits so we could confidently stand behind the quality of our product.

I realized that the same tools I was going to use to build the curtain-opener bot could also be used to repeatedly manipulate a cable.

BendyBot was born!

I earned my undergraduate degree in Computer Engineering, which included a few low-level hardware engineering courses. When I graduated, I kept all of the class materials (toolboxes full of jumper wires, breadboards, tons of basic ICs and switches) because I knew they would be useful someday. The closest I’ve come to building anything since was buying a few RF circuit boards, haphazardly hooking them to an Arduino, and quickly realizing I don’t have the faintest clue how RF communication actually works.

BendyBot represented a chance to rebuild my shattered confidence in my digital circuit design abilities.

To build BendyBot I would need only a few components. The bending would come from angular motion: a stepper motor turning the cable back and forth around a pivot point. Stepper motors require a motor driver circuit to operate properly. An Arduino — a microprocessor and prototyping board designed for hobbyist electronics projects — would be a perfect “brain” to control the motor driver. A DC power supply (PSU) would power all of it.

Digression: why a stepper motor? I’ll admit to being clueless as to what a stepper motor was when I first saw one used in a curtain-opener build, but they are intriguing! A stepper motor has precise positioning controls (in many cases, one “step” is only a 1.8º turn) and high torque, which are desirable qualities for repeatably bending something that might resist being bent. A traditional DC motor can spin very quickly but is very difficult to position repeatably and has relatively weaker torque. A servo might also be a good choice for a bending tool, but they are limited to turning 180º in each direction — this wouldn’t work for a curtain-opener.

I already had an Arduino laying around from the aforementioned failed project (RIP GarDoOp), so I started researching stepper motors and how to control them. Luckily, Adafruit sells great hobbyist circuits for just about anything (including stepper driving) and also provides great documentation and tutorials on how to hook them up properly.

When all the parts arrived, I invited a buddy over and we started hacking away at a proof of concept that would turn the stepper using the Arduino. He wrote the code for the Arduino, while I soldered header pins onto the motor driver and wired everything together.

Tiny Cable sighting!

When it was all ready to go, we programmed the Arduino and plugged in power to the motor driver.

And nothing happened.

Not even a twitch. After triple-checking all of the connections, I realized that grounding the STBY (standby) pin on the motor driver was the issue; I originally did this due to some ambiguous wording on the Adafruit Learn page (and I’m not the first person to be confused by it).

I un-grounded the standby pin and we tried again. This time the stepper motor started turning sporadically. It should have turned 360º clockwise, paused for a second, and then turned 360º counter-clockwise. Instead, it turned short distances in spastic spurts like a broken washing machine agitator.

My clothes will never get clean!

Upon further inspection, we discovered that the LED on the 12v power supply was dimming whenever the motor was supposed to turn — which told me that a) the motor needed more juice than the 3A the power supply was rated for, or b) the power supply wasn’t able to provide as much power as advertised.

I tried a couple other 12v PSUs that I had laying around (#engineerlife) but experienced similar results with all of them. This led me to believe that the stepper motor likely required more power than the motor driver could supply. I checked the specs, and lo and behold, they clearly state that the motor driver can drive up to 1.2A/phase, but the stepper motor could draw up to 2A/phase! I had initially glossed over these numbers, but that was obviously a mistake.

Tired and defeated, we decided to call it a night.

I went back to the drawing board, researching stepper motors that would draw less power and still have enough torque. I had no idea how much torque I needed, I just wanted the strongest motor I could power.

When I first bought a stepper motor on Amazon, all of the popular ones seemed to run on 12v. This caused a bit of an inconvenience because my Arduino required a 5v power source. I had resigned myself to ordering a step-down converter to get 5v from the 12v power supply. However, this time around I spent a bit more time searching and found a great motor that operated at 5v.

I ordered it and then went to sit at the front door, waiting for it to arrive.

2-day shipping feels like 2-week shipping when you’re itching to complete a project

Approximately 2 eternities later, my Amazon order arrived. I had taken the opportunity to order a protoshield (a small prototyping circuit board that sits on top of the Arduino) along with the replacement motor, so I migrated the spaghetti-mess of wires down to something much more manageable. Since everything now ran at the same voltage, I could power all of it from a spare 5v power supply I had lying around.

Before: spiderweb of breadboarded wires (without Arduino) next to protoshield and mini-breadboard
After: connections neatly organized on the mini-breadboard, attached to the top of the Arduino

I hooked up the stepper motor. Time for the moment of truth!

IT LIVES (and looks even better infinitely-looped)
Don’t touch (trust me)

After letting the motor run for a bit in celebration, I discovered that the main chip on the motor driver gets very hot. Using my thermal camera I checked the temp, and it was running at over 90ºC (slightly above the 85º max operating temp). I happened to have an appropriately-sized heatsink lying around (#engineerlife), which now helps keep the chip cool. I re-ran some of the wiring to isolate the motor power circuit from the Arduino (so there isn’t a ton of current being run through the Arduino unnecessarily).

At this point, there’s only one real challenge left: how do I actually attach a tiny cable to this contraption so that it bends? I went to Lowe’s for some inspiration and returned with some screws, nuts, and T-Plates. Using JB Weld, I attached a lock nut to a stepper motor gear I had previously ordered for my curtain opener build.

JB Weld, pictured with the gear, screw, and lock nuts (pre-weld)

24 hours later (yeah, it takes forever to cure), I attached a T-Plate to the gear, mounted the gear on the motor and zip-tied the cable to the arm of the T so that it would wrap around the center post when the T is rotated.

Kinda like that!

When I got ready to run the tests, I realized that it would be hard to monitor the Arduino output via the serial interface, as I would have to leave it tethered to my laptop in order to do so. Instead, I fished an LCD screen out of one of my parts boxes (#engineerlife) and tried to remember how to hook it up.

Front/Back. Does anyone have a pinout diagram for this thing?

I was able to find the relevant chip diagrams via Google and trace most of the pins back to the chips. There was one pin that I couldn’t figure out, but since I still had the old circuit board from the class where this was used (naturally), I was able to discover that it was contrast voltage. Arduino has a library for easy LCD interaction, so a few lines of code later I had a nice display with the number of bends and seconds elapsed.

Out of an abundance of caution, I decided to run the first overnight test on the hearth of my fireplace. I added some bumper “dots” to dampen motor vibration, wedged the stepper between a few old textbooks to keep it in place, and set up my FauxPro (Gitup Git2 action camera) to take snapshots throughout the test (to monitor for issues). I taped the other end of the cable to a textbook and let BendyBot go to town.

Look at the bend in that cable!

When it was all said and done, the Mini-USB cable I chose to test first was bent over 17,000 times by BendyBot. The only issue the test setup encountered was an integer overflow in my time-keeping code (oops), which only affected the display of seconds elapsed.

As for the cable itself, it’s in great shape! There’s no deformation of the sheath and the cable still functions well.

I’m Batman.

While BendyBot is now fully operational, there are some things I’d like to do in the future to make it even better:

  • Set up for multiple-cable testing: I think multi-cable testing is very doable with only slight modifications to the current setup (turning the motor both directions, adding better cable end anchoring, etc).
  • Get a smaller (lower-current) stepper motor: the current motor works great, but powering it generates a ton of heat. I think a smaller stepper motor would work just as well, and help the motor driver stay cooler.
  • Mount in an enclosure: I’d like to try setting the Arduino inside a project box (and possibly mount the LCD on top). This would help with portability and durability.
  • Custom-length ribbon cable: right now the connections to the breadboard (for the LCD) are individual, rigid, and short. I’d like to make custom-length ribbon cables that would reduce the clutter and combine all of the separate wires into one flexible cable.

Final Parts/Cost List

* Only partial quantity of item used

BendyBot source code

Here’s a gist with the BendyBot source code