Tuesday, 12 February 2013

Hello World!

I bought a cheap display and some arduino nano pro clones from dx.com. It's very nice, and looks great -good contrast and 128x64 pixels (for £8.48!), and the nanos were £5 each (I bought 3!).

Using some google-fu, I tracked down the library and connections that made it work:
the u8GLIB library http://code.google.com/p/u8glib/wiki/thelloworld
a very handy post http://parenthetic.blogspot.co.uk/2011/12/hello-world-in-arduino-with-st7920-lcd.html
and the datasheet http://www.dfrobot.com/image/data/FIT0021/ST7920.pdf
I ended up with the following wiring:
E = ESCLK = SCK = PB5 = D13
R/W = RW = MOSI = PB3 = D11
RST = PB0 = D8
RS = a0 = d1 = Data/Register select = D9

(in the picture I also linked PSB to GND (to select serial input). Don't know if this is required.

and wiring
BLA = A = 1.2k resistor to 5v
BLK = K = GND
VCC = Vcc = 5v
GND = GND

I then uploaded the 'Hello World' example from the u8glib, and uncommented and changed the header line from the defaults:

U8GLIB_ST7920_128X64 u8g(13, 11, 9, U8G_PIN_NONE);                
         // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17

I also had not used the external serial driver before. The 'pro does not have a USB in : it needs a separate USB-Serial/TTL interface.
I found the MAC driver from the manufacturers site (CP2102), and a very handy tip on this blog - the 'RST' pin on the end is to reset the *CP2102* chip and therefore does nothing if you connect it to the arduino reset line. It won't upload anything, as it needs to be reset to upload. (pressing reset manually just after pressing the 'upload' button works.
Instead, you need to connect an extra pin to the 'DTR' line and take that to the arduino reset:

It then works great! ( select the SLAB serial port, and the 'arduino pro mini (5v, 16Mhz)w ATmega328 ).

Lastly, I also grabbed some great one-wire temperature sensors (data sheet). The arduino library is Dallas Temperature control library (and you also need to install the oneWire lib), but you just connect the DS18B20 to +5v, and GND, and then the middle wire to a data line, and put a biggish resistor between data and 5v (I had some 4k7 ohms lying about so used them).  It gives you a clear digital readout (in degrees C) - no conversion, calibration, thermistor curves or anything!  it seems to react quickly and should be great.

I've got this vague plan about building a temperature controller for some sous vide cooking (water bath)... at least I have the bits now!


2 comments:

Unknown said...

Thanks for sharing David.
With this post, I had it running very fast.
Greetings, Arjan

Unknown said...

Happy to help!