Recent Posts

Pages: 1 ... 7 8 9 [10]
91
Hi Everybody!

Can you recommend a cheap RFI/EMI filter for my homebuilt sound card? In lower volumes I hear annoying buzz or high pitch noise and if I put my tx closer to the device a buzz going crazy. Maybe I need shielded cable for the speaker? Can I make it better with shielded cable?

Thanks
Rongyos
92
TCB Dev / Re: Ideas for the OP Config
« Last post by Rongyos on May 24, 2023, 02:14:34 PM »

The brake light is connected to an analog output which is how we are able to dim it for "running lights." If you set the "Brake Lights on When Stopped" option you will see that it uses a flickering effect similar to the candle effect you found. But when we are flickering the "running lights" I can't be sure what dim level the user specified, and to flicker a dim light it might not be very visible, so in that case I am flickering it only between off and the dim level.

[...]
In the meantime, maybe you could attach a white led to the Brake lights, and select the "Brake Lights on When Stopped" option, and then at least let me know if that effect even looks very good?

Hi Luke,

I attach a video how it looks. The brake light is on during enginestart sequence and no flickering on it (in the video it looks like it has but its just visual illusion, the blinking headlight effects the camera lens (beleive me pls :) )

Is the Headlight pin is PWM compatible digital pin? (analogWrite = random(150)+170)

How complicated will be to add this effect to AUX outputs if the brake light flickering will successful? It would be very good.

Thanks
Rongyos

93
TCB Dev / Re: Ideas for the OP Config
« Last post by LukeZ on May 23, 2023, 08:06:48 AM »
Hi Rongyos, you're right, simply turning a light on and off doesn't make for a very realistic "flickering" effect. I haven't actually seen what it looks like, but I can imagine it is not very good.

Unfortunately, that is the only option we have for the headlights, which is connected to a "digital" output on the ATmega2560 chip. A "digital" output is one that can only have two states, either on or off. There are other pins on the ATmega2560 that are called "analog" outputs and those can be set to any level between off (0) and on (255). But these pins are limited in number and we have had to use them for other things.

The brake light is connected to an analog output which is how we are able to dim it for "running lights." If you set the "Brake Lights on When Stopped" option you will see that it uses a flickering effect similar to the candle effect you found. But when we are flickering the "running lights" I can't be sure what dim level the user specified, and to flicker a dim light it might not be very visible, so in that case I am flickering it only between off and the dim level.

Here is the code I have added which handles the flickering. There is more than this, but this is the important part:

Code: [Select]
// This effect takes place on engine startup if the user has selected the option to "Flicker Headlights on Engine Start" (Lights & IO tab of OP Config)
// and if they have specified a "Transmission Engage Delay" (Driving tab of OP Config). The effect will last for the duration of the Transmission Engage Delay.
// It applies to both the headlights and the brake/running lights, but only if they were already on before the effect begins.
void FlickerLights()
{
    static boolean flickerState;
   
    // Initialize if appropriate:
    if (HeadlightsFlickering == false && BrakeLightsFlickering == false)  // They will both be false if we have not started the effect.
    {                                                                     // They will both remain false if neither the headlights or brakelights are on, in which case we won't come back here.
        // Only flicker lights that are already on
        if (Light1State)                                    HeadlightsFlickering = true;
        if (BrakeLightsActive || RunningLightsActive)       BrakeLightsFlickering = true;
        if (HeadlightsFlickering || BrakeLightsFlickering)  flickerState = false;  // Initialize light state to false (which has the effect of starting the effect with "on")
    }

    // Now perfrom the flickering if it has been enabled
    if (HeadlightsFlickering || BrakeLightsFlickering)
    {
        if (HeadlightsFlickering)
        {
            // The headlight output can not be dimmed, so we simply toggle it on and off.
            // We don't use the dedicated Light1Toggle function because that would also call the headlight sound, which we don't want, not to mention the possible debug message.
            flickerState ? digitalWrite(pin_Light1, LOW) : digitalWrite(pin_Light1, HIGH);         
        }
       
        if (BrakeLightsFlickering)
        {
            // The brake light flickering effect will differ depending on whether we are flickering the running lights or the full brake lights.
            if (BrakeLightsActive)
            {
                // Here we vary the light between some lower and higher dim levels, it can go full off or full on, but also something in-between
                if (flickerState) analogWrite(pin_Brakelights, random(100));      // Dimmer   - random value between 0 (off) and 100 (not even half brightness)
                else              analogWrite(pin_Brakelights, random(75)+180);   // Brighter - random value between 180 and 255 (full on)
            }
            else if (RunningLightsActive)
            {
                // Here we vary the light between full off and whatever the running lights dim level is
                flickerState ? digitalWrite(pin_Brakelights, LOW) : analogWrite(pin_Brakelights, RunningLightsDimLevel);
            }
        }
       
        // Toggle the flicker state, now it will match what we've just done above (which was the opposite of flickerState)
        flickerState = !flickerState;
       
        // Now set a timer to come back here after a random amount of time to continue the effect
        // We adjust the random delay so that the light "off" time is shorter than the light "on" time
        if (flickerState) FlickeringTimerID = timer.setTimeout(random(350)+60, FlickerLights); // On  - random time between 60 and 410 mS
        else              FlickeringTimerID = timer.setTimeout(random(210)+50, FlickerLights); // Off - random time between 50 and 260 mS
    }
}

I think the only other option to improve the headlight flickering would be to use the Aux output for headlights instead. The Aux output uses an analog output and therefore could be flickered more realistically. Of course this would require even more changes, and also there is no headlight sound associated with the Aux output (although one could be created with Function Triggers assigned to the same switch).

I'm not sure if the added complexity would be worth it... I may consider it but I need to explore the code some more to remind myself what complications that would involve.

In the meantime, maybe you could attach a white led to the Brake lights, and select the "Brake Lights on When Stopped" option, and then at least let me know if that effect even looks very good?
94
TCB Dev / Re: Ideas for the OP Config
« Last post by Rongyos on May 22, 2023, 04:14:46 PM »
Let me know how it goes.

Hi Luke,

I thank you that you are dealing with it :)

Now the functions are working fine but a flickering does the led switch on and off randomly. Maybe thats why I wrote you a whole bunch of stupidity in the code.

What about if you can change this? (stolen from candle effect arduino code):
Code: [Select]
// Generate a random dimming value (0-255)
 int dimValue = [i]random(170) + 170[/i]
[i]delay(random(150))[/i];

thanks
Rongyos (the guineaPIG) :)
95
TCB Dev / Re: Ideas for the OP Config
« Last post by LukeZ on May 22, 2023, 03:30:06 PM »
Hi Rongyos, thank you very much for doing that test. In fact I see now there were multiple problems with the code I had written. It's always more complicated than it seems, and you're absolutely right, there are more dependencies than even I can remember!  ;)

But your test helped me find the problems. Also, in the version I posted yesterday, I hadn't implemented flickering for running lights, only brake lights. But I've added it now for both. And of course we don't want the headlight sound to be playing while we flicker the lights, so I've fixed that as well. Your 2 and 3 position switches should also hopefully now work correctly.

I've posted an update to the firmware. I am keeping the same version name, but you can still download it and overwrite what you flashed yesterday.

It's entirely possible there could still remain some bugs. I apologize I can't presently do any testing on my side, and I appreciate you being the guinea pig!

Let me know how it goes.
96
TCB Dev / Re: Ideas for the OP Config
« Last post by Rongyos on May 22, 2023, 08:19:17 AM »
I don't actually have a TCB to do any tests with, so I can't say exactly how good it will look. I'd appreciate if you could test it both to make sure it works as intended and also to let me know what you think of the flickering.

Hi Luke,

First of all, thank you for your quick reply and support.
I downloaded the new firmware and OP Config, managed to set up the build. I faced some bug / error:
  • Light toggle on/off function not working properly on headlights (see video) - its working well with toggle on + toggle off functions binded on 2 pos switch
  • Start engine flickering not working with toggle on/off function at all
  • Start engine flickering has some errors:
    • a. only works with 2 pos function
    • b. no lights at all during the start engine sequence
    • c. random light sound played during the start engine sequence

maybe there are more dependencies than I thought :( I attached a video for better understanding.

The build is up and I am happy to test the upgrades :)

Rongyos

97
TCB Dev / Re: Ideas for the OP Config
« Last post by LukeZ on May 21, 2023, 02:54:04 PM »
Hi Rongyos, thanks for the question, and don't worry, your English is very good. I understand clearly what you are asking.

I've made some updates to the firmware to incorporate your suggestion. You will have to update both OP Config and also re-flash the latest firmware to your TCB (the latest version of both is 0.93.75)

To enable this feature there is an option on the "Lights & IO" tab of OP Config that you can select, called "Flicker Headlights during Engine Start."

The length of time that the flickering effect will last is defined by the "Transmission Engage Delay" setting on the "Driving" tab of OP Config. Since this setting should be set to the length of time of your engine start sound, it will also work for the flickering.

The flickering will affect both the headlights and the brake lights, but only if you have them on before you start the engine. In the case of brake lights, probably the only way for them to be on before the engine is started is to select the "Brake Lights On when Stopped" option on the Lights & IO tab.

The headlight output on the TCB is unable to be dimmed, it can only be full on or full off. However the brake lights output can be set to any intensity. I've used a slightly different approach on each one, the brake light will flicker in sync with the headlights but because it is able to be dimmed I've used that to make the flickering a little less harsh.

I don't actually have a TCB to do any tests with, so I can't say exactly how good it will look. I'd appreciate if you could test it both to make sure it works as intended and also to let me know what you think of the flickering.
98
TCB Dev / Re: Ideas for the OP Config
« Last post by Rongyos on May 19, 2023, 02:22:39 AM »
Hi Luke,

First of all, please don't laugh at me because my programming skills are very basic

I have a Beier board and I very like the headlight flickering effect on it but it has some flaws. I generated a basic flickering function which can be (I think) put in LIGHTS.ino

Code: [Select]
// Duration of the flickering effect in milliseconds
const unsigned long flickerDuration = 5000; //no idea where to put this - that should be cool if the user can set this in the OPCONFIG


void EstartFlickering {
  // Check if the flicker duration has elapsed
  if (millis() >= flickerDuration) {
    // Turn off the LED and exit the loop
    digitalWrite(ledPin, LOW);
    return;
  }

  // Generate a random dimming value (0-255)
  int dimValue = random(256);
;
}

This function can be put in DRIVING.ino where engine starts (at there there is also a
Code: [Select]
// Play the engine start sound
                TankSound->StartEngine();

there. The duration time should be set by user (easiest way). The beier reads the sound wave signals and flicker the LEDs following the wave spikes which is not realistic when the tank engine finally on and has a revving sound in the "enginestart" sound. In that phase the alternator can put voltage IRL and the headlights are even, but beier lower the dim according to the sound volume, thats what I dont like. The duration should be the time while the tank starting up, ignition or how can I say that in English, hope its understandable :) .
Can you somehow put this function in the codes? (I think mine wont work if i put it with force :) )
99
Open Panzer Help / Re: CS-TK-SWB Heng Long
« Last post by LukeZ on March 07, 2023, 01:22:06 PM »
Hi Paul, that is an interesting device which I did not know about, even though it seems it has been released for several years.

As usual the Chinese documentation leaves something to be desired, but from what I can tell this is a standalone gyro system that operates with standard RC inputs. In that case it should work with the TCB or any other control board that can output servo signals.

These are the connections you would make with the TCB:

Heng Long TK-SWBOpen Panzer TCB
P2-1RC Output 3 (Turret rotation)
P2-4RC Output 4 (Barrel elevation)

In OP Config on the Motors tab, you will want to set both "Turret Rotation" and "Barrel Elevation" to "RC Output."

Then connect a rotation motor and an elevation servo to the TK-SWB, and of course you will have to provide power to that unit also, as shown in the Heng Long diagram.

I can't promise this will work but I think it should. I'd be interested to hear the results of anyone who gives it a try.

100
Open Panzer Help / Re: CS-TK-SWB Heng Long
« Last post by kettenpaul on March 07, 2023, 01:01:02 PM »
CS-TK-https://de.aliexpress.com/item/1005004924384115.html?spm=a2g0o.detail.1000060.2.1a56428a0xzyoO&gps-id=pcDetailBottomMoreThisSeller&scm=1007.13339.291025.0&scm_id=1007.13339.291025.0&scm-url=1007.13339.291025.0&pvid=86070a97-97ca-4948-b066-63f81b2f79d8&_t=gps-id%3ApcDetailBottomMoreThisSeller%2Cscm-url%3A1007.13339.291025.0%2Cpvid%3A86070a97-97ca-4948-b066-63f81b2f79d8%2Ctpp_buckets%3A668%232846%238108%231977&pdp_ext_f=%7B"sku_id"%3A"12000031037363205"%2C"sceneId"%3A"3339"%7D&pdp_npi=3%40dis%21EUR%2168.95%2157.91%21%21%21%21%21%40211b600a16782147684774604e45ae%2112000031037363205%21rec%21DE%211837893692&gatewayAdapt=glo2deuSWB Heng Long

https://prnt.sc/GkzX1mBH6UHO
Pages: 1 ... 7 8 9 [10]
bomber-explosion