Posts

Showing posts with the label software

On the GPS features of WiFiChron

The WiFiChron GPS-synchronized clock was begging for some documentation on the menu options and some details on its features. Here they are. The GPS-WiFiChron uses TinyGPS library to read the time from NMEA sentences  (specifically GPRMC and GPGGA strings) from the uBlox Neo GPS module . The clock starts reading the data from the GPS module (using SoftwareSerial library, receiving on pin D7) 2 minutes after power up. Once a valid GPRMC or GPGGA sentence is received, the minutes and seconds (but not the hours) are automatically re-set from the satellite UTC time. The successful synchronization is indicated by the "up arrow" at the end of the scrolling date (e.g. Sunday August 21, 2016 ^). In order to automatically set the hours as well, I added a new menu option, GPS? (Yes/No) . When this is selected (set to "Yes"), the local hour is calculated based on the longitude, by estimating the timezone using a simple formula: // estimate time zone from longitude; int8_t g...

WiFiChron with ATmega1284

Image
The WiFiChron code, with support for ESP8266, nearly reached the program memory limit of ATmega328, yet still missing a few features, the most important being the much needed debugging capability. Naturally, the next step in WiFiChron 's evolution was to upgrade to Atmega644P/1284P. Since there was no room on the board for the 40-pin DIP package, I settled for the SMD version. The schematic is shown below. Although functional, the board I designed is far from perfect: requires pull-up resistors for buttons; I relied on software pull-up, but that does not work in the current Sanguino library; requires a couple of more decoupling capacitors; (I soldered all these extra parts on the bottom side of the PCB, as shown in the next photo. The 595 shift-register is soldered on the bottom by design. The next revision will have the currently missing parts in the SMD package.) The WiFiChron-1284 board has the same dimensions as the previous revision , and it still fits in the Serpac A20 box....

From the mailbox

Image
AlexP managed to port the Wise Clock 4 code to Arduino Mega2560 (shared here , thanks Alex!). He made this video demonstrating it in action: Today I had a great day! I did it! I soldered a development board for my Mega2560. A little corrected code and ... voila!   Wiring diagram: rtc sqw (1hz) - pin 2 menu key - pin 3 set key - pin 4 plus key - pin 5 speaker - pin 6 speaker - pin 7 HT1632_WRCLK - pin 10 HT1632_CS - pin 11 HT1632_DATA - pin 12 HT1632_CLK - pin 13 rtc sda - pin 20 rtc scl - pin 21 (SD while not tested, but I think it works) sd miso - pin 50 sd mosi - pin 51 sd sck - pin 52 sd cs - pin 53 NelsonC built his own hand-wired version of WiFiChron and it looks awesome: MikeM sent in (thanks Mike!) his latest WiFiChron code (available here ). The enclosed zip file compiles under Arduino 1.6.8, though it generates a warning I haven't figured out how to eliminate. Ray ran into a problem with data overruns. When data in an RSS feed was split between multiple packets, so...

Wise Clock 4 software for Arduino 1.6.8

Image
Scott H. put the time and the effort to port the Wise Clock 4  code (also the HDSP-Proverb and WiFiChron code) to Arduino 1.6.8 (the latest, but maybe not the greatest). This is a big endeavor, which I did not plan to pursue any time soon. Now, thanks to Scott, here we have it . I compiled it and uploaded it myself, on Windows (he did it on Mac). The Wise Clock 4 files are all in the same " TheClock " folder, directly under " libraries ", as shown in the following screenshot. But before uploading to ATmega1284, this section needs to be inserted in boards.txt (*): ############################################## atmega1284.name=Sanguino W/ ATmega1284p 16mhz atmega1284.upload.tool=avrdude atmega1284.upload.protocol=stk500v1 atmega1284.upload.maximum_size=129024 atmega1284.upload.speed=57600 atmega1284.bootloader.low_fuses=0xFF atmega1284.bootloader.high_fuses=0x98 atmega1284.bootloader.extended_fuses=0xFD atmega1284.bootloader.path=atmega atmega1284.bootloader.file=a...

GPS-synchronized Mondrian clock

Image
The challenge was to add GPS to this "basic LED matrix clock". Since I don't see the point of a GPS clock that does not show seconds, I had to figure out how to fit 6 digits on the 8x16 LED matrix. One way to do it is this: as used by the " Matrix Clock V1.0 ". Kind of hard to distinguish between 0 and 8 though. Another way is based on MixiClock , where 4 digits are crammed in a 8x8 (tri-color) matrix. (This was more than 4 years ago. Incredible how little progress I made since.) As for the name, I settled for "Mondrian" because  Kandinsky  was already taken :) The hours are shown in red, the minutes in green and the seconds in orange. After power up, the seconds blink until the GPS time is received (less than 5 minutes in my house, more than 3 meters away from the nearest window). Only the minutes and the seconds are synchronized (but not the hours). The Mondrian clock is made of 2 boards: the wsduino with the GPS Bee plugged in (and the antenna aff...

Add light sensor to Wise Clock 4

This is long overdue. As we know, the display brightness on Wise Clock 4 can be changed between 5 levels, by pressing the "Plus" button. To adjust the brightness automatically, based on the light conditions, we need to add a light-sensitive sensor of some sort, and the most common is the LDR (light-dependent resistor). Any of the countless articles and tutorials on Arduino + LDR will teach how to connect the LDR to an analog pin, using a voltage divider. For Wise Clock 4 , the LDR is connected between A0 (pin 40 of the processor) and ground, with a 10k resistor between A0 and Vcc, as shown below:   GND|----[ LDR ]---A0---[10k resistor]----+Vcc The automatic brightness adjustment is enabled in software with this macro (in file UserConf.h ): // use an LDR (connected to A0) to automatically adjust // (every 5 seconds) screen brightness to ambient light; #define AUTO_BRIGHTNESS and implemented in this new function: void WiseClock::checkBrightness() { #ifdef AUTO_BRIGHTNESS ...

Add a barometer sensor to Wise Clock 4

Image
While cleaning up my desk, I found a little I2C module that I completely forgot about. It is a breakout for BMP180 barometer sensor, which I probably bought on ebay for a couple of dollars (I just checked , it is still under $2). This tiny board can be added literally to any Arduino clock to display atmospheric pressure, with the help of  Adafruit_BMP085 library . Connecting the barometer to Wise Clock 4 is trivial: I soldered wires directly to processor pins (SDA, SCL, VCC and GND), as shown in the photo. There is plenty of clearance between the board and the display. In the software, as mentioned, I used the Adafruit BMP085 library, which also covers the compatible BMP180. There is no extra setting required from the user: the pressure is displayed together with the temperature, and enabled/disabled from the TEMP+/- menus. Also, there is no extra settings when compiling/building: if the BMP180 module is not installed, no pressure data will be displayed. Essentially, the new code...

New Wise Clock 4 software release

The latest release of the Wise Clock 4 software can be found here . It includes a few new features: support for the XBee-fied ESP8266 (from iteadstudio), courtesy of MikeM; The WiFi settings are configured in the SD card file message.txt , and they look like this: #### ESP8266 configuration # # Esp8266.ssid Wireless SSID to connect to # Esp8266.phrase pass phrase to use (WPA authentication) # Esp8266.sntp optional SNTP server IP address (not hostname) for time synchronization # Esp8266.rssurl optional URL of an RSS feed, like http://w1.weather.gov/xml/current_obs/KMYF.rss Esp8266.ssid   BELL475 Esp8266.phrase 7xyz1E9F6 Esp8266.sntp    Esp8266.rssurl  This feature is enabled in the code by the following line in file  UserConf.h : #define WANT_ESP8266 support for GPSBee  (from seeedstudio): only the minutes and seconds are set from the GPS data, the hours remain as set from the buttons; synchronization is performed once a day and/or when the clock is ...

Experimenting with MAX6955

Image
MAX6955  is an interesting LED driver chip. It is the primordial charlieplexing device, being the materialization of a technique invented by Charlie Allen of Maxim Integrated. Without understanding how charelieplexing works, it is actually counter-intuitive to wire multiple (up to 8) 16-segment displays to such a driver chip. Fortunately, Maxim has great documentation on how to do it. My experimenting actually started with MAX6954 . After many failed tries due to SPI issues (Maxim uses a special interpretation of the protocol, I read), I switched to MAX6955. MAX6955 is the I2C sibling of MAX6954 (which uses SPI). They both have identical LED driving abilities, only the microcontroller interface part of the chips differ. Once, both chips were available in DIP-40 package. Now, MAX6955 only comes in SSOP-36 (MAX6954 is still available in DIP-40). Luckily, the pin configurations for the two chips are compatible, which allows for easy swap. For this reason, I designed a breakout board...

WiFiChron fix and other WiFis

Image
The peculiar feature of the "May 2015" revision of WiFiChron board is that it was designed to use software serial to communicate with either the XBee or ESP module. The reason is related to debugging. I wanted to be able to send messages to the serial monitor while (software serially) communicating with the serial device. This solution works well for XBee ( GPSBee , BTBee ), but not for ESP8266, only because the software takes more than the available 2K of RAM in this case (WiFi + software serial). The immediate fix to use the ESP module is to connect its Rx/Tx lines to Rx/Tx of the processor. The existing connections can be left uncut, since they are not used in the sketch for ESP8266 . The wiring should be like in the photo below. The "permanent" fix would be re-designing the board to use ATmega1284 SMD (DIP-40 would not fit). Talking about 1284,  take a look at Farit's WiseClock4 mod. He used the WiseClock4 board, but completely re-wrote the software, in...

Prototype 14-segment-display shield

Image
There are many ways (*) to drive the 6-digit 14-segment common cathode display from Seeed Studio. This time I chose to multiplex two MAX7221 , a method described here  (but used for driving a bi-color 8x8 LED matrix). The code is based on LedControl library , which I extended to cover the definition and display of 14-segment characters (digits, upper case letters, and a few specials). Below is a relevant fragment of the code I added: /* * Segment names in the 14-segment (plus DP) display: * *     -     A *   |\|/|   F,I,J,K,B *    - -    G,H *   |/|\|   E,N,M,L,C *     -  .  D,P */ // my wiring: //            GFEDCBAx // 1st byte: B11111111 // //            NHJIKMLP // 2nd byte: B11111111 const static byte charTable14Seg[43][2] = {     {B01111110,B10001000},  // 0     {B00001100,B00001000},  // 1     {B1...