New series: Arduino Test Equipment

The ESR electronics Tricorder, Part 1

In this article I describe the beginnings of a device that I like to think of as a Tricorder for electronics. This is the first of a three part series in what will (hopefully) be the start of a series of articles that describe ways to use Arduino boards and AVR microcontrollers to build useful, low-cost test, measurement, and control devices.

For additional details and definitions be sure to check out my books “Practical Electronics: Components and Techniques” and “Arduino: A Technical Reference“. Both are available from O’Reilly, Amazon, Barnes and Noble, and numerous other places where fine books are sold.

I remember seeing ads for miniature test equipment back around 1980, and I really wanted some of those little gadgets. One particular brand that caught my eye was the Sinclair/Thandar series of miniature test equipment, which included digital meters, signal generators, and oscilloscopes. Here’s a photo of the Thandar SC110A oscilloscope that was the object of my techno-obsession for quite a while.


Image from Flickr by John Honniball (

Sadly, I never did get one of these. Instead, I ended up with a parade of Tektronix, Hewlett-Packard, LeCroy, and lately, digital ‘scopes from China. All good, to be sure, but the closest thing I have to the old Thandar, size-wise, is a cute little Nano DS201 DSO from SeeedStudios, like this one:


Now, I really like my Nano. It lives in my satchel and goes everywhere with me (I primarily do software engineering for a living these days, but every now and again I need to look at something to make sure it’s doing what the software told it to do). The biggest issues I have with these devices is that they simply don’t have enough inputs. Even the latest model, the DS203, only has four inputs (and I want one, of course–if one happened to show up in my mailbox I’d be glad to review it).

Of course, I also own a few full-up logic analyzers, but I don’t relish the prospect of dragging one of these beasts around and going through the whole set-up routine each time I want to use it. They live in my shop, most of the time. I need something small, lightweight, easy to use, and with enough functionality to be useful in a wide variety of situations. So, what to do?

I want to be able to observe state changes in a control system, monitor some voltages, and perhaps generate some signals to stimulate behavior. Bearing in mind that most control system actions in the real world don’t happen very quickly (on the order of 50 ms or so), I don’t need a 500 MHz logic analyzer. Nor do I need a 4 and one-half digit DMM. What I need is a small, compact device with multiple state inputs, at least 10 bits of analog input resolution, and the ability to log that data and pass it along to a notebook PC for later analysis. It looks like I just described an Arduino. Well, yes, I did, but there’s a catch (there always is).

The primary catch is that an Arduino, of any type, is really nothing more than a break-out for the AVR microcontroller soldered to the PCB. There is no protection or isolation for any of the ins or outs. It is frighteningly easy to destroy an AVR if it’s connected to something evil (from its perspective, that is). This is also true of most boards with a PIC or MSP430 microcontroller, or an ARM microcontroller like an STM32.

The solution I’ve come up with is a hand-held thing that I like to think of as a Tricorder for electronics (you do remember Spock’s Tricorder from Star Trek, right?), which I’m calling an Electronic Sensor and Recorder, or ESR. If you can think of a better name, by all means let me know in the comments. Right now it’s in the early stages. I’ve found a nice little color LCD display, a keypad, and a case to house it all. The test fixture for the display is shown below:


The data display is just a demonstration prototype at this point. It’s displaying random data that changes at a 1 Hz rate, and the date/time fields at the bottom are not filled in. I intend to incorporate a real-time clock into the design so I can get accurate timestamps for the data it collects.

The plastic box under the display is a really nice enclosure that I found on eBay for Uno/Leonardo R2 and R3 size Arduino boards. I stuck a small solderless breadboard block onto this one so I could use it for quick prototyping. I’ve been merrily stuffing my Arduino boards into these and building up a herd of the things. The enclosure has some clear plastic bits inside that transfer the light from the LEDs on the PCB up to the front (very clever, actually), it comes with a plastic “key” to reach the reset button, and it also has cutouts on the back for hanging it on a wall (I already have some ideas in mind for that). You can order your own from here, and they go for around $4 each. In a future posting I will describe what I discovered about using these little boxes effectively, since there are a few caveats to keep in mind.

The case I’ve selected for the ESR is shown below. I’ve mounted the keypad temporarily, and yes, the keypad is massively ugly. But after spending a lot of time trying to find keypads that looked like calculators instead of telephones, I came to the sad conclusion that these simply don’t exist as commodity modules. They are all custom made for a specific application. Perhaps some clever engineer in China can come up with a compact keypad like the ones found on calculators as a stand-alone module. I would definitely buy a bunch of them, and I suspect a lot of other people would as well.


The keypad looks like it’s tilted, but it’s really not. It looks that way because the bottom cut was a bit off and the two bottom corners aren’t right angles. That’s what I get for not aligning and securing things at the outset on the X-Y table I used to do this. The cover slipped slightly while I was making the cut and I didn’t notice it. A black front cover piece of thin plastic will hide this. There is a piece of dark paper covering the hole where the LCD will be mounted, mainly to keep the screws and other bits inside from falling out.

The enclosure is about 25 mm high at the front end, and about 38 mm high at the rear. It’s a two-piece design, and the bottom half is a consistent 18 mm deep. Four self-tapping screws (supplied) hold it all together, but you will need to add your own rubber feet if you want them. The self-adhesive types work well, provided that you add a small drop of additional epoxy glue to each one first.

If you’re curious, the enclosure is a Serpac 15-S, and it’s available for a little over $8 from Mouser. Serpac makes a lot of small enclosures like this, so if you don’t like my selection then I would recommend browsing through what is available. And, of course, there’s always eBay. This just happened to be handy, and it looked like a good choice.

When it’s finished there will be some buttons to the right of the display for function control. I haven’t decided yet if I want to incorporate a rotary control, mainly because I don’t want the knob jutting up above the front panel. If I can come up with a way to mount it so only part of a thumbwheel disk protrudes through the side of the enclosure, then I might give that a try. In the meantime I can use pushbuttons and the keypad to control the gadget.

For labeling I’m going to attempt to use a 1W CNC laser engraver, like the one shown below from GearBest:


This isn’t a heavy-duty thing, by any stretch, but at 1W output it does a decent job with most plastics (PVC, ABS, polystyrene, etc.) as well as wood and cardboard. It will not cut anything except paper or thin balsa, and it doesn’t work with metal. The control software is a bit wonky, and it doesn’t have the ability to do G-code, it just raster scans an image onto the surface of the material. The working area is also somewhat constrained (3.8 by 3.8 cm), but I can position the work piece so that the ends hang out, and there is some space inside to slide it over if necessary. It’s actually built from what look like the innards of disk drives, so that’s what sets the maximum physical work area. The table only moves in one axis (front to rear), so as long as I can fit whatever I’m burning into the frame and still get the laser where it needs to go I’m OK.

You can find out more about the engraver from the GearBest web site. I also have a more detailed write-up on it here.

I’ll use a piece of thin black plastic over the front panel with suitable cut-outs for the display, buttons, and keypad. This will also work out well after it’s been lettered with the laser engraver, because the channels left by the laser can be filled with white paint and the whole surface then sanded and buffed smooth. White letters on a black background will look nice.

The preliminary design for the front panel is shown below:


This is by no means a final design. I’m sure it will change as I figure out more things for the device to do and try to find clever ways to make it controllable. For example, there is a blank area between the buttons and the keypad that is begging for a small display of some type. I have some 0.2″ 7-segment LEDs on order, and when they show up I’ll see if I can do something with that unused real estate. The space between the LCD and the keypad might accommodate some surface-mount LEDs, if there is a need for them.

There will also be connectors mounted in the tall end of the enclosure. The current plan is to use a DB-25 for the signal I/O, a barrel type power connector, a type B USB connector, and a power switch. The preliminary rear view is shown below:


The space below the power switch might be useful for an additional connector, if I want to include RS-485, which I probably will. That will allow the ESR to send and receive data using Modbus or some other standard protocol. Now I just need to decide on the type of connector to use–there isn’t enough space left over for a DB-9.

For the internals I’ll be using the Arduino Nano. While the full-size R2 and R3 boards are fine, they are often too large for the things I want to build. For this project I only need the functionality of the AVR, and I don’t really care about the headers on the larger boards. Nice for prototyping, but they get in the way when trying to wedge things into a small space. The Nano can be soldered directly to a PCB, and depending on the pins used it is possible to put components on the PCB under the Nano. Of course, that means a custom PCB, but that’s not really such a big deal these days, what with free layout tools and low-cost fabrication services.

Internally, the ESR will utilize two Arduino Nano boards mounted on a main PCB. The block diagram below shows the preliminary design concept. The real-time clock isn’t shown.


One Nano will handle the user interface and the communications with the outside world, the other will do the data acquisition, signal generation, and logging to a MicroSD flash memory module. The interface Nano will be busy, and most, if not all, of its I/O ports will be in use. The second Nano will be able to focus on the data, and take directions from the first Nano. The data Nano will also have input/output protection to help prevent frying the AVR microcontroller. This is what will take up a lot of the area on the main PCB.

The RS-485 will be capable of full duplex operation, but it will also also work in half-duplex mode. This will be a configuration parameter. You might be surprised to see a Bluetooth module in the design, but this is a very handy feature and significantly extends the capabilities of the ESR. With a smart phone and an app like the Bluetooth electronics from Keuwl (as described in an earlier posting), you can control all the functions of the ESR from a phone or tablet. More information about the Keuwl app can be found here.

Lastly, I plan to include a Li-Ion cellphone battery, or something similar. I have accumulated multiple cellphone batteries in good condition, but I’m encountering a challenge trying to find a generic battery holder for them. Although they are all about the same size, it seems that each manufacturer feels compelled to use a unique connector configuration. Yes, this is profoundly stupid and serves no real purpose except to lock consumers into one vendor’s batteries, but I’m still hoping that I can find or devise a solution. If it comes down to it I can always use a battery pack from a cordless phone or a quad-copter, but space-wise the cell phone battery would be ideal.

Programming this will be something of a challenge. The Nano uses an ATMega328, which has only 32K of flash, 2K of SRAM, and 1K of EEPROM. The Nano is clocked at 16 MHz, which should be sufficient to allow for analog and digital input samples at up to a target of 1000 Hz without pushing the AVR too hard. In free-running mode the AVR ADC has a 65 us conversion time, or about 15 KHz. 1000 Hz is 1 ms per sample, which for a 16 MHz AVR is roughly equivalent to about 1,000,000 CPU cycles (most AVR instructions execute in 1 clock cycle). Assuming the microSD flash latency isn’t too bad, I should be able to catch, log, and display events without dropping things on the floor. It will be interesting to see what the actual performance limits really are, and I will use the display prototype to do just that in a week or so.

The control Nano will need to be able to handle USB I/O, RS-485 I/O, user control inputs, the Bluetooth interface, and the LCD display. The only function in this list that isn’t an asynchronous event is the LCD display, so the code for the control Nano will need to utilize multiple interrupts. The LCD uses an SPI interface, so it isn’t the fastest thing around, but that also means I may want to move the microSD from the data acquisition Nano to the control Nano, and free up some pins on the data acquisition Nano.

This posting is, in effect, a statement of work (or, user requirements, if you are used to thinking of it that way). I will be generating a set of functional requirements Real Soon Now to help guide the development and eventual testing, and I’m sure things will change as the design evolves. It always does.

Well, that’s it for this part. In Part 2 I’ll go into the details of the physical construction, and Part 3 will cover the programming and usage of the ESR. If there is enough interest in the circuit design and PCB layout I may need to insert an additional post or two, but we’ll play that by ear as we go.

4 Responses to “New series: Arduino Test Equipment”

  1. 1 Jona January 3, 2017 at 6:17 pm

    Hola! I’ve been reading your site for a long time now and finally got the bravery
    to go ahead and give you a shout out from
    Houston Tx! Just wanted to say keep up the excellent work!

  2. 2 Jim January 6, 2017 at 2:31 am

    Way cool! Some extremely valid points! I appreciate you writing this article and the rest of
    the website is really good.

  3. 3 cửa gỗ công nghiệp sagaco January 11, 2017 at 12:13 pm

    What’s up, just wanted to say, I loved this article.
    It was helpful. Keep on posting!

  1. 1 The ESR electronics Tricorder: Update | Crankycode Trackback on January 18, 2017 at 11:47 am

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow Crankycode on

Little Buddy

An awesome little friend

Jordi the Sheltie passed away in 2008 at the ripe old age of 14. He was the most awesome dog I've ever known.

%d bloggers like this: