My 10 year old nephew is into robots, so I recently bought him an "OWI-535 Robotic Arm Edge", and helped him put it together. It's actually a great little product, especially for the price (I paid under $40 for it), with 5 degrees of motorized movement, including grippers, and a front-pointing LED you can turn on and off. He immediately took to it, and couldn't stop playing with it.
The thing is, it's controlled by a controller unit that's hard-wired to the robot arm with a ribbon cable that's around a meter long. Since kids expect everything today to be wireless, I mentioned to him that I might be able to modify it for wireless control, and he got excited at the prospect. So I've been working on the details.
I have most of it worked out, including the wireless part (an RF24+ & Nano board on each end should do the trick, although I might eventually move up to dual NodeMCUs since they have their own microcontrollers and it would allow controlling the robot arm by phone, tablet or PC, but the RF24+ is simpler to implement so I'll stick with it for now).
All that's left is figuring out the circuity that controls its 5 motors and LED (which is why I posted this in the motors and not the robotics forum, since the problem I need to solve is not specific to robots, but concerns controlling motors that just happen to power a robot arm in this instance).
The out of the box circuity is of a very simple design, consisting of a power source (4 D batteries), motors, rocker and slide switches (in the controller unit), and wiring. Here's the schematic from the manual:
Basically, each motor is controlled by an (On)-Off-(On) rocker switch that controls the motor's direction by applying either a positive or negative 3V voltage that's split off from the 4 D batteries:

So, putting aside the separate challenges of how to convert the output of each rocker switch (in case you're wondering, I connected a 10k pullup and pulldown resistor to each analog pin, in addition to each switch's center lead, so one direction results in a ~0 reading, the other direction in a ~1023 reading, and the off position results in a ~512 reading), and transmitting the signal wirelessly (as I explained above), the challenge I'm still trying to solve concerns how to actually control each motor from the robot arm Arduino Nano.
I thought about using relays, but that would result in a clunky and clickety-noisy design. So, since I'd likely have to use transistors anyway to control relays using a Nano, I decided to go with an all-transistor design, basically a custom-built H-Bridge. Here is the design I came up with:

The idea was to employ tristate logic, such that when the Nano pin was set to Input_Pullup, nothing happened, corresponding to motor off, and when the pin was set to Output, a 0 turned the motor one way, and a 1 the other way.
However, when I tested it, it didn't quite work the way I'd hoped. I actually tested it without an Arduino, connecting the "pin" lead to either Ground, 6V, or floating, to correspond to the above 3 states. When connected to Ground or 6V, the motor did indeed turn one way or the other. But when the pin floated, the motor still turned, albeit much more slowly.
As some of you have probably figured out by now, the reason was that the bases of the 2 transistors were bridged by way of the 2 pin resistors (each 10K), so enough current was leaking from the base of the PNP to the base of the NPN to allow enough current to flow through the NPN to slowly turn the motor.
The obvious solution to this is to use 2 Arduino pins, one for each transistor and motor direction, with both pins set to 1 to turn the motor one way, both set to 0 to turn it the other way, the left pin set to 1 and the right pin set to 0 to stop it, and the left-0 and right-1 setting never used (with a delay in the code to avoid it even in passing):

However, I was hoping to use just 1 pin per motor, because it seemed like a more elegant way to do this, using tristate logic. But I'm not sure how to make this design work that way. Is there any way to do this, say, by using higher-value resistors, or inserting a diode or two elsewhere in the circuit, or another transistor (which, admittedly, would make it no longer simple or elegant)?
Anything else wrong with this design, or that could benefit from modifications?
Also, what should I connect the Arduino's Ground pin to, the rightmost "-" on the battery, or the midpoint that the motor's other lead is connected to?
And yes, I realize that I could use an H-Bridge chip such as a 293D instead, and in fact that was my initial design, which worked. But it would require a bit of rewiring on the robot arm, and I wanted a solution that could be plugged into its cable pins directly and not require any changes to the robot arm unit.
Thanks in advance!



