Registration Notice

Due to increased spam, forum registration must be manually approved by a moderator! Please see this post for instructions.

*

Offline LukeZ

  • 1255
    • View Profile
  • France
Re: Standalone Tank IR
« Reply #60 on: May 21, 2024, 10:15:39 AM »
Hi Rongyos, I will be happy to share the project. We can create an entry for it on the Downloads page the same way we have with other user designs. In addition to your Arduino code, if you have a schematic, board files (Eagle or Gerber or whatever), and list of parts (what we call a "BOM" for "bill of materials") we can post all that as well.

Even only understanding the subtitles, your video was very clear to me!
NO SUPPORT THROUGH PM - Read why
Need a forum account? Read here
Open Panzer FAQs

*

Offline Rongyos

  • 51
    • View Profile
  • Hungary
Re: Standalone Tank IR
« Reply #61 on: May 23, 2024, 08:20:25 AM »
Hi Rongyos, I will be happy to share the project. We can create an entry for it on the Downloads page the same way we have with other user designs. In addition to your Arduino code, if you have a schematic, board files (Eagle or Gerber or whatever), and list of parts (what we call a "BOM" for "bill of materials") we can post all that as well.

Even only understanding the subtitles, your video was very clear to me!

Hey Luke,

I hope its okay to attach the file to this post.

Regards
Rongyos
*
Rongyos_TankIR.rar
(79.99 kB ~ Downloads: 343)
*
Rongyos_IR_BOM.xlsx
(10.98 kB ~ Downloads: 1658)
*
Schematic.pdf
(39.38 kB ~ Downloads: 1686)
*
Rongyos_IR_2024-05-23.zip
(55 kB ~ Downloads: 334)
*
printable_case.stl
(178.41 kB ~ Downloads: 1567)
IMG_20240523_131752.jpg
Standalone Tank IR IMG_20240523_131752.jpg
Views: 747

*

Offline LukeZ

  • 1255
    • View Profile
  • France
Re: Standalone Tank IR
« Reply #62 on: May 23, 2024, 02:47:27 PM »
Hi Rongyos, yes that's ok you posted the files here. I have created an entry for your project on the Downloads page and added all the files there, along with a link to this thread as well as to your YouTube video.

I wrote a short description but if I have said anything incorrect or if you would like to modify it, just let me know!

NO SUPPORT THROUGH PM - Read why
Need a forum account? Read here
Open Panzer FAQs

*

Offline Rongyos

  • 51
    • View Profile
  • Hungary
Re: Standalone Tank IR
« Reply #63 on: May 27, 2024, 03:34:21 AM »
I wrote a short description but if I have said anything incorrect or if you would like to modify it, just let me know!

Hi Luke,

I’ve corrected some values in the BOM. Please reupload the file for clarity. Also, there is a misspelling in the name of the STL file in your post (cse should be case).

regards
Rongyos
*
Rongyos_IR_BOM.xlsx
(10.98 kB ~ Downloads: 305)

*

Offline LukeZ

  • 1255
    • View Profile
  • France
Re: Standalone Tank IR
« Reply #64 on: May 27, 2024, 11:37:28 AM »
Hi Rongyos, thanks for double-checking everything. I actually found two typos! But they have been corrected, and I've also updated the BOM file.
NO SUPPORT THROUGH PM - Read why
Need a forum account? Read here
Open Panzer FAQs

*

Offline Rongyos

  • 51
    • View Profile
  • Hungary
Re: Standalone Tank IR
« Reply #65 on: September 02, 2024, 12:11:51 PM »
Hi Luke!

I hope everythings well, long time no see. There is some battle unit around now, working like charm with servo recoil...but... In case of taigen recoil the fire cannon function activated after the whole recoil effects is done (when gun barrel go back to default). I assume thats because of the firing cannon function is looking for the "BACK TO DEFAULT" signal, and - how the taigen works - the board recevies negative signal until the microswitch disconnects the negative pole from battery. Question: why is it important to wait until the pin signal go back to HIGH? Sometimes the battle unit fails and restarts because of this. Is it for safety? How can I solve this problem?

Thanks
Rongyos

*

Offline LukeZ

  • 1255
    • View Profile
  • France
Re: Standalone Tank IR
« Reply #66 on: September 03, 2024, 04:24:00 AM »
Hi Rongyos, I'm not sure I know which "Back to Default" signal you are referring to - is this in the Standalone IR code? Where is the code waiting for anything to go back to HIGH?

Are you using the negative signal from the Taigen connected to Pin D4 on the Arduino as the trigger to fire the cannon?
NO SUPPORT THROUGH PM - Read why
Need a forum account? Read here
Open Panzer FAQs

*

Offline Rongyos

  • 51
    • View Profile
  • Hungary
Re: Standalone Tank IR
« Reply #67 on: September 03, 2024, 04:54:38 AM »
Hi Rongyos, I'm not sure I know which "Back to Default" signal you are referring to - is this in the Standalone IR code? Where is the code waiting for anything to go back to HIGH?

Are you using the negative signal from the Taigen connected to Pin D4 on the Arduino as the trigger to fire the cannon?

Hey Luke!

Sorry for not able to provide clear details. Finally I am near my computer so I can provide more details.

As the taigen mechanical recoil works: it gets negativ signal from the airsoft pin from taigen for a short period (you only have to push the transmitter joy up for a short time). The rotary gear releases a microswitch then in the recoil unit which connect the ground from the battery. The cycle is around 3 seconds, and the microswitch being pushed and disconnects the ground pole from the battery. (single banana plug from taigen). The standalone unit gets the shot signal from the airsoft pin (yellow wire) BUT the wire connected to the recoil motor - where the battery ground also connected until the microswitch close the line. (3 sec). So for 3 sec the battle unit receives LOW (because the D4 pin is INPUT_PULLUP in my case).

I checked the code again the loop is waiting for InputButton.wasReleased() then activates the FireCannon function. (I called it BACK TO DEFAULT before, i remembered the thing but not the name) BUT there is an other function you commented on it:


Code: [Select]
case BUTTON_WAIT:               
                if (InputButton.wasReleased())
                {   // A single press (short) of the button will fire the cannon
                    FireCannon();
                }
                else if (InputButton.pressedFor(2000))
                {
                    // User has held down the input button for two seconds (long press)
                    // Wait for them to release the button before proceeding
                    do { delay(10); InputButton.read(); } while (!InputButton.wasReleased());                     
                    ButtonState = BUTTON_WAIT;

 // Now you could take some other action here to occur on long button press
                    // bla bla

So I think the board wants to go to the special menu which is not set and sometimes fails itself. What do you think, is it better to modify the loop to wait for InputButton.isPressed or .wasPressed to solve the problem and force the unit to activate FireCannon function as soon as it receives the LOW signal?
Code: [Select]
/*----------------------------------------------------------------------*
 * isPressed() and isReleased() check the button state when it was last *
 * read, and return false (0) or true (!=0) accordingly.                *
 * These functions do not cause the button to be read.                  *
 *----------------------------------------------------------------------*/
uint8_t OP_Button::isPressed(void)
{
    return _state == 0 ? 0 : 1;
}

uint8_t OP_Button::isReleased(void)
{
    return _state == 0 ? 1 : 0;
}

/*----------------------------------------------------------------------*
 * wasPressed() and wasReleased() check the button state to see if it   *
 * changed between the last two reads and return false (0) or           *
 * true (!=0) accordingly.                                              *
 * These functions do not cause the button to be read.                  *
 *----------------------------------------------------------------------*/
uint8_t OP_Button::wasPressed(void)
{
    return _state && _changed;
}

uint8_t OP_Button::wasReleased(void)
{
    return !_state && _changed;
}

Thanks
Rongyos

*

Offline LukeZ

  • 1255
    • View Profile
  • France
Re: Standalone Tank IR
« Reply #68 on: September 03, 2024, 05:52:28 AM »
Ok, I also found that same area of code while you were writing and I agree, I think it is a problem. That code was copied from the TCB which wants to tell the difference between short and long press of the input button, but we don't need that here. And you are correct, the result is that if the airsoft takes a long time, then the Arduino might keep waiting and waiting and never fire the canon.

Try changing that section of code to this and see if this works better:
Code: [Select]
    // PROCESS BUTTON PRESS
    // --------------------------------------------------------------------------------------------------
        switch (ButtonState)
        {
            // The BUTTON_WAIT state watches for a press of the button (or GND signal) on D4.
            case BUTTON_WAIT:               
                if (InputButton.isPressed())
                {
                    FireCannon();
                }
        }

Note that I have changed "wasReleased" to "isPressed" and deleted the "pressedFor(2000)" part and all that comes after it in this statement. All we really want to know here is if a ground signal is received.

I think I might see another problem where the reload delay is not being taken into account properly, but let's test this change first, and if that solves your problem, I will update the code and issue a release with this fix and a fix for the reload delay.
NO SUPPORT THROUGH PM - Read why
Need a forum account? Read here
Open Panzer FAQs

*

Offline Rongyos

  • 51
    • View Profile
  • Hungary
Re: Standalone Tank IR
« Reply #69 on: September 16, 2024, 03:09:03 AM »

I think I might see another problem where the reload delay is not being taken into account properly, but let's test this change first, and if that solves your problem, I will update the code and issue a release with this fix and a fix for the reload delay.

Hey Luke,

Sorry for the long delay, I was working on a new board layout where users can easily connect single relay to activate the taigen / henglong airsoft/recoil microswitch which activates the cannon sound and the irritating gearbox recoil. Also, i want to make a 3d printed case for the relays to store them stacked to save some space. Attached you can see a sample how it looks when two relay modules having an affair :D
 (sorry for the cable spaghetti)

Regards
Rongyos
Rongyos_IR_v1.2.png
Standalone Tank IR Rongyos_IR_v1.2.png
Views: 56
kép_2024-09-16_100844753.png
Standalone Tank IR kép_2024-09-16_100844753.png
Views: 55
stug.jpg
Standalone Tank IR stug.jpg
Views: 109

*

Offline LukeZ

  • 1255
    • View Profile
  • France
Re: Standalone Tank IR
« Reply #70 on: September 16, 2024, 10:53:17 AM »
That's ok, take your time! Those sound like good improvements. When you get to the code testing stage, let me know, but there's no hurry.
NO SUPPORT THROUGH PM - Read why
Need a forum account? Read here
Open Panzer FAQs