Sunday, November 30, 2014

It happened again

Once again, Sure Electronics modified their 32x16 3mm LED display, and this time not only cosmetically.
The two 16-pin shrouded male connectors have been replaced with 10-pin connectors. And the worst thing is that the display now requires 12V for power! Maybe these new displays are intended for use in vehicles powered by 12V batteries. Or maybe designers thought a 12V power source is easier to access than a 5V one. In any case, the display has an on-board DC-DC switching regulator (with XL4013) to make the required 5V.

For someone who needs to replace the older model with the new one, the immediate consequences are:
  • the connector between the driver board (e.g. Wise Clock 4) and the display won't work; connections must be re-wired, probably using an adapter cable;
  • either supply 12V to the board through the connector, or hack the display by soldering the 5V wire directly to the board (see the photos);
  • the holes won't align anymore.

The good news is that the display is electrically compatible with the old one. With the correct re-wiring, the display should work without any software changes.

The following photo shows the testing of the display with the Wise Clock 4 board (and it works just fine).


The display has a series of rail bars that can be used for soldering the 5V power wire, as shown below.


A new design based on this display should (or must) use a 12V power supply. Powering from the USB is not an option any more. This would require a re-design of the Wise Clock 4 board as well (USB connector would be useless now; the FTDI cable won't be able to power the display).

Saturday, November 29, 2014

From the mailbox (with software updates)

New software for the Bubble clock from MikeM:
I have the bubble LED shield working with the DS1337 RTC & LiPo shield.  I have it alternating the display with the battery voltage every 2 seconds right now.  I don't have a voltmeter handy, so I haven't verified what is displayed with actual voltage.  It started fully charged at 4.2v and has now dropped to 4.1v.  It should start blinking at 3.45v, and go to sleep at 3.3v.
I started with your original bubble sketch from the blog posting, but then had to remap all the display pins from the schematic.  The current version of the SevenSeg library doesn't match your code, so I had to make some adjustments.
I also changed the SevenSeg library code to even out the brightness.  It looped through all the segments and turned on each appropriate digit, then delayed and turned everything off.
I changed it to loop through all the digits, turning on each appropriate segment.  Once all the appropriate segments are lit, it turns on the current digit, delays, then turns everything off, then moves to the next digit.  With the previous method some segments were bright and some dim, depending on what was displayed on the other digits.
I also changed the SevenSeg library to not blank leading digits.  It now displays 01.36 for 1:36 AM.  I left it as a 24-hour clock.  I can only display a decimal point, not a colon.
Thanks again Mike!

From ScottH, another version (HDSP.ino only; the rest of the files are unchanged) of the HDSP clock sketch adds scrolling of the time and date and improved setting. Thanks Scott!

From DaveC [on the HDSP clock]:
Here are the pictures.  Hope you find it interesting, unique at least.   There is a slide switch in the back with selections Solar charge, USB charge, USB run (the default mode of the kit), and battery run where you press that button on the front to turn on and display the time.   I used a solar/USB  charge board from Adafruit as I am no EE to figure out how to charge a battery from solar and USB with all of the correct regulated voltages etc.  The case is made from corian and in the top view those speckles are a kind of metallic flake in the corian, the center band is pure black. 




From EricL [on the HDSP clock]:
We got the package last week and my 13 yr-old grandson and I soldered it together and powered it up. Works perfectly!! Then I got your Arduino code for it and programmed it with a flashing ':' between hours and minutes and between minutes and seconds. Then I set the date in the RTC and changed the code again. Now it shows the date for 2 seconds every minute. Nice! Thanks for a great project!

From GregoryK [on the HDSP clock]:
Your kit is fantastic. Simple but well thought out. Thanks for bringing it to the market!
I would like to use it in one of my classes at Stanford as an "intro to soldering" and "intro to Arduino hacking" (they already will be familiar with the Uno) project.

From IvanS [on Wise Clock 4]:
Thank you Florin for the very thoughtful and entertaining  gift. Anything based on electronics is always interesting to me. We have been reading the famous quotes all day. It was a pleasure to meet you [...]

"Double Bubble Clock" shield for ProMini

I could have added a second bubble LED display to my "bubble clock" by connecting the anodes for the 4 new 7-segment digits to the only 4 pins left available: D0, D1, A6 and A7.
Instead, I preferred to use the expensive ($8+) LED driver MAX7219. Luckily, I got mine a long time ago as free sample from Maxim, and this was my chance to use it. As one can expect, the "double bubble" clock can display the seconds, plus the date and day of the week.


Below are the 2 bubble clock versions side by side. Both are ProMini shields, so ProMinis get plugged on their backs. I designed them to stand by themselves with the electronics exposed and on the open, as shown in this post. I am not sure if this is a good idea, but designing (or finding) an enclosure seems even a bigger challenge.


The sketch, included below, uses the LedControl library (communicates with MAX7219 through SPI).

#include "LedControl.h"
#include "Wire.h"
#include "DS1307.h"

#define PIN_DIN          12
#define PIN_CLK          11
#define PIN_LOAD         10
#define PIN_BTN_SETHOUR  2
#define PIN_BTN_SETMIN   9

int hour, minute, second;

// read time from DS1307 at intervals;
#define MAX_TIME_READING_COUNTER  1000
long timeReadingCounter = MAX_TIME_READING_COUNTER;

LedControl lc = LedControl(PIN_DIN, PIN_CLK, PIN_LOAD, 1);

void setup()
{
  // MAX72XX is in power-saving mode on startup, we have to do a wakeup call;
  lc.shutdown(0,false);
  lc.setIntensity(0,8);
  lc.clearDisplay(0);
  pinMode(PIN_BTN_SETHOUR, INPUT_PULLUP);
  pinMode(PIN_BTN_SETMIN,  INPUT_PULLUP);
}

void displayTime()
{
  // hours;
  lc.setDigit(0, 4, hour/10, false);
  lc.setDigit(0, 5, hour%10, false);
  // minutes;  
  lc.setDigit(0, 7, minute/10, false);
  lc.setDigit(0, 0, minute%10, false);
  // seconds;
  lc.setDigit(0, 2, second/10, false);
  lc.setDigit(0, 3, second%10, false);
  // delimiters (optional);
  lc.setChar(0, 1, ' ', true);
  lc.setChar(0, 6, ' ', true);
}

void loop()
{
  checkButtons();
  timeReadingCounter++;
  if (timeReadingCounter > MAX_TIME_READING_COUNTER)
  {
    getTimeFromRTC();
    displayTime();
    delay(5);
    timeReadingCounter = 0;
  }
}

void getTimeFromRTC()
{
  int rtc[7];
  RTC_DS1307.get(rtc, true);
  // check to avoid glitches;
  if (rtc[DS1307_MIN] < 60 && rtc[DS1307_HR] < 24 && rtc[DS1307_SEC] < 60)
  {
    second = rtc[DS1307_SEC];
    minute = rtc[DS1307_MIN];
    hour   = rtc[DS1307_HR];
  }
}

void setTime(int hh, int mm, int ss)
{
  getTimeFromRTC();
  RTC_DS1307.stop();
  RTC_DS1307.set(DS1307_SEC,  ss);
  RTC_DS1307.set(DS1307_MIN,  mm);
  RTC_DS1307.set(DS1307_HR,   hh);
  RTC_DS1307.start();
}

void checkButtons()
{
  // increment hours and minutes;
  if (LOW == digitalRead(PIN_BTN_SETHOUR))
  {
    hour++;
    if (hour>23) hour = 0;
    setTime(hour, minute, 0);
    delay(400);
  }
  if (LOW == digitalRead(PIN_BTN_SETMIN))
  {
    minute++;
    if (minute > 59) minute = 0;
    setTime(hour, minute, 0);
    delay(400);
  }
}

Since it's a shield, the board requires a ProMini. The device takes about 50mA.
Schematic and board are shown below.




I shared the PCB layout at OSH Park, so anyone can make their own.