A TF2 Mini Sentry

Blargenth

New Member
Hello, I'm currently working on a personal project to make a remotely controlled Mini sentry that is capable of going into an idle state of turning back and forth and beeping. And on the press of a button will make an alert noise as I press a turn button (IE make a noise when I turn it left or right) and light up LEDs and make noise when I press the fire button. And finally after I've left it alone for a few secons, it will return back to its idle mode and continue turning from side to side and beeping.


The parts I am using:
IC 2262/2272 4 CH Key Wireless Remote Control 315MHZ Receiver module F Arduino
PICAXE-18 Standard Project Board
PICAXE-18M2 microcontroller
TDA7297 DC 6V-18V 10-50W Dual-Channel Power Amplifier Module Board
200s USB MP3 with 5 BUTTONS device

I've been getting help on "All About Circuits" forums from Bertz and I am including some code snippets he suggested for this project plus his wiring diagram.

I'm a pretty novice computer programmer myself so I'm not asking for someone to do the whole project for me, just help on the syntax for coding the pickaxe module as well as some ideas on how to put it into and take it out of idle mode.

View attachment Sentinel Code.pdf View attachment Wiring Diagram0002.PDF

Any help will be greatly appreciated.
 

Blargenth

New Member
Also no rush, I don't want to give undo pressure for something being done for me for free. But this is for a project that I need to be finished by July 17th.
 

Blargenth

New Member
Sorry to show my ignorance, but perhaps I'm not alone. ;)

What the heck is this thing for?
No, questions are welcomed.

This is for A Team Fortress 2 Mini Sentry Prop



A remote controlled prop of one of these for a convention coming up.

The Remote has four buttons on it, I want one button to be turn right, one to be turn left and the last to 'fire'. If possible I think maybe the fourth should be a manual return to idle or something like that.
 
Last edited:

Rick100

Senior Member
Hello Blargenth and welcome to the forum. This looks like a fun project and should be possible with a Picaxe. How far have you got so far? Have you used the Picaxe editor and got an led to blink or some other simple program running?

I would approach the projects in stages. First I would get the servo sweeping. Then in a separate program get the sound board playing under program control. After you get all the pieces working, you can combine them.

Good luck,
Rick
 

Blargenth

New Member
Thanks rick, I'll start in steps like you suggested but sadly I haven't gotten very far at all with the actual program because the battery packs I ordered still haven't arrived. And its annoying me cause I haven't seen any movement on the USPS tracking site either...
 

Goeytex

Senior Member
A good 5V AC to DC "wall wart" or other Adapter can substitute for the battery pack until it arrives. I have several 5V adapters that I acquired from the local Goodwill or Salvation Army resale shops that typically have bins full of wall warts and adapters for chea.

I have several that I have acquired from these sources that supply regulated 5V @ 2 amps and one that supplies 5V @ 5 amps. I think I paid about $1 or $2 each for these. Something like this should be more than adequate for local testing until the battery packs arrive.
 

erco

Senior Member
If this is for indoor use only, you could use IR for remote control. Cheaper, easier, one one I/O pin, and more functions than the RC unit you listed. You would use with a universal TV remote and an IR receiver module.
 
Last edited:

Blargenth

New Member
Were way passed that, I don't know if I'll have direct line of sight at all times so we went with wireless instead of IR


Also for some reason I could find my pickaxe editor on this computer so I downloaded the 6th editor. But for some reason it says beta.. .are their any like major flaws with it that would make it not work with this project, and or should I go to an older version?
 

Blargenth

New Member
So a few weeks earlier into this project when I was just starting out, I kind of threw together a pseudo code for what I want this sentry to do in a C based language.

What I wanna know is will Pickaxe manage things like if statements and switch statements? Or do I need to change up my code drastically to work with pickaxe?

switched on

if signal
switch

case 1: make attention noise for 1 second
turn left slow (until release (break))

case 2: make attention noise for 1 second
turn right slow (until release(break))

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


else If (no signal for 3 seconds)
idle
{
center self
turn left 45 degrees
Beep
while (no signal)
{
turn right 90 degrees
beep
turn left 90 degrees
beep
}
 

Blargenth

New Member
So I finally finished all the wiring on my board. But now I have no idea if the board is being picked up by my editor. All I get when I plug i the board to my usb is the error noise of 'usb not recognized'

When I try to check the pickaxe connection its says 'Error: Cannont open port com5"
 

Blargenth

New Member
I tried doing some other checks on the board with my multimeter and what I found was when I turned on the powersource, the secondary chip heated up so much it was too hot to touch. I turned it around and now its not heating up.... did I just put it in backwads?
 
Last edited:

inglewoodpete

Senior Member
To #17 Go to the Workspace Explorer and click "Refresh COM ports". Then select the com port that is connected. If you move a USB-to-Serial cable between USB ports, the Com port number will change.

#18: I think there are two different problems here. The second one is a wiring/soldering problem on the board. Post some clear, close-up photos of the top and bottom of your board and members will be able to comment. Oh, and is the PICAXE (and any other chips) plugged in the right way around? - I've done that one :(
 
Last edited:

Blargenth

New Member
To #17 Go to the Workspace Explorer and click "Refresh COM ports". Then select the com port that is connected. If you move a USB-to-Serial cable between USB ports, the Com port number will change.

#18: I think there are two different problems here. The second one is a wiring/soldering problem on the board. Post some clear, close-up photos of the top and bottom of your board and members will be able to comment. Oh, and is the PICAXE (and any other chips) plugged in the right way around? - I've done that one :(
Yea it was the 18m2 chip. I had it in backwards. I think it worked but hitting refresh port still returns None available in the COM port selection
 

Blargenth

New Member
SHE LIVES! I had no idea that their were drivers for the download cable I had to install pre-plugging in the cable. Now she's coming up on the editor! and now all I need to do is write the software >_< I know I know, I'm procrastinating....
 

Blargenth

New Member
Ok time to get to the nitty gritty of this programming hobajoba

Like I showed in the psuedo code I want it to go into an idle mode after a few seconds of inactivity, but other than that I just want it to respond to wireless inputs like it was being remotely controlled. Any idea how to initialize and divide those two tasks?
 

Rick100

Senior Member
If you have the receiver and led wired up like the diagram in your first post, try this code. It will print the input from the receiver in binary to the terminal screen in the editor. It will also turn the led on and off with the remote. This should confirm part of your setup is working.

Code:
[color=Navy]#picaxe [/color][color=Black]18m2[/color]
[color=Navy]#no_data
#terminal 4800[/color]

[color=Blue]symbol LED [/color][color=DarkCyan]= [/color][color=Blue]B.1[/color]

[color=Green]'program start

      [/color][color=Blue]output LED        [/color][color=Green]'make led pin an output
      [/color][color=Blue]sertxd([/color][color=Red]"****Reset****"[/color][color=Black],[/color][color=Navy]13[/color][color=Black],[/color][color=Navy]10[/color][color=Blue]) [/color][color=Green]'signal reset has happened

      [/color][color=Blue]pause [/color][color=Navy]1000[/color]

[color=Black]top:
      [/color][color=Purple]b0 [/color][color=DarkCyan]= [/color][color=Purple]pinsC  [/color][color=Green]'read portC into bit addressable variable
      [/color][color=Blue]sertxd([/color][color=Black]#[/color][color=Purple]bit7[/color][color=Black],#[/color][color=Purple]bit6[/color][color=Black],#[/color][color=Purple]bit5[/color][color=Black],#[/color][color=Purple]bit4[/color][color=Black],#[/color][color=Purple]bit3[/color][color=Black],#[/color][color=Purple]bit2[/color][color=Black],#[/color][color=Purple]bit1[/color][color=Black],#[/color][color=Purple]bit0[/color][color=Black],[/color][color=Navy]13[/color][color=Black],[/color][color=Navy]10[/color][color=Blue])     [/color][color=Green]'print portC in binary to terminal
      
      'copy state of input pin C.2 to led output pin
      [/color][color=Blue]if [/color][color=Purple]bit2 [/color][color=DarkCyan]= [/color][color=Navy]1 [/color][color=Blue]then
            high LED
      else
            low LED
      endif

      pause [/color][color=Navy]100
      [/color][color=Blue]goto [/color][color=Black]top
      
      [/color][color=Blue]end[/color]
Good luck,
Rick
 

Blargenth

New Member
Thanks rick. My major achilles heel with programming this is I have little in the way of examples to draw on how the syntax is laid out, especially in terms of including library's and other startup things that have to be preset. So this will definitely help.

Edit:
So I tried your coding example and programmed it into my board... and a Serial Terminal opened up and started printing 00000000 over and over again, its at about 1500 lines of it right now. Is this it loading into the program or part of the sertexd command? I don't know whats going on and my board isn't responding to input from my wireless remote
 
Last edited:

Rick100

Senior Member
So I tried your coding example and programmed it into my board... and a Serial Terminal opened up and started printing 00000000 over and over again, its at about 1500 lines of it right now. Is this it loading into the program or part of the sertexd command? I don't know whats going on and my board isn't responding to input from my wireless remote
That's the output from the sertxd command displaying the state of the input pins.

Do you have a multimeter? Can you post some pictures of your board? If you have a multimeter, unhook one or all of the output pins from the the receiver board but leave the power pins hooked up. Put your multimeter on volts and measure between the ground going to the board and one of the unhooked outputs. Make sure you don't short between 2 pins with the multimeter probe. Measure it while you push the button on the transmitter to see if it goes from 0 to 5 volts. Your trying to confirm the transmitter/receiver are working.

Is this the transmit/receiver you using?
https://youtu.be/2RHOTXIoy2k

Good luck,
Rick
 

Blargenth

New Member
That's the output from the sertxd command displaying the state of the input pins.

Do you have a multimeter? Can you post some pictures of your board? If you have a multimeter, unhook one or all of the output pins from the the receiver board but leave the power pins hooked up. Put your multimeter on volts and measure between the ground going to the board and one of the unhooked outputs. Make sure you don't short between 2 pins with the multimeter probe. Measure it while you push the button on the transmitter to see if it goes from 0 to 5 volts. Your trying to confirm the transmitter/receiver are working.

Is this the transmit/receiver you using?
https://youtu.be/2RHOTXIoy2k

Good luck,
Rick
Yea thats the one. I'll do that when I get out of class in 4 hours but for now heres the pics of the circuitry.

I rearranged the wires after making a mistake of mixing the voltage and the ground wires on the reciever chip. But not before the chip got so hot I couldn't touch it.
 

Attachments

Rick100

Senior Member
I rearranged the wires after making a mistake of mixing the voltage and the ground wires on the reciever chip. But not before the chip got so hot I couldn't touch it.
These must be old pictures since the 18m2 is plugged in backwards. It sounds like the receiver board may be fried :( . You'll just have to test it with your meter.

Good luck,
Rick
 

Blargenth

New Member
real quick, does the code have to be running and the sertxd output showing form e to run this test or should it be working purely with just the power on for the board? And yes they are old pictures.
 

Blargenth

New Member
So I just got a chance to run the multi-meter through the receiver... and well... it does the opposite. Theirs a charge running through it of 4.30 until I press the corresponding button. Then it drops to 0v
 

Rick100

Senior Member
So I just got a chance to run the multi-meter through the receiver... and well... it does the opposite. Theirs a charge running through it of 4.30 until I press the corresponding button. Then it drops to 0v
Does it do this consistently? Any other words, does a pressed button equal 0 volts and a non pressed button equal 4.3 volts? What is the power supply voltage?
 

Rick100

Senior Member
Try this test to confirm the inputs to the 18m2 are working. Unhook the wire from the receiver to input C.0 on the CH1030 board. Run the test program. you should see a 00000000 scrolling by. With the program still running take a piece of wire and connect C.0 to V1+ . You should see 00000001 start to scroll by. When you remove the wire it should change back to 00000000 .

Good luck,
Rick
 

Blargenth

New Member
Sooo... I said that the deadline was tomorrow, but really I don't need a fully working prop till sunday. So I will be working on the coding over the weekend while I'm at the convention. So any help would be greatly appreciated that you guys can offer.

Also Rick. We did do a test on the reciever to find it was working.... But It seemed that it was outputting 4.5v when not pressed... and 0v when the reciever got a signal... like it was working in reverse or something. Will I need to change my code to accommodate that?
 

Rick100

Senior Member
Also Rick. We did do a test on the reciever to find it was working.... But It seemed that it was outputting 4.5v when not pressed... and 0v when the reciever got a signal... like it was working in reverse or something. Will I need to change my code to accommodate that?
Yes, your code will have to change to respond to low signal. Do you have anything written yet? Also, I don't think the led will work if it's wired according to your original drawing. The led will have to be wired with the cathode(flat spot side) to the B.1 output pin. The anode should be connected to V2+ through the resistor. You should run the test code again and watch carefully for the bits to change when you press the transmitter buttons. Make sure you press and hold the button. The code just displays the status of the input pins. If the receiver output is not showing up on the inputs your program won't have anything to respond to. The test code should also control the led with one of the receiver outputs.

Good luck,
Rick
 

erco

Senior Member
Big day tomorrow, Blargenth. Looks like you're in good hands with Rick100. How are you coming along?

BTW it may seem difficult now with your deadline looming, but you're learning a lot under fire. After the crisis has passed, you'll be coding in your sleep.
 

Rick100

Senior Member
After the crisis has passed, you'll be coding in your sleep.
Or coding instead of sleeping :)

You can try this program on your hardware. It does most of the actions you wanted. I'm not sure the outputs from your receiver are getting to the inputs of the Picaxe. If the inputs are staying at all zeros, this program should fall into it's idle mode and start sweeping the servo back and forth. Maybe it will give your prop some motion.

View attachment TF2_sentry.bas


Good luck,
Rick
 

Blargenth

New Member
I don't know if anyone is awake right now. But I finally got a chance to wire everything up and check it. And I can't get sertxd to respond to my inputs. Its still not working.

The code I'm using is Rick's example code to light up the LED. And I don't think what rick said about the LED pin will make a difference, its not detecting my input.
 

erco

Senior Member
Do you have a common ground between your Picaxe and your remote control? That is, you need to connect the remote neg battery connection to your Picaxe neg battery connection, in addition to connecting each remote output to a Picaxe input.
 

Rick100

Senior Member
In addition to erco's suggestion you can try the test I described in post 33 to make sure the inputs are working. You can also try the program in post 37 to see if the servo works. I'm afraid your receiver board may be fried.
 
Top