Welcome to Cockpitbuilders.com. Please login or sign up.

May 01, 2024, 11:25:50 AM

Login with username, password and session length

PROUDLY ENDORSING


Fly Elise-ng
316 Guests, 0 Users
Members
  • Total Members: 4,154
  • Latest: xyligo
Stats
  • Total Posts: 59,641
  • Total Topics: 7,853
  • Online today: 227
  • Online ever: 582
  • (January 22, 2020, 08:44:01 AM)
Users Online
Users: 0
Guests: 316
Total: 316

COUNTDOWN TO WF2022


WORLDFLIGHT TEAM USA

Will Depart in...

Recent

Welcome

(Video) Cockpit Ambient Lighting

Started by RayS, September 06, 2016, 11:32:51 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

RayS


As I note in the video, it's amusing sometimes, flying in broad (Sim) daylight and yet the cockpit basically looks like a night flight.

Using X-Plane, a Teensy, an RS-485 TTL-RS485 (DMX) converter, an RGB LED Light controller and a few dozen lines of code, I've hopefully, partially solved that problem.

The nice thing about using a light bar is it (almost) eliminates shadows inside the pit, much like reality. The lighting is a bit too blue to my liking. I'd like it a lot warmer, so this will take a bit more research.

Regardless, here is Ambient Lighting v1.0:
https://youtu.be/pVGtdzMyFHQ
Ray Sotkiewicz

tennyson

Great job, Ray, and the demo video is very impressive.

I've also been thinking about this for a while and remember seeing a similar thread (I think it was on here) a good while back about it, too.

I saved the url to the software/hardware that it was referring to. I note that they are using Arduino, instead of teensie, like you have.

Maybe, something can be used from both?

Anyway, here's the url:  http://amblone.com/

I'll be watching for future posts on this, with interest.



Frank

727737Nut

Looks promising Ray!  Please though use the K and L key.  LOL ;)   We could have seen a smooth light change vs the blue screen menu and abrupt change.
737 Junkie

RayS

Will Do!

I'm going to remake the video tonight anyway... Turns out I had the camera's white balance set incorrectly. Should be a much better representation after tonight.
Ray Sotkiewicz

RayS

New video:

https://youtu.be/1FhF-wyDhHQ

Demonstrates (much better) the ability to extract RGB ambient light values from X-Plane which in turn drives a DMX to RGB light driver.

The coloration is still slightly off because the RGB light bar output confuses the camera. I adjusted the white balance to the best of my ability but it still came out a tad pink. In real life (And with better light bars) I imagine this problem would be eliminated.
Ray Sotkiewicz

727737Nut

Nice Job Ray!!  Looks great.   Can you share your code?  What part numbers are the interface and light bars?

Rob
737 Junkie

RayS

#6
Here you go, Rob!
v2.0 will most likely eliminate the DMX to RGB LED driver module, because I want to experiment with a professional-grade DMX RGB light bar...

#include <Wire.h> // Comes with Arduino IDE
#include <LiquidCrystal_I2C.h>
#include <DmxSimple.h>

/*-----( Declare Constants )-----*/
/*-----( Declare objects )-----*/
// set the LCD address to 0x27 for a 20 chars 4 line display
// Set the pins on the I2C chip used for LCD connections:
// addr, en,rw,rs,d4,d5,d6,d7,bl,blpol
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Set the LCD I2C address

FlightSimFloat lightlevel_R; // For IAS Adjustment
FlightSimFloat lightlevel_G; // For IAS Adjustment
FlightSimFloat lightlevel_B; // For IAS Adjustment

void setup()
{
DmxSimple.usePin(3);
DmxSimple.maxChannel(3);

Serial.begin(9600);
Serial.println("Here we go!");
lcd.begin(20,4); // initialize the lcd for 20 chars 4 lines, turn on backlight

// ------- Quick 3 blinks of backlight -------------
for(int i = 0; i< 3; i++)
{
lcd.backlight();
delay(250);
lcd.noBacklight();
delay(250);
}

lcd.backlight(); // finish with backlight on
lcd.setCursor(0 ,0); lcd.print("X-Plane Sky Color");

//----------------------------------------------------
// configure the X-Plane variables (Use Sky Color)
// Cockpit color is a little wanky...
//----------------------------------------------------
lightlevel_R = XPlaneRef("sim/graphics/misc/outside_light_level_r");
lightlevel_G = XPlaneRef("sim/graphics/misc/outside_light_level_g");
lightlevel_B = XPlaneRef("sim/graphics/misc/outside_light_level_b");

/*
lightlevel_R.onChange(update_R);
lightlevel_G.onChange(update_G);
lightlevel_B.onChange(update_B);

lightlevel_R = XPlaneRef("sim/graphics/misc/cockpit_light_level_r");
lightlevel_G = XPlaneRef("sim/graphics/misc/cockpit_light_level_g");
lightlevel_B = XPlaneRef("sim/graphics/misc/cockpit_light_level_b");
*/

}

void loop() /*----( LOOP: RUNS CONSTANTLY )----*/
{
FlightSim.update(); // causes X-Plane's changes to be received
delay(200);

update_R(lightlevel_R);
update_G(lightlevel_G);
update_B(lightlevel_B);

}

void update_R(float lightlevel_R)
{
DmxSimple.write(1, (lightlevel_R * 1.15 ) * 255.0); // RED Channel
lcd.setCursor(0 ,1); lcd.print("R: ");
lcd.setCursor(3,1); lcd.print(lightlevel_R);

}
void update_G(float lightlevel_G)
{
DmxSimple.write(2, (lightlevel_G * 1.00) * 235.0); // GREEN Channel
lcd.setCursor(0 ,2); lcd.print("G: ");
lcd.setCursor(3, 2); lcd.print(lightlevel_G);
}
void update_B(float lightlevel_B)
{
DmxSimple.write(3, (lightlevel_B* 1.00) * 235.0); // BLUE Channel
lcd.setCursor(0 ,3); lcd.print("B: ");
lcd.setCursor(3, 3); lcd.print(lightlevel_B);
}


Ray Sotkiewicz

tennyson

So, is this project going to be just for your own use, Ray, or do you think you might market it.

It's really clever technology and one that is needed within a lot of our sims, really.


Frank

Trevor Hale

CRAZY RAY PAVING THE WAY IN THE DAY!!!!!!!!!!!!!!!!!!!!!

You have really set the realism bar high here, especially when it extracts the information automatically.  I AM JUST SHOCKED AND SPEECHLESS.

Trev
Trevor Hale

Owner
http://www.cockpitbuilders.com

Director of Operations
Worldflight Team USA
http://www.worldflightusa.com

VATSIM:

RayS

Quote from: tennyson on September 09, 2016, 05:41:40 AM
So, is this project going to be just for your own use, Ray, or do you think you might market it.

It's really clever technology and one that is needed within a lot of our sims, really.


Frank

Thank you for the kind words, Frank~!

I've given it some thought and I think it'll remain open-source. The sim community has always been generous to me so... returning the favor.

I may offer kits, or just built solutions for those that don't want to get into programming microcontrollers and just want the finished solution.

Another thing is that the current solution only works with X-Plane. I'm going to get a few RGB light sensors and connect it to Teensy. Pointing the sensor at the screen  should provide the same functionality in P3D as well as X-Plane.. and should also enable the ability to create lightning (Dunno why I'm so fixated on lightning but... there it is...)

Expect more updates as this project continues. :-)
Ray Sotkiewicz

KyleH

Looking good Ray.

Yes, a higher quality LED fixtures should help with the blue look. An RGBW fixture might work better too. Might want to verify that it is the colour of the LED's that is an issue and not a shade that is being driven by x-plan.

Actually, the datarefs may be commanding blue for the sky, could that by why your illumination is on the bluish side?



Kyle

Chief Pilot
Worldflight Team USA
http://www.worldflightusa.com

RayS

It's kind of a black art under the hood. Values range from 0.00 to 0.88

3am is represented by: (R)0.01, (G)0.02 (B)0.03

High Noon is roughly:   (R)0.77, (G)0.77 (B)0.79

Dusk/Sunset :              (R)0.46, (G)0.45 (B)0.47

It's odd because there's very little difference in the raw numbers coming from X-Plane, even when the sky in the sim varies by quite a bit.

I'm wondering if it's a cloud function or something that creates the colors around sunrise/sunset...
Ray Sotkiewicz

Bob Reed

Quote from: RayS on September 09, 2016, 01:04:26 PM
It's kind of a black art under the hood. Values range from 0.00 to 0.88

3am is represented by: (R)0.01, (G)0.02 (B)0.03

High Noon is roughly:   (R)0.77, (G)0.77 (B)0.79

Dusk/Sunset :              (R)0.46, (G)0.45 (B)0.47

It's odd because there's very little difference in the raw numbers coming from X-Plane, even when the sky in the sim varies by quite a bit.

I'm wondering if it's a cloud function or something that creates the colors around sunrise/sunset...

When you get your light sensors and you do not use X-Plane as the source we will see if there is any difference n the colors...

RayS

Just ordered a pair of 42-inch DMX RGB LED light bars, and a few RGB light sensors. Should be fun to play around with!

Been thinking more and more of putting together a kit... with a few extra functions on board. We'll see how the RGB light sensors behave first.
Ray Sotkiewicz

737man

What would you guys suggest for led dome lights that I can connect to the CPFlight Dimmer pot on the pedestal?  12v led 5w draw....I am thinking....  Will the pot handle a 12v input?

Gallie

Guys,

Dont want to hi-jack this topic.
But check the ambient lighting from this video https://www.youtube.com/watch?v=O8lE6Aogngc
I dont understand any french, but perhaps there is someone here that can translate? 

Mike

KyleH

That video is showing how they use lights sensors pointed at the screen to control the ambient lighting.
Kyle

Chief Pilot
Worldflight Team USA
http://www.worldflightusa.com

jackpilot



Jack

Like the Website ?
Support Cockpitbuilders.com and Click Below to Donate