Skip to main content

Posts

Showing posts from August, 2018

geolocation.getCurrentPosition() only works with HTTPS

Just found out that more recent web browsers requires a SSL-secured (HTTPS) site to host the target script before navigator.geolocation.getCurrentPosition() will work. Otherwise, the following error will be emitted: getCurrentPosition() and watchPosition() are deprecated on insecure origins, and support will be removed in the future. You should consider switching your application to a secure origin, such as HTTPS. See goo.gl/rStTGz for more details. This creates a problem for the original ESPCLOCK code. Since  WifiManager does not support hosting a HTTPS captive portal, the logic for capturing the user's geolocation (and hence the timezone) no longer works. Back to the drawing board... ESPCLOCK1  /  ESPCLOCK2  /  ESPCLOCK3  /  ESPCLOCK4

Programming the WeMos D1 mini

So I went ahead and ordered the WeMos D1 Mini (now called Lolin D1 Mini). It's a diminutive ESP8266 dev board with reportedly very low deep sleep current draw. To program this board, the CH340 driver needs to be installed in order to access the board via USB. Then select the corresponding board type in Arduino. No code change is necessary. ESPCLOCK1  /  ESPCLOCK2  /  ESPCLOCK3  /  ESPCLOCK4

Hooking up USBasp programmer to the ATTiny85

After putting off the ESPClock project for quite a looooong while, I finally decided to pick up the project again. But the Arduino Uno board had been siphoned off by my eldest son for one of his science projects, so I decided to pick up a cheap  USPasp clone off eBay to help with programming the ATTiny85. First off is to connect the 2x5 ISP header to the ATTiny85. It was a bit confusing at first, but after some research, here are the connections required. I plugged the wires into the 10-pin ISP header, and soldered the other ends to two 1x4 male headers in the correct order. That way, I can just plug the male headers into the breadboard alongside the ATTiny85 quite easily to start programming it without too much fiddling. I had to strengthen the soldering with some hot glue to prevent the wires from breaking off the headers when plugging them in and out repeatedly. Works a treat so far. Then choose "USBasp" as the programmer under the Arduino IDE: I was