ESP8266 driving 7 Segment Display - Page 1
Forum section: electronics / projects

author: kkessler
author_rank: Regular Contributor
timestamp: October 15, 2015, 03:35:13 pm
content: As my first ESP8266 project I'm building a connected clock which will sync time, get it's timezone, and set and unset daylight savings time automatically from the internet (somehow). The display I'm using is 4 1.5" Blue 7 segment leds, common anode, with each segment made up of 2 blue leds in series. This means I'm going to have to drive the display at something like 7.5 V to get across the 2 blue diode voltage drops. I also plan to put a light sensor in the clock and dim the display through PWM. I initially thought of using a dedicated driver chip like the MAX7219, but I didn't find any that met the requirements; 3.3 V inputs, 7.5 V output, common anode, not expensive, etc. After Googling a bit, I came across a PCA9532, which is basically a 16 bit GPIO expander, with open-drain output and PWM, and it looks to me like a pair of these would do the trick. I would just need to write code that would light up the individual segments, instead of have some chip do the translation from numeric value to display segments.I'm just looking for a bit of a sanity check. Is this a reasonable way to solve this problem, or am I missing some better answer.Thanks.

author: linux-works
author_rank: Super Contributor
timestamp: October 15, 2015, 04:15:26 pm
content: I'm a big fan of the adafruit led display modules that are i2c based and use a holtek single chip. they are not as large as the ones you want to use but maybe you can use the chips/boards and wire your leds to this board. it gives 8 level of dim, too.here's 2 of them; one 7seg and one 'union jack' alpha style (love the name for that, lol).and by running more modules in parallel (giving each its own i2c addr) you can add more digits to the string length.update speed is very fast and adafruit has simple code examples for them. you can buy the leds in blue, white, yellow, red.as for the time stuff, you will have to manually enter your local timezone but the arduino time.h and timezone.h librs are pretty good and I can post some code examples of how I get GPS time (utc) and convert it to local with automatic DST calcs.btw, one simple hack for getting network time without having to mess with NTP is to get a web header from a 'big website' (such as ebay) and this is the unix command to do it, if that helps any:Code:curl -s 'http://viv.ebay.com/ws/eBayISAPI.dll?EbayTime' | grep -A 1 'The official eBay Time is now' | tail -1 | awk '{ print $5 }'a similar thing can be done in C from the arduino or esp. you simply do a web GET or HEAD command on port 80 and parse out the ascii time string from the returned simple data.

author: ralphd
author_rank: Frequent Contributor
timestamp: October 15, 2015, 05:02:16 pm
content: Quote from: linux-works on October 15, 2015, 04:15:26 pmOr just use the daytime port on a Unix host; that's what it is meant for. You can test it with telnet cesium.clock.org daytime

author: ralphd
author_rank: Frequent Contributor
timestamp: October 15, 2015, 05:06:00 pm
content: Quote from: kkessler on October 15, 2015, 03:35:13 pmI'm planning to do a couple esp projects hooking up a HD44780 and possibly a 4-digit 7-segment display. My plan is to use shift registers. They are much cheaper than a port expander (around 5c ea in small qty), and you can find lots of C code for driving the displays with a shift register.

author: kkessler
author_rank: Regular Contributor
timestamp: October 15, 2015, 09:51:37 pm
content: The shift register was exactly the sort of answer I was looking for, especially since I have some 74hc595s in my parts drawer. Thanks ralphdAs to setting the time, getting accurate time in UTC is easy, since there is are already calls for NTP in the ESP8266 SDK. Getting the timezone and adjusting for daylight savings time is the trick. What I was looking for was an API to call that would Geolocate my NAT'ed IP address and tell me my time zone, and when to set the clocks forward and back, but no one seems to offer that (at least not for free). Right now I'm going to provide that info by just writting a little API running on the RaspberryPI I will also be using to put OTA updates to the device.

author: linux-works
author_rank: Super Contributor
timestamp: October 16, 2015, 12:57:01 am
content: again, I suggest just grabbing the arduino librs that implement the timezone.h stuff.its thin, its simple C code and the table you create for your timezone is elegant and it works.no need to futz with ip to geo. that never works well enough anyway, at least I'd never care to use it.use a static table and it will just plain work. timezone.h is the stuff.

author: kkessler
author_rank: Regular Contributor
timestamp: October 16, 2015, 04:22:04 am
content: The problem with the libraries that basically hard code the rules is, when they change them, it takes a firmware upgrade to fix it. I have a radio clock in my Living Room that changes time according to the 1987-2006 schedule, and now is wrong about a month out of the year. I'd rather having something I can call that is always using the current DST rules.

author: promacjoe
author_rank: Regular Contributor
timestamp: October 16, 2015, 04:35:35 am
content: the TM1638 Can provide up to 10 digits, with a 3x8 keyboard matrix. it is a single-chip SPI solution. And is very inexpensive. It is worth taking a look at.