Friday 30 May 2014

Monday 26 May 2014

Hitachi LM038 LCD with Arduino

I bought 2 Hitachi LM038 LCDs at the car boot sale last weekend (new), wondering if I'd be able to make them work with an Arduino.

It was TOO easy :-)

I had bought 10 rows of 40 Header Pins on eBay, (so called, but actually various odds & sods of shorter lengths of pins) so soldered 2 rows of 7 pins into the LM038

I had also bought some 40 pin Dupont Male to Female Ribbon Cable (Jumper Wires)


I found this very helpful page:

http://www.m0yom.co.uk/index.php/blog/34-general/62-using-the-hitachi-lm038-lcd-with-the-arduino

tried it, and it worked. TOO easy... BUT... What's with his insane pin order?

It was a bit fraught hooking it up!

I noticed that the initialisation in the start of his code was in the same order as his twisted wiring instructions, so I thought I'd try re-ordering the pins in a more sane manner & seeing if changing the initialisation string to match would work too... of course it did! :-)

So now I have:

LCD PinArduino Pin
1GND
2+5V
3GND via Resistor for contrast control
42
53
64
75 (Optional)
86 (Optional)
97 (Optional)
108 (Optional)
119
1210
1311
1412

And I changed my code to:



#include <LiquidCrystal.h>
/*
 * LiquidCrystal display with:
 * LCD 4 (RS)  to Arduino pin 2
 * LCD 5 (R/W) to Arduino pin 3
 * LCD 6 (E)   to Arduino pin 4
 */

LiquidCrystal lcd(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);

void setup()

{

    // Print a message to the LCD.

    lcd.print("hello, world!");

}

void loop()

{

}

Friday 23 May 2014

Setting up mpide ( IDE for Unu32 ) on Linux


http://chipkit.net/started/

http://chipkit.net/started/install-chipkit-software/install-mpide-linux/

https://github.com/chipKIT32/chipKIT32-MAX

Trouble getting mpide to compile for Uno32

When I tried to verify or compile with mpide (from http://chipkit.net/started/install-chipkit-software/install-mpide-linux/ ) on 64bit Debian (Jessie/Sid) I got an error:


Cannot run program "/.../hardware/pic32/compiler/pic32-tools/bin/pic32-g++": error=2, No such file or directory

How I fixed it was:

$ sudo dpkg --add-architecture i386
$ sudo aptitude update
$ sudo aptitude upgrade
$ aptitude install gcc-multilib

I don't know if I needed the --add-architecture i386

The other thing I found was when I tried to run ldd on the binary that was failing, it told me:

$ ldd pic32-g++
not a dynamic executable

It *should* have told me this:

$ ldd pic32-g++
linux-gate.so.1 (0xf771a000)
libm.so.6 => /lib32/libm.so.6 (0xf76bc000)
libc.so.6 => /lib32/libc.so.6 (0xf7511000)
/lib/ld-linux.so.2 (0xf771b000)


$ file ./pic32-g++
./pic32-g++: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.0.0, stripped

I found these 2 pages were useful in finding the answer:

http://unix.stackexchange.com/questions/75054/ldd-tells-me-my-app-is-not-a-dynamic-executable

http://colinharrington.net/blog/2011/08/running-mpide-chipkits-arduino-ide-remake-64bit-ubuntu/


Friday 16 May 2014

7x4 font

https://github.com/aguegu/dot-matrix/blob/master/font/vfont_7x4.c


Monday 28 April 2014

SainSmart Mega 2560 + TFT_320QVT

I bought this:

SainSmart Mega2560 + 3.2" TFT LCD Shield + Touch Screen SD Reader For Arduino

http://youtu.be/zcrW7FHcZMM

http://youtu.be/8bnAmIq3BIw

http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&item=280931953825

To get it working, all I needed to do was download the UTFT library from

http://www.henningkarlsen.com/electronics/library.php?id=51

Then go through and add:

const in front of each font definition in DefaultFonts.c

~/sketchbook/libraries$ diff -t UTFT UTFT.orig
diff -t UTFT/DefaultFonts.c UTFT.orig/DefaultFonts.c
21c21
< fontdatatype SmallFont[1144] PROGMEM={         
---
> const fontdatatype SmallFont[1144] PROGMEM={         
125c125
< fontdatatype BigFont[3044] PROGMEM={
---
> const fontdatatype BigFont[3044] PROGMEM={
234c234
< fontdatatype SevenSegNumFont[2004] PROGMEM={
---
> const fontdatatype SevenSegNumFont[2004] PROGMEM={

In the demo file, comment out the myGLCD line and replace it with this one:

// For Mega 2560
UTFT myGLCD(GEEE32,38,39,40,41);

// or

UTFT myGLCD(ITDB32S,38,39,40,41);

For the TFT_320QVT you of course want the 320x240 demos.

Helped:

  • http://forum.arduino.cc/index.php?topic=115211.0
  • http://technomungo.blogspot.com.au/2013/11/how-to-use-utf-library-on-sainsonic.html +

Sunday 27 April 2014

Power supply...

The Mega 2650 will happily run powered off the USB cable connected to your PC, but you can give it an external 9v power lead instead.

It just needs a 2.1mm x 5.5mm plug and up to about 650mA 9V DC