Team Fortress 2 Mini Sentry

Thread Starter

Blargenth

Joined Apr 30, 2015
45
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
 

elec_mech

Joined Nov 12, 2008
1,500
That's probably normal then. The ones I last used were latching so they toggled state (0V or 5V) when I pressed the buttons. So it sounds like the receiver is still working then? Good news!
 

elec_mech

Joined Nov 12, 2008
1,500
Maybe I missed it, but I only see one code posting by bertz and no code written that looks for a signal from the receiver. Can you post what code you have?

You're right though, instead of looking for a high signal, you'll be looking for a low one on pins C.0, C.1, C.2, & C.6. Something like:

Code:
IF pinC.0 =0 THEN LED_Blink

LED_Blink:
HIGH B.0
WAIT 0.5
LOW B.0
WAIT B.0
Untested, so don't hold me to that.
 

bertz

Joined Nov 11, 2013
327
I'm back from my festival duties and a great week at the beach with the family. I see your last post was last Thursday, so by now you will have had a successful project or simply run out of time to finish. Either way, let us know how you made out. You invested a lot of time, effort and money in this project. So if it was not ready in time for the convention, don't give up. There's lots to learn and much satisfaction seeing this through to completion.
 

Thread Starter

Blargenth

Joined Apr 30, 2015
45
So here's my final post for the time. I made a lot of sacrifices to get this project off of the ground and to make a good show at the convention..... and it broke 5 minutes into the actual panel. The connector I hot glued to the frame broke when I tried to move the whole assembly and made the whole project useless.

Ontop of that, the night before something shorted in the 12v power plug for the amplifier and started smoking, and I didn't bring a spare so their was no audio either. I never managed to get the LED to work at all, and the test code that I used from Bertz which allowed me to show what inputs were working through binary, only returned the pin5 as a working input. So I probably either damaged the receiver when it was shorting, or I wired it wrong.

So it was a learning experience sure, but it was also a complete bust....

I'll hang on to the parts and try it again some day, maybe fore the biannual gaming party on campus, but probably not any thing any time soon.
 

bertz

Joined Nov 11, 2013
327
I was helping Blargenth with this project and was disappointed to see him give up after all the hard work he put into it. Perhaps he will look in on this forum and be re-energized based on what I am about to put forward. I really feel bad because we went away on holidays just as his project was nearing conclusion. I was intrigued by this project and would like to replicate it with a few differences. The O.P. was using an 18M2 project board based on my suggestion, in order to keep his costs down. I will be using a Picaxe 28X2 shield base and the instant robot shield (AXE408) that was used on another project. The O.P. also used a servo which he salvaged from an old RC car to rotate the turret. I will be using a GM3 gear motor because I have several lying around. I ended up with 7 input pins and 7 output pins so the 18M2 should handle this easily when used with a servo. A motor could be used with the 18M2 board but it would require a separate motor driver board. Attached is my I/O table which sort of puts it all into perspective.

With that having been said, let’s review what we want this puppy to do. Channel “A” toggles the sentinel in and out of ‘auto-rotate’ mode. This is where the turret rotates back and forth while emitting a weird alien sound. So if you want the turret to rotate back and forth by itself, press the “A” button on the transmitter. If you want to manually rotate the turret, press and hold the “A” button until it stops. Got it? Press “A” to go into auto mode, press “A” again to go into manual mode.

Buttons “B” and “D” on the transmitter move the turret left and right. Why use “B” and “D” ? Because they are next to each other on the transmitter. :p Upon pressing one of the buttons on the transmitter, the turret will drive in the direction assigned to the button (right or left). So, two of the buttons on the transmitter will drive the turret right or left as desired. Channel “C” will be used to fire the gun which consists of flashing an LED and emitting an alien gun sound.

Since I am using a motor, I used a pair of Hall effect sensors as my travel limit switches. Why Hall effect sensors instead of reed switches? Because they are so cool and I have a few on hand. When using a servo, the limit switches are not required and that frees up two more pins. The code for driving the servo manually is a little different. You would have to create a byte variable for the pulse length and then increment the variable using the ‘for…next’ construct.

One final word, the project was not a complete bust. It was a disappointment that it did not perform as expected for your convention. Whether you realize it or not, you gained an incredible amount of knowledge in a short time. I strongly encourage you to build on what you learned so far now that you have the luxury of time on your side.

In any event here is the code using the AXE401 and AXE408 shield:


Code:
[color=Green]'******************Sentinel Code.bas****************
'Version 2.0
'AJZ/July 2015
'This is code for the Super Sentinel using the AXE401 shield base
'and the AXE408 instant robot shield
'The sentinel is controlled by a 4 channel transmitter/receiver
'When the Channel button on the transmitter is pressed,
'the corresponding channel on the receiver goes high
'Channel A toggles the turret between auto & manual mode
'Channel D drives the turret left
'Channel B drives the turret right
'Channel C fires the gun
'the limit of rotation is determined by Hall effect sensors
'motor is GM3 or equivalent, 5 volt 3 RPM
'In addition the sound of an alien recording is played during rotation

'===Constants===[/color]
[color=Blue]symbol abit [/color][color=DarkCyan]= [/color][color=Navy]500  [/color][color=Green]'sets short pause interval

'===Variables===[/color]
[color=Blue]Symbol [/color][color=Purple]Chan_A [/color][color=DarkCyan]= [/color][color=Purple]pinA.0  [/color][color=Green]'Assign receiver channel A to Port A.0[/color]
[color=Blue]Symbol [/color][color=Purple]Chan_B [/color][color=DarkCyan]= [/color][color=Purple]pinA.1  [/color][color=Green]'Assign receiver channel B to Port A.1[/color]
[color=Blue]Symbol [/color][color=Purple]Chan_C [/color][color=DarkCyan]= [/color][color=Purple]pinA.2  [/color][color=Green]'Assign receiver channel C to Port A.2[/color]
[color=Blue]Symbol [/color][color=Purple]Chan_D [/color][color=DarkCyan]= [/color][color=Purple]pinA.3  [/color][color=Green]'Assign receiver channel D to Port A.3[/color]
[color=Blue]Symbol [/color][color=Purple]Limit_L [/color][color=DarkCyan]= [/color][color=Purple]pinB.3  [/color][color=Green]'Assign left travel limit to Port B.3[/color]
[color=Blue]Symbol [/color][color=Purple]Limit_R [/color][color=DarkCyan]= [/color][color=Purple]pinB.4  [/color][color=Green]'Assign right travel limit to Port B.4[/color]
[color=Blue]Symbol [/color][color=Purple]slave  [/color][color=DarkCyan]= [/color][color=Purple]pinB.6  [/color][color=Green]'Assign auto-rotate latch to Port B.6
  'B.5 & B.6 are jumpered together[/color]

[color=Blue]symbol motcont  [/color][color=DarkCyan]= [/color][color=Blue]C.1  [/color][color=Green]'motor ON/OFF[/color]
[color=Blue]symbol motdir  [/color][color=DarkCyan]= [/color][color=Blue]C.0  [/color][color=Green]'determines motor direction HI/LO[/color]
[color=Blue]symbol LED  [/color][color=DarkCyan]= [/color][color=Blue]C.4  [/color][color=Green]'fires LED[/color]
[color=Blue]symbol beep  [/color][color=DarkCyan]= [/color][color=Blue]B.2  [/color][color=Green]'makes "alien recording" noise  [/color]
[color=Blue]symbol chirp  [/color][color=DarkCyan]= [/color][color=Blue]B.0  [/color][color=Green]'makes "strange alien" noise[/color]
[color=Blue]symbol gun  [/color][color=DarkCyan]= [/color][color=Blue]B.1  [/color][color=Green]'makes "alien machine gun" noise[/color]
[color=Blue]symbol master  [/color][color=DarkCyan]= [/color][color=Blue]B.5  [/color][color=Green]'toggles auto mode on & off

'===Directives===[/color]
[color=Navy]#com 3  [/color][color=Green]'specify serial port[/color]
[color=Navy]#picaxe [/color][color=Black]28X2  [/color][color=Green]'specify processor
'#no_data  'save download time
'#terminal of  'disable terminal window

'============== Begin Main Program ==========================[/color]
[color=Purple]dirsA [/color][color=DarkCyan]= [/color][color=Navy]%00000000  [/color][color=Green]'all inputs[/color]
[color=Purple]dirsB [/color][color=DarkCyan]= [/color][color=Navy]%10100111  [/color][color=Green]'B.3, B.4 & B.6 are inputs[/color]
[color=Purple]dirsC [/color][color=DarkCyan]= [/color][color=Navy]%11111111  [/color][color=Green]'all outputs[/color]

[color=Black]main:[/color]
[color=Blue]If [/color][color=Purple]Chan_A [/color][color=DarkCyan]= [/color][color=Navy]1 [/color][color=Blue]then  [/color][color=Green]'press "A" on xmtr
  [/color][color=Blue]toggle master  [/color][color=Green]'toggles outpin B.5 between Hi/Lo[/color]
[color=Blue]end if
If [/color][color=Purple]slave [/color][color=DarkCyan]= [/color][color=Navy]1 [/color][color=Blue]then  [/color][color=Green]'jumper between B.5 & B.6
  [/color][color=Blue]gosub [/color][color=Black]auto[/color]
[color=Blue]end if
if [/color][color=Purple]Chan_D [/color][color=DarkCyan]= [/color][color=Navy]1 [/color][color=Blue]then  [/color][color=Green]'press "D" on xmtr[/color]
[color=Blue]gosub [/color][color=Black]manleft  [/color][color=Green]'manually rotate turret left[/color]
[color=Blue]end if
If [/color][color=Purple]Chan_B [/color][color=DarkCyan]= [/color][color=Navy]1 [/color][color=Blue]then  [/color][color=Green]'press "B" on xmtr[/color]
[color=Blue]gosub [/color][color=Black]manright  [/color][color=Green]'manually rotate turret right[/color]
[color=Blue]end if
If [/color][color=Purple]Chan_C [/color][color=DarkCyan]= [/color][color=Navy]1 [/color][color=Blue]then  [/color][color=Green]'Chan "C" button is pressed on xmtr
  [/color][color=Blue]gosub [/color][color=Black]shoot  [/color][color=Green]'execute shoot sub-routine[/color]
[color=Blue]end if
pause abit
goto [/color][color=Black]main

auto:[/color]
[color=Blue]high beep  [/color][color=Green]'activate "strange alien" sound[/color]
[color=Blue]pause abit  [/color][color=Green]'a momentary pulse activates[/color]
[color=Blue]low beep  [/color][color=Green]'a 30 second sound bite[/color]
[color=Blue]if [/color][color=Purple]Limit_L [/color][color=DarkCyan]= [/color][color=Navy]1 [/color][color=DarkCyan]and [/color][color=Purple]Limit_R [/color][color=DarkCyan]= [/color][color=Navy]1 [/color][color=Blue]then [/color][color=Green]'turret is out of the limits[/color]
[color=Blue]gosub [/color][color=Black]autoleft  [/color][color=Green]'rotate turret left[/color]
[color=Blue]end if
If [/color][color=Purple]Limit_L [/color][color=DarkCyan]= [/color][color=Navy]0 [/color][color=Blue]then  [/color][color=Green]'turret is in left limit
  [/color][color=Blue]pause abit
  gosub [/color][color=Black]autoright  [/color][color=Green]'rotate turret right[/color]
[color=Blue]end if
If [/color][color=Purple]Limit_R [/color][color=DarkCyan]= [/color][color=Navy]0 [/color][color=Blue]then  [/color][color=Green]'turret is in right limit
  [/color][color=Blue]pause abit
  gosub [/color][color=Black]autoleft  [/color][color=Green]'rotate turret left[/color]
[color=Blue]end if
goto [/color][color=Black]main

autoleft:[/color]
[color=Blue]high motcont [/color][color=Black]: [/color][color=Blue]high motdir  [/color][color=Green]'high C.1 & C.0 go left[/color]
[color=Blue]do until [/color][color=Purple]Limit_L [/color][color=DarkCyan]= [/color][color=Navy]0  [/color][color=Green]'until limit made
  [/color][color=Blue]loop
low motcont  [/color][color=Green]'low C.1 stops motor[/color]
[color=Blue]pause abit
return[/color]

[color=Black]autoright:[/color]
[color=Blue]high motcont [/color][color=Black]: [/color][color=Blue]low motdir  [/color][color=Green]'high C.1 low C.0 go right[/color]
[color=Blue]do until [/color][color=Purple]Limit_R [/color][color=DarkCyan]= [/color][color=Navy]0  [/color][color=Green]'until limit made
  [/color][color=Blue]loop
low motcont  [/color][color=Green]'stop motor[/color]
[color=Blue]pause abit
return[/color]

[color=Black]manleft:[/color]
[color=Blue]high beep  [/color][color=Green]'activate "alien recording" sound[/color]
[color=Blue]pause abit  [/color][color=Green]'a momentary pulse activates[/color]
[color=Blue]low beep  [/color][color=Green]'a 30 second sound bite[/color]
[color=Blue]high motcont [/color][color=Black]: [/color][color=Blue]high motdir  [/color][color=Green]'high C.1 & C.0 go left[/color]
[color=Blue]if [/color][color=Purple]Chan_D [/color][color=DarkCyan]= [/color][color=Navy]0 [/color][color=DarkCyan]or [/color][color=Purple]Limit_L [/color][color=DarkCyan]= [/color][color=Navy]0 [/color][color=Blue]then  [/color][color=Green]'button released or limit made
  [/color][color=Blue]low motcont  [/color][color=Green]'stop motor[/color]
[color=Blue]end if
do until [/color][color=Purple]Limit_L [/color][color=DarkCyan]= [/color][color=Navy]0  [/color][color=Green]'until limit made
  [/color][color=Blue]loop
low motcont  [/color][color=Green]'low C.1 stops motor[/color]
[color=Blue]pause abit
return[/color]

[color=Black]manright:[/color]
[color=Blue]high beep  [/color][color=Green]'activate "alien recording" sound[/color]
[color=Blue]pause abit  [/color][color=Green]'a momentary pulse activates[/color]
[color=Blue]low beep  [/color][color=Green]'a 30 second sound bite[/color]
[color=Blue]high motcont [/color][color=Black]: [/color][color=Blue]low motdir  [/color][color=Green]'high C.1 low C.0 go right[/color]
[color=Blue]if [/color][color=Purple]Chan_B [/color][color=DarkCyan]= [/color][color=Navy]0 [/color][color=DarkCyan]or [/color][color=Purple]Limit_R [/color][color=DarkCyan]= [/color][color=Navy]0 [/color][color=Blue]then  [/color][color=Green]'button released or limit made
  [/color][color=Blue]low motcont  [/color][color=Green]'stop motor[/color]
[color=Blue]end if
do until [/color][color=Purple]Limit_R [/color][color=DarkCyan]= [/color][color=Navy]0  [/color][color=Green]'until limit made
  [/color][color=Blue]loop
low motcont  [/color][color=Green]'stop motor[/color]
[color=Blue]pause abit
return[/color]

[color=Black]shoot:[/color]
[color=Blue]high gun  [/color][color=Green]'take pin B.4 high[/color]
[color=Blue]pause [/color][color=Navy]100  [/color][color=Green]'a short pulse plays entire sound bite[/color]
[color=Blue]low gun  [/color][color=Green]'take pin B.4 low[/color]
[color=Blue]for [/color][color=Purple]b0 [/color][color=DarkCyan]= [/color][color=Navy]1 [/color][color=Blue]to [/color][color=Navy]3  [/color][color=Green]'entire sound bite is about 3 seconds
  [/color][color=Blue]high LED  [/color][color=Green]'so we flash the LED at 0.5 sec intervals
  [/color][color=Blue]pause abit
  low LED
  pause abit
next [/color][color=Purple]b0[/color]
[color=Blue]return  [/color][color=Green]'finished firing sequence[/color]
 

Attachments

Top