web based clock

Post details of your projects here.
basicchip
Posts: 905
Joined: Fri Oct 19, 2012 2:39 am
Location: Lake Tahoe, CA
Contact:

Re: web based clock

Post by basicchip » Sun Jan 06, 2019 10:53 pm

Tweaked the time server to handle recognized time zones listed here https://secure.php.net/manual/en/timezones.php

so you can request

coridium.us/time.php -- and you well get US Pacific time zone

or

coridium.us/time.php?zone=Europe/London

No error checking and most likely never will be

Code: Select all

<!DOCTYPE html>
<html lang=en>
<head>
<title>Coridium Time Server</title>
</head>
<body>
<?php
    $timezone = htmlspecialchars($_GET["zone"]);
    if ( $timezone == "")
        $timezone = 'America/Los_Angeles';

    $tz_object = new DateTimeZone($timezone);

    $datetime = new DateTime();
    $datetime->setTimezone($tz_object);
    
    echo "time is-",$datetime->format('H:i:s');
    echo "<br>";
    echo "date is-",$datetime->format('m/d/Y');
?>
</body>
</html>



basicchip
Posts: 905
Joined: Fri Oct 19, 2012 2:39 am
Location: Lake Tahoe, CA
Contact:

Re: web based clock

Post by basicchip » Tue Jan 08, 2019 2:10 pm

Care package from Digikey came in so I can finish up the ambient light sensor. Also ordered some LPC54005s for other boards we are experimenting with.

Speaking of light I already decreased the brightness at night, but it still acts like a night light for me. I am far sighted which my eye doc told me is why I have excellent night vision. Just me and the cats wandering around at in the dark in the house.

basicchip
Posts: 905
Joined: Fri Oct 19, 2012 2:39 am
Location: Lake Tahoe, CA
Contact:

Re: web based clock

Post by basicchip » Fri Jan 11, 2019 1:11 am

Well the light sensor is a pretty simple circuit.
lightDark.jpg
lightDark.jpg (6.64 KiB) Viewed 67 times
The real variable is what resistor to choose. I went from 1 M to 2 M to 3 M. Then I put the bezel in front which cuts out a lot of light, and may end up increasing the resistor size more. Waiting for night to test ambient room light vs dark to set that value. Most likely the display will go full bright with room lights on at night, and then dim way down.

basicchip
Posts: 905
Joined: Fri Oct 19, 2012 2:39 am
Location: Lake Tahoe, CA
Contact:

Re: web based clock

Post by basicchip » Fri Jan 11, 2019 10:57 pm

Buttoned up the project today. I ended up putting the light sensor poking out of the top slightly. With that 10 M would probably be the correct resistor. So now every 5 seconds the AD is read to set the brightness of the display, may do some final adjustment of the AD vs brightness tonight. I left it possible to program the ARMstamp or ESP8266 without disassembly. But it looks pretty good where it will live in the bedroom.
clock6.jpg
clock6.jpg (157.51 KiB) Viewed 65 times
Birds nest of wires hidden inside
clock7.jpg
clock7.jpg (96.94 KiB) Viewed 65 times
USB connections for power only (original clock power) and for debug
clock8.jpg
clock8.jpg (79.6 KiB) Viewed 65 times
And a closeup of the light sensor -- the equivalent of deadbugging SMT parts
clock9.jpg
clock9.jpg (37.39 KiB) Viewed 65 times
The resistor in the light sensor is now 15M. Using values that high you have to be careful of oils from your hands, flux ... Meaning you need to clean it up as those can have significant impacts on resistance. Still playing with the values, clipping on the high end above 55000 calling that full bright, and below 3000 calling it all dark. I seem to be playing with the settings each night. I had 20 /1000 PWM on the low end was too dim to easily read in a dark room so upped it to 25 that seems better. But it still is a bit of a night light.

olzeke51
Posts: 333
Joined: Sat May 17, 2014 4:22 pm
Location: South Carolina
Contact:

Re: web based clock

Post by olzeke51 » Sat Jan 12, 2019 2:26 am

Lookin' good on the mantel. You're right, these LEDs do make a 'nite lite".
So when will the clock send the ambient light level to the thermostat to modify
the temperature settings to accomodate the changing sunrise and/or Daylight Savings!!!??
'
I have/am using a simple programmable furnace control to control a furnace controller, but
I have hooked up a standard light socket to the relay output contacts. So the room temp
setting is way hi/low at the different times !!!! My son saved the furnace controller from
one of his jobs - part of it is kaput. I have it turn on the 'nite setting/lite' to remind me to
wind down from my computer so I can go to sleep easier....
''fun with parts----
Gary

Post Reply