Fork me on GitHub

Project Notes

#391 MilliVoltmeterDIY Custom PCB and Enclosure

Custom PCB and enclosure for the ATmega328-based millivolt meter based on a design by Scullcom Hobby Electronics. Uses an LTC2400 ADC and LT1019 voltage reference

Build

Notes

This is a continuation of LEAP#372 MilliVoltmeterDIY, a circuit based on the Scullcom Hobby Electronics #44 - Millivolt Meter MK2 project.

Previously, I reached the point of modifying the design somewhat, revising the code and having a breadboard prototype working just fine. Since it is such a handy piece of kit, I decided to go the whole hog: make a PCB and mount it in a case.

Update: I’ve added battery by-pass and reverse polarity protection - see the last section of this document.

PCB Design

I’m going to drop an ATmega328P-AU TQFP on the board, rather than use an Arduino module. So let’s get some pin mapping stright first:

Arduino Pin Connection ATmega pin
D2 DB7 serial LCD 32, PD2
D3 DB6 serial LCD 1, PD3
D4 DB5 serial LCD 2, PD4
D5 DB4 serial LCD 9, PD5
D6 E serial LCD enable 10, PD6
D7 RS serial LCD 11, PD7
D8 BTN_2_FUNCTION function button 12, PB0
D9 BTN_PRECISION precision button 13, PB1
D10 CS - ADC SPI select 14, PB2
D10 MOSI - ICSP header 15, PB3
D12 MISO - ADC SPI SDA, ICSP 16, PB4
D13 SCK - ADC SPI clock, ICSP 17, PB5
A0 BTN_CAL calibration button 23, PC0
A1 VBATT_SENSE battery sensor 24, PC1
A4 SDA optional I²C screen 27, PC4
A5 SCL optional I²C screen 28, PC5
RESET ICSP header 29, PC6
  VCC 4, 6
  GND 3, 5, 21
  AVCC 18
  XTAL 7, PB6
  XTAL 8, PB7

I decided to provision pin connections for either serial or I²C LCD displays.

After finding that KiCad didn’t have footprints for half the components I wanted to use in the standard library, I decided to try EasyEDA for PCB production:

  • the component library is very complete (I didn’t need to create any custom components)
  • but the PCB designer is not quite as advanced as KiCad. Workable though.

The EasyEDA project is available here, and I sent the board off to OSHpark. The OSHPark project is available here.

CustomBoardAndEnclosure_schematic

pcb_render_front

pcb_render_rear

The boards have arrived! All traces and pads check-out perfectly.

pcb_blanks

Mostly hot-air for surface-mount components, but through-hole for:

  • connectors - I decided to use simple male header pins in this build (instead of soldering wires direct to the board)
  • ICSP header and shroud
  • trim pot

pcb_populated

Dang! This is when I realise I forgot the 50Hz/60Hz noise rejection jumper.

Enclosure and Hardware

I’m using a 140mm x 110mm x 42mm black plastic project enclosure. As a bonus it comes with 4 screw-on rubber feet.

I picked this up while browsing in Sim Lim Tower (Singapore). There is no manufacturer identification, but I suspect it may be the Future Kit FB16.

Control Buttons

I’m using some 7mm normally closed momentary push-buttons similar to these from an aliexpress seller

hw_pb_switch

Input Jacks

I decided to use a nice dual banana binding post for the positive and negative test lead connector, like this example from a seller on aliexpress

I have Multimeter Dual Test Hook Clip to Male Banana Plug Cable that matches perfectly.

I’m maybe having second thoughts about this. If I’d used for example some 4mm Banana Female Jack Socket Panel Mount then I could use most of my multimeter test leads with the unit.

hw_input_jacks

DC Socket

On the rear panel I have a 5.5x2.1mm DC Power Socket Connector Round Panel Mounting to take external 9V DC supply (centre positive), and a SPST 2PIN ON/OFF G130 Rocker Switch 3A/250V. There is no reverse polarity protection in the circuit yet, so maybe I should just throw a diode in series. There’s a perfect spot for it: connecting the power to the switch.

hw_power_connectors

Calibration Test Point

I fashioned a loop of copper wire, soldered to a 1x3 piece of protoboard on the rear. It is positioned just next to the positive input jack.

Code and Programming

The unit is programmed with the MilliVoltmeterDIY.ino sketch and associated libraries.

Only one modification was required. As I’m using normally-closed pushbutttons, the button state logic is declared as active-high:

#define BUTTON_LOGIC_ACTIVE_STATE          (HIGH)

I used an Arduino as ISP to:

  • burn bootloader
  • upload the code

See LEAP#068 ATmegaViaArduinoISP for notes on programming with Arduino ISP.

Assembly

There’s lots of room in this enclosure, so it all goes in very well. Immediately I see a few things that could be better if I’d planned the construction properly when designing the board. If I were to do it again:

  • I should reverse the LCD serial connectors, so they don’t need to cross when connecting to the LCD
  • the push-button connectors would be better positioned on the other side of the board
  • mounting holes I made in the PCB should have been larger! The screws provided with the enclosure are a size too big… so I just hot-glued the board in place.

assembly_top

assembly_inner_front

assembly_inner_rear

Done and Tested

Calibrating with the 2.5V reference voltage:

  • connect the positive input to the 2.5V calibration test point and press the Calibrate button. The calibration factor is stored in EEPROM and reloaded on startup.

CustomBoardAndEnclosure_calibration

The function button cycles between 3 display modes on the second line:

  • bar graph
  • hold value
  • raw ADC value

The precision button cycles through the number of significant digits to display.

Rear view:

CustomBoardAndEnclosure_rear

With a simple voltage-divider test load:

CustomBoardAndEnclosure_build

Battery By-pass and Reverse Polarity Mod

After the initial build, there were two enhancements I wanted to make:

  • more flexible power supply: internal battery for portable use. The power socket has bypass connector, so this is easy to add.
  • reverse polarity protection, to avoid issues with centre-positive/centre-negative connectors

I’ve just added these, having got hold of some 9V battery holders designed for panel mounting…

Battery_mod

The battery is wired up with the negative connection to the bypass connector on the panel jack. I added a 1N5819 rectifier diode in series to the power switch for reverse-polarity protection.

All installed:

Battery_mod_installed

Rear panel now has power switch, external power supply jack, and 9V battery holder:

Battery_mod_CustomBoardAndEnclosure_rear

Conclusion

All told, this turned out pretty well, though there are a couple of things I would change if I were to do it again:

  • some changes to the PCB as mentioned above:
    • flip the LCD serial connectors, so they don’t need to cross when connecting to the LCD
    • the push-button connectors would be better positioned on the other side of the board
    • larger (M3) mounting holes
  • I think I’d switch from binding posts to shrouded banana sockets for the input jacks (compatible with most multimeter leads)
  • perhaps a mains AC supply adapter built-into the unit

Credits and References

About LEAP#391 ATmegaADCToolsTest Equipment
Project Source on GitHub Project Gallery Return to the LEAP Catalog

This page is a web-friendly rendering of my project notes shared in the LEAP GitHub repository.

LEAP is just my personal collection of projects, usually involving an Arduino or other microprocessor in one way or another. Some are full-blown projects, while many are trivial breadboard experiments, intended to learn and explore something interesting (IMHO!).

The projects are usually inspired by things found wild on the net, or ideas from the sources such as:

Feel free to borrow liberally, and if you spot any issues do let me know. See the individual projects for credits where due. There are even now a few projects contributed by others - send your own over in a pull request if you would also like to add to this collection.