# Team Fortress 2 Mini Sentry

Thread Starter

#### Blargenth

Joined Apr 30, 2015
45
So I'm a novice to circuits and a low level computer programmer. But I want to tackle what I consider and moderately difficult project of making a remote controlled sentry prop.

My idea for it is to have a wireless remote of some sort that has a button (trigger) and a dial to control the turret. When its not being controlled it would be in an Idle Mode where a motor inside the turret would oscillate it back and forth, maybe while making a timed 'beep'. As soon as I turn the dial it will stop oscillating and make a louder different beep, and remain in Active Mode for me to turn its head from side to side with the dial. And if I push the button (trigger) it would make firing noises and light up an LED to simulate muzzle flash. Then after 5 seconds of no commands from me, it would return to Idle Mode until I take control of it again.

It doesn't seem like it would be that difficult... but I know that with electronics things are never that easy.
So since I'm a novice I was hoping to get some advice on parts I would need, and how I could wire it all up to do this. I have a month and a half to work with so any help would be appreciated!

#### elec_mech

Joined Nov 12, 2008
1,500
Welcome to AAC.

There are a number of ways to do this, all with their pros and cons. Since you have some programming experience, I might suggest using two microcontrollers (uC). The first for the remote with an ADC (analog to digital) pin to read a potentiometer (your knob) and a momentary switch for the fire button and send data to a cheap RF transmitter. The second to read a cheap RF receiver and control either a servo or stepper motor and LED. The second uC can be programmed to oscillate the turret whenever it does not see any data from the first uC.

I can work on a design if this sounds of interest. Perhaps someone else will come up with a better idea.

#### bertz

Joined Nov 11, 2013
327
So I'm a novice to circuits and a low level computer programmer. But I want to tackle what I consider and moderately difficult project of making a remote controlled sentry prop.

My idea for it is to have a wireless remote of some sort that has a button (trigger) and a dial to control the turret. When its not being controlled it would be in an Idle Mode where a motor inside the turret would oscillate it back and forth, maybe while making a timed 'beep'. As soon as I turn the dial it will stop oscillating and make a louder different beep, and remain in Active Mode for me to turn its head from side to side with the dial. And if I push the button (trigger) it would make firing noises and light up an LED to simulate muzzle flash. Then after 5 seconds of no commands from me, it would return to Idle Mode until I take control of it again.

It doesn't seem like it would be that difficult... but I know that with electronics things are never that easy.
So since I'm a novice I was hoping to get some advice on parts I would need, and how I could wire it all up to do this. I have a month and a half to work with so any help would be appreciated!
Sounds like an interesting project. I have a couple of questions. Will this sentry be posted indoors or outdoors? Will it work off batteries or mains? The RF xmtr/rcvr concept will work. However if you can have line of sight control, then a standard IR module (like your TV remote) can do the remote work.

Thread Starter

#### Blargenth

Joined Apr 30, 2015
45
Its going to be an indoor prop for a convetion. I plan to have line of sight but with how crowded conventions can be I don't know when or if it would be blocked by other people. It would also work off batteries because I plan to carry it around alot at the covnetion. And also use it in a 'cosplay chess' tournament where it would act as one of the pieces.

I actually had more ideas for it over the past couple of days and I think I may be able to cheat the movement components of the prop by gutting a cheap RC car and using the motors in it to do the movement of the prop. The only problem with that is I have no idea how to make the sounds and lights with a set up off an RC car.

#### bertz

Joined Nov 11, 2013
327
Its going to be an indoor prop for a convetion. I plan to have line of sight but with how crowded conventions can be I don't know when or if it would be blocked by other people. It would also work off batteries because I plan to carry it around alot at the covnetion. And also use it in a 'cosplay chess' tournament where it would act as one of the pieces.

I actually had more ideas for it over the past couple of days and I think I may be able to cheat the movement components of the prop by gutting a cheap RC car and using the motors in it to do the movement of the prop. The only problem with that is I have no idea how to make the sounds and lights with a set up off an RC car.
Here's another thought. You could make the sentinel fully autonomous. The turret would rotate back and forth through a 60 degree arc until an ultrasonic proximity sensor detected an object (or person) say with 6 ft. (or whatever distance you want). When the object is detected, the turret will lock onto the subject and fire the LED cannon along with sound effects. A high torque servo will do the job of rotating the turret (depending how big you want it). If the turret is super large then a stepper motor is probably the best bet (but more expensive). Flashing LED's and making noise is easy. It's up to you.

Elec Mech is a great resource who has helped me on other projects./

Thread Starter

#### Blargenth

Joined Apr 30, 2015
45
Yea there is a page online of a guy who did something simmilar. The problem is the convention is gonna be so crowded it would have trouble locking onto people. And I don't think it'll work in the chess tournament either since it'll be facing a whole row of other 'pieces' and as the tournament progress it may miss fire when someone moves. Thats why I'd rather have direct control of it unless its idle.

#### elec_mech

Joined Nov 12, 2008
1,500
Unfortunately, cheap RC cars don't have a lot of working distance between the receiver and transmitter. That aside, I'd also be concerned about the mechanics - an RC car goes extremely fast whereas you want the tank turret to turn slowly. You'd have to either add gears or belts and pulleys which will become complicated and time-consuming quickly.

However, if you could find an RC tank that fits within your budget, you could add a circuit to handle the automation whenever you aren't actively sending it a command from the transmitter. This could be tricky because you'd need something in between the receiver and motor.

Approximately how big will the tank be, e.g., tennis ball, shoe box, etc.?

For simplicity, I still think a couple of microcontrollers, a servo, and a data receiver/transmitter pair would do what you want. I haven't used a modem RF module before, but I'm confident (perhaps with bertz's help) we can get something to work. Additionally, you won't have to worry about interference from other people using RC signals for other props (not sure how big an event this will be) since there is only a handful.

If you want to be a glutton for punishment, you may try looking for something that communicates with smartphone (assuming you have one) - then you could write an app and your smartphone would be the remote. Can't say I've done this before, but there have been similar discussions on this forum that might offer guidance.

#### bertz

Joined Nov 11, 2013
327
I agree with elec-mech, not much value in those cheap RC cars.

Here is how I would do it. The heart of the system is a Picaxe 28 Project Board with a ULN2803 chip and a L293D motor driver. You can pick up a nice gearmotor (12 volt, 8 RPM) on e-bay for about $22.00. You will also need an audio amplifier module and a pair of speakers if you want this to be heard in a large room with a lot of background noise. You'll also need a 12 volt and 5 volt power supply if this robot will be powered from the mains (batteries wont last very long). The next question is remote control. Personally I favor an IR system that uses one of the cheap "universal" remotes on the market today. We could assemble an 08M2 based stand alone device using a TSOP4838 IR receiver that can recognize the TV-remote signals and send the data to our 28X2 master processor. The big advantage is less complexity and straight forward programming. Or we could utilize one of the cheap 2.4 RC transmitter/receivers such as the Turnigy 5ch available for about$40 from Hobby King. The output from the RC receiver is a PWM signal so that would have to be converted to a digital input (yuck!).

Either way the project should cost between $150 and$200 depending on how fancy you want to make the turret and what materials you have on hand. By the way, I envision the turret to be no more than 12 inches in diameter. If greater than that we will have to go to a larger (more expensive) gearmotor and use a L298 driver.

The machine gun would consist of 4 high intensity white LEDs in the barrel to simulate a muzzle flash.

#### elec_mech

Joined Nov 12, 2008
1,500
The 2.4GHz transmitter is a bit pricey (to me), but all the RF black magic and antenna design is taken care of, which is no small matter. I still like the idea of using a servo only because it simplifies the mechanical design and a servo can be connected to and controlled by a PICAXE directly. However, a geared motor will be far stronger than most servos, so it depends on how the OP wants to move forward.

bertz said:
The output from the RC receiver is a PWM signal so that would have to be converted to a digital input (yuck!).
I think there is a fairly simply interface between the servo signal from the RC receiver and the PICAXE. I found a few posts here, here, and here, the last one being the most helpful I think. Using the 2.4GHz transmitter with a servo to turn the turret, I think we could program the PICAXE to receive the signal from the remote and simply pass that signal onto the servo directly. When a signal from the remote is no longer detected after x time, then the PICAXE would take over and control the turret on an auto cycle.

Going this route, the remote uses a 'stick' that is kept in the center position by springs. If the OP really wants a knob, I think the remote innards could be put into another housing with the turret 'stick' placed on its side and a knob attached (I think).

Might need to look at two signals simultaneously since all signals will always be active from a RC remote, but the OP only wants to control the turret remotely sometimes. Perhaps if we can disable the springs, then the PICAXE only needs to see if the signal remains unchanged after x time before going to auto mode.

Again, the servo is just how I would do it for ease of construction. This can all still be done with a geared or stepper motor just as easily, just with a slight change to the program.

I like the multiple white LED idea to simulate muzzle flash. Neat idea.

#### bertz

Joined Nov 11, 2013
327
After thinking about this further, it seems to me that interfacing a PICAXE with an RC receiver is a simple matter. The positioning signal for each channel is a pulse between 0.75 and 2.25 milliseconds (ms) long, repeated about every 18ms (so there are roughly 50 pulses per second).
How many channels do we need?
1 channel to cycle the turret
1 channel to manually position the turret
1 channel to fire the gun
We can use the pulsin command to measure the length of the pulse coming from each channel, then based on the length of the pulse use a case or if...then construct to execute the activity we want.
A 5 channel transmitter usually has a "gear" or "flap" switch which could be used to select manual or cyclic rotation of the turret.

I completely agree that I would prefer to use a servo for rotating the turret, but the OP has given us no indication as to the size of this sentinel. One other note of caution when using a servo in cyclic mode. It will get HOT! So a high quality servo with built in heat sink is in order here. These are not cheap either. The servos used in my avatar cost about \$50 each.

One final observation. It seem that this is a one off project so we should try to modularize this as much as possible as well as use off the shelf components with minimum modification. I think we should keep soldering to an absolute minimum. That's why I strongly recommend the project boards. Let's hear from the OP to give us some direction as to the size of this beast and whether or not he wants to move forward.

#### Søren

Joined Sep 2, 2006
472
After thinking about this further, it seems to me that interfacing a PICAXE with an RC receiver is a simple matter.
Why not one of the very cheap TX/RX sets (running on ISM frequencies like 433MHz, or whatever is the local legal flavor)?
Then it's possible to use any asynchronous serial protocol that you can dream up.

The positioning signal for each channel is a pulse between 0.75 and 2.25 milliseconds (ms) long, repeated about every 18ms (so there are roughly 50 pulses per second).
No, although most manufacturers deviates (some even worse than what you mention, 0.3ms to around 2.8-3.2ms), the standard signal is 1.0ms to 2.0ms with 1.5ms as the center position signal, repeated at 20ms/50Hz.
All the non-standards result in a need for loose tolerances - which lets manufacturers go even more berserk.

How many channels do we need?
1 channel to cycle the turret
1 channel to manually position the turret
1 channel to fire the gun
1 channel to aim and 1 to fire - "scanning" resumes a number of seconds after the shot, if no new repositioning signal is received before timeout. Same thing if not fired, perhaps use the position reached point to start a countdown to "scanning mode", with a count down reset if fired.

If used with an ISM set, 1 channel. A single byte could hold all commands (send twice and discard if not equal).
A byte could be broken up in 1 value to fire, 1 value to resume "scanning mode" if needed and, depending on the coverage of the turret, position data for positions 1° or 2° apart.

We can use the pulsin command to measure the length of the pulse coming from each channel, then based on the length of the pulse use a case or if...then construct to execute the activity we want.
"Case" is usually a bad move for a large (-ish) number of decisions on a controller - nice and structured, of course, but they compile to a huge code size.

Thread Starter

#### Blargenth

Joined Apr 30, 2015
45
So here's the update. I'm gonna go through all of ya'lls posts to get a good idea on how to radio control parts. But purely I'm gonna use mechanical for alot of parts in this.

I've disected an RC car from walmart that has two motors, one for driving the wheels and one for turning. With that I plan to use a simple oscillating mechanism for the turret turning side to side that I plan to remotely control (no idle mode, just always run it myself) It came with working LEDs for the headlights that I'll figure out how to wire into the muzzle of the turret as the muzzle flash. What I still need to figure out is how to set up prechosen sounds as an output (the gun shooting and beeping) and how to trigger them with the motor circuits I already have.
this is what one of the motors will drive.

#### bertz

Joined Nov 11, 2013
327
By going mechanical you are severely limiting yourself to what you want to do, not to mention making things a lot more complicated mechanically. Most RC toy cars have only two channels and the receivers use pulsed outputs to drive an ESC (Electronic Speed Control) for the drive motor and a servo for steering. I suspect you only have one motor, the other "motor" is a servo. In my opinion, you need at least 3 channels to accomplish the tasks you have set out.

Here is a nifty little 4 channel transmitter/receiver combo that also happens to be dirt cheap. I just bought two of them this morning. These readily interface with a microcontroller (MCU) because the receiver outputs are digital! This dramatically simplifies programming.

http://www.ebay.com/itm/IC-2262-2272-4-CH-Key-Wireless-Remote-Control-315MHZ-Receiver-module-F-Arduino-/201159288346?pt=LH_DefaultDomain_0&hash=item2ed607261a

The servo can be used to drive the turret directly and the MCU can define the travel limits.

In addition, the MCU can be used to generate the beeps and rat-tat-tat of the machine gun as well as synchronize the LEDs to the sound of the gun.

You will definitely need an amplifier if you want the sounds of the sentinel to be heard in a noisy environment.

I have attached a block diagram of how all this fits together. Don't let the thought of programming scare you off. We can provide lots of help here and in the PICAXE forum if you choose to go that route.

Good Luck!

#### Attachments

• 443.1 KB Views: 34
Thread Starter

#### Blargenth

Joined Apr 30, 2015
45
By going mechanical you are severely limiting yourself to what you want to do, not to mention making things a lot more complicated mechanically. Most RC toy cars have only two channels and the receivers use pulsed outputs to drive an ESC (Electronic Speed Control) for the drive motor and a servo for steering. I suspect you only have one motor, the other "motor" is a servo. In my opinion, you need at least 3 channels to accomplish the tasks you have set out.

Here is a nifty little 4 channel transmitter/receiver combo that also happens to be dirt cheap. I just bought two of them this morning. These readily interface with a microcontroller (MCU) because the receiver outputs are digital! This dramatically simplifies programming.

http://www.ebay.com/itm/IC-2262-2272-4-CH-Key-Wireless-Remote-Control-315MHZ-Receiver-module-F-Arduino-/201159288346?pt=LH_DefaultDomain_0&hash=item2ed607261a

The servo can be used to drive the turret directly and the MCU can define the travel limits.

In addition, the MCU can be used to generate the beeps and rat-tat-tat of the machine gun as well as synchronize the LEDs to the sound of the gun.

You will definitely need an amplifier if you want the sounds of the sentinel to be heard in a noisy environment.

I have attached a block diagram of how all this fits together. Don't let the thought of programming scare you off. We can provide lots of help here and in the PICAXE forum if you choose to go that route.

Good Luck!
Wow thats incredible. I am deffinetly gonna pick that up then. Could I still use the motor off of the RC car I picked up? It seemed like a standard electrical motor at first glance to me. And what would be a good cheap amplifier for the sounds?

Thread Starter

#### Blargenth

Joined Apr 30, 2015
45
I'm still waiting for the control circuit to come in but now that I'm done with finals I have some free time to really start putting this project together. I still need to know what MCU I should use that can set an idle mode, control the turning of the unit, and make noises at the proper times.

#### bertz

Joined Nov 11, 2013
327
I'm still waiting for the control circuit to come in but now that I'm done with finals I have some free time to really start putting this project together. I still need to know what MCU I should use that can set an idle mode, control the turning of the unit, and make noises at the proper times.
PICAXE-18 Standard Project Board
http://www.picaxestore.com/index.php/en_gb/picaxe/project-boards/chi030.html
PICAXE-18M2 microcontroller
http://www.picaxestore.com/index.php/en_gb/picaxe/picaxe-chips/picaxe-chips/axe015m2.html
AXE027 PICAXE USB Download Cable
http://www.picaxestore.com/index.php/en_gb/picaxe/picaxe-download-cables/axe027.html

Thread Starter

#### Blargenth

Joined Apr 30, 2015
45
OK, so zero progress has been made, but that's partially because this past month has been a nightmare of stress. And I have no money to buy parts.

BUT I did take the time tonight to flesh out a basic idea of a program psuedo code. I tried to use keywords from C++ to convey the general logic statements, but I may have used some of them wrong.... I'm not the best programmer in the world...

switched on

if signal
switch

case 1: turn left slow (until release (break))

case 2: turn right slow (until release(break))

case 3: make attention noise
while (case 3)
{
light led
firing noise
} (All until release(break))

else If (no signal)
idle
{
wait 5 seconds
turn left 45 degrees
Beep
while (no signal)
{
turn right 90 degrees
beep
turn left 90 degrees
beep
}

}

My question is does this seem like a good set up for a controlled sentry from tf2? and also will I be able to use logic like this when programming the microcontroller you recommended?

Last edited:
Thread Starter

#### Blargenth

Joined Apr 30, 2015
45
So I got the parts Bert suggested... can anyone help me with how to properly wire it up and program it?

Thread Starter

#### Blargenth

Joined Apr 30, 2015
45
bump?

#### elec_mech

Joined Nov 12, 2008
1,500
I was hoping @bertz would provide further assistance, but I assume he's otherwise disposed. I'm a bit busy myself, but I'll try to help. Can you list out everything you currently have and, where possible, include links to the products you've purchased?

What did you decide on for a remote control? Hobby, IR, other form of wireless? Of has this been decided yet?