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

Onboard Firmware of the Human Brain

Freesiders are continually tinkering with robotics and other such machinery .  Many of these embedded processors and firmware are becoming open source and every-more diversified in the wake of the modern Maker movement . One notable boost to the hackerspace arsenal is the Arduino (an like platforms).  This offers designers an incredible power to devise not just individual devices but even the emergence of complex, integrated systems . This evolutionary pace of modern technological systems may be significantly faster the biologic system development, but there may be a few well learned tricks yet to be mastered.  It seems that studying how nature has managed to solve many development challenges will aid in designing robotics, where efficiently counts just as much. One  challenge, that is particularly interesting, is data processing.  Artificial intelligence is labored with processing data and producing a meaningful and useful output.  When considering the increase in sensory

Freesiders Hackers Collaborate in Medical / Surgical Research

Published in the May issue of the Journal of Foot and Ankle Surgery : " A Novel Combination of Printed 3-Dimensional Anatomic Templates and Computer-assisted Surgical Simulation for Virtual Preoperative Planning in Charcot Foot Reconstruction ." This collaboration of specialties represents an undertaking by members of Freeside Atlanta , Southern Arizona Limb Salvage Alliance , and The Podiatry Institute .  Charcot foot reconstruction remains on of the most challenging procedures in foot and ankle surgery.  These procedures are often lengthy procedures which can be riddled with complications. With the help of Freeside Atlanta Members, institutional researchers used open source Osirix Image viewer and 3D Software such as Newtek's Lightwave or Blender to create simulated surgical reductions as well as 3D printed templates.  Freeside Atlanta members assisted in providing 3D printing solutions and know-how to the project. Experimental test prints were done on a M