Tag Archive | "serial"

Using older Noritake Itron VFD modules

Introduction

Now and again you come across interesting parts on ebay, from friends or just rooting around in second-hand stores. One example of this was a huge Noritake Itron 40 x 2 character vacuum-fluorescent display from 1994 (or earlier) which was passed on from a client. Originally it looked quite complex, however after spending some time the data sheets were found and it was discovered to have a simple serial interface – and with a little work we’ve got it working, so read on if you’re interested in classic VFDs or have a similar unit.

Getting Started

The model number for our display is CU40026SCPB-T20A. Here’s a quick walk-around, the front:

Noritake VFD

… the back:

Noritake VFD

… the interfaces:

Noritake VFD

… and configuration jumpers:

Noritake VFD

The serial interface baud rate is determined by the jumpers (above), for example:

VFD baud rate jumpersSo comparing the table above against the jumpers on our module gives us a data speed of 19200 bps with no parity. Great – we can easily create such a connection with a microcontroller with a serial output and 5V logic levels; for our examples we’ll use an Arduino-compatible board.

Wiring up the VFD is simple – see the white jumpers labelled CN2 as shown previously. Pin 1 is 5V (you need an external supply that can offer up to 700 mA), pin 2 to Arduino digital pin 7, and pin 3 to Arduino and power supply GND. We use Arduino D7 with software serial instead of TX so that the display doesn’t display garbage when a sketch is being uploaded. Then it’s a matter of simply sending text to the display, for example here’s a quick demonstration sketch:

… and the results:

noritake vfd demonstration

If you’re not keen on the colour or intensity of the display, try some Perspex over the top – for example:

Noritake VFD

Controlling the display

At this point you’ll need the data sheet, there’s a couple you can download: data sheet onedata sheet two. As you saw previously, writing text is very simple – just use .print functions. However you may want to send individual characters, as well as special commands to control aspects of the display. These are outlined in the data sheet – see the “Software Commands” and “Character Fonts” tables.

If you need to send single commands – for example “clear display” which is 0x0E, use a .write command, such as:

Some commands are in the format of escape codes (remember those?) so you need to send ESC then the following byte, for example to change the brightness to 50%:

Armed with that knowledge and the data sheets you can now execute all the commands. According to the data sheet it is possible to change fonts however no matter what the hardware jumper or command we tried it wouldn’t budge from the Japanese katakana font. Your screen may vary. If you use the “screen priority write” function heed the data sheet with respect to the extended “busy” time by delaying subsequent writes to the display by a millisecond.

 Putting it all together

Instead of explaining each and every possible command, I’ve put the common ones inside documented functions in the demonstration sketch below, which is followed by a quick video of the sketch in operation.

 

Conclusion

We hope you found this interesting and helpful. And if you have an inexpensive source for these old displays, let us know in the comments. Full-sized images are on flickr. And if you made it this far – check out my new book “Arduino Workshop” from No Starch Press.

In the meanwhile have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column? And join our friendly Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

Posted in arduino, Itron, Noritake, tronixstuff, tutorial, VFD, vintageComments (6)

Improving Arduino to PC Interactions with MegunoLink

Introduction

Through a colleague I was introduced to a new piece of software for the Windows environment which comprises of useful tools that interact with an Arduino-style board (or other MCU with serial data). The software is called MegunoLink, from BlueLeafSoftware in New Zealand. Megunolink has many useful features, and we’ll run through them briefly in this article. They include:

  • Serial port monitoring – that doesn’t reset the MCU
  • The ability to capture serial port data to a text file
  • A tool to graph formatted data sent from the Arduino in real time
  • “George” the serial monkey! (see below)
  • Enable building Arduino projects using ATMEL AVRstudio
  • And Megunolink can also act as a graphical interface for AVRdude to upload compiled code to an Arduino

Installation was simple and straightforward. The installation is only ~1.5 megabytes and not taxing at all. We only have a Windows 7 64-bit machine, so haven’t tested this in emulation under MacOS or Linux. Before moving ahead, note that the software is free. However the developers do ask for a US$10 donation, and if you use the software more than once this is a very fair amount to pay for such a featured piece of software. Now for a look at each of the features.

Serial Data monitoring

As with the Serial Monitor in the Arduino IDE, you can monitor the data from the Arduino, and also send it back through the serial line. Just click the ‘Monitor’ tab and you’re set, for example:

However unlike the Arduino IDE, opening the monitor does not reset the Arduino. But if you do need to perform a reset, a button on the toolbar is provided as shown below:

Capturing Serial Data to a file

Very useful indeed, much quicker than dumping data to a microSD card and then bringing it back to the PC. Just click the ‘Log’ tab, specify a file location and name, then click ‘Enabled’, for example:

You can also append data to an existing text file. When creating the output format in your Arduino sketch, be mindful to have separators such as commas or colons – which make it much easier to delimit the data once imported into a spreadsheet or database application.

Plotting and Graphing Serial Data

Plotting data to a graph is very simple. You simply format the data you’d like to plot using Serial.write commands, and Megunolink takes care of the rest – just click the ‘Plotter’ tab and you’re off.  The data must be formatted as such:

Where ‘a’ is the name of the series. T tells MegunoLink to plot the actual real time, and b is the data as a number in string form. Here is a very simple example:

which resulted with:

Here is another example, it is the “SendSineCurve” sketch from the Arduino Graphing library:

You can always save the graph as an image in the usual formats as well as in .emf vector image file format.

“George” the Serial Monkey

This is a serial protocol simulator tool which is useful for testing the control of serial-based devices. You can setup George so that it listens for a particular pattern in the serial output from an Arduino – and then sends back a response of your choice to the Arduino. For example:

For a more detail explanation and detail tutorial on how to control George, see the MegunoLink website.

Arduino Development with AVR Studio 

Using MegunoLink you can develop Arduino projects with Atmel AVRStudio software. As some people find the Arduino IDE somewhat limiting, this option gives you access to the more programmer-friendly Atmel IDE, for example:

Although there is a small amount of tasks to make this possible, it is straightforward to do so, and an easy to follow tutorial has been provided at the MegunoLink website.

Upload compiled .HEX files to Arduino

For those using avrdude to upload compiled .hex files to an Ardiuno, you can also do this using the GUI MegunoLink interface. This is also used for uploading the compiled files generated in AVRStudio, for example:

As with all the other MegunoLink features – there is a relevant tutorial available on the website.

Conclusion

MegunoLink works well, is easy to use, and the price is right. It has to be the simplest tool available for plotting data from a microcontroller, or capturing it to a file without any extra hardware. So download it and give it a try, it won’t cost you anything and I’m sure you will find a use for it in the near future. And remember – if you’re using MegunoLink, please consider making a donation towards the development of further versions. Thanks to Freetronics for the use of their top-notch Arduino-compatible hardware.

In the meanwhile have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column? And join our friendly Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

Posted in arduino, data analysis, megunolink, software review, tutorialComments (9)

Review – Agilent Infiniivision MSO-X 3024A Mixed Signal Oscilloscope

Hello Readers

In this article we examine the Agilent Technologies Infiniivision MSO-X 3024A Mixed Signal Oscilloscope. Please note that the review unit has the latest version 2.0 firmware (existing owners can upgrade with the free download).

Initial Impressions

Unlike smaller instruments the packaging is plain and non-descript, however the MSO is protected very well for global shipping and arrived in perfect condition. Inclusions will vary depending on the particular model, however all come with a calibration certificate, user guide on CD and a power lead.

image1

Four passive 300MHz probes are included with the MSO-X3024A:

image1a

Due to the constant upgrading of the firmware the lack of a printed user manual is no surprise. You can download the manual as well as the service, programming and  educational lab guides from the documents section of the product web page – which make good reading to get a feel for the unit.

Now for a tour around the unit. Coming from a smaller DSO or an analogue model, the first thing that strikes you is the display. 8.5” diagonal with 800×480 resolution:

image2

Unlike cheaper brands the larger screen is not extrapolating data from a smaller image – each pixel is separately used. The front panel is clean and uncluttered. Each button and knob feels solid and responsive, and if pressed and held down, a small help window appears with information about the item pressed. Note that each analogue channel has independent controls for vertical position and V/div sensitivity (the minimum sensitivity is 1mV/division). This saves a lot of time and possible confusion when working on time-sensitive applications.

Around the back we find the cooling van ventilation on the left, the IEC AC power socket on the bottom-right, manufacturing data and so on. The fan is just audible, however the noise from a desktop computer drowns it out. On the far right near the top are separate USB connections for device and host mode, and the external trigger input and output sockets. Apart from the trigger out signal the socket can also be set to give a 5V pulse on a mask test failure or the optional WaveGen sync pulse.

image3

Below this is a space for a Kensington lock cable, and the optional modules – the VGA/LAN adaptor or the GPIB bus module. On the right is my old faithful GW 20 MHz analogue CRO. Finally, there is a compartment on the top of the unit that can hold two probes comfortably, and four at a pinch:

image4

As the unit is can be considered a small computer, it takes time to boot up – just over thirty seconds. (The operating system is Windows CE version 6.0). The user-interface is quite simple considering the capability of the unit. The six soft-keys below the display are used well, and also can call a separate list of options under each button.

When such a list is presented, you can also use the “Push to select” knob on the right hand side of the display to select an option and lock in by pressing the knob in. Below the soft keys from left to right are: BNC output for the optional function generator, digital inputs for logic analyser, USB socket for saving data to a USB drive, probe points for calibration and demonstration use, and four probe sockets. Connections exist that can interface with optional Agilent active probes.

Specifications

This instrument falls within the range of Agilent’s new Infiniivision 3000-series oscilloscopes. The range begins with the DSO-X3012A with 100MHz bandwidth and two channels, through to the DSO-X3054A with 500 MHz bandwidth and four channels. Furthermore the range is extended with the MSO-X models that include a sixteen channel logic analyser.

Some of you will know there is also the Infiniivision 2000-series, and wonder why one would acquire a 3000-series. There are three excellent reasons for doing so:

  1. Waveform update rate is 50000 per second on a 2000, one million per second on a 3000;
  2. Memory depth on a 2000 is 100 kilopoints; 3000s have 2Mpts standard or 4Mpts optional;
  3. Eight vs. sixteen digital channels when specified as an MSO-X model.

For a full breakdown of specifications please download the Agilent data sheet located here.

Getting Started and general use

The process from cutting open the packaging to measuring a signal is quite simple – just plug it in, connect probes and go – however some probe compensation is required, which is explained quite well in the manual. There are strong tilting bales under the front side which can be used to face the unit upwards. At this point the unit is ready to go – you can start measuring by using the Auto Scale function and let the MSO-X3024A determine the appropriate display settings.

However there is no fun in that – the vertical scale can be manually adjusted between 1 mV and 50V per division, the horizontal between 2 nanoseconds and 50 seconds per division. These values can be selected rapidly or (by pressing the knob in) in a fine method for more precise values. If working with more than one channel, each can be labelled using a pre-set description or select a label from a list. One can also alter the display between X-Y, horizontal and roll modes.

Each channel has separate controls for coupling – DC/AC but no GND, as the earth point is shown on the LCD. Impedance can be 1M or 50 ohm. One can also limit bandwidth to 20MHz to remove high-frequency interference.

Capturing data is very easy, you can save images as .png or .bmp files in grey scale or colour , data in .csv form and so on. You can also assign popular functions to a “Quick Action” button – one press and it is done. For example I use this as a “save bitmap” button to send the screen image to the USB drive. If the optional LAN/VGA module is installed screens can be captured by the host computer via the network. Finally there is a very basic file explorer available to find files on the USB drive as well.

Waveforms can also be stored and used later on as references for other measurements. When reviewed they appear as an orange trace – for example R1:

rrr

The horizontal zoom mode activated using keys to the right of the horizontal control is very useful. Agilent call this “Mega Zoom” and it certainly works. Consider the following screen shot – the 32.768kHz square-wave from a Maxim DS1307 real-time clock is being analysed:

megazoom

The time base is 10uS per division – and using the zoom we can get down to two nanoseconds per division and investigate the ringing on fall of the square-wave. This is great for investigating complex signals over short periods. Awesome.

Capturing infrequent events is made simple by the combination of the one million waveforms per second sampling rate, and the use of infinite display persistence. In the following example a clock with very infrequent glitch is being sampled. By setting persistence to infinite, as soon as the infrequent glitch occurs it can be displayed and held on the screen. For example:

infreq

Triggering

There is a plethora of triggering options available. Standard modes include: edge, edge then edge, pulse-width (customisable), pattern trigger (for logic analyser – you can create your own patter of high, low, or doesn’t matter with comparison operators for duration), hex bus trigger, OR trigger, customisable rise/fall time trigger, nth edge burst trigger which allows  you to nth edge of a burst after an idle time, runt trigger on positive or negative pulse, setup and hold trigger, on video signals (PAL, PAL-M, NTSC, SECAM), and USB packets. Phew. Furthermore, if you have any of the optional decoding and analysis licenses, they include triggering on the matching signal type (see later).

Math modes

Performing math waveforms on analogue channels is done via a seperate Math button, and the operations available are addition, subtraction, multiplication, differentiation, integration, square root and FFT.

Waveform statistics

When the time comes to further analyse your measurement data, there area variety of measurements that can be taken, and they can be displayed individually, such as in the following:

stats1

or all in a summary screen:

allstats

Or you can manually use the cursors to determine information about any part of a wave form, for example:

cursors

Logic Analyser

Everything required is included with the MSO-X3024A for the sixteen channel logic analyser, including a very long dual-head probe cable:

lacables

as well as sixteen grabbers and some extension runs:

lacables2

Setup and use was surprisingly simple, just connect the probe cable head to ground, insert grabbers onto the ends of each channel wire, and connect to the signal pins to analyse. You can have all sixteen channels and the four analogue channels active at once, however when doing so the screen is quite busy. You can adjust the height  for each digital channel. Here we are measuring two analogue and eight digital channels:

msoinaction

As always there are many forms of customisation. Automatic scaling is available the same as analogue measurement. You can set the threshold levels for high and low, and presets exist for TTL, CMOS, ECL and your own custom levels. The cable is very well-built (made in the USA) and the socket on the MSO is a standard, very solid IDC connector. Thanks to the use of the IDC connector you could also make your own probes or extension cable for the analyser. Digital channels can also be combined and displayed as a data bus, with the data values shown in hexadecimal or binary – for example:

hexbus

binbus

Options

Both the 2000- and 3000-series Infiniivision units have a variety of options and upgrades available either at the time of purchase or later on. Agilent have been clever and installed all the software-based options in the unit – when required they are “unlocked” by entering a licence key given after purchase. Trial 14-day licenses are generally available if you want to test an option before purchase. You can also upgrade the bandwidth after purchase – for example if you started with a 100MHz a licence key purchase will upgrade you to 200MHz , or 350 to 500MHz. However if you wish to upgrade a 200MHz to 350/500, this needs to be performed at at Agilent service facility. Surprisingly the logic analyser upgrade that converts a DSO-X to an MSO-X is user-installable. For more information on the upgrade options and procedures please visit here.

Memory Upgrade (DSOX3MEMUP)

A simple yet useful option – it doubles the total memory depth to 4 Mpts interleaved.

LAN/VGA Module (DSOXLAN)

This options really opens up the MSO to the world (and is a lot of fun..) – it is inserted into the port at the rear of the unit:

lanvga1

VGA output is very simple – no setup required. Just plug in your monitor or projector and you’re ready to go -for example, with a 22″ LCD monitor:

monitorview

The educational benefits of the LAN/VGA module are immediately apparent – instead of having twenty classmates huddle around one MSO while the instructor demonstrates the unit, the display can be show on the classroom projector or a large monitor. The MSO display is still fully active while VGA output is used.

LAN connection via Ethernet was also very simple. The MSO can automatically connect to the network if you have a router with DHCP server. Otherwise you can use the Utility>I/O>LAN Settings function to enter various TCP/IP settings and view the MSO’s MAC address.

Once connected you can have complete control of the MSO over your network. Apart from saving screen shots:

remotesaveimage

There is a “simple” remote control interface that contains all the controls in a standard menu-driven environment:

simpleremotepanel

Or you can have a realistic reproduction of the entire MSO on your screen:

fullremotepanel

The full remote panel is completely identical – it’s “just like being there”. The ability to monitor your MSO from other areas could be very useful. For example using the mask testing in a QC area and watching the results in an office; or an educator monitoring students’ use of the MSO.

Furthermore you can view various data about the MSO, such as calibration date and temperature drift since calibration, installed options, serial number, etc. remotely via the web interface.

GPIB Module (DSOXGPIB)

This allows you to connect your MSO to an IEEE-488 communications bus for connection to less contemporary equipment.

Segmented Memory Option (DSOX3SGM)

This options allows you to capture infrequent multiple events over time. For example, you want to locate some 15 mS pulses that occur a few times over the space of an hour. All you need to do is set the triggering to pulse-width, specify the minimum/maximum pulse width to trigger from, then hit Acquire>Segmented, the number of segments to use and you’re off. When the pulses have been captured, you can return and analyse each one as normal. The unit records the start time and elapsed time for each segment, and you can still use zoom, etc., to examine the pulse. For example:

segment

Embedded Serial Triggering and Analysis (DSOX3EMBD)

Debugging I2C and SPI buses are no longer a chore with this option. For example with I2C just probe you SDA and SCK lines, adjust the thresholds in the menu option and you’re set. Apart from displaying the bytes of data below the actual waveform, there is a “Lister” which allows you to scroll back and forth along the captured data along with correlating times. In the following example a Maxim DS1307 RTC IC has been polled:

i2c_lister

The Lister details all – in the example we sent a zero to address 0x68, which caused the DS1307 to return the seven bytes of time and date data. This is an extremely useful option and is very useful when working with a range of sensors and other parts that use the I2C bus. The SPI bus analysis operates in exactly the same manner. Adding this option also allows triggering on I2C data as well.

FlexRay Triggering and Analysis (DSOX3FLEX)

The optional FlexRay measurement applications offer integrated FlexRay serial bus triggering, hardware-based decoding and analysis. The FlexRay measurement tools help you more efficiently debug and characterize your FlexRay physical layer network by having the ability to trigger on and time-correlate FlexRay communication with your physical layer signals. So if you are working on the ECU of your Rolls-Royce or new BMW 7-series, you can use an MSO that matches the quality of the vehicle under examination. Here is an example of the FlexRay being monitored in the lister:

flexray

RS232/UART Serial Decode and Trigger (COMP/MSOX3000-232)

This option allows RS232, 422, 485 and UART decoding and triggering, as well as the use of the Lister to analyse the data. For example:

uartdecode

Advanced Math (DSOX3ADVMATH)

This option adds more math functions to enhance your waveform analysis, including: divide, base-10 logarithm, natural logarithm and exponential.

CAN/LIN Triggering and Serial Decode (DSOX3AUTO)

Again, allows decoding of automotive CAN and LIN bus signals, and the use of the Lister. For example:

can_decode

lin_decode

Military Standard 1553 and ARINC429 Standards Serial Triggering and Decoding (DSOX3AERO)

The option exists for decoding and triggering of the above bus types. According to Agilent the Mil-STD 1553 serial bus is primarily used to interconnect avionics equipment in military aircraft and spacecraft(!). This bus is based on tri-level signaling (high, low, & idle) and requires dual-threshold triggering, which the 3000X supports. This bus is also implemented as a redundant multi-lane bus (dual-bus analysis), which is also supported by the 3000X.

The ARINC 429 serial bus is used to interconnect avionics equipment in civilian aircraft (Boeing & Airbus). This bus is also based on tri-level signaling (high, low, & null) and requires dual-threshold triggering, which the 3000X supports. Since ARINC 429 is a point-to-point bus, multi-lane analysis is also required to capture both send and receive data. So if you need this capability – Agilent has you covered.

milbus

Video Triggering and Analysis Application (DSOX3VID)

The DSOX3VIDEO option provides triggering on an array of HDTV standards, including:

  • 480p/60, 567p/50, 720p/50, 720p/60
  • 1080i/50, 1080i/60
  • 1080p/24, 1080p/25, 1080p/30, 1080p/50, 1080p/60
  • Generic (custom bi-level and tri-level sync video standards)

The 3000X Series oscilloscope already comes standard with NTSC, PAL, PAL-M, and SECAM support. Example of video analysis:

dsox3vid

Audio Serial Triggering and Analysis (DSOX3AUDIO)

And not surprisingly this is an option to allow decoding of and triggering from I2S digital audio data. For example:

i2s_decode

Mask Limit Testing (DSOX3MASK)

This is another interesting and useful option, idea for quality testing, benchmarking and so on. First you create a mask by measuring the ideal waveform, and then feed in the signal to be compared with the ideal mask. Mask limit testing can operate at up to 280000 comparisons per second. You can view pass/fail statistics, minimum sigma and so on, for example – a perfect test:

mask1

… then a change of frequency for a few cycles:

mask2

Furthermore you can specify the number of tests, change source channel, specify action upon errors, etc. Finally you can create and save to USB your own mask file for use later on – which can also be modified on a PC using any text editor software. Or for other monitoring options the external trigger socket on the read of the MSO can be configured to give a 5V pulse on a mask test failure.

If you have the LAN/VGA module you could place the MSO on in a lab or factory situation and monitor the testing over the network using a PC – very handy for QC managers or those who need to move about the workplace and still monitor testing in real time.

20MHz Function Generator/Arbitrary Waveform Generator (DSOX3WAVEGEN)

The “WaveGen” function is a versatile option that offers a highly controllable 20 MHz function generator and arbitrary waveform generator. It offers eleven different types of waveform: sine, square, ramp, pulse, DC, noise, sine cardinal, exponential rise and fall, cardiac and gaussian pulse.

The frequency can be adjusted between 100mHz to 20 MHz in 100 mHz steps; period from 50ns to 10s; full offset, amplitude and symmetry control; as well as logic level preset outputs (such as TTL, CMOS 5V, 3.3V etc.) Finally the WaveGen can be operated independently to normal measurement tasks, which is useful for ideal vs. actual comparisons and so on. Output is from the BNC socket at the bottom-left of the front pane and sync is also availble from the rear BNC socket. The arbitrary waveform generator is very simple to use  – and copied waveforms can be edited or have noise added to them to replicate real-world waveforms.

Power Measurement (DSOX3PWR)

This is a power measurement and analysis option that is integrated into the unit and provides a quick and easy way of analysing the reliability and efficiency of switching power supplies. It also includes a user license for U1881A-003 PC-based power measurement and analysis software that provides even more powerful insight into power supply measurement. With this option you can:

  • Measure switching loss and conduction loss at the switching device (to help improve efficiency)
  • Analyse dI/dt and dV/dt slew rate (for reliable operation)
  • Automate oscilloscope set-up for ripple measurements (to eliminate tedious manual oscilloscope set up)
  • Perform pre- compliance testing to IEC 61000- 3- 2 standards (to reduce compliance testing time)
  • Analyse line power with total harmonic distortion, true power, apparent power, power factor, and crest factor tests (to quickly provide power quality information)
  • Measure output noise (ripple)
  • Analyse modulation using the on- time and off- time information of a Pulse Width Modulation (PWM) signal (to help characterize the active power factor)
  • Measure how well a circuit rejects ripple coming from the input power supply at various frequencies with the Power Supply Rejection Ratio (PSRR) measurement.
For more indepth explanation of this option download and read the well written manual.

Etch-a-sketch

Well not a feature as such, but it exists if you know where to find it:

msoxes

Initial Conclusions

There is no doubt that the Infiniivision 3000-series are a great line of instruments. The waveform sample rate, memory size and bandwidth options are very competitive, and the ability to add various options is convenient and also helps lower the final cost for purchasing departments. (Start with the base model then hit them up for the options over time)

However there are a few things that could use improvement. Although the display is excellent – the right-hand column with “Agilent” at the top is always displayed. This is a waste of LCD space and there should be an option to turn it off, allowing waveforms to be displayed across the entire screen. If a $400 Rigol can do this, so should a $5000+ Agilent. The build unit of the unit is good, no problems are evident however it could be a little more “solid”; and the option of a clear shield for the LCD would be a great idea to protect against forceful and dirty fingers.

Furthermore the ground demonstration terminal suffers from metal fatigue very quickly, it already is somewhat chipped and may need replacing if you used it quite often. Finally, it would have been nice to see Agilent include the a carry bag – already people have asked to borrow the unit and to wander around with it in the box is somewhat awkward.

For those who rely on their test equipment will have the peace of mind that Chinese discount suppliers cannot give you – Agilent support exists and will not ignore you once a sale has been made. It doesn’t take long to find a tale of woe on an Internet forum from someone who imported their own “high-spec” DSO via eBay or direct east-Asian sellers only to find there are no firmware updates, competent English-speaking support or warranty of any kind. Furthermore, the ability to combine many functions in the one piece of equipment saves space, time and reduces your support channel back to one supplier. There is also an iPhone “app” that may be of interest – however as an Android user I haven’t tried it.

The saying “Quality is remembered long after price is forgotten” certainly holds true – and at the end of the day combined with the mix of standard and optional features at various price points – the Agilent Infiniivision MSO-X 3024A rises to the top echelon of test equipment.

 The Agilent Technologies Infiniivision MSO-X 3024A Mixed Signal Oscilloscope used in this review is a promotional consideration received from Agilent and element-14 via their Road Test program.

Agilent Test and Measurement equipment is available from your local element-14Farnell or Newark distributor.

Australian readers please note:  Trio Smartcal are the exclusive Australian Agilent distributors for all states except WA and NT – telephone 1300 853 407.

Measurement Innovation for WA and NT – telephone 08 9437 2550

High-resolution images are available on flickr.

Once again thanks for reading, have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column, or join our Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

Posted in agilent, DSO, MSOX3024A, oscilloscope, review, test equipment, tutorial

Tutorial: Arduino and a Thermal Printer

Use inexpensive thermal printers with Arduino in chapter thirty-eight of a series originally titled “Getting Started/Moving Forward with Arduino!” by John Boxall – a series of articles on the Arduino universe. The first chapter is here, the complete series is detailed here.

Updated 05/02/2013

In this article we introduce the inexpensive thermal printer that has recently become widely available from Sparkfun and their resellers. The goal of the article is to be as simple as possible so you can get started without any problems or confusion. In the past getting data from our Arduino to a paper form would either have meant logging it to an SD card then using a PC to finish the job, or perhaps viewing said data on an LCD then writing it down. Not any more – with the use of this cheap and simple serial printer. Before we get started, here is a short demonstration video of it in action:


Not bad at all considering the price. Let’s have a look in more detail. Here is the printer and two matching rolls of thermal paper:

… and the inside of the unit:

Loading paper is quite simple, just drop the roll in with the end of the paper facing away from you, pull it out further than the top of the front lip, then close the lid. The paper rolls required need to be 57mm wide and have a diameter of no more than 39mm. For example. There is a piece of white cardboard stuck to the front – this is an economical cover that hides some of the internals. Nothing of interest for us in there. The button next to the LED on the left is for paper advance, and the LED can blink out the printer status.

From a hardware perspective wiring is also very simple. Looking at the base of the printer:

… there are two connections. On the left is DC power, and data on the right. Thankfully the leads are included with the printer and have the plugs already fitted – a great time saver. You may also want to fit your own rubber feet to stop the printer rocking about.

Please note – you need an external power supply with a voltage of between 5 and 9 volts DC that can deliver up to 1.5 amps of current. When idling the printer draws less than 10 milliamps, but when printing it peaks at around 1.47 A. So don’t try and run it from your Arduino board. However the data lines are easy, as the printer has a serial interface we only need to connect printer RX to Arduino digital 3, and printer TX to Arduino digital 2, and GND to … GND! We will use a virtual serial port on pins 2 and 3 as 0 and 1 will be taken for use with the serial monitor window for debugging and possible control purposes.

If you want to quickly test your printer – connect it to the power, drop in some paper, hold down the feed button and turn on the power. It will quickly produce a test print.

Next we need to understand how to control the printer in our sketches. Consider this very simple sketch:

After ensuring your printer is connected as described earlier, and has the appropriate power supply and paper – uploading the sketch will result in the following:

Now that the initial burst of printing excitement has passed, let’s look at the sketch and see how it all works. The first part:

configures the virtual serial port and creates an instance for us to refer to when writing to the printer. Next, four variables are defined. These hold parameters used for configuring the printer. As the printer works with these settings there is no need to alter them, however if you are feeling experimental nothing is stopping you. Next we have the function initPrinter(). This sets a lot of parameters for the printer to ready itself for work. We call initPrinter() only once – in void setup(); For now we can be satisfied that it ‘just works’.

Now time for action – void loop(). Writing text to the printer is as simple as:

You can also use .println to advance along to the next line. Generally this is the same as writing to the serial monitor with Serial.println() etc. So nothing new there. Each line of text can be up to thirty-two characters in length.

The next thing to concern ourselves with is sending commands to the printer. You may have noticed the line

This sends the command to advance to the next line (in the old days we would say ‘carriage return and line feed’). There are many commands available to do various things.  At this point you will need to refer to the somewhat amusing user manual.pdf. Open it up and have a look at section 5.2.1 on page ten. Notice how each command has an ASCII, decimal and hexadecimal equivalent? We will use the decimal command values. So to send them, just use:

Easy. If the command has two or more values (for example, to turn the printer offline [page 11] ) – just send each value in a separate statement. For example:

… will put the printer into offline mode. Notice how we used the variable “zero” for 0 – you can’t send a zero by itself. So we assign it to the variable and send that instead. Odd.

For out next example, let’s try out a few more commands:

  • Underlined text (the printer seemed to have issues with thick underlining, however your experience may vary)
  • Bold text
  • Double height and width
Here is the sketch:

And the results:

Frankly bold doesn’t look that bold, so I wouldn’t worry about it too much. However the oversized characters could be very useful, and still print relatively quickly.

Next on our list are barcodes. A normal UPC barcode has 12 digits, and our little printer can generate a variety of barcode types – see page twenty-two of the user manual. For our example we will generate UPC-A type codes and an alphanumeric version. Alphanumeric barcodes need capital letters, the dollar sign, percent sign, or full stop. The data is kept in an array of characters named … barCode[]  and barCode[]2. Consider the functions printBarcode(), printBarcodeThick()  and printBarcodeAlpha() in the following example sketch:

Notice in printBarcodeThick() we make use of the ability to change the vertical size of the barcode – the height in pixels is the third parameter in the group. And here is the result:

So there you have it – another practical piece of hardware previously considered to be out of our reach – is now under our control. Now you should have an understanding of the basics and can approach the other functions in the user guide with confidence. Please keep in mind that the price of this printer really should play a large part in determining suitability for a particular task. It does have issues printing large blocks of pixels, such as the double-width underlining and inverse text. This printer is great but certainly not for commercial nor high-volume use. That is what professional POS printers from Brother, Star, Epson, etc., are for. However for low-volume, personal or hobby use this printer is certainly a deal. As always, now it is up to you and your imagination to put this to use or get up to other shenanigans.

This article would not have been possible without the example sketches provided by Nathan Seidle, the founder and CEO of Sparkfun. If you meet him, shout him a beer.  Please don’t knock off bus tickets or so on. I’m sure there are heavy penalties for doing so if caught.

LEDborder

Have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column, or join our Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

Posted in arduino, COM-10438, COM-10560, education, lesson, microcontrollers, printer, sparkfun, thermal, tutorialComments (11)

Tutorial: Arduino and monochrome LCDs

Please note that the tutorials are not currently compatible with Arduino IDE v1.0. Please continue to use v22 or v23 until further notice. 

This is chapter twenty-four of a series originally titled “Getting Started/Moving Forward with Arduino!” by John Boxall – A tutorial on the Arduino universe.

The first chapter is here, the complete series is detailed here.

Welcome back fellow arduidans!

The purpose of this article is to summarise a range of affordable monochrome liquid-crystal display units that are available to work with our Arduino; and to replace the section about LCDs in chapter two of this series. We will first examine some fixed-character and then graphical LCD units in this article. So let’s go!

Fixed-character LCD modules

When shopping around for LCD modules, these will usually be the the most common found in retail outlets. Their size is normally measured by the number of columns and rows of characters in the display. For example, the three LCDs below are 8×2, 16×2 and 20×4 characters in size:

lcdtypesss

Currently, most LCDs should have a backlight of some sort, however you may come across some heavily-discounted models on (for example) eBay that are not. Character, background and backlight colours can vary, for example:

backlitsss

Interfacing these screens with our Arduino boards is very easy, and there are several ways to do so. These interface types can include four- and eight-bit parallel, three-wire,  serial, I2C and SPI interfaces; and the LCD price is usually inversely proportional to the ease of interface (that is, parallel are usually the cheapest).

Four-bit parallel interface

This is the cheapest method of interface, and our first example for this article. Your LCD will need a certain type of controller IC called a Hitachi HD44780 or compatible such as the KS0066. From a hardware perspective, there are sixteen pins on the LCD. These are usually in one row:

16pinsss

… or two rows of eight:

2by8pinsss

The pin labels for our example are the following:

  1. GND
  2. 5V (careful! Some LCDs use 3.3 volts – adjust according to LCD data sheet from supplier)
  3. Contrast
  4. RS
  5. RW
  6. Enable
  7. DB0 (pins DB0~DB7 are the data lines)
  8. DB1
  9. DB2
  10. DB3
  11. DB4
  12. DB5
  13. DB6
  14. DB7
  15. backlight + (unused on non-backlit LCDs) – again, check your LCD data sheet as backlight voltages can vary.
  16. backlight GND (unused on non-backlit LCDs)

As always, check your LCD’s data sheet before wiring it up.

Some LCDs may also have the pinout details on their PCB if you are lucky, however it can be hard to decipher:

Now let’s connect our example 16×2 screen to our Arduino using the following diagram.

Our LCD runs from 5V and also has a 5V backlight – yours may differ, so check the datasheet:

4bitparallel2

(Circuit layout created using Fritzing)

Notice how we have used six digital output pins on the Arduino, plus ground and 5V. The 10k ohm potentiometer connected between LCD pins 2, 3 and 5 is used to adjust the display contrast. You can use any digital out pins on your Arduino, just remember to take note of which ones are connected to the LCD as you will need to alter a function in your sketch. If your backlight is 3.3V, you can use the 3.3V pin on the Arduino.

From a software perspective, we need to use the LiquidCrystal() library. This library should be pre-installed with the Arduino IDE. So in the start of your sketch, add the following line:

Next, you need to create a variable for our LCD module, and tell the sketch which pins are connected to which digital output pins. This is done with the following function:

The parameters in the brackets define which digital output pins connect to (in order) LCD pins: RS, enable, D4, D5, D6, and D7.

Finally, in your void setup(), add the line:

This tells the sketch the dimensions in characters (columns, rows) of our LCD module defined as the variable lcd. In the following example we will get started with out LCD by using the basic setup and functions. To save space the explanation of each function will be in the sketch itself. Please note that you do not have to use an Arduino Mega – it is used in this article as my usual Arduino boards are occupied elsewhere.

And here is a quick video of the example 24.1 sketch in action:

There are also a some special effects that we can take advantage of with out display units – in that we can actually define our own characters (up to eight per sketch). That is, control the individual dots (or pixels) that make up each character. With the our character displays, each character is made up of five columns of eight rows of pixels, as illustrated in the close-up below:

pixels

In order to create our characters, we need to define which pixels are on and which are off. This is easily done with the use of an array (array? see chapter four). For example, to create a solid block character as shown in the image above, our array would look like:

Notice how we have eight elements, each representing a row (from top to bottom), and each element has five bits – representing the pixel column for each row. The next step is to reference the custom character’s array to a reference number (0~7) using the following function within void setup():

Now when you want to display the custom character, use the following function:

where 0 is the memory position of the character to display.

To help make things easier, there is a small website that does the array element creation for you. Now let’s display a couple of custom characters to get a feel for how they work. In the following sketch there are three defined characters:

And here is a quick video of the example 24.2 sketch in action:

So there you have it – a summary of the standard parallel method of connecting an LCD to your Arduino. Now let’s look at the next type:

Three-wire LCD interface

If you cannot spare many digital output pins on your Arduino, only need basic text display and don’t want to pay for a serial or I2C LCD, this could be an option for you. A 4094 shift register IC allows use of the example HD44780 LCD with only three digital output pins from your Arduino. The hardware is connected as such:

twilcd

And in real life:

exam24p3ss

From a software perspective, we need to use the LCD3Wire library, which you can download from here. To install the library, copy the folder within the .zip file to your system’s \Arduino-2x\hardware\libraries folder and restart the Arduino IDE. Then, in the start of your sketch, add the following line:

Next, you need to create a variable for our LCD module, and tell the sketch which of the 4094’s pins are connected to which digital output pins as well as define how many physical lines are in the LCD module. This is done with the following function:

Finally, in your void setup(), add the line:

The number of available LCD functions in the LCD3wire library are few – that is the current trade-off with using this method of LCD connection … you lose LCD functions but gain Arduino output pins. In the following example, we will demonstrate all of the available functions within the LCD3Wire library:

And as always, let’s see it in action. The LCD update speed is somewhat slower than using the parallel interface, this is due to the extra handling of the data by the 4094 IC:

Now for some real fun with:

Graphic LCD modules

(Un)fortunately there are many graphic LCD modules on the market. To keep things relatively simple, we will examine two – one with a parallel data interface and one with a serial data interface.

Parallel interface

Our example in this case is a 128 by 64 pixel unit with a KS0108B parallel interface:

glcdparallelss

For the more technically-minded here is the data sheet. From a hardware perspective there are twenty interface pins, and we’re going to use all of them. For breadboard use, solder in a row of header pins to save your sanity!

This particular unit runs from 5V and also has a 5V backlight. Yours may vary, so check and reduce backlight voltage if different.

You will again need a 10k ohm potentiometer to adjust the display contrast. Looking at the image above, the pin numbering runs from left to right. For our examples, please connect the LCD pins to the following Arduino Uno/Duemilanove sockets:

  1. 5V
  2. GND
  3. centre pin of 10k ohm potentiometer
  4. D8
  5. D9
  6. D10
  7. D11
  8. D4
  9. D5
  10. D6
  11. D7
  12. A0
  13. A1
  14. RST
  15. A2
  16. A3
  17. A4
  18. outer leg of potentiometer; connect other leg to GND
  19. 5V
  20. GND

A quick measurement of current shows my TwentyTen board and LCD uses 20mA with the backlight off and 160mA with it on. The display is certainly readable with the backlight off, but it looks a lot better with it on.

From a software perspective we have another library to install. By now you should be able to install a library, so download this KS0108 library and install it as usual. Once again, there are several functions that need to be called in order to activate our LCD. The first of these being:

which is placed within void setup(); The parameter sets the default pixel status. That is, with NON_INVERTED, the default display is as you would expect, pixels off unless activated; whereas INVERTED causes all pixels to be on by default, and turned off when activated. Unlike the character LCDs we don’t have to create an instance of the LCD in software, nor tell the sketch which pins to use – this is already done automatically. Also please remember that whenever coordinates are involved with the display, the X-axis is 0~127 and the Y-axis is 0~63.

There are many functions available to use with the KS0108 library, so let’s try a few of them out in this first example. Once again, we will leave the explanation in the sketch, or refer to the library’s page in the Arduino website. My creative levels are not that high, so the goal is to show you how to use the functions, then you can be creative on your own time. This example demonstrate a simpler variety of graphic display functions:

Now let’s see all of that in action:

You can also send normal characters to your KS0108 LCD. Doing so allows you to display much more information in a smaller physical size than using a character  LCD. Furthermore you can mix graphical functions with character text functions – with some careful display planning you can create quite professional installations. With a standard 5×7 pixel font, you can have eight rows of twenty-one characters each. Doing so is quite easy, we need to use another two #include statements which are detailed in the following example. You don’t need to install any more library files to use this example. Once again, function descriptions are in the sketch:

Again,  let’s see all of that in action:

If you’re looking for a very simple way of using character LCD modules, check this out.

LEDborder

Have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column, or join our Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

Posted in arduino, education, LCD, LCD-00710, learning electronics, lesson, microcontrollers, tutorialComments (52)


Subscribe via email

Receive notifications of new posts by email.

The Arduino Book

Arduino Workshop

Für unsere deutschen Freunde

Dla naszych polskich przyjaciół ...

Australian Electronics!

Buy and support Silicon Chip - Australia's only Electronics Magazine.

Use of our content…

%d bloggers like this: