Silicon ChipIntroducing OLED Displays - September 2009 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Low sunspot activity presages solar cooling
  4. Project: High-Quality Stereo Digital-To-Analog Converter, Pt.1 by Nicholas Vinen
  5. Project: Using A Wideband O₂ Sensor In Your Car, Pt.1 by John Clarke
  6. Feature: Introducing OLED Displays by Mauro Grassi
  7. Review: At Last . . . An Affordable Logic Analyser by Geoff Graham
  8. Feature: Pebble: PICAXE Electronic Bread Board Layout Emulator by Wayne Geary
  9. Project: Build A Simple Seismograph On A Protoboard by Stan Swan
  10. Project: Autodim Add-On For The 6-Digit GPS Clock by Jim Rowe
  11. Project: 3-Channel UHF Rolling-Code Remote Control, Pt.2 by John Clarke
  12. Vintage Radio: The Kellogg TRF receiver by Rodney Champness
  13. Book Store
  14. Advertising Index
  15. Outer Back Cover

This is only a preview of the September 2009 issue of Silicon Chip.

You can view 33 of the 104 pages in the full issue, including the advertisments.

For full access, purchase the issue for $10.00 or subscribe for access to the latest issues.

Items relevant to "High-Quality Stereo Digital-To-Analog Converter, Pt.1":
  • 4-Output Universal Regulator PCB [18105151] (AUD $5.00)
  • High-Quality Stereo DAC Input PCB [01109091] (AUD $10.00)
  • High-Quality Stereo DAC main PCB [01109092] (AUD $10.00)
  • High-Quality Stereo DAC front panel PCB [01109093] (AUD $7.50)
  • ATmega48 programmed for the Stereo DAC [0110909A.HEX] (Programmed Microcontroller, AUD $15.00)
  • ATmega48 firmware and C source code for the Stereo DAC [0110909A.HEX] (Software, Free)
  • Stereo DAC Digital/Control board PCB pattern (PDF download) [01109091] (Free)
  • Stereo DAC Analog board PCB pattern (PDF download) [01109092] (Free)
  • Stereo DAC Switch board PCB pattern (PDF download) [01109093] (Free)
Articles in this series:
  • High-Quality Stereo Digital-To-Analog Converter, Pt.1 (September 2009)
  • High-Quality Stereo Digital-To-Analog Converter, Pt.1 (September 2009)
  • High-Quality Stereo Digital-To-Analog Converter, Pt.2 (October 2009)
  • High-Quality Stereo Digital-To-Analog Converter, Pt.2 (October 2009)
  • High-Quality Stereo Digital-To-Analog Converter, Pt.3 (November 2009)
  • High-Quality Stereo Digital-To-Analog Converter, Pt.3 (November 2009)
  • A Balanced Output Board for the Stereo DAC (January 2010)
  • A Balanced Output Board for the Stereo DAC (January 2010)
Items relevant to "Using A Wideband O₂ Sensor In Your Car, Pt.1":
  • PIC16F88-I/P programmed for the Wideband Oxygen Sensor Controller [0511009A.HEX] (Programmed Microcontroller, AUD $15.00)
  • PIC16F88 firmware and source code for the Wideband Oxygen Sensor Controller [0511009A.HEX] (Software, Free)
  • Wideband Oxygen Sensor Controller PCB pattern (PDF download) [05110091] (Free)
Articles in this series:
  • Using A Wideband O₂ Sensor In Your Car, Pt.1 (September 2009)
  • Using A Wideband O₂ Sensor In Your Car, Pt.1 (September 2009)
  • Using A Wideband O₂ Sensor In Your Car, Pt.2 (October 2009)
  • Using A Wideband O₂ Sensor In Your Car, Pt.2 (October 2009)
Items relevant to "Autodim Add-On For The 6-Digit GPS Clock":
  • 6-Digit GPS Clock Autodim Add-On PCB [04208091] (AUD $5.00)
  • 6-Digit GPS Clock Driver PCB [07106091] (AUD $15.00)
  • 6-Digit GPS Clock Main PCB [04105091] (AUD $25.00)
  • PIC16F877A-I/P programmed for the 6-Digit GPS Clock [0410509E.HEX] (Programmed Microcontroller, AUD $20.00)
  • PIC16F877A firmware and source code for the 6-digit GPS Clock [0410509E.HEX] (Software, Free)
  • 6-Digit GPS Clock Autodim Add-On PCB pattern (PDF download) [04208091] (Free)
Items relevant to "3-Channel UHF Rolling-Code Remote Control, Pt.2":
  • PIC16F88-I/P programmed for the 3-Channel Rolling Code UHF Remote Control Transmitter [1500809A.HEX] (Programmed Microcontroller, AUD $15.00)
  • PIC16F88-I/P programmed for the 3-Channel Rolling Code UHF Remote Control Receiver [1500809B.HEX] (Programmed Microcontroller, AUD $15.00)
  • PIC16F88 firmware and source code for the 3-Channel UHF Rolling Code Remote Control [1500809A/B.HEX] (Software, Free)
  • 3-Channel UHF Rolling Code Remote Control Transmitter PCB pattern (PDF download) [15008091] (Free)
  • 3-Channel UHF Rolling Code Remote Control Receiver PCB pattern (PDF download) [15008092] (Free)
  • 3-Channel UHF Rolling Code Remote Control Receiver front panel artwork (PDF download) (Free)
  • 3-Channel UHF Rolling Code Remote Control Transmitter front panel artwork (PDF download) (Free)
Articles in this series:
  • A 3-Channel UHF Rolling-Code Remote Control, Pt.1 (August 2009)
  • A 3-Channel UHF Rolling-Code Remote Control, Pt.1 (August 2009)
  • 3-Channel UHF Rolling-Code Remote Control, Pt.2 (September 2009)
  • 3-Channel UHF Rolling-Code Remote Control, Pt.2 (September 2009)

Purchase a printed copy of this issue for $10.00.

Introducing OLED Displays By MAURO GRASSI Organic LED technology is now affordable for the hobbyist. In this article, we survey some available OLED screens and modules and give an example for a simple oscilloscope. O LED displays are becoming mainstream and are now commercially available at prices affordable for educational and hobby use. While the technology may still need further development to seriously challenge LCDs in the bigger sizes, OLED screens of modest sizes can be purchased in Australia from a number of distributors at comparable prices to LCDs. OLED screens emit light, rather than relying on backlighting like LCDs. For that reason they have a much wider viewing angle. They also use less power than LCDs, exhibit higher contrast, are lighter and can be manufactured on more flexible materials. All these advantages over LCDs are making them the display screen of choice. For example, mobile phones using OLED screens are now on the market. In Australia, 4D Systems have a range of OLED displays, including siliconchip.com.au modules and standalone screens. The modules are essentially a screen and an embedded graphics processor. By contrast, the screens contain a driver IC embedded in the flexi-cable connector and can be directly driven by a host microcontroller – see photos. Some driver ICs, like the SSD1339 used in the 4D OLED-282815 screen, have inbuilt graphics acceleration for drawing lines, rectangles and circles. This means that you can draw primitives, simply by writing commands to the display from a microntroller. Instead of having to control individual pixels to draw a circle you can simply send the opcode corresponding to the command to draw a circle. You also send the associated data like the coordinates of the origin and the radius. How the driver IC is used For those readers interested in incorporating a screen rather than a module, we will now give a brief overview of the driver IC. The biggest challenge for the hobbyist is the mechanical connection to the flexi-cable, especially since the connectors themselves are surface-mount. The interface to the SSD1339 can be either parallel or serial. The serial interface is SPI (Serial Peripheral Interface), with the D0 line being used as a clock and D1 being used as data. There are two parallel interfaces, to suit 6800 style and 8080 style processors. Each has an 8-bit data bus but they differ as to the control signals. The 6800 style bus uses a R/W line which acts as a write strobe when low and a read strobe when high, whereas the 8080 style bus has separate RD and WR lines, each active-low. The 6800 uses an active-high E strobe to latch data. For both modes, there is a further CS (chip select) input active low that acts as a master enable – no writing or reading occurs while September 2009  35 The reverse side of two 4D Systems modules. At left is the OLED-160-G1, with a 1.7-inch (43mm) display, while at right is the smaller OLED-96-G1, which has a 0.96-inch (24mm) display. ever CS is high. Furthermore, there is a C/D line that selects whether the data represents a command or data. When C/D is low, the data represents a command, while if high, it represents a data word. The command codes for drawing primitives as well as the initialisation sequence for the screen are outlined in the data sheet for the driver IC (SSD1339) and is available from 4D Systems’ website (www.4dsystems. com.au). Play sounds: the GOLDELOX modules can play strings of notes, including complex sequences. The PICASO modules are even better in this respect, as these can play WAV files from the memory card. Convert analog readings to digital: using an on-board ADC (Analog to Digital Converter), you can use it to read voltages, sensors and any other type of analog signal. Use simple I/O: there are also two general purpose I/O pins with myriad applications. Control a Dallas 1-wire device: you can also configure the available pins for the 1-wire Dallas protocol. The Dallas 1-wire protocol can transfer data to and from a compatible device using only one data line (and GND). The data line also supplies power to the component! There are many devices available that use the 1-wire Dallas protocol including temperature sensors, memory ICs including EEPROM, analog to digital converters and real-time clocks. 4DGL language 4DGL is a graphics-oriented language for use with the embedded graphics controllers on 4D Systems’ OLED modules. Developed by 4D Systems, it is available from their website together with an IDE (Integrated Development Environment) called 4DGL Workshop – see Fig.1. OLED modules You can purchase 0.96”, 1.5” or 1.7” modules named OLED96-G1, OLED128-G1 and OLED-160-G1 respectively. The numbers indicate the number of horizontal pixels. In this article, we’ll be using the 96 x 64 pixel, 0.96” module which is a passive matrix OLED module. Passive matrix displays are cheaper but more power hungry and have a slower response than active matrix screens. However, they are still suitable for many applications. Each module has a GOLDELOX embedded graphics processor, an ASIC (Application Specific Integrated Circuit) developed by 4D Systems that can also be bought separately (for volume runs and lower production costs). Some modules use another graphics processor, called PICASO. Some of what you can do with these modules include: Display bitmaps and animations: you can select to store bitmaps and animations to a microSD card that plugs into the back of the module. Once the files have been stored on the memory card, you can display them with a few lines of code. 36  Silicon Chip Fig.1: the 4DGL Workshop program running on a PC. This program is freely available from the 4D Systems website and is a complete development environment that includes a compiler for the 4DGL language, a programmer to upload the program to the module and a text editor for modifying the source code. siliconchip.com.au 4DGL Simple Oscilloscope Program #platform “uOLED-GOLDELOX” // A Simple Oscilloscope // SC 2009 #constant BLUE 0x059B #constant ORANGE 0xF3E0 #constant BLACK 0x0000 func main() var x, y, ox, oy, miny, maxy; gfx_Cls(); x := 0; y := 0; ox := 0; oy := 0; miny := 64; maxy := 0; pin_Set(ANALOGUE_10, 0); while(1) x:=x+1; if(x>=96) x:=0; ox:=0; y:=0; while(y<32) y:=pin_Read(0)/16; wend txt_MoveCursor(7, 0); txt_Set(TEXT_COLOUR, ORANGE); print(“Pk-Pk(mV): “, 51*(maxy-miny)); miny:=64; maxy:=0; pause(100); gfx_Cls(); endif y:=pin_Read(0)/16; if(y>maxy)maxy:=y; if(y<miny)miny:=y; if(ox!=0)gfx_Line(ox, oy, x, y, BLUE); ox:=x; oy:=y; wend endfunc siliconchip.com.au The OLED modules from 4D Systems work in two modes: serial or 4DGL mode. In serial mode, they accept commands from another microcontroller. You can use almost any off-the-shelf microcontroller to control the display using a list of inbuilt commands and a UART (Universal Asynchronous Receiver Transmitter). The inbuilt commands include putPixel and drawCircle, for example. Commands are sent in multi-byte packets, with the first byte being the instruction code and the rest of the bytes make up the data for the instruction. For example, for the putPixel command, you send the instruction and the x and y coordinates of the pixel to draw. In 4DGL mode, a program in the embedded graphics processor runs on power up. 4DGL is loosely based on C syntax, although it also retains elements from other languages. If you’ve done programming before, you will be in a good position to learn this new language quickly. As an example, we’ve written a simple oscilloscope program in 4DGL. The program can be loaded into the embedded processor using a serial connection or via a USB to serial interface. For the purpose of this demonstration though, we have used the OLED-96-G1 module on 4D Systems’ DEVBOARD-G1 which comprises a power supply, a USB interface, a joystick and a mini speaker. OLED oscilloscope The oscilloscope has a rudimentary trigger implemented in software and measures the peak to peak voltage of the signal. The analog signal is applied to one of the two I/O pins of this module. Note that this oscilloscope is for demonstration purposes only and its bandwidth is severely limited by the speed of the embedded graphics processor (which affects the sampling frequency) and the resolution of the display (which affects the display of the waveform). It is OK for signals up to around 150Hz. The input signal is coupled to the I/O pin via a capacitor and resistor. There are also diodes to clip any out-of-range signals, along with two resistors which bias the input at half supply. We have mounted the components for this on the mini protoboard SMART PROCUREMENT SOLUTIONS Unit 3, 61-63 Steel Street Capalaba QLD 4157 AUSTRALIA Ph (07) 3390 3302 Fx (07) 3390 3329 sales<at>rmsparts.com.au www.rmsparts.com.au o Resistors o Capacitors o Potentiometers o Crystals o Semiconductors o Optoelectronics o Relays o Buzzers o Connectors o Switches o Hardware o Chemicals & Fluxes WHOLESALERS  DISTRIBUTORS  KITTING SOLUTIONS     September 2009  37 Running the Oscilloscope program on 4D Systems’ DEVBOARD G1, in this case displaying a square wave . . . on the DEVBOARD-G1 - see photo. The program works by digitising the analog signal and using the resulting digital value as the y coordinate on the screen. Here’s an explanation of the program (printed on p37). The oscilloscope program explained line-by-line #platform “uOLED-GOLDELOX” The #platform command tells the compiler which hardware the code will run in. In this example, we are using an OLED screen with the GOLDELOX processor. // A simple Oscilloscope // SC 2009 The above lines are comments. As in C, the ‘//’ indicates a line of comment. Multi line comments can be enclosed within a block delimited by ‘/*’ and ‘*/’. # constant BLUE 0x059B # constant ORANGE 0xF3E0 # constant BLACK 0x0000 The above three lines define constants we will use in the code below. These are equivalent to #define statements in C. The string BLUE is defined to have the constant hexadecimal . . . here a sine wave . . . value 0x059B. You may also define values in decimal. The three defined strings represent colour values. 4DGL assumes a 16 bit colour value that is broken up into three groups of bits (5-6-5) that correspond to the intensities of the three colours R-G-B (Red, Green, Blue). In this way, 65,536 colours can be displays on the OLED screen. func main() ... endfunc These lines declare the beginning of a function. In this case, the main() function is where execution begins, as in C. Everything between this line and the ‘endfunc’ line at the end of the program is part of the main function. var x, y, ox, oy, miny, maxy Here we are declaring various variables that we will use later. The variable x, y are the x and y coordinates respectively of the point currently being traced on the display. The ox, oy coordinates are the previous values of these. The miny and maxy variables, as their names suggest, store the minimum and maximum y values over the cycle. The latter are needed to compute the peak to peak voltage of the waveform, which is displayed too. gfx_Cls(); This is a built in graphics function that simply clears the display. x y ox oy miny maxy := 0; := 0; := 0; :=0; := 64; := 0; These lines initialise the variables, notice that unlike C, the way to set a variable is to use ‘:=’. The screen coordinates begin at (0,0) which corresponds to the top left corner of the screen. The value of 64 for miny is the lowest value the 10-bit ADC conversion can have (after it is divided by 16). 4DGL currently does not support floating point numbers, so all arithmetic operations are integer operations. pin_Set(ANALOGUE_10, 0); One of the general input pins (there are two) is set to function as an analog input. The constant ANALOGUE_10 specifies that we will use a 10 bit conversion (you can also use 8 bit conversions). while(1) ... wend +3.3V Fig.2: the hardware for the simple oscilloscope. We’ve used an OLED-96-G1 module and a DEVBOARD-G1 development board from 4D Systems. The development board has a prototyping area in the form of a breadboard where we’ve added the additional components to bias the signal at halfsupply along with a measure of input protection. 38  Silicon Chip 1N5819 10k 10 F SIGNAL IN VDD IO1 470 1N5819 10k OLED-96-G1 MODULE GND siliconchip.com.au . . . a sawtooth wave . . . This defines a while loop which is the main loop of the program. The program will execute this loop indefinitely, as the constant in brackets is non-zero. This is similar to C except that the curly brackets to group the statements in the while loop are not used and the ‘wend’ (while-end) keyword is used as delimiter instead. x:x+1; Each time around the loop we increment the x coordinate of the sweep point. if(x>=96) ... endif This block is only executed once the horizontal sweep gets to the edge of the screen (remember we are using a screen with 96 columns, each a pixel). x := 0; ox := 0; y :=0; At the end of each screen sweep, we set the variables for a new sweep. while(y<32) y:=pin_Read(0)/16; wend These lines essentially block the program until the signal crosses the horizontal line defined by y=32. It functions as a rudimentary ‘trigger’ and holds periodic waveforms steady. txt_Movecursor(14, 0); txt_Set(TEXT_COLOUR, ORANGE); prin(‘Pk-Pk (mV): ‘, 51*(maxy-miny)); The function txt_MoveCursor sets the cursor position for text, the format is in (line, columns). Thus, we’ve sesiliconchip.com.au . . . and a triangular wave, all at 50Hz. lected the cursor to be set to the bottom of the screen and leftmost. The txt_Set function can be used to set a number of attributes that apply to text, such as the type of font or its colour. In this case, we’re setting the text’s colour to that defined previously by the constant ORANGE. Finally, we print out a string using the print function. It simply shows the peak-to-peak voltage. The scaling factor of 51 converts from the y value to a voltage level. miny:=64; maxy:=0 pause(100); gfx_Cls(); Now we simply set up the variables for the next sweep, resetting the minimum and maximum values and pausing for 100 ms. We then clear the screen ready for the next sweep. y:=pin_Read(0)/16 The pin_Read function converts the analog level on the pin indicated in its argument (ie, 0=IO1 pin) to an integer. Since we’ve selected 10 bit mode previously, the value returned will be in the range 0-1023. When we divide by 16, we’ll get a value between 0 and 64 which becomes the new y coordinate. if(y>maxy)maxy:=y; if(y<miny)miny:=y; These two lines update the running minimum and maximum values to later determine the peak to peak voltage of the waveform. if(ox!=0)gfx_Line(ox, oy, x, y, BLUE); ox:=x; oy:=y; The gfx_Line function draws a line from the point (ox, oy) to (x, y) in the colour BLUE. The conditional (ox!=0) means the line is drawn everywhere except at the beginning of the sweep. The last two lines then transfer the contents of (x, y) to (ox, oy), the latter will represent the previous sweep coordinates in the next phase of the sweep. With the specified input coupling network we show in Fig.2 you can view signals of up to 3.3V peak-topeak. Larger signals will be clipped by the input protection diodes. While it is a very simple project, it highlights how easy it is to write applications using these OLED modules. At the time of going to press, prices (excluding GST) of the OLED modules from 4D Systems ranged from around $60 (the one we used for the oscilloscope photos above) to around $230, the latter featuring a 70mm active matrix touch screen. The GOLDELOX processor was priced at around $12.00. For more information on 4D Systems’ OLED displays, visit 4Dsystems. com.au SC A NOTE TO SILICON CHIP SUBSCRIBERS Your magazine address sheet shows when your current subscription expires. Check it out to see how many you still have. If your magazine has not turned up by the first week of the month, contact us at silchip<at>siliconchip.com.au September 2009  39