Saturday 23 August 2014

LCD Master Board for Raspberry Pi

About a week ago I bought a board from Pridopia which can interface 16x2 and 20x4 LCDs or a Nokia 84x84 LCD screen. The latter came with the board with some instructions as to what software needed to be installed to dive it. Also there is a disk image containing everything on their web site. There are three variations of the image depending on which Pi board you own. Naturally I downloaded the B+ image and 'burned' it on a 8GB micro SD card.

All the examples shown use the Scratch programming program.

First thing to note is that the board catches on the extra USB ports on the B+ so it is advisable to use something, electrical tape or in my case a bit of cardboard to make sure nothing on the board makes contact with the metal USB ports. Also because of these the board does not fit fully flat on the GPIO pins but does work.

DSCN3217

My first attempt to get any text on the 5110 was a partial failure. There is an example program to show an RSS feed, providing the Pi has internet access. This worked but attempts to put my own text on the screen were a complete failure. It may have been that I was also letting the Pi update all its files, which can take ages, which was interfering with things.

I put it aside for a day and then had another attempt. Once the updates had finished things started to work as expected. I find the Scratch screen difficult to read. Others have noted the same. It is a pity that there seems to be no way to enlarge the text in that program. In the end, after much experimenting I had a working test program:

DSCN3215DSCN3208


The main thing I found out about the 5110: It is slow to respond and needed a pause between instructions otherwise they got mixed up. In the above program / script there is a WAIT 1 between each instruction which sends text to the LCD. This pauses one second.



After some experimentation I found the wait could be reduced to 0.3 seconds. Anything shorter than this caused corruption as instructions blended together.

Don't blame me for it showing 22th instead of 22nd. I just send the instruction 'date'. How it displays is decided by the inner working of the program code.

Monday 11 August 2014

First bit of FUZE BASIC

The aim was to get the MyPiFi LED board working on the RPi B+ with FUZE BASIC. I don't have the FUZE hardware, just running the B+ with keyboard, mouse and HDMI TV as monitor.

Firstly the MyFiPi board overhangs some of the extra pins on the B+ board, as will probably be the case with most, if not all, boards designed for the RPi A and B boards. It does not touch them so is not a problem, unless you need to use the hidden pins.

DSCN3183

FUZE BASIC seems to have its own method of numbering the GPIO pins. The example Python scripts use 11 for Red, 13 for Amber and 21 for Green. These numbers didn't work in FURZE Basic so I wrote a short program to cycle through all the pins and noted down which pin worked which LED. Then I could get down to writing my first working program to cycle the LEDs in the traditional UK traffic light cycle:

DSCN3182      DSCN3185

I couldn't use the full colour names as some are reserved words.

Anyway, after a few attempts and correcting a few errors it finally did what it was supposed to do.
The code allows for the program to be stopped and all LEDs switched off by holding down any key on the keyboard  (WHILE inkey = -1 CYCLE)



Saturday 9 August 2014

A Bit of Soldering

Made a start soldering some components on the Tandy Mulitface board.

Bare board:
DSCN3159

As the instructions are in the form of a downloadable pdf file I put it on the iPad so I could easily see what to do next:
DSCN3160

Resistors and diodes fitted:
DSCN3164

So far it is going a lot easier than I thought it would as the solder pads can look very close together. For the resistors I was able to use a 12W iron with a narrow bit but the diodes soaked up the heat too fast so I had to resort to a 15W with a larger bit for them.

I gave up after that as my eyes were beginning to go out of focus!

Later another small kit arrived, the MyPiFi LED board, so I decided to put that together. This is a simple board with three LEDs and a switch. Useful for me to test out a bit of programming:

DSCN3165

The example scripts are for Python but I typed one in and kept getting syntax errors when I ran it. I think I may be short of a couple of GPIO files there.

I also tried it in FUZE BASIC and eventually got the LEDs working. Just got to get the switch working then I'll explain the differences that need to be make to pin allocations for it to run in FUZE.

Raspberry Pi B+

I have looked at the Raspberry Pi on and off since it was first introduced but have only now got round to ordering one. As the B+ had recently been released that was what I went for. Along with the Pi I also have ordered a WiFi dongle and a camera.

DSCN3147



Also ordered was a Tandy Multiface kit:

DSCN3145

Previous experience of programming goes back a long way, mostly with various forms of BASIC. Sinclair BASIC on the ZX81 and ZX Spectrum, BBC BASIC on the BBC model B and GFA BASIC on the Atari ST so at least many of the structures are familiar though the remaining grey cell needs a good prodding to remember how to use them. I have reached the age where learning a new type of programming language is well and truly a very slow climb along a steep learning curve.

To date I now have two micro SD cards. One loaded with NOOBS which I have got working OK with WiFi and the camera.  The other was loaded with FUZE BASIC which works OK with WiFi but I am disappointed that there seems no way to access the camera from FUZE BASIC.