Skip to main content

Posts

Showing posts from 2016

Hacking an analog clock to sync with NTP - Part 5

This is how it looks after I have put everything together. The Arduino sketch is available here . The 2 jumper wires soldered to the clock mechanism are connected to pins D0 and D1 on the ESP-12 (in any order). When the device first boots up, it presents an access point which can be connected to via the PC or smartphone. Once connected, the captive portal redirects the web browser to the configuration page:     A custom field has been added to the WiFi configuration page to enter the current clock time in HHMMSS format. Try to set the clock time to as close to the current time as possible using the radial dial at the back of the clock so the clock will have less work to do catching up. In the config page, the HTML5 Geolocation API is also used to obtain your current location (so if your web browser asks if you would like to share your location, answer "yes"). This is then passed to the Google Time Zone API to obtain the time and DST offset of your time z

Hacking an analog clock to sync with NTP - Part 4

Assuming the jumper wires from the clock are connected to pins D1 and D2 on the ESP-12, the following Arduino sketch will make it function as a normal clock that ticks every second: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 tickPin = D1; os_timer_t secTimer; // Triggered by system timer every second void timerCallback ( void * pArg) { tickOccured = true ; } void setup () { // Setup GPIO outputs pinMode(D1, OUTPUT); pinMode(D2, OUTPUT); digitalWrite(D1, LOW); digitalWrite(D2, LOW); // Start system timer which triggers every second os_timer_setfn( & secTimer, timerCallback, NULL ); os_timer_arm( & secTimer, 1000 , true ); } void loop () { if (tickOccured) { tickOccurred - false ; tickPin = (tickPin == D1 ? D2 : D1); digitalWrite(tickPin, HIGH); delay( 100 ); digitalWrite(tickPin, LOW); delay( 100 ); } delay( 250 ); } To be continued... ESPCLOCK1  / 

Hacking an analog clock to sync with NTP - Part 3

Most battery-operated analog quartz clock on the market today are quite similarly internally. They are usually based on an oscillator driving a Lavet type stepper motor , Movement is made by alternating the current running through a copper coil in every step, followed by an interval without current so as to provide time for the magnetic gear to turn to its new position. I am going to disassemble the Ikea clock and connect two jumper wires to the clock mechanism. These two wires will then be connected to the GPIO pins of the ESP-12 for ours to control. To remove the plastic cover over the clock face, turn the clock over and disengage the 3 plastic tabs holding the cover using a flathead screwdriver. Once that is done, pull out the second hand, followed by the minute then the hour hands. With a butter knife (I used a plastic pry bar), gently pry the clock mechanism out of its holding cavity. There are tabs on both sides of the clock mechanism holding the front and back

Hacking an analog clock to sync with NTP - Part 2

Since I am more familiar with C/C++, it makes sense for me to use the Arduino IDE (rather than Lua, the other alternative). Everything was surprisingly easy to setup. I first installed the Arduino IDE , Then I followed the instructions here to setup the board manager within the IDE. I really wanted to base the WiFi configuration part of the project on WiFi Manager , so I added that to the IDE using the library manager. I also setup the board type under "Tools". There is no entry for ESP-12F, so I went with the ESP-12E since the two should be virtually identical as mentioned previously. With all the setup done, I went with the simplest possible WiFi Manager sample code, which looks like this: 1 2 3 4 5 6 7 8 9 10 11 12 #include <DNSServer.h> #include <ESP8266WiFi.h> #include <ESP8266WebServer.h> #include <WiFiManager.h> void setup () { WiFiManager wifiManager; wifiManager.autoConnect( "ESPCLOCK" ); } void lo

Hacking an analog clock to sync with NTP - Part 1

Inspired by this blog post detailing how to control the ticking mechanism on an analog clock with an Arduino, and having recently come across this gem of a WIFI-enabled micro-controller called ESP8266 ,  I decided to try and see if I can tether an analog clock to the ESP8266 and make it sync with a time server so that it is always on time (and is able to deal with daylight saving as well). Not being much of a hardware geek myself, I opted to get the dev board for the ESP8266, the ESP-12E . That way, I can connect it straightaway with my laptop via a USB cable and start coding right away. Cost: ~$6. Note: What I received turns out to be the ESP-12F, which appears to be virtually identical to ESP-12E . For the analog clock, I chose to use the $2 RUSCH wall clock from Ikea. Now this is a cheap and nasty clock, made using the cheapest possible material. The second hand doesn't even line up with some of the tick marks as it makes its rounds. But cheap is good for experimen

Cheaper to salvage 2TB laptop HDD from Seagate portable HDD

As widely discussed since 2014 , this trick still works in 2016, which is insane price arbitrage if you ask me. Bought a 2TB Seagate Expansion Portable HDD for $117. The 2.5" SATA HDD inside, if purchased as a stand-alone unit, costs upwards of $165. Prying this open requires a thin sturdy Swiss army knife blade (or something equivalent). A guitar pick was not rigid enough to do the job for me. The way these newer casings are designed, the plastics catches on the end that you start prying are bound to break. The other end should be OK if you are careful enough. I didn't need the casing anyway, so I didn't care. But you can always put it together with a little creative application of black electrical tape, so I don't think it's too much of a problem, unless you are really picky about cosmetics. After putting it into my laptop, SeaTools detects the HDD as ST2000LM007 . Not much of a surprise here. Pros: $50 savings for

Lossless concatenation of MP4 video files

Source: http://stackoverflow.com/questions/7333232/concatenate-two-mp4-files-using-ffmpeg ffmpeg -i myfile1.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts int1.ts ffmpeg -i myfile2.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts int2.ts ffmpeg -i "concat:int1.ts|int2.ts" -c copy -bsf:a aac_adtstoasc output.mp4  

RIP - QY8 Bluetooth Earpiece

Purchased: Sep 2015 From: GearBest Died: May 2016 Issue: No audio in right earpiece. Suspect break in connecting wire between the two earpieces. While it lasted: Good reception, audio and battery life. Comfortable wear (not too heavy). A little disappointed with the durability because I have always handled it gently.

Old brake pad vs new brake pad

Left = old | Right = brand new