top of page
  • BrainlessRBT

Employee Temperature System: How I failed to build a product, What I learned? Part III

ython, Kivy, OpenCV, Android, Buildozer, RaspberryPi, Arduino, Chromebook etc.

I still could not figure out OpenCV frame to texture with Kivy on Android. So I decided to use a pc. A pc that is affordable and with a screen that you can fold. The most affordable way for that would be a Chromebook. Such as Lenovo C340 around $299



However, the operating system is Chrome OS. So we need something, that we can install and run Python. So in order to that you either turn on Linux (Beta) on Chromebook or install another linux os over such as Gallium.


Buttt.. Unfortunately after installing Linux to a Chromebook I have, I learned that Chromebook is not giving access to its CAMERA hardware yet! Even not to USB Cam.. Disappointment again!


But anyway check these links for Linux on Chromebook:


Guide to turn on Linux (Beta) and Install Python: https://installpython3.com/chromebook/


Install Gallium OS (DB TECH):


PROCEEDING:

I would still continue to complete my software at least on another OS, another device. I was still lacking sensor, but at least I could complete the main interface, so only thing remaining would be reading the sensor value from a serial interface.


So far, I could manage to figure out face detection with OpenCV, I was not needing face recognition but I knew what to use if I need (Python face-recognition module). Also besides face-recognition module, for higher volume and more complex system, and if my hardware would not have enough processing, I could use Amazon Rekognition



1st Screen is Logo:


The program shows a logo in the first screen, when a face is not detected in the area.



If a face is detected the screen slides to the second screen, where the camera is viewed. A person should put his/her face in the ellipse area to start measuring. It will measure the face size if the face size is big enough, it will trigger the sensor to measure (No sensor of course, so this code has a fake measurement).



Checking Face Size:

if faces==():
    print("No One Around")
    Clock.schedule_once(self.no_human_around, 5)  ## Go to function to change to first page !!

for (x, y, w, h) in faces:
    # To draw a rectangle in a face

    cv2.rectangle(frame, (x, y), (x + w, y + h), (255, 255, 0), 2)
    #print(w,h) # for closer head it needs to be aroung 145 for w and h
    #print (x,y) # Face position for 33>x>16 // 80>y>35
    if (x > 5 and y > 5 and w > 10 and h > 10):

        Clock.schedule_once(self.human_detected)
        Clock.unschedule(self.no_human_around) ## Cancel it in any case

        #Clock.schedule_once(self.add_camera_view_widget)

        #self.human_in_target= True
    if not (x > 5 and y > 5 and w > 10 and h > 10):
       # self.human_in_target= False
        print("noone")
        running_app.screen_manager.current = "First"
        print("Nobody")

    print(x,y,w,h)
    if (x<60 and x>16 and y<180 and y>35 and w >250 and h>250):
        self.face_position_counter=self.face_position_counter+1
        print(self.face_position_counter)
        if  self.face_position_counter == 1: # add a time thing to count

            target_lock=True ## Add here Label for "Hey Dude Stand Still"
            #Clock.schedule_once(self.shoot,1.00/2.00)
            self.shoot()

    else:
        target_lock=False
        Clock.unschedule(self.shoot)

Also on the left side of the screen, it pulls an image that is daily uploaded picture from California website which is showing daily COVID statistics. However, the website was not consistent with the image name, so the code tries to find a published one.


def download_covid_report(self,*args):   ### CHECK IF CA RELEASED TODAYS IMAGE!!! Always in a different format so trying to find the right one.
    now = datetime.now()
    day_before= datetime.now() - timedelta(days=1)
   
   # self.today_date = self.today_date.strftime("%m-%d-%y")
    month = now.strftime("%B")
    day = now.strftime("%d")
    covid_report_img_text = month + day
    ### If the month end or the report is not ready for the new day

    month_b=day_before.strftime("%B")
    day_b=day_before.strftime("%d")
    covid_report_img_text_DayBefore= month_b+day_b
    self.covid_report_img_text_address = "https://www.cdph.ca.gov/Programs/CID/DCDC/PublishingImages/COVID-19/CA_COVID-19_ByTheNumbers_" + covid_report_img_text + ".png"

    if self.check_report_image(self.covid_report_img_text_address)==True:
        self.covid_report_img_text_address = "https://www.cdph.ca.gov/Programs/CID/DCDC/PublishingImages/COVID-19/CA_COVID-19_ByTheNumbers_" + covid_report_img_text + ".png"
        print("Trying to Download Todays Image")
        self.aimg = AsyncImage(source=self.covid_report_img_text_address)

    elif self.check_report_image("https://www.cdph.ca.gov/Programs/CID/DCDC/PublishingImages/COVID-19/"+ covid_report_img_text +"CA_COVID-19_ByTheNumbers.png")==True:
        self.covid_report_img_text_address = "https://www.cdph.ca.gov/Programs/CID/DCDC/PublishingImages/COVID-19/"+ covid_report_img_text +"CA_COVID-19_ByTheNumbers.png"
        print("Downloading Style 2 type todays report")
        self.aimg = AsyncImage(source=self.covid_report_img_text_address)

    elif self.check_report_image("https://www.cdph.ca.gov/Programs/CID/DCDC/PublishingImages/COVID-19/CA_COVID-19_ByTheNumbers_" + covid_report_img_text_DayBefore + ".png")==True:
        self.covid_report_img_text_address = "https://www.cdph.ca.gov/Programs/CID/DCDC/PublishingImages/COVID-19/CA_COVID-19_ByTheNumbers_" + covid_report_img_text_DayBefore + ".png"
        print("Could not download today, downloading yesterdays Image Type 1")
        self.aimg = AsyncImage(source=self.covid_report_img_text_address)

    elif self.check_report_image("https://www.cdph.ca.gov/Programs/CID/DCDC/PublishingImages/COVID-19/"+ covid_report_img_text_DayBefore +"CA_COVID-19_ByTheNumbers.png")==True:

        self.covid_report_img_text_address= "https://www.cdph.ca.gov/Programs/CID/DCDC/PublishingImages/COVID-19/"+ covid_report_img_text_DayBefore +"CA_COVID-19_ByTheNumbers.png"
        print ("Downloading Type II - Yesterdays Image")
        self.aimg = AsyncImage(source=self.covid_report_img_text_address)
    else:
        self.aimg=Image(source="stop_spread.logo")





After the face is close enough, the temp is measured, conceptually, and result is presented. You can change the conditions.



Where is the sensor? There is no sensor, at least one that works.


After all these, only one thing was remaining. The most important thing. The temperature sensor. Everything was "0 in Stock"


I tried MLX90614 on Sparkfun's dev board which was back in stock again. However, the problem was distance. Because of the angle you should be almost touching to the sensor in order to have an accurate measurement. If you want to have a measurement from a good distance like a handheld laser temp tool, you need a focus scope on the sensor.



I tried keychain laser focusing lens.


It did not help a lot. Then I found out that in Home Depot, they have a good stock of Ryobi's handheld laser temp tool.



This is a pretty accurate thermometer and the price is not bad. So I could disassemble it and use the sensor with scope, and even get the measured temp data from serial if there is any.


However, there was no I2C I could read from. I was in rush, yes. So I thought the best way, I could do it was to read the data from the LCD. So I found this person, did the same thing I intended to..


A way to read the displayed number on a segment LCD.





I tried the same thing..
















Getting the analog data from the sensor. No data sheet :(




Finally.. This is the point I stopped, said enough. I felt that I failed. But thinking about the stuff, I learned, experienced, it was not a failure really. One of the important things that I learned was, especially when you are doing something like that rush and could bring something good, "Don't be cheap!" Try to outsource. Don't loose time.





78 views0 comments
bottom of page