Posts

Showing posts from July, 2022

Replacing my MacBook Air

 My 2013 MacBook Air is still well and kicking, all but the battery is in good condition. I replaced the battery for a random one off Amazon and it was no good. Eventually the seller refunded my money after I reported the system would just cut off when the battery indicated around 55%. My guess is the power management was poor or the dialog with the laptop's control logic was not good so battery voltage and battery capacity were not interpreted properly. Whatever the reason, I was left with a computer that could be used only when battery was over 60% and that it can shut off anytime the number was below that. The old battery only lasted for less than one hour and I was not sure whether I would be any luckier buying another battery unless it came from Apple (which was pricier).  OTOH, that laptop had served me well for almost nine years and though it was a top of the line model (that was expensive at the time) with an i7, 8GB or RAM, and a 512GB SSD, I chose to look for a new model

Set the time of Raspberry Pi Pico W using NTP

Image
 While the new RPi Pico W does not have a battery to keep the RTC, it does have something the previous model was lacking, network connectivity. So using the built-in Wifi module it can figure out the time and date from a network server using the Network Time Protocol (NTP).  It can work with it but the MicroPython binary I am using does not include a module for that at the moment (as the binary for ESP32 does) but it should not be a big deal to use that. As usual, it was easier to say than to do, but now I have it working. Please note that if you use the Thonny program, it will adjust the Pico real-time clock without warning you. So for a while, you may think it was your code that did it when it may well it is not the case. I just recycled some code I found but I was getting errors till I figured out the right offset for my board and timezone. You may need to tweak that to adjust it to yours. try: import usocket as socket except: import socket try: import ustruct as struc