Sunday, April 15, 2018

Carpc project - light sensors

I recently uploaded a new video to show my custom-made carpc based on a Raspberry Pi. In the video, I had to leave a lot of information out for the sake of runtime, so, I decided to write a little series of posts to explore thoughts and ideas about this project.

This episode is about light sensors.

Disclaimer (sort of):
Be aware that this post is not self-contained. If you haven't seen the video, you probably won't get much out of this reading. Also, this is not a tutorial on how to build a carpc like the one I made. For that, I'd need much more time and space. I just want to document the thought process behind a few hardware and software choices, share some techno-ramblings, and provide you with some links to get you started using the components I used.

Have you ever modified your car with custom electronics? Are you planning to hack a Raspberry Pi into a device that was not intended to be modified? Have you ever started a simple project (such as adding music to your car), and somehow turned it into a huge, titanic undertaking?

Light sensors

 

So, have you ever pulled out your smartphone in the middle of the night, touched the power button, and burned your retinas with the blazing white fury of a million suns? Or have you ever tried to read on your smartphone screen outdoors, in a sunny summer afternoon?

It's bloody annoying...

That's why I decided to implement some sort of screen brightness control for my carpc. The illumination conditions during a road trip might change drastically (starting during the day and finishing at night, entering and exiting tunnels, etc), and being forced to change the brightness of a rather big screen manually would be a deal breaker for me.

A photoresistor.
A photoresistor.
The first idea I evaluated was the use of a simple photoresistor. A photoresistor is a type of resistor whose resistance changes with the brightness of the light hitting the device. Unfortunately, most photoresistors I could find have a very uneven spectral response, which means that the variation of the component's resistance strongly depends on the color of the light, besides its intensity. I figured this would be difficult to calibrate, and I abandoned the idea.

Adafruit TSL2561.
Adafruit TSL2561.
That's when I came across the TSL2561 device from Adafruit, a very nifty light sensor module that can be easily controlled using I2C. I2C is an ideal interface, because it is natively supported by the Raspberry Pi. Also, Adafruit provides tutorials and example scripts to get you going, which is nice indeed!

Now I need to decide how many sensor to use, and where to install them. Well, the location is easy to choose: the sensors should be placed as close as possible to the screen, because that's the place where I want to measure the intensity of the light. I figured that one sensor would not be enough. I can imagine many situations in which one sensor would be fully illuminated while most of the screen would be in the shade, and viceversa. Ideally I would like to measure the intensity of the light all around the screen, but that would be highly impractical, and expensive. In the end, I settled for two sensors, one at each side of the screen.

I wrote a script based on the Adafruit examples, that uses these sensors to automatically control the brightness of the screen, and adjust it to ambient light. I want the screen to get brighter in full sunlight, and dimmer in darkness.

To achieve that, I programmed a Python script that runs a loop every 50ms. In each iteration, the script measures the brightness detected by both sensors, averages them, and compares the average against few previous measurements. If the trend is consistently decreasing, the script assumes it's getting darker, and dims the screen a little. If on the contrary the trend is consistently increasing, the script assumes it's getting brighter in the car, and it increases the brightness of the screen. Adafruit provides convenient Python libraries to generate I2C traffic on the Raspberry Pi, so reading out the sensors is literally a one-liner. The control of the brightness of the screen is also easy: I just needed to edit the system file /sys/class/backlight/rpi_backlight/brightness with a single integer number between 0 (no backlight) and 255 (UNLIMITED POWEEEEER backlight). Incrementing and decrementing the screen brightness by a single unit on every 50ms cycle allows me to smoothly change the perceived brightness of the screen, and avoid flickering effects.

I know will need to adjust a few constants to tell the script when to change brightness and how much, to make sure the system is responsive enough, and that the target brightness makes sense in each illumination condition. This, however, is not a big deal, as I can edit the script after the installation of the carpc without breaking a sweat.

9 comments:

  1. Will be greatly appreciated if you could share python code that has been used. Although I'm thinking it would be overkill to use two sensors for this purpose, single would be sufficient enough, unless unit is being used for watching videos b passengers.

    ReplyDelete
  2. I wouldn't mind seeing the code either, I am still a python noob and need a little hand holding =)

    ReplyDelete
  3. I enjoyed your project.Could you please share the script? Thank you

    ReplyDelete
  4. Professional Revenge Company is a group made up of High-level assassins with martial art skills, IT Engineers, Network Programmers, and Hackers.
    This group was created in 2002 with the aim of providing assassination and mercenary services worldwide.
    Visit our website( https://prohitman.com )

    Wickr..... (revenge24)

    Our services
    Gift Box, Killing, Acid Attack, Facial Scar, Crippling, Blinding, Castration, Poisoning, Injuries, Damages, Fires, Beating * HIGH NET WORTH INDIVIDUAL KIDNAPPING. … * TIGER KIDNAPPING. … * EXPRESS KIDNAPPING. … * VIRTUAL KIDNAPPING. … * POLITICAL KIDNAPPING. … * BRIDE KIDNAPPING * Chair Torturing. * The Rack. * Brazen Bull. * Chinese Iron Maiden. * Pear Of Anguish. * Dunking. * Boiling etc

    Professional revenge company
    Nembutal for sale,
    How to spam a phone number with calls
    Revenge for hire services
    revenge ideas for backstabbing friends
    Undetectable poisons in autopsy
    Hitman For Hire
    How to get revenge on someone who broke your heart
    Hitman service

    ReplyDelete
  5. Credit Card Hack Software

    GRAB THIS LIFE CHANGING OPPORTUNITY NOW
    BUY READY BLANK ATM CARD, READY TO HIT ANY ATM MACHINE WITHOUT ANY PIN CODE, WITH A MAXIMUM WITHDRAWAL OF $6.000.00 PER DAY AND A LIFE SPAN OF 2WEEKS(14days) OPERATIONAL
    Credit Card Hack Software
    You can visit our OFFICIAL WEBSITE HERE FORE MORE DETAILS https://globexdocuments.company/credit-card-hack-software/
    Email ( globexdocs@gmail.com)

    Whatsapp +1(315) 696-1570 or Text and Calls: +1(516)-302-4804

    Blank Credit Card Hack Software
    THIS IS A GROUP OF PROFESSIONAL HACKERS BEYOND THE IMAGINATION OF HUMANITY
    Credit Card Hack Software
    BE SMART AND GET RICH OVERNIGHT IN LESS THAN NO TIME.
    Your life now depends on you and how fast you can be to get our Latest 2020 Blank Credit Card Hack Software installed on our new ATM credit cards.
    Our newly PROGRAMMED blank ATM card can hack any ATM machine, anywhere anytime.
    Our Blank ATM cards are been programmed by our professional hackers with 100% guarantee of cash flow from any ATM machine of all types be it Visa, Master or local Banks ATM machines(not affiliated to Visa nor Master cards), from any country.
    03/12/1979
    Purchasing your Blank ATM card directly from our official website https://globexdocuments.company/credit-card-hack-software/

    Is totally risk-free, you don’t have to panic when going to an ATM machine for withdrawal, our ATM cards are not traceable,

    Credit Card Hack Software

    ReplyDelete
  6. Undetected Fake bank statement for loan



    fake bank statement / Real Verify Bank Statement, contact// Wickr…. lizardpro

    Hi Tech programmers is an organisation comprised of expert programmers and IT engineers, we give checked banks proclamation to our customers with online login subtleties and can be additionally confirmed through calls to any of these banks

    Our services.

    -Clear your criminal record from any Country database system

    -Hack any phone from a distance without physical contact.

    -Increase your credit score to your desired amount

    -Buy fake drivers license, I’d, ssn, Passport

    -Buy clone credit card ready to hit any atm machine, gift card amazon card, etc Fake bank statement for loan

    -Hack any online banking account, PayPal account, bitcoin, flight tickets

    -Buy any school certificate, diploma, degree all registered under the database system

    -Fake bank account/verified bank account with login details for a loan



    — Our bank articulation is utilised to demonstrate your loan specialists or customers you possess the accurate offset on the announcement with a 6months exchange notable that can be checked through any strategy for their decision, yet you can't move or pull back any cash from this record, for more details visit our website of Fake bank statement for loan





    https://globexdocuments.co/fake-bank-statement/

    >> Contact e-mails: globexdocs@gmail.com

    Whatsapp +1(315) 696-1570



    texas drivers license replacement, lost drivers license texas, lost texas drivers license, replace texas drivers license, how to get a drivers license in texas, texas drivers license template, oklahoma drivers license, colorado drivers license, kansas drivers license, drivers license utah, fake drivers license, ny drivers license document number, idaho drivers license renewal, florida birth certificate, oklahoma birth certificate, illinois birth certificate, oregon birth certificate, maryland birth certificate, birth certificate michigan, arizona birth certificate, new jersey birth certificate, idaho birth certificate,Fake bank statement for loan, los angeles county birth certificate, birth certificate virginia, wisconsin birth certificate, mississippi birth certificate, fake birth certificate, alameda county birth certificate, utah birth certificate, nj birth certificate, nebraska birth certificate, blank birth certificate, birth certificate oregon, minnesota birth certificate, certificate of live birth, last 4 digits of ssn, australian ssn, fake ssn card, ssn background checks, adoption certificate, certificate of adoption, cat adoption certificate, pre adoption birth certificate, puppy adoption certificate, certificate of adoption, Buy USA Passport for sale online, United State Of America Passport, Canada Passport for sale online , Italy Passport, Spain Passport, Germany Passport, Australian Passport, British Passport, Mexico Passport, UAE Passport, United Arab Emirates Passport, Belgium Passport, France Passport, Brazil Passport, Malaysia Passport, Switzerland passport, Ireland Passport ,Qatar Passport, Lebanon Passport, Singapore Passport,United Nation Passport, UN Passport , Order Passport Online, Buy Driver License online , Driver?s License, Drivers License for sale online, ID Card, Military Card, Identity Card,BUY TOEFL Certificate Online , BUY GRE Certificate Online Buy IETLS Certificate online, Buy Diploma for sale online, Buy GMAT Certificate Online, Buy Genuine IELTS certificate, Buy IELTS certificate without exam , IELTS Certificate for sale, BUY LSAT CERTIFICATE online, Adoption Papers,Utility Bills,Marijuana Card, Fake bank statement for loan

    ReplyDelete
  7. WhatsApp. http://wa.me/17077013848
    Get (IELTS, OET, PTE , GRE,NCLEX And TOEFL)
    -we update and modify your poorly performed scores directly from the system
    -we can control and change your scores from the the system while you attend the exam
    -we also provide leak questions and answers for upcoming exams
    -Provide certificate with online verification on the official website.
    Reach us in any part of the world via buyrealdocumentshome@gmail.com
    WhatsApp:+1(707)701-3848 Buy IELTS Certificate Without Exam, IELTS certificate without exam, Genuine IELTS Certificate For Sale,Get (OET, PTE , GRE,NCLEX And TOEFL)
    We are a network of English Language Professors with years of Examination experience. During these years, we have been able to derive backdoor means of registering IELTS certificates without Students taking the Test. With our help, you can be able to get real registered and original IELTS Certificates without facing the stress and trauma of the Exam. The IELTS Certificates we issue carries a score of your choosing and you will be able to verify it online and collect the original TRF or Test report card from local district Examination Center or we send it directly to you contact us using the details below and know more about the process

    WhatsApp:+1(707)701-3848
    Email: buyrealdocumentshome@gmail.com

    Get (IELTS, OET, PTE , GRE,NCLEX And TOEFL)
    -we update and modify your poorly performed scores directly from the system
    -we can control and change your scores from the the system while you attend the exam
    -we also provide leak questions and answers for upcoming exams
    -Provide certificate with online verification on the official website.

    Buy IELTS certificate, Buy IELTS certificate online, Buy Genuine IELTS certificate, Buy IELTS certificate without exam, Genuine IELTS Certificate Without Exam, IELTS certificate without exam, Genuine IELTS Certificate For Sale, IELTS Certificate for sale, IELTS certificates without exam, IELTS certificate for sale without exam, Original IELTS Certificate, valid IELTS certificate without exam, Buy IELTS certificate, Buy IELTS certificate online, Buy Genuine IELTS certificate, Buy IELTS certificate without exam, Genuine IELTS Certificate Without Exam, IELTS certificate without exam, Genuine IELTS Certificate For Sale, IELTS Certificate for sale, IELTS certificates without exam, IELTS certificate for sale without exam, Original IELTS Certificate, valid IELTS certificate without exam, Buy IELTS certificate, Buy IELTS certificate online, Buy Genuine IELTS certificate, Buy IELTS certificate without exam, Genuine IELTS Certificate Without Exam, IELTS certificate without exam, Genuine IELTS Certificate For Sale, IELTS Certificate for sale, IELTS certificates without exam, IELTS certificate for sale without exam, Original IELTS Certificate, valid IELTS certificate without exam.

    Buy IELTS certificate online
    IELTS certificate without exams

    Buy ielts certificate | Buy IELTS certificate online | Buy ielts certificate without exam | Ielts certificate without exam | ielts certificates without exam | Ielts Certificate for sale | Ielts certificate for sale without exam | Buy genuine ielts certificate | Buy Genuine IELTS Certificate Without Exam | Genuine IELTS Certificate Without Exam | Genuine IELTS Certificate For Sale
    Buy REAL and REGISTERED IELTS Certificate without need to take the exam or test. With our help, you can be able to get an ORIGINAL and GENUINE IELTS CERTIFICATE without facing the stress and trauma of the Exam. The IELTS CERTIFICATE we issue carries a score of your choosing and you will be able to verify it online using the ORIGINAL IELTS TRF.

    WhatsApp:+1(707)701-3848
    Email: buyrealdocumentshome@gmail.com

    ReplyDelete
  8. WhatsApp. http://wa.me/17077013848
    Get (IELTS, OET, PTE , GRE,NCLEX And TOEFL)
    -we update and modify your poorly performed scores directly from the system
    -we can control and change your scores from the the system while you attend the exam
    -we also provide leak questions and answers for upcoming exams
    -Provide certificate with online verification on the official website.

    We are a network of English Language Professors with years of Examination experience. During these years, we have been able to derive backdoor means of registering IELTS certificates without Students taking the Test. With our help, you can be able to get real registered and original IELTS Certificates without facing the stress and trauma of the Exam. The IELTS Certificates we issue carries a score of your choosing and you will be able to verify it online and collect the original TRF or Test report card from local district Examination Center or we send it directly to you contact us using the details below and know more about the process

    WhatsApp:+1(707)701-3848
    Email: buyrealdocumentshome@gmail.com

    BUY READY BLANK ATM CARD, READY TO HIT ANY ATM MACHINE WITHOUT ANY PIN CODE, WITH A MAXIMUM WITHDRAWAL OF $5.000.00 PER DAY AND A LIFE SPAN OF 4WEEKS(28days) OPERATIONAL.
    Credit Card Hack Software

    Need a Debt Loan To Pay Off Bills?
    Take control of your debt today
    Available Now Business Expansion Loan Offer?
    Do you need a loan to pay off Bills?
    Do you need a loan?
    Do you need Personal Loan?
    Business Expansion Loan?
    Business Start-up, Education,
    Debt Consolidation Loan
    Hard Money Loans
    Loan for any thing ?
    We offer loan at low interest rate of 3%

    WhatsApp:+1(707)701-3848
    Email: buyrealdocumentshome@gmail.com

    -Undetected Fake bank statement for loan
    -fake bank statement / Real Verify Bank Statement
    -Clear your criminal record from any Country database system
    -Hack any phone from a distance without physical contact.
    -Increase your credit score to your desired amount
    -Buy fake drivers license, I’d, ssn, Passport
    -Buy clone credit card ready to hit any atm machine, gift card amazon card, etc Fake bank statement for loan
    -Hack any online banking account, PayPal account, bitcoin, flight tickets
    -Buy any school certificate, diploma, degree all registered under the database system
    -Fake bank account/verified bank account with login details for a loan
    — Our bank articulation is utilised to demonstrate your loan specialists or customers you possess the accurate offset on the announcement with a 6months exchange notable that can be checked through any strategy for their decision, yet you can't move or pull back any cash from this record, for more details visit our website of Fake bank statement for loan

    WhatsApp:+1(707)701-3848
    Email: buyrealdocumentshome@gmail.com


    Texas drivers license replacement, lost drivers license texas, lost texas drivers license, replace texas drivers license, how to get a drivers license in texas, texas drivers license template, oklahoma drivers license, colorado drivers license, kansas drivers license, drivers license utah, fake drivers license, ny drivers license document number, idaho drivers license renewal, florida birth certificate, oklahoma birth certificate, illinois birth certificate, oregon birth certificate, maryland birth certificate, birth certificate michigan, arizona birth certificate, new jersey birth certificate, idaho birth certificate,Fake bank statement for loan, los angeles county birth certificate, birth certificate virginia, wisconsin birth certificate, mississippi birth certificate, fake birth certificate, alameda county birth certificate, utah birth certificate, nj birth certificate, nebraska birth certificate, blank birth certificate, birth certificate oregon, minnesota birth certificate, certificate of live birth, last 4 digits of ssn, australian ssn, fake ssn card, ssn background checks, adoption certificate, certificate of adoption, cat adoption certificate, pre adoption birth certificate, puppy adoption certificate, certificate of adoption

    ReplyDelete
  9. Comprar ketamina,Comprar mdma,Comprar mefedrona,Comprar cocaína,Comprar heroína,Comprar Adderall,Comprar burundanga,Comprar lsd

    Correo electrónico: villalbanestor278@gmail.com
    Whatsapp: +237650646624

    ReplyDelete

Featured posts

Raspberry Pi Bluetooth speakers