Sunday, July 20, 2014

MicroLCD issues

I have just started investigating why both of my new OLED displays require a 2 pixel offset to the right in order to prevent truncating the display.  Starting out easy, we go with the simplest bit of code to turn on the LCD.

#include <Wire.h>
#include <MicroLCD.h>

LCD_SSD1306 lcd;

void setup()
{
  lcd.begin();
}

void loop()
{
  // put your main code here, to run repeatedly:

}

This code results in the following display.  Notice the white bar on the right side.  The display clear code is already suspect.  Unplugging the display and re-running the code moves the white bar to the left side of the display running the entire way from top to bottom.



This is the code in the LCD initialization function that clears the display.

    ssd1306_command(SSD1306_SETLOWCOLUMN | 0x0);  // low col = 0
    ssd1306_command(SSD1306_SETHIGHCOLUMN | 0x0); // hi col = 0
    ssd1306_command(SSD1306_SETSTARTLINE | 0x0);  // line #0

    for (byte i = 0; i < SSD1306_LCDHEIGHT / 8; i++) {
      // send a bunch of data in one xmission
        ssd1306_command(0xB0 + i);//set page address
        ssd1306_command(0);//set lower column address
        ssd1306_command(0x10);//set higher column address

        for(byte j = 0; j < 8; j++){
            Wire.beginTransmission(_i2caddr);
            Wire.write(0x40);
            for (byte k = 0; k < SSD1306_LCDWIDTH / 8; k++) {
                Wire.write(0);
            }
            Wire.endTransmission();
        }

    }

If I change k < SSD1306_LCDWIDTH to k <= SSD1306_LCDWIDTH then I can get the entire display to clear.  However, this is suspect because as written, it should work logically speaking.

When the device is initialized, if no cursor setting operations are performed, the first text will be displayed in the lower left corner without any truncation.  Once any cursor setting is done, The truncation is present from that point forward.

I will dig into the driver further, but for now I have fixed this by moving the inter-character spacing to the front of a character rather than the end and additionally provide two additional inter-character spaces at the beginning of a line of text.

#include <Wire.h>
#include <MicroLCD.h>


LCD_SSD1306 lcd;
uint8_t invert = 0;

void setup()
{
  lcd.begin();
  lcd.clear();
  for (int i = 0; i < 8; i++)
  {
    lcd.print("A");
    lcd.print(i);
    lcd.print("-----------------");
    lcd.print(i);
    lcd.println("B");
  }

}

loop()
{
}

The code above now displays correctly with no truncation.  This provides for 21 colums by 8 rows of text using the 5x8 font.  When I have time to dig into this further, I will post further updates on this topic.




Saturday, July 19, 2014

New LCD display

I have just received a couple of nice little display modules from China.  These cute little devices are I2C interfaced and use the MicroLCD Arduino library for the SSD1306 controller.  http://freematics.com/store
 
The displays are relatively cheap in single unit quantities of USD9.95.  Two of them and 90g shipping delivered for USD24.85.  Shipping took 12 days.

The device is a 3.3 volt device and interfaces nicely with the Arduino if you remember that you don't want to use the internal pull-up resistors and instead use external resistors to a 3.3 volt rail.

The display comes in two relatively small formats 0.9" and 1.3".  Since it is an OLED display, the direct sunshine readability is excellent.

Since I have converted my Minima code to use I2C displays, I decided to hook it up and modify the Minima code as necessary to utilize this display.  The result is as you can see below.


As is the case with most things I buy from China, there are a couple of anomalies that I have noted...

1. The first two pixel columns are not visible on the display.  By offsetting two pixels to the right, the result is what you see above.

2. There is no cursor support in the shipped library (MicroLCD) so some investigation will be necessary to see how to implement similar functionality.

This should be fun for a number of projects, nice and compact and easy to interface, anomalies and all... 

Here I have increased the font size for my tired eyes.  I think it still looks pretty good.


Tuesday, July 15, 2014

Minima hardware build

I have spent some time today organizing my Minima hardware so that it is not quite so fragile and breadboard-ish in preparation for starting to put together my own rig.

I am comfortable that I have the software in good shape and it is time to think about pulling together my own build.

Here is what I have for a front panel.  There is a 20 column by 4 line display, three push-buttons and a rotary encoder.  Readers of my blog may recognize this as the panel for my beacon project which is being re-purposed for this project.


I have mounted an I2C daughter board on the LCD in order to reduce the number of pins required to support the LCD.  I am not going to use the plethora of buttons I have seen on other designs.  I am also using a commercially available Arduino Uno board rather than build a controller board.  I have mounted it on the back of the LCD.  The remainder of the electronics of the radio will be in the bottom of the box.


I am replacing the potentiometer tuning with a rotary encoder and adding my iambic keyer code to the main Minima sketch.  If sufficient flash is available, I will also add my Arduino beacon code to the mix.  This may require an ATMega2560 device with its larger flash and RAM.  There may be sufficient space, but RAM in particular is getting a bit tight.

Wednesday, July 9, 2014

Salmoncon Presentation

This weekend I will speaking briefly on my recent code changes to the Minima code base to enable 1Hz tuning on the Minima transceiver at Salmoncon this weekend.  Salmoncon 2014 is this weekend at Valley Camp in North Bend area of the Cascade Mountains.  It is a beautiful venue and a great opportunity to hang out with other hams for the weekend.  Look for us on the air using the special event call sign of K7S or better yet, come out and join us.

Sunday, June 1, 2014

Si570 code published

I have published my Si570 code that should be compatible with the Minima Arduino sketch on my github repository.  You can find it at https://github.com/ko7m/Si570.  In the lower right corner you can find a button that will allow you to download a zip file of the code if you don't want to bother learning about Git.

As always, comments welcome.

73's de jeff - ko7m

Monday, May 26, 2014

6 Metres is open

Listening around on 6 metres this morning and hearing lots of signals all over the midwest.