Author Topic: tiny OLED 128x64 calendar display (arduino)  (Read 89118 times)

0 Members and 1 Guest are viewing this topic.

Offline linux-worksTopic starter

  • Super Contributor
  • ***
  • Posts: 1997
  • Country: us
    • netstuff
tiny OLED 128x64 calendar display (arduino)
« on: May 13, 2015, 12:51:44 am »
had this little oled 128x64 $10 display sitting around and figured I'd put it to good use.



I wrote some arduino code today (took me ALL day) that does a bunch of calendar calculations and formats a 'cal' unix style display, but graphically.  there's JUST enough room on this display, with those fonts, to display a 6 line calendar (some odd months have 6 weeks in them, sort of; like the one this month, in fact!).

will upload the source soon as I run a bunch more tests on it.

nice little 5v device.  using the (very large, sigh) u8glib library (takes a long time to build, even on a pretty fast i3 system): http://code.google.com/p/u8glib/

device is known as 'sh1106'.

amazon has it:

http://www.amazon.com/Huhushop-TM-Serial-Display-Arduino/dp/B00JM88A94

note, that's just one of many vendors that have it.


I might integrate this display and logic with a clock project later on.
 
The following users thanked this post: Renate

Offline PeterFW

  • Frequent Contributor
  • **
  • Posts: 577
  • Country: de
    • Stuff that goes boom
Re: tiny OLED 128x64 calendar display (arduino)
« Reply #1 on: May 13, 2015, 01:45:02 am »
I might integrate this display and logic with a clock project later on.

Be advised, those displays are (might be) not well suited to run permanently.
They are rated for only a few thousand hours run and lifetime.

They are pretty nice though, i got a few myself.
 

Offline linux-worksTopic starter

  • Super Contributor
  • ***
  • Posts: 1997
  • Country: us
    • netstuff
Re: tiny OLED 128x64 calendar display (arduino)
« Reply #2 on: May 13, 2015, 02:30:29 am »
did not know that!  they have that short of a lifetime?

well, $10 makes me care a bit less (and that's the 'expensive' amazon price; I'm sure its cheaper direct from china).

I guess I will make sure I socket the thing so that when it wears out I can simply plug a new one in.

thx

Offline linux-worksTopic starter

  • Super Contributor
  • ***
  • Posts: 1997
  • Country: us
    • netstuff
Re: tiny OLED 128x64 calendar display (arduino)
« Reply #3 on: May 15, 2015, 09:48:04 pm »
more progress:



and the front:



I'm using nearly all of the 30k that the arduino 328 chip has.  each time I touch the code I have to find a 'donor block' of variables or code or something.   the u8 graphics lib takes a huge chuck of it, though.  the wifi library also takes its tax.

its a neat little clock, though.  if you pre-enter your ssid and password and give it a website url to hit, on power-on it will connect to wifi, hit the webserver, get its GMT time and convert it to your local time (you do have to pre-enter your DST and TZ data; it uses time.h and timezone.h arduino libs).  after it gets 'network time' it simply runs the software RTC code, not really needing a local RTC hardware module.  that saves cost and bulk and complexity.  the arduino hits the same webserver at intervals you select (at code/build time) and so it resyncs and stays long-term accurate.

currently, the display cycles between the calendar page and a 2-line date and hh:mm:ss page.  just that simple.

mostly its a learning exercise to get experience with this ESP wifi module (and those horrid horrid AT commands.  have to try the LUA stuff next).  also is my first time using that 128x64 oled module.  its a fun little module, although the u8lib takes forever to build, even on a modern system.

Offline linux-worksTopic starter

  • Super Contributor
  • ***
  • Posts: 1997
  • Country: us
    • netstuff
Re: tiny OLED 128x64 calendar display (arduino)
« Reply #4 on: May 15, 2015, 11:17:34 pm »
front of the unit showing a simple date and time display



right now, it shows that and updates every second on the second until halfway thru the minute, then it shows the calendar for a few seconds, then back to this display.

3 more of those displays just arrived in the mail, so I will be doing more with them, over time, I can tell ;)

Offline linux-worksTopic starter

  • Super Contributor
  • ***
  • Posts: 1997
  • Country: us
    • netstuff
it now checks for unread email ;)
« Reply #5 on: May 24, 2015, 12:50:06 am »


left image is when there is no unread email.

right image means there is email to be read ;)

this is using the white version of the display (1.3").  I also have the .96" oled displays, which are noticeably smaller but do run the same code and display protocol.

the way this works (for me) is that I have an xbee on this system with an arduino controlling it all.  it listens for 'beacons' to arrive on the xbee and they can be time/date announcements or they can be email counter annoucements.  no email info is sent over the beacons (for obvious security reasons) and all email polling is done on a 'locked down' rasp pi system with some simple python IMAP fetcher code.  the only thing that goes over the xbee is the email count: 0 or some other positive integer.

I kind of like having little dedicated displays that do a single thing (or a small # of things) well and nothing more than that.  quite the opposite of the smartphone-does-everything idea; but I don't really like the phone approach, to be honest.  purpose-built devices are always nicer (to me) than generic ones.

Offline zapta

  • Super Contributor
  • ***
  • Posts: 6190
  • Country: us
Re: tiny OLED 128x64 calendar display (arduino)
« Reply #6 on: May 24, 2015, 02:51:58 am »
Those 1.3" OLED displays are very handy and I used the in a few arduino and arm projects, always with the u8g library. They come in different non compatible versions, different controllers, different pinouts (some have the + and - swapped, some have reset some don't), different voltage specification (some have a 3.3V LDO but the signals are not 5V tolerant, some don't the LDO but flicker when you run them on 5V) and different protocols (SPI vs ICS). I settled on one model and get them directly from heltec because ebay vendors often sent me the wrong model.

If you are looking for case idea I recommend the Sick Of Baige 'cases', either one of the stock sizes or a laser cut custom one (Ponoko near SF do a great job).

http://dangerousprototypes.com/docs/images/e/e4/SOBv1_overview2.jpg

https://raw.githubusercontent.com/zapta/power-monitors/master/pmon_3v8/www/pmon_3v8_closeup_annotated.png

EDIT: does your display have an LDO at the back? As far as I know the SSD1306 is not compatible with 5V, not as supply and not for the signals. When I run it on 5V the display flickered on some units during updates.
« Last Edit: May 24, 2015, 02:54:52 am by zapta »
 

Offline linux-worksTopic starter

  • Super Contributor
  • ***
  • Posts: 1997
  • Country: us
    • netstuff
Re: tiny OLED 128x64 calendar display (arduino)
« Reply #7 on: May 24, 2015, 04:06:28 am »
I bought one from ebay (white 1.3") and that's the harder one to find, for some reason.  blue blue blue - you can get lots of blue ;)  white is nice since it works well behind an orange plexi filter and it almost matches the nixie color.  blue is just always blue ;)

for protocols, I've seen ones that are i2c-like (mine) and ones with an extra pin or 2 which seem more like spi.  if I ever did build something that needed a lot of these, I'd buy them all at once to be sure.  I can see that you'd go nuts trying to go from vendor to vendor and have the same product.

no idea if there is an ldo on there.  I see a 3 legged thing but it looks more like a transistor, no heatsink area that I could see.  it is native 5v and signals at 5v, so that's fine with me.  3.3v annoys me simply because the whole world is not at 3.3v.

as for the case, I am a techshop member and so I'll do a lasercut box of some kind.  the challenge is to think about what to do that might be a little bit unusual or different.

one of my (two) builds has an opto proximity sensor (sharp, I think) and it was fun playing with that.  on that unit, the oled only comes on if you are sitting at the desk within 2 feet of the device.

seeing that waveform or graph on your pic gives me an idea.  I've been wanting to take the serial output from my fluke and send it over packet RF to some other data collector.  maybe I should put this kind of oled to work for a small rolling graph of measured values from serial-controlled dvm's and such.  my old fluke45 has a great display but no graph or trend ability.  even if just a coarse 128x64 - it can still show some trends if you are watching some point on a circuit.

Offline zapta

  • Super Contributor
  • ***
  • Posts: 6190
  • Country: us
Re: tiny OLED 128x64 calendar display (arduino)
« Reply #8 on: May 24, 2015, 05:45:49 am »
no idea if there is an ldo on there.  I see a 3 legged thing but it looks more like a transistor, no heatsink area that I could see.  it is native 5v and signals at 5v, so that's fine with me.  3.3v annoys me simply because the whole world is not at 3.3v.

That three legged part is probably the 3.3 LDO, you can measure the voltages across it  (if you can post a picture here it will be great).  This doesn't mean that your device is really 5V compatible. Are there level shifters on the signal lines?

Look at the Maximum Ratings section in the data sheet https://www.adafruit.com/datasheets/SSD1306.pdf, signal levels are limited to vdd+0.3V which is ~3.7V. 

Glass module specification
http://www.adafruit.com/datasheets/UG-2864HSWEG01.pdf
http://www.adafruit.com/datasheets/UG-2864HSWEG01%20user%20guide.pdf

BTW, have you tried to run everything on the ESP8266? I think it does have I2C (on the modules that expose more pins) and the U8G is quiet portable. With the Arduino/ESP8266 it's quiet easy to write C/C++ programs for the ESP8266.
 

Offline linux-worksTopic starter

  • Super Contributor
  • ***
  • Posts: 1997
  • Country: us
    • netstuff
Re: tiny OLED 128x64 calendar display (arduino)
« Reply #9 on: May 24, 2015, 06:02:06 am »
the modules are marketed as 5v and they have not died, yet, but that does not mean much.

esp is 3.3v for sure and the inputs are not 5v tol.  but I thought the oled had 5v tol inputs, even if the vcc internally had to be 5.  I'll check, but so far, 3 or more modules that I've connected have been running fine for over a week now.

the 3 legged thing is probably a transistor.  looks way too small to be a reg chip.  I'll take a photo.

if I can bypass the arduino and go direct from esp to oled that will be great - BUT - the esp is not my only or even my main wireless uplink.  in some ways, I prefer the xbee and that cannot run 'code' in any conventional way (that I know of).  and so, I don't mind too much having the arduino be in the middle.  it gives me more abstraction in how I can put pieces together.

next, I will try using the nrf24l01 modules; I have a pair of those that I have not tried yet.  yet more rf uplink choices ;)

Offline echen1024

  • Super Contributor
  • ***
  • Posts: 1660
  • Country: us
  • 15 yo Future EE
Re: tiny OLED 128x64 calendar display (arduino)
« Reply #10 on: May 26, 2015, 01:07:19 am »
the modules are marketed as 5v and they have not died, yet, but that does not mean much.

esp is 3.3v for sure and the inputs are not 5v tol.  but I thought the oled had 5v tol inputs, even if the vcc internally had to be 5.  I'll check, but so far, 3 or more modules that I've connected have been running fine for over a week now.

the 3 legged thing is probably a transistor.  looks way too small to be a reg chip.  I'll take a photo.

if I can bypass the arduino and go direct from esp to oled that will be great - BUT - the esp is not my only or even my main wireless uplink.  in some ways, I prefer the xbee and that cannot run 'code' in any conventional way (that I know of).  and so, I don't mind too much having the arduino be in the middle.  it gives me more abstraction in how I can put pieces together.

next, I will try using the nrf24l01 modules; I have a pair of those that I have not tried yet.  yet more rf uplink choices ;)
Not sure if you caught the Noritake VFD gravy train some time ago, but one of those industrial VFDs would be beautiful here!
I'm not saying we should kill all stupid people. I'm just saying that we should remove all product safety labels and let natural selection do its work.

https://www.youtube.com/user/echen1024
 

Offline linux-worksTopic starter

  • Super Contributor
  • ***
  • Posts: 1997
  • Country: us
    • netstuff
Re: tiny OLED 128x64 calendar display (arduino)
« Reply #11 on: May 26, 2015, 03:00:55 am »
nope, did not get ant vfd's.  did not know about it (?)

this is the latest iteration:



blue is looking more blue, now (EV on camera set way back).

I added an 'audio volume mode'; when my volume control changes on my diy preamp, it sends out a message.  this will pick it up and show the speaker icon and the dB level.  I'm adding more icons almost daily ;)  32x32 is a challenge but you can find things that scale down well enough (its still a very manual effort to get xbm bitmaps into the arduino u8lig code).


Offline linux-worksTopic starter

  • Super Contributor
  • ***
  • Posts: 1997
  • Country: us
    • netstuff
Re: tiny OLED 128x64 calendar display (arduino)
« Reply #12 on: May 27, 2015, 01:07:39 am »
now, all mounted on a single board:



sort of - I'm using an xbee explorer sparkfun breakout board since xbees use nonstandard pin spacing and that means their raw modules usually need a carrier board if you are .1" perf board limited (and I am, generally).

the back is a bit messy, as is the front behind the display ;)  it was a tight fit getting all this in there.  there's the 28pin skinnydip atmega 328, a resonator, 6 pin inline 'arduino' download header (you see the ftdi module on it, in the background), a 74125 tri-state buffer (to share the hardware uart with the xbee) and there's even a piezo speaker wedged in there between the xbee breakout and the 2 DIP chip top plastic surfaces.  I have not soldered wires in for the buttons and have not even thought about -what- the buttons will do, but I knew I needed 2 buttons there, so I mounted them and planned around them ;)  I'll think of something for them eventually (lol).

the box comes next.  I'm tired of this thing sitting on the table all exposed like this ;)  but it is a nice little software test-bed and I can now explore what sw to run on this kind of device.


Offline zapta

  • Super Contributor
  • ***
  • Posts: 6190
  • Country: us
Re: tiny OLED 128x64 calendar display (arduino)
« Reply #13 on: May 27, 2015, 02:26:41 am »
Looks very nice. I like your screen design.
 

Offline zapta

  • Super Contributor
  • ***
  • Posts: 6190
  • Country: us
Re: tiny OLED 128x64 calendar display (arduino)
« Reply #14 on: May 30, 2015, 05:50:00 am »
Here is my variation of the ESP8266 + OLED concept. The two nodes are controlled by the phone via the cloud. The nodes and the phone maintain persisted connections to a server and can exchange messages with very low latency. The nodes are based on the ARM PRO MINI design (ARM M0, mbed.org and lpcxpresso compatible) and contains a SPI 1.3" oled and an ESP8266 module with stock AT firmware). Power, programming, configuration and output log are done using the USB port (Virtual disk and CDC serial) and optional hardware debugging is done via SWD port with a Link 2 board.





 

Offline linux-worksTopic starter

  • Super Contributor
  • ***
  • Posts: 1997
  • Country: us
    • netstuff
Re: tiny OLED 128x64 calendar display (arduino)
« Reply #15 on: May 30, 2015, 07:42:42 am »
looks good.  is that for work or home/hobby?


Offline zapta

  • Super Contributor
  • ***
  • Posts: 6190
  • Country: us
Re: tiny OLED 128x64 calendar display (arduino)
« Reply #16 on: May 30, 2015, 08:54:23 am »
looks good.  is that for work or home/hobby?

It's a fun project I did at home.
 

Offline Yansi

  • Super Contributor
  • ***
  • Posts: 3893
  • Country: 00
  • STM32, STM8, AVR, 8051
Re: tiny OLED 128x64 calendar display (arduino)
« Reply #17 on: May 30, 2015, 09:38:36 am »
How well are those displays readable in sunlight?

I might just buy one for little fun too.
 

Offline linux-worksTopic starter

  • Super Contributor
  • ***
  • Posts: 1997
  • Country: us
    • netstuff
Re: tiny OLED 128x64 calendar display (arduino)
« Reply #18 on: May 30, 2015, 04:46:01 pm »
I will have to try it outside.  but its quite bright and high contrast as you'd expect.

there is blue (most common) and white (harder to find), as well as an odd yellow strip on the top few lines and blue all below.

the white is interesting since you can put it behind some color filters to change the look.  the strength goes down but it does work (maybe not well enough for outdoors use).  with an orange filter I can get something similar to the neon/nixie look.  red filter blocks too much light so that does not work.

blue won't need or benefit from a filter, so if you buy blue you have to really like blue ;)

also be sure you get the right display.  its so easy to buy the .96" display instead of 1.3".  many sellers will not even realize there are 2 models.

mounting is a challenge.  on a few of mine, the top glass is lower on the bottom than it should be and this makes using 4 screws pretty hard and risky (it comes right up against the glass).  and if you look at one of my later photos, you'll see on the bottom left area - glass has started to crack off and break away.  it has not affected the display yet but its pretty fragile, overall.

these are a neat little evolutionary stepping stone.  they are nice for now and I can see uses for them, but I expect them to go away over time and be replaced by multi color oled displays eventually.  but for right now, for $10 each, they ARE fun and once you get used to the api (like u8lib) its not hard to use.

build on arduino takes forever, though.  the u8lib causes my (semi fast and modern) i3 cpu to take nearly half a minute to build a fairly simple app.  compared to a few seconds for most any other app; something in how the author coded the u8lib seems to be really inefficient (for building).  for running, it seems fine though.

on limited memory systems (like arduino) be careful about loading too many fonts.  with 2 fonts I'm already at 25k code size and there is only 30k on the 328 series arduino chips!  there are NO built in fonts, this is a pure bitmap display, so any font you load takes progmem or eeprom.

they also are not super fast to write to unless you go with spi; so don't expect to have lots of motion on the i2c versions.

Offline zapta

  • Super Contributor
  • ***
  • Posts: 6190
  • Country: us
Re: tiny OLED 128x64 calendar display (arduino)
« Reply #19 on: May 30, 2015, 05:29:06 pm »
also be sure you get the right display.  its so easy to buy the .96" display instead of 1.3".  many sellers will not even realize there are 2 models.

Had similar experience more than once, ebay sellers don't really know what they are selling, I got blue instead of white and SPI ones with the new pinout (e.g. no RST pin) even though the picture is of the old pinout. I think the problem is that Heltec doesn't have model numbers so you need to know what to look for. I solved the problem by buying directly from Heltec.

mounting is a challenge.  on a few of mine, the top glass is lower on the bottom than it should be and this makes using 4 screws pretty hard and risky (it comes right up against the glass).

I am using single pin headers for support and solder a small round piece of copper wire at the top. Not very elegant. I am thinking of designing some 3D printed mounts, the PCB holes are large enough so I think it will work.

build on arduino takes forever, though.  the u8lib causes my (semi fast and modern) i3 cpu to take nearly half a minute to build a fairly simple app.  compared to a few seconds for most any other app; something in how the author coded the u8lib seems to be really inefficient (for building).  for running, it seems fine though.

The first build is slow but then incremental changes to my app compiles very fast (a few seconds). I am using Arduino 1.6.4 on mac air.

on limited memory systems (like arduino) be careful about loading too many fonts.  with 2 fonts I'm already at 25k code size and there is only 30k on the 328 series arduino chips!  there are NO built in fonts, this is a pure bitmap display, so any font you load takes progmem or eeprom.

Some fonts are smaller than others. You can also try trimming characters you don't need. I am using only the u8g_font_8x13 font. 

 

Offline linux-worksTopic starter

  • Super Contributor
  • ***
  • Posts: 1997
  • Country: us
    • netstuff
Re: tiny OLED 128x64 calendar display (arduino)
« Reply #20 on: May 30, 2015, 05:41:41 pm »
when I picked 3 fonts instead of 2, suddenly my mem usage went from 25k to over 30k, which would not even fit inside an arduino.

I'm using the 1.58 chain for now.  wonder if 1.6 is that much better.  I have no idea why its so slow to build.   I have 16gb of ram, an ssd on sata3 and a reasonably modern i3.  something is really inefficient (templates in c++?  don't know, but something is really ugly, I suspect) in how this code is designed.  it works and all, but when I see builds take this long, I really wonder what design decisions the author made that caused this.  it does make iterative testing so much slower than it has to.

and yes, the ebay sellers are mostly just SELLERS now.  I tried to buy a few of the white and blue displays from china; the seller had combined shipping on the blue and the white, I wanted a mix of them so I asked if they would combine across the 'product lines'.  I used the simplest english I could form, but still the seller took days and did not even understand what I asked ('I do not check it' was her reply; whatever THAT means!).  they simply don't know their products, they buy and sell whatever they can get and they don't even have the most basic communication skills anymore (there was a time that to do business, you had to speak 'business english' but now ebayers from china don't even take the time to learn enough to communicate well with their customers.  they are now useless, not adding any value at all, but still taking their middleman cut).

I've had good luck with amazon.  but amazon has been out of those displays for a while now (maybe I bought all they had, lol).  I'll pick amazon over ebay/china any day of the week, even if I have to double-pay for the item.

your idea of buying direct is the better way.  how many do you have, btw? ;)  maybe a group buy would actually make sense.  that way people would know what they're getting and they could count on a certain interface or color or build and know that it is what its described as.

Offline zapta

  • Super Contributor
  • ***
  • Posts: 6190
  • Country: us
Re: tiny OLED 128x64 calendar display (arduino)
« Reply #21 on: May 30, 2015, 08:02:09 pm »
The older arduino ide compilation may be less incremental, don't know. I presume you installed u8g as a library, not in your project directory.

I typically but in batches of 10, using them for the power monitors, when people ask for them. Am low now, have only 2 left so may order another batch. I can includes your in my order if you like, the cost about $9 each.
 

Offline IanJ

  • Supporter
  • ****
  • Posts: 1595
  • Country: scotland
  • Full time EE & Youtuber
    • IanJohnston.com
Re: tiny OLED 128x64 calendar display (arduino)
« Reply #22 on: May 30, 2015, 08:36:43 pm »
when I picked 3 fonts instead of 2, suddenly my mem usage went from 25k to over 30k, which would not even fit inside an arduino.

I've used the u8 lib on Arduino and noticed similar.
On my home built power supply I used these fonts (Arduino Nano) and with two 128x64 LCD's connected. I think I used about 80% of the Nano.

u8g_font_6x10
u8g_font_fub25n
u8g_font_fub17r
u8g_font_fub11r

U8glib version V1.14

Code: [Select]
U8GLIB_ST7920_128X64 u8g(13, 11, 12);    // SCK, SID, CS (hardware based SPI for LCD2)
U8GLIB_ST7920_128X64_4X u8g2(10, 8, 9);  // SCK, SID, CS (software based SPI for LCD1)

Ian.
Ian Johnston - Original designer of the PDVS2mini || Author of the free WinGPIB app.
Website - www.ianjohnston.com
YT Channel (electronics repairs & projects): www.youtube.com/user/IanScottJohnston, Twitter (X): https://twitter.com/IanSJohnston
 

Offline linux-worksTopic starter

  • Super Contributor
  • ***
  • Posts: 1997
  • Country: us
    • netstuff
Re: tiny OLED 128x64 calendar display (arduino)
« Reply #23 on: May 30, 2015, 08:52:24 pm »
the thing about arduinos (and other small chips) is: once you fill them up, time to bring in a second ;)

it drives some people nuts - to have cpu to cpu comms and to break things up to message-passing between them, but I like the freedom to make 'purpose built chips'.

so, I could see a 328 arduino being a mini display server of sorts.  you might figure out what UI widgets you might need, then code them as 'commands' and devise a protocol to send data back.

now you have a main controller who simply sends primitives to a 2nd controller.  you get more code space, you also get better concurrency (in some cases).

I don't love the 'mega' arduinos.  not easy to deal with in the phys pkg they come in.  I like attiny's and 328 arduinos.  on one task, I moved the IR receiver code over to an 8pin attiny and had it send out serial 'tokens' on IR signals received.  the main arduino simply had to listen to the uart for IR requests.  it freed up a lot of resources since ir scanning is very timing based.

so, I could see an arduino as a 'font and ui server' (lol) in some cases.

(or, of course, go with larger controllers.  I know: ARM!.  lol.  yes, once the UI gets big enough, little arduinos don't make the most sense, at least single units of them)

Offline zapta

  • Super Contributor
  • ***
  • Posts: 6190
  • Country: us
Re: tiny OLED 128x64 calendar display (arduino)
« Reply #24 on: May 30, 2015, 09:15:21 pm »
I switched from the 328p to the lpc11u35 and am not looking back. It's come in a smaller package and can do more, not to mention the better ide and optional hardware debugger.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf