Skip to main content

Sharp Memory LCD - Musings

Update: Arduino Library Released

If any of you guys were at Freeside this weekend, you would have seen me staring into the oscilloscope trying to make heads or tails of its output and comparing that to a couple of datasheets. One of those datasheets was for the Atmega328P microcontroller that is on the Arduino UNO, the other was the Sharp Memory LCD. These are cool because the are ultra low power 6uW and have extremely high contrast.

The Sharp datasheet isn't what I would call straightforward, at least for the uninitiated (whom I count myself among). The power up sequence was pretty clear but once it came to pushing pixels it got a little vague. Really it was just a bunch of waves on the sheet.


One of the waves is a constant 5-60Hz pulse. That is the sort of thing that would be very irritating to create if you are bit banging on the main loop of your program, so I needed to get the AVR to pump that out in an automatic way. Researching the interwebz and reading the Atmega datasheet at length and comparing that to the output on the o-scope, I came up with this:

pinMode(11, OUTPUT);
TCCR2A = _BV(COM2A0) | _BV(COM2B1) | _BV(WGM20);
TCCR2B = _BV(WGM22) | _BV(CS22) | _BV(CS21) | _BV(CS20);
OCR2A = 65; // 60HZ roughly
Which is logically equivalent this (to but not as annoying because it happens in the absence of the loop):
int bang = 0;
void loop() {
  pinMode(9, OUTPUT);
  if(bang == 0) {
    digitalWrite(9,HIGH);
    bang = 1;
  } else {
    digitalWrite(9,LOW);
    bang = 0;
  }
  delayMicroseconds(8333);
}

The prior code puts out a "phase correct" square wave on pin 11 at 60Hz. It also screws with pin 3 (not good) which I need to address next time I am at a scope. With that, it was just a matter of reading the data sheet for the screen and deciphering the thing into C code. I also found a non-arduino project on youtube using one of these screens and asked the poster to send me his source which was very helpful in understanding the datasheet. Once that was done, I converted that C code into C++ code and made a "SharpMemoryLCD" Arduino library. Currently it can print out basic strings and read byte[]s from PROGMEM and paste them to the screen. I will also add some other features like painting vectors to the screen and loading bitmaps from a disk before I'll call it "done". The current functionality is enough to get the reflow oven project I am working on finished though. That reflow oven project will be the basis of a future Freeside project/class where attendees will get a custom PCB and firmware to use to convert their toaster oven into a high quality reflow oven. You will be required to bring a 1500W toaster oven, and I think the rest of the stuff I'll include in the class fee (custom electronics, solid state relays, and thermocouples).



This is the code that produces the images in the video above. The library is not link up yet. I'll make a google code project for this once I have it a little more mature. Feel free to post up a comment if you want a pre-release copy. I'll hook you up.
#include "SharpMemoryLcd.h"

SHARPMEMORYLCD lcd;

void setup() {                
  Serial.begin(57600);
  lcd.LcdInitialize();
  lcd.LcdAllClearMode();
  lcd.LcdStartEXTC();

}

void loop() {
  lcd.LcdPrintString("  CRAFTYCODER'S",4);
  delay(1000);
  lcd.LcdPrintString("  WIFE COMES HOME",7);
  delay(1000);
  lcd.LcdStopEXTC();
  lcd.LcdAllClearMode();
  lcd.LcdStartEXTC();
  lcd.LcdPrintImage();
  delay(1000);
  lcd.LcdStopEXTC();
  lcd.LcdAllClearMode();
  lcd.LcdStartEXTC();
}

Comments

Popular posts from this blog

A Capacitive-Touch Janko Keyboard: What I Did at the 2017 Georgia Tech Moog Hackathon

Last weekend (February 10-12, 2017) I made a Janko-layout capacitive-touch keyboard for the Moog Werkstatt at the Georgia Tech Moog Hackathon. The day after (Monday the 13th), I made this short video of the keyboard being played: "Capacitive Touch Janko Keyboard for Moog Werkstatt" (Text from the video doobly doo) This is a Janko-layout touch keyboard I made at the 2017 Moog Hackathon at Georgia Tech, February 10-12. I'm playing a few classic bass and melody lines from popular and classic tunes. I only have one octave (13 notes) connected so far. The capacitive touch sensors use MPR121 capacitive-touch chips, on breakout boards from Adafruit (Moog Hackathon sponsor Sparkfun makes a similar board for the same chip). The example code from Adafruit was modified to read four boards (using the Adafruit library and making four sensor objects and initializing each to one of the four I2C addresses is remarkably easy for anyone with moderate familiarity with C++), and

Building an enclosure for the LulzBot AO 100

As the cold weather season arrives in Atlanta, with it comes issues with our 3D printers. Specifically problems with temperatures and print stability. Freeside is essentially a big warehouse, and our 3D printing station is setup in the large open area in the front of the space. What this means is that when it is cold in the space, this will affect the printing quality because the ambient temperature is far lower than what is optimal for thermoplastics. The cold ambient air will cause parts to rapidly cool during the middle of a print. And with materials like ABS which can shrink dramatically during cooling, this causes prints to warp, deform, and delaminate during and after printing is finished. The print on the left is showing signs of delamination from plastic cooling mid print. To remedy this, we built an acrylic enclosure for our LulzBot AO-100, which is our dedicated ABS printer. We tested the proof of concept of whether an enclosure would help mitigate printing problem

Build-Out Recap!

A bunch of great stuff got done at the build-out yesterday. A huge thanks to everyone that came out to pitch in! Here are some pictures to recap the projects... Randy's team hung the curtain to the workshop to create more of a barrier between the front of the house and back of the house and to control dust levels a bit more. We'll be finishing the top of the wall soon, but the hard part's already done. Karen, Donald, Tom, Violet, and James framed the doorway to the Media Lab and Bio Lab and hung the door for that area. Next step is AC! Michelle and Mary's team cleaned out project storage and moved the shelves over so that Neils could put the flammability cabinets in that area. That allowed all of us with the help of Adam and Nathan to clean up the workshop and really tidy up. They also sorted out all of the laser cutter raw materials and cut them down to a usable size on the table saw.  For the portal clouds, JW, Nathan, and Kat rolled an aw