Announcement

Collapse
No announcement yet.

Gamma control by light sensor

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Gamma control by light sensor

    Being the lazy bastard that I am I decided that it would be too complicated (read too much of an effort) for me to push a button to change frontend gamma from day to night so why not have a sensor to do all the hard work for me? That way when the darkness falls the gamma would be switched on to around half the normal value and when the day breaks it would be switched back on to normal value automagically.

    First the hardware. Pulled out my breadboard and off to work. As usually people do, I started with the most complicated scheme for the purpose i.e. with an op-amp running as a voltage comparator.


    All fine, but I can have the same thing a lot simpler, so I tried with a darlington.


    Fine too, but that left me with a problem: I needed a 12V source for the scheme to work (I know it's not that hard to find one in a computer case , but I like the KISS principle). So I ended up with just the photo-transistor and a diode for added protection since DTR in low state is -12V (I'd rather be on the safe side ). This has a disadvantage though: due to the extreme simplicity you can't adjust the level of light it's gonna respond to, but things are working just fine for me without adjusting anything (I even stayed wake last night to see the level of ambiental light at dawn when it will switch and it switched just fine). The photo-transistor is soldered at the end of two wires, isolated with shrink-wrap tubing and fitted inside a dc jack housing. The transparent head comes from a ball point pen cap which I had around; it needed some step by step cutting to get the exact diameter so I could fit it tight in the jack housing. It connects to pins 4 and 8 (DTR and CTS) of the com port on your computer.




    Now the software. Since the routine is integrated in the frontend I'm writing I decided to make it available to you guys as a standalone program. Remember that the program just sits in the tray and does not accept any user input (except exit command of course) it just monitors the serial port for the CTS line status (sensor connects the DTR line - which is set to high when the program starts - to CTS line when there's light falling on it and disconnects the two when there's no light) so if you run it without the sensor connected it will just darken your screen. You've been warned . Oh and by the way set the com port your sensor will be on in the ini file. Other than that hope somebody will find it useful.
    Attached Files
    Why drink and drive when you can smoke and fly ?

  • #2
    Looks like a great idea,
    Zip Saved for when i build the comp, Still in the scavenging of parts stage
    Still Planning and Scavenging Parts ------Software-----and anything else i can lay my hands on!!! :)

    Acquired a Toshiba Satelite 4000CDT
    HDD`s ****ed new one on way! 30gb Toshiba.

    Comment


    • #3
      nice idea there!

      my car has a built in light sensor that turns the lights on/off. How hard would it be to integrate it into your software?

      Comment


      • #4
        I like this, will build it. Now, is this photo-transistor has part number , can I get it from RadioS . Thanks for sharing

        Comment


        • #5
          Originally posted by boostedGT-S
          nice idea there!
          my car has a built in light sensor that turns the lights on/off. How hard would it be to integrate it into your software?
          I can give you the source code so that you can modify it if you connect the sensor in a different way. Alternatively if you provide me with schematics of how is your light sensor connected to your car maybe I can come up with some adapter to connect it to the serial port and use the software as it is.

          Originally posted by kingtut
          I like this, will build it. Now, is this photo-transistor has part number , can I get it from RadioS . Thanks for sharing
          Basically, because of the extremely low current of the serial port
          any photo-transistor or photo-diode will work. I used a generic (no part number, sorry) photo-transistor which looks exactly like a white transparent LED. Good luck with building.
          Why drink and drive when you can smoke and fly ?

          Comment


          • #6
            I have done the exact same thing... I used the cheapo photocells and am regulating voltage between the 12 down to about 8... I used a 317 instead though, no need for a transistor then... for the "split" resistors that would normally set the output voltage I put a pair of 15 turn 10k pots and with the upper leg I put two cheapo photocells from the "grab bag" at radio shack... about $15 in parts... one big difference is mine is not gonna "switch" over, it will transistion and street lights/headlights aren't going to change the brightness unless you are sitting directly under it...

            for my setup I added a fairly large cap to the control leg, to "slow" the transitions... it takes mine about 10 seconds to go from low to high... I haven't hooked up the Xenarc yet (still waiting on some bigger cohones )... but it is getting closer to the top of the to-do list... I will post pics of the proto board tonight... this rocks, glad to see I am not the only one climbing this hill...

            Kronos, keep this thread alive.. I think people bite once the kinks are worked out...
            EPIA SP13000, 512 DDR400, Seagate 300GB, Belkin PCI 802.11g w/external antenna, Holux GM-210 GPS, XM Direct w/ serial, Dlink FM, Opus 120 p\s, Rockford P4004 amp, Xenarc 7" VGA touchscreen custom mounted in double din spot -- see pics and write up here!!

            Comment


            • #7
              I am skipping the computer connection, no need for serial input... light is all you need... backlight dimming looks way better than gamma settings, don't you think??

              I think it would be easier to hardwire it directly into the screen, than to build circuit and software... I have an in dash DVD player that uses another input on the screen, so I am looking for a total screen solution, not just computer input dimming...

              anyone else think this is a project worth pursuing??
              EPIA SP13000, 512 DDR400, Seagate 300GB, Belkin PCI 802.11g w/external antenna, Holux GM-210 GPS, XM Direct w/ serial, Dlink FM, Opus 120 p\s, Rockford P4004 amp, Xenarc 7" VGA touchscreen custom mounted in double din spot -- see pics and write up here!!

              Comment


              • #8
                What a great idea!!!

                And of course this would work through tunnels as well (how cool would that look to your passengers as it adjusts automatically!!!)

                boostedGT-S, using a relay connected through your lights you could make a similar circuit that therefore runs off your car's sensor though it would probably need the line high setting reversed to work? (sure someone could correct me on this)

                mgithens, my lilliput is permanently in pieces behind my fascia so I might be up for your version if it truly is simple - how would it work?
                Ford Focus MP3 : www.stevieg.org/carpc Blog Updated 29 January 2009!
                Car PC Status: Complete - Undergoing Software Redevelopment

                Comment


                • #9
                  Originally posted by mgithens
                  I am skipping the computer connection, no need for serial input... light is all you need... backlight dimming looks way better than gamma settings, don't you think??

                  I think it would be easier to hardwire it directly into the screen, than to build circuit and software... I have an in dash DVD player that uses another input on the screen, so I am looking for a total screen solution, not just computer input dimming...

                  anyone else think this is a project worth pursuing??
                  Actually you're right with hardwiring into the screen, but since I don't have a screen yet (raising funds ) I had nothing to practice on. If you do something in that direction then please post some info. Eventually I will go that route too, once I'll have a screen, but until then... I thought something is better than nothing and besides that some people simply lack the technical skills to modify a screen so a simpler solution might work for them. Let's make this a dual system thread, one approach being interfacing with a computer and the other interfacing directly with the screen so all the info is in one place.

                  Originally posted by stevieg
                  What a great idea!!!

                  And of course this would work through tunnels as well (how cool would that look to your passengers as it adjusts automatically!!!)
                  Originally posted by mgithens
                  ... one big difference is mine is not gonna "switch" over, it will transistion and street lights/headlights aren't going to change the brightness unless you are sitting directly under it...

                  for my setup I added a fairly large cap to the control leg, to "slow" the transitions... it takes mine about 10 seconds to go from low to high...
                  Tunnels were the main reason I didn't use a capacitor to slow the response, but instead the wait can be implemented in software e.g. only during the night will it slow down the transition cause during the day we don't need it.
                  Why drink and drive when you can smoke and fly ?

                  Comment


                  • #10
                    Originally posted by stevieg
                    What a great idea!!!

                    And of course this would work through tunnels as well (how cool would that look to your passengers as it adjusts automatically!!!)

                    boostedGT-S, using a relay connected through your lights you could make a similar circuit that therefore runs off your car's sensor though it would probably need the line high setting reversed to work? (sure someone could correct me on this)

                    mgithens, my lilliput is permanently in pieces behind my fascia so I might be up for your version if it truly is simple - how would it work?
                    ok, first let me start off by saying that I am a Mech Engr... electrical crap is for hobbies...


                    this is a link to the heart and soul of the idea... simple voltage regulator, can handle MUCH more than we are asking for... the only other thing you need are some 10k-100k photocells and a few 0-10k potentiometers...


                    here's the basic diagram... my changes were to replace R1 and R2 with 10k pots, then you can dial in the brightness and range that you want... and the second change is to add the photocells in parallel with R1... you need to find photocells that have a decent range (read - LESS RESISTANCE OVERALL)... some photocells go up into the 1M ohm range, we need the 10k to 100k ranges to be covered... I actually am running two 10k-100k in parallel to get 5k-50k... I found these in a $3 5-pack of photocells...

                    the only other change that I would suggest is putting a sizeable electrolytic capacitor in parallel (positive side away from ground) with R2.. this will keep the light from "bouncing" it will stay constant and won't respond immediately to light changes... I used 3300pF and it worked great... more is better - within reason... and also, for reference, I skipped the C1 and C2 caps - those are for line noise and fluctuation... we're working with light, we won't be able to notice the small variations... ok, so here's a proof of concept video on a protoboard...
                    video here

                    this isn't 100% of the info that you'll need... one thing I am up against is that if you use the regulated 12V supply from your motherboard's p/s then you will have two issues... #1 is 12V... the car's electrical system is typically 14.4V when the alternator is turning, and this voltage regulator will take a hit so you will max out less than the supply voltage... from reading the forums someone mentioned that there was a 1ohm resistor in series with the positive lead to the backlight... so I will definitely be ditching that and just dial in my own equivalent... so if you do manage to bypass the 1ohm the voltage drop might put you right in the butter zone... #2 is that the computer has to be on for lighting...

                    ok, feedback time... thoughts?? (I pulled the capacitor out for the video so that you could see it work fast, with the cap it takes about 10 or so seconds from dark to light)
                    EPIA SP13000, 512 DDR400, Seagate 300GB, Belkin PCI 802.11g w/external antenna, Holux GM-210 GPS, XM Direct w/ serial, Dlink FM, Opus 120 p\s, Rockford P4004 amp, Xenarc 7" VGA touchscreen custom mounted in double din spot -- see pics and write up here!!

                    Comment


                    • #11
                      Originally posted by stevieg
                      boostedGT-S, using a relay connected through your lights you could make a similar circuit that therefore runs off your car's sensor though it would probably need the line high setting reversed to work? (sure someone could correct me on this)
                      I updated the program to accept another parameter so you can set it to reverse depending on your sensor (i.e. if it outputs a signal if lighted or if not lighted), although this could be easily accomplished with a SPDT relay by connecting the 'normal open' pair of contacts so when the lights turn on it also brings CTS high.

                      mgithens what about using a couple of photocells: a separate one and the other in a delayed circuit (around 1 sec or maybe less) and by comparing the states when the delay circuit triggers you can tell if it's really night or it was just a shadow from a light pole or something (both must be illuminated or not to detect the event); that way you can shorten the reaction time and still have a good amount of error filtering. I'm thinking if you enter a short tunnel by the time the 10 secs pass and the dim turns on you are out of the tunnel.
                      Why drink and drive when you can smoke and fly ?

                      Comment


                      • #12
                        well I switched my 3300pF cap for a 100pF and it makes the swing you are looking for... photocells are MOST sensitive to direct light, but ambient light is still very much a factor... so by changing the capacitance you can adjust the reaction time... think of the capacitor as a small bucket, the electricity pours in and the circuit stays level (for the most part) and if the shadow goes away quickly then the light change would go unnoticed... but if it persists then the light on the screen will dim to match the surroundings...

                        if the tunnels are really that dark, then you should consider using darker color backgrounds, for instance a white lettering on a med dark blue background won't blind you when you hit the tunnel... but I dont' think a circuit needs to respond faster than your eye will, and I think that is the direction that it sounds like you are heading... I will post a circuit tomorrow after work... it really does work well and I will post full videos after my completion (not any time soon)...

                        I am also working on a temperature circuit... at first I was thinking that I would just keep the CPU from booting when temps dipped below freezing, but now I am set on the idea of a really small heater/light bulb to keep the hard drive above freezing... I am thinking a 10watt bulb will do the trick... and I found a mechanical thermostat that would help reduce electrical consumption... Rittal SK 3110... pretty slick device... but I will save that for another thread... hopefully it will be installed this weekend... in the summer I will switch it over for a fan type unit to kick on when CPU bay temps (when booted) get over the 120degF threshold...
                        EPIA SP13000, 512 DDR400, Seagate 300GB, Belkin PCI 802.11g w/external antenna, Holux GM-210 GPS, XM Direct w/ serial, Dlink FM, Opus 120 p\s, Rockford P4004 amp, Xenarc 7" VGA touchscreen custom mounted in double din spot -- see pics and write up here!!

                        Comment


                        • #13
                          And you can use this sensor with a tiny piece of software that computes twilight/sunrise/noon/sunset/twilight/ where you are, using lat/lon coordinates.
                          Now Galileo is real. Muhahahahaha :p

                          Comment


                          • #14
                            Originally posted by kronos
                            I updated the program to accept another parameter so you can set it to reverse depending on your sensor (i.e. if it outputs a signal if lighted or if not lighted), although this could be easily accomplished with a SPDT relay by connecting the 'normal open' pair of contacts so when the lights turn on it also brings CTS high.

                            mgithens what about using a couple of photocells: a separate one and the other in a delayed circuit (around 1 sec or maybe less) and by comparing the states when the delay circuit triggers you can tell if it's really night or it was just a shadow from a light pole or something (both must be illuminated or not to detect the event); that way you can shorten the reaction time and still have a good amount of error filtering. I'm thinking if you enter a short tunnel by the time the 10 secs pass and the dim turns on you are out of the tunnel.
                            My thoughts are about your software is that is could be very useful for a WIDE range of uses without having to go out and buy a proper relay/interface board... if it could run a program (gamma on/off) in the ini It could then be adapted to other uses, such as a reverse camera, or disabling play of video/dvd whent he handbrake is off.

                            For the screen gamma, I think I would rather fit a relay across the lights so when I turn them on, it does the screen gamma... And then if I want auto-gamma/lights I would fit the mod to the lights instead!
                            Ford Focus MP3 : www.stevieg.org/carpc Blog Updated 29 January 2009!
                            Car PC Status: Complete - Undergoing Software Redevelopment

                            Comment


                            • #15
                              Originally posted by stevieg
                              My thoughts are about your software is that is could be very useful for a WIDE range of uses without having to go out and buy a proper relay/interface board... if it could run a program (gamma on/off) in the ini It could then be adapted to other uses, such as a reverse camera, or disabling play of video/dvd whent he handbrake is off.

                              For the screen gamma, I think I would rather fit a relay across the lights so when I turn them on, it does the screen gamma... And then if I want auto-gamma/lights I would fit the mod to the lights instead!
                              I made a modified version to run a program in the ini instead of setting the gamma (and if you want I'll give you the source code which is very simple so that you can modify it to suit your needs if you please). About connecting the mod to turn on the lights I don't know... I always turn them on, even during the day, so that I can be better seen on the road by the others, in which case it would mean that my screen would be dim all the time.
                              Attached Files
                              Why drink and drive when you can smoke and fly ?

                              Comment

                              Working...
                              X