PDA

View Full Version : Flashing lights



Tony Hill
09-12-2011, 08:24 AM
Hello again.

Thanks to the help I received last time and many hours banging around with the few lights the Spitfire has, I have now managed to learn my way around FS2phidget.

I even managed to make all the lights conditional upon a master switch and THEN their independant switches/triggers.

However I have struck one problem. I am building the camera controllers for the PRU Spit and the Type 35 (that controls the actual taking of the photos) has a red light which goes on in between exposures then it goes out and a green light flashes as each exposure is taken.

Now obviously FSX doesn't support this but I would like to set a fixed cycle for these lights to operate at whenever the main Type 35 switch is turned on.

So I set up two outputs up (conditional upon the main circuit being open..software valve) and wired them through the physical switch...no switch, no power so what FSX does is irrelevant. So now they come on all the time once the physical and software circuits are BOTH on.

But I can't get them to flash on the fixed cycle, or in fact at all. I see the Flash set to true and I can set a rate .... but it does not seem to have any effect?

I have read the manual (5.021) for Flash but it just seems to say what I am doing already?

Can someone give me a lead....??

cheers


Darryl

Tom_G_2010
09-12-2011, 09:45 AM
Can you post what your variables are set to. I have flashing setup on a couple different LED's and it's working.

Tony Hill
09-12-2011, 10:03 AM
Can you post what your variables are set to. I have flashing setup on a couple different LED's and it's working.


Will do, thanks..will be tomorrow now, I have a day off to get this sorted out but I'm off to bed now.

cheers


Darryl

Tony Hill
09-13-2011, 02:29 AM
Ahhh...late night, low blood sugar and impatience...this morning I got them working in about 20 minutes...

But I still don't understand how "Flash Rate" and InitialValue interact.

The manual just says to use InitialValue to set flash rate...but "flash rate appears to control that and initial Value to do nothing??

What I need to do is have a Green light come on every 8 seconds..easy..BUT I need a red light to come on for 4 seconds before the green light each time. To do this I need to "delay" the start of the green light for 4 seconds the first time..at the very least ....but preferably make the green light be triggered by the "switch off" of the red light.


Is this possible..it doesn't seem so...? Not a complaint, just a query mind you!

So what I have now is station 62 with an InitialValue of 1 and a flashrate of 1000, set Flash to TRUE. (red light)

And Station 63 has an InitialValue of 1000 and a FlashRate of 2000, set Flash to TRUE.



I was so proud of my self making all this conditional upon the battery charge being ample and the U/C Indicator Light Switch (a quasi "master" in a broad sense in the Spitfire..) being turned on...but this latest idea is beyond me I'm afraid.


Not that any of this actually stops me flying..but the light cues are used for making Photo runs and the whole idea of the Spitfire Sim is simulated PRU missions. So it would be nice to time screenshots using the light cues. (the 4 second warning is particularly important as it gives you time to tip 90degrees to check position...as you can't see "down" in a Spit.

Tom_G_2010
09-13-2011, 04:19 PM
. . . What I need to do is have a Green light come on every 8 seconds..easy..BUT I need a red light to come on for 4 seconds before the green light each time . . .

I was pondering your circuit and came up with a simple single cycle on off timer circuit but have a few questions to see if I can better understand what you are looking for. Could you clarify further.


Does the red light come on right away when the switch is closed or is there a delay?

After the red light is illuminated for 4 seconds is there any delay before the Green light comes on?

Does the Green light only give a single flash or will it repeat until the switch is released?

Does the Red light come on before each green or only when the switch is initially closed?

If the red does come on before each green how much time passes after each green before the red repeats?


Here's the simple timer circuit using a timer and a set of controlled switches with some inverted as needed. When the first switch is closed it illuminates the RED LED for 4 seconds and then it goes out and the Green LED begins to flash repeatedly until the switch is released.

http://www.mycockpit.org/forums/attachment.php?attachmentid=5583&d=1315944872

Tony Hill
09-14-2011, 03:00 AM
Thanks Tom, I will play around with that tonight and see if I can make sense of it...I usually need things in front of me to try!!

To answer your questions, probably best explain how the real camera unit works which should detail what I need.

The Type 35 is the "timer" controller for the cameras in the PR Spitfires (as well as Mosquitos, Canberra Bombers etc..)

When the switch is turned on the Red light illuminates for 4 four seconds and then turns off as the Green light comes on whilst the exposure is made .. let's say one second for exposure and wind on to next film...so green for one second.

Then all lights are out until 4 seconds before the next exposure, when the red illuminates again and the cycle starts again. So the red light coming on says "hold the aircraft steady, a film will be taken in 4 seconds time".

So as soon as controller turned on..4 seconds of red, then OFF as green comes on and stays on for 1 second. Then 3 seconds of darkness until red on for 4 seconds then OFF as green comes on for 1 second.

Total time of the cycle is 8 seconds...commencing when the controller switch is turned on each time and continuing until it is turned off.


The rate of exposures is variable...but there is NO way to do that as the controller is not modelled in FSX..I am relying on physical switching and therefore only on and off. I chose 8 seconds between "shots" as a fairly common setting from 20,000ft at 350mph ground speed. In addition I can't think of a way to force the software to start the cycle each time the switch is put on..it probably just needs to start the cycle when the phidget is started and continue in a loop....this isn't a problem as the physical switch deprives the LEDs of power when off...there is also a valve or two I have put on so that they won't come on until the battery is charged enough etc....


I will have a look at Timers..I haven't used them at all as yet I didn't even realise they were there!!.

cheers

Darryl

Tom_G_2010
09-14-2011, 04:40 PM
Darryl,

I'm between build steps (due to budget) on my sim pit so I'm going out of my mind waiting to get to the next step. As such I have had a bit of time in the evenings to toy with a solution for your circuit. I attempted all different configurations to get a software feedback loop to make the process repeat every 8 seconds. No dice. HOWEVER, I did find way to do it if you use one external relay. According to the documentation you can use a digital output to drive a small relay. I leveraged that and the flash interval set out at about 8 seconds (7500 on my pc) to drive a pulse circuit that restarts the 4 second and 1 second timers to toggle the Red and Green LED's.

http://www.mycockpit.org/forums/attachment.php?attachmentid=5584&d=1316031344

When the Start Switch (an external switch in your pit that feeds a digital in on a phidgets card) is closed it will cause a digital out to start alternating on and off at an 8 second interval. That digital out would control an external relay. One of the normally open contacts of that relay is then fed back into the circuit via a second digital input in a phidget card. Any time that relay contact changes state (in this case every 8 seconds) it triggers the pulse circuit to restart the two timers. Those timers are setup to immediately turn on the Red LED and leave it on for 4 seconds. As soon as the Red LED goes off, the Green LED comes on and stays on for one second. It then goes off and the circuit sits idle until the reset pulse starts it over again (about 3 seconds later). All this will repeat until you reopen the Start Switch.

I don't have a low enough current relay on my bench to test the external portion of this so that would need to be verified, but the doc's do say a relay can be driven that way. Also, I'm sure with some combination of other software components, counters, comparitors, etc. that this could all be done in software, but that's beyond me.

http://www.mycockpit.org/forums/attachment.php?attachmentid=5585&d=1316031345

PM me if you want me to send you the XML file of the circuit.

Hope this works for you. Thanks for the boredom and frustration relief, I'm grounded until the next paycheck so this was a great way to pass the time.

Tom G.

Tony Hill
09-15-2011, 02:23 AM
Thanks Tom,

That looks great. I havea guy who can set relays up for me but he is away for a couple of weeks. I'll contact you by email.


Thanks mate!! Glad to ease your suffering :)


Darryl