Asked — Edited

Activating A Switch

Hi All.

I'm working on making a full sized Dr. Who K-9 robot and need some help on how to activate a couple things with the EZ-b.

It's going to have a laser pointer in the nose, and I'm planning on taking out the push button switch and somehow activating it instead with the EZ-b. How would I do this?

There'll also be a USB-type powered digitial picture frame to activate. I imagine the same solution could be used for this too.

A little more complicated is a car antenna (it's extends his suction cup probe). There are 2 type of antennas as I understand. A semi-automatic one which I believe needs to revere polarity to retract, and a fully-automatic one which retracts when power is cut off. How would I wire both of these types (I'm not sure which is better)?

thanks in advance,



Upgrade to ARC Pro

Discover the limitless potential of robot programming with Synthiam ARC Pro – where innovation and creativity meet seamlessly.


You can use a TIP120 transistor as a switch from one of EZ=Bs digital ports. here is a diagram of how to wire it. I use this to work my lights and other circuits.

User-inserted image



To activate a semiautomatic car antenna to a given distance and retract it back to "zero", I was thinking of using an H bridge. Would this work? From what I've read, you need to reverse the polarity of those motors and I'd need to keep track of the position of the antenna. I'm also using a sabertooth 2x12 for my wheels, but I presume there'd be no interference.

I'm guessing a 2 spdt relays could be an alternative, but it sounds like the h bridge is already set up to do what I want.

Do I have things right and how can I keep track of the antenna distance with either method?

Thanks again,



Actually, I don't use a small project board for the TIP 120. I solder on my leads and put heat shrink tubing over them. Then I put a large piece of heat shrink tubing over the whole transistor and wire leads and shrink that down. It basically looks like a big fuse with wires coming out of it. Then I just zip tie it where ever I want. It's quick and easy. The problem I have found with using relays is they use more voltage. But they are definitely quick and easy. And probably look more professional on the install. They also cost some money and the transistor method is super cheap.

So on the antenna, do you want to be able to control how far out it goes and comes in? Or is it just going out to a fixed point and then retract back to starting position?

United Kingdom

I'm not sure if a hbridge can track position accurately. Could you not use a standard servo, position 1 being fully retracted and position 100 being fully extended (may need some kind of gearbox or linkages). It would certainly give better accuracy.

I may be wrong and hbridge may have the ability to track but I've not come across that action on my 4 wire hbridge, it just has the movement panel...

United Kingdom

Also, I plan to do what Bret suggested with the TIP120 (122 in my case, cannot source 120s here in the UK). I do have a breadboard on it's way to test it first but soldering the TIP122, resistor and diode "inline" covered with heat shrink and tied together nicely will take less space and be way cheaper than making up a small board (am I looking in the wrong places or are project boards and PCBs expensive in the UK?)


I also think a servo is a better option, but if he doesn't want to take apart the power antenna I can see what he is trying to do. I would also replace the antenna motor with a servo - would take some modification - but I do think it would be the way to go, and it would use a lot less of the DO ports on the EZ-B.


It'd be nice to control the antenna range, but it's not critical. I understand that a fully automatic antenna just goes all the way up with power and retracts without power, so I'd think one of these relays could do that.

I'm not sure how hard it'll be to put in a servo. The housing would have to be cut up quite a bit. I'm guessing there's a cable that rolls up and extends to push out the antenna but I don't know what sort of mechanism translates the rotational movement of the motor. The motors are always vertically positioned.



Yes, I can see where covering the switching transistor with heat shrink is a very good option if space is a question. Very neat and compact.

I've got more elbow room then most in my robot so I used a small project board that I cut down even smaller. Here's a pic of a small project board I made with 4 different switching transistors. I did use some heat shrink in places for insulation. A little messy but it works nice:

User-inserted image

User-inserted image

Here's a couple small drawbacks I can think of with the heat shrink methoid: The heat shrink makes it hard to troubleshoot and repair. You need to replace the whole assembly if the transistor burns out. Heat; transistors heat up sometimes depending on the use. However used like this I don't see this as an issue.

Frank, I'm using a h-bridge for my DC motor to turn the waist of my B9 back and forth. It works great but there are a few things to be aware of; Flyback voltage from the motor can and will damage unprotected circuits. This happens when the DC motor builds up a magnetic charge and sends that voltage back into the driving circuit when the h-bridge suddenly reverses direction of the motor. I burned up 3 h-bridges before I learned this lesson. A smaller motor may not cause this type of damage but I'm running bigger motors. The waist rotation motor is a 24vdc gear motor running through a Pololu VNH5019 Motor H-bridge. This is a very small and sturdy h-bridge. It has some over voltage protection but I also built small diode protection boards and placed them between the H-Bridges I'm using and the DC motors to keep the voltage backlash rushing into the h-bridges from the motors when the direction changes quickly. In short it consists of four quick switching Shockley diodes tied between the two motor leads and the two power supply leads to drain off the power surge to ground (that happens when the DC motor changes direction). That voltage can be up to twice the original voltage and like I mentioned above and will fry unprotected electronic parts (let the smoke out). Here's a pic of everything in place and running everything in the lower section of B9. You'll see two protection boards I made (the brown ones) protecting two h-bridges (again this may be overkill for you. I'm kinda anal):

User-inserted image

Now for tracking where the antinia is; I'm using a Multi turn pot for encoder feedback running in-line on the waist gear next to the motor. This pot is connected to a ACD port of the EZ-B and it knows where the gear is by reading the voltage change on the pot. It's very precise and you need to write a EZ Script to control the stopping points. Her's what my setup looks like. You can modify this so work with your robot:

User-inserted image

Here's a vid of it working:

I already have a ruff script written that works nicely but needs refining. It's in my project in the EZ-Cloud named "B9 Robot Control". There is actually one main waist rotation script that is called by any other script I choose to send stop point variables (like the speech recognition).

You can read the thread where I was helped by other forum members while learning this process here:

Hope this all helps. Maybe after reading all this you will decide to use a simple servo motor and adapt it you your needs. EZB does a real good job controlling servos but the little suckers are noisy and not very strong.

Let me know if I can help at all. I'm no expert and can only comment on what little I've already learned.

Dave Schulpius