Pages: 1 [2] 3 4 5 ... 10
11
« Last post by Rongyos on May 26, 2023, 02:12:06 PM »
I think I will need to buy an Arduino and LED to do some testing at home.
You dont need to if I am here Very, very close. I think we can meet the goal if the max flickering dim is below the max dim (255) Something like this: // 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, [u]random(45)[/u]+180); // Brighter - random value between 180 and 255 (full on) I dont understand the first row. Why do we need 0 (full off) state? Here is the video. IRL its mutch better and looks like drop voltage flickering but It will be better with lower max value  Thanks ROngyos
12
« Last post by LukeZ on May 26, 2023, 11:00:12 AM »
I see what you mean about it being a bit harsh. I can't quite use the faderate code as written, but I've tried to soften it some more in the attached.
I think I will need to buy an Arduino and LED to do some testing at home. I've been using an online emulator but it really doesn't provide an accurate representation of what the LED will look like.
13
« Last post by NS-21 on May 25, 2023, 02:42:33 PM »
if i had a bigger printer i would do that one https://www.3dprintedtanks.com/is1en/
Greetings, dear! I have been jealous of your tank and print quality for a very long time, and what can I say? I'm doing KV-1! Scaled 1:10. I have a printer with a large print area, and I am printing a project (more precisely, it is already printed by 60%) from this respected author: https://www.printables.com/model/219806-tank-kv-1-rc-model-110This is an incredible model! P.S. I will also find an opportunity to buy from https://www.3dprintedtanks.com/ - the T-34 tank! Unfortunately, there are still difficulties in paying, but I will overcome this difficulty as well. And I'm also looking forward to when he makes a model of the IS-2 tank!
14
« Last post by Rongyos on May 25, 2023, 02:20:22 PM »
let's see if the effect looks good on the brake output first, because it will be the same effect on the Aux output.
Hi Luke, Thanks for your support  I think "we are almost there". The flickering works in the brake light but I think it only needs a "faderate", because now it changes the dim very fast. IDK if this helps but I found a code from somewhere with fadein fadeout (it might be useless but trying to "help"): int brightness = random(256);
// Fade in for (int fadeValue = 0; fadeValue <= brightness; fadeValue += 5) { analogWrite(ledPin, fadeValue); delay(10); }
// Fade out for (int fadeValue = brightness; fadeValue >= 0; fadeValue -= 5) { analogWrite(ledPin, fadeValue); delay(10); } Rongyos
15
« Last post by LukeZ on May 25, 2023, 10:10:19 AM »
I'm afraid I don't have a suggestion, the fact is I am not too experienced with sound circuits even though I designed one. Hopefully someone else will have a suggestion. I think this is definitely an application where it helps to have the components on a board and a DIY one with lots of wires will certainly be susceptible to interference.
16
« Last post by LukeZ on May 25, 2023, 10:07:35 AM »
Hi Rongyos, thanks once again for doing this test. I apologize I'm not able to work out these bugs on my end, I only have a couple TCB boards left to me and they are in a storage box on the other side of the world!
I think I know what was wrong with the brake light effect. I've made a new firmware, this time I'm just attaching it to this message and will wait to update the official one until we have all the problems worked out. Can you test once again with the brakelight and let me know how it looks?
As for the headlight pin, no, unfortunately, that is what I was saying earlier, it is not PWM compatible. It can only be turned on or off, and I agree with you, that effect does not look very good...
It should be possible to flicker the Aux output but let's see if the effect looks good on the brake output first, because it will be the same effect on the Aux output.
17
« Last post by Rongyos on May 25, 2023, 08:59:32 AM »
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
18
« 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
19
« 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:
// 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?
20
« 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): // Generate a random dimming value (0-255) int dimValue = [i]random(170) + 170[/i] [i]delay(random(150))[/i]; thanks Rongyos (the guineaPIG) 
Pages: 1 [2] 3 4 5 ... 10
|