Arduino Portable Workbench Part 3

Introduction: Arduino Portable Workbench Part 3

If you've viewed parts 1, 2 and 2B, then so far there hasn't been much Arduino in this project, but just a few boards wires etc isn't what this is about and the infrastructure part has to be built before the rest works.

This is the electronics and Arduino code. The previous 2B instructable lists the power supply details.

This section kits out the portable workbench with the following features

A TFT touch screen providing a display, driven by an Arduino Mega to provide the following

  1. 8 digital displays, off/on/oscillating
  2. 4 voltage displays
  3. 3 current/voltage displays
  4. E24 resistance meter (because I can no longer read the colour bands)

There'll be other things I'll add, but this was my initial target. The Arduino code also lists a serial display, I2C display, capacitance meter, digital switches and oscilloscope which I'll add as time goes by. Also I haven't quite decided if its worth adding a 3V3 power supply, a variable power supply, or power supply voltage/current monitoring. So far this has been built using the Mega but I'm also looking at moving some of the functions to separate I2C accessed circuits, either dedicated chips or programmed Atmel 328's which will more easily accommodate a different controller.

Supplies

5 x 16 way header sockets

5 x 8 way dupont sockets, actually made from long 40 way single in line sockets cut up to the required length

1 x 3.5" ILI9486 TFT touch screen

1 x Arduino Mega 2650

Individual components

As per the text, the value of some of these aren't absolutely fixed and if you miss out a function won't be needed at all :)

Digital input

16 x 10K resistors

Analogue input

1 x TL074 a quad jfet opamp, this is what I had as a spare, anything similar will do :)

4 x 68K and 4 x 430k resistors used as voltage dividers.

4 x 1N4001 or similar

Resistance meter

1 x TL072 a dual jfet opamp, this is what I had as a spare, anything similar will do :)

1M0, 300k, 100k, 30k, 10k, 3k, 1k, 300R ( If these values are changed the the Arduino code has to be updated)

Step 1: Overview of the Electronics

The grey console was made by me 30 years ago and is still in regular use, but times have moved on. It provides dual power supplies on the left, a central audio amplifier in the middle, with internal speaker, and an oscillator on the left. These days most of my circuits only need the power supply and of that, only the positive rail. Something different was needed, as well as labelling which I've lived without, well I did make it.

The main requirements for the project box electronics was to power newer circuits using Arduino or Raspberry PI's so 5V was essential as were USB sockets. Illuminated switches tell me if the power is on or not, and when testing I regularly have to build small auxiliary circuits to give temporary displays of status. I have a box of bulky meters which use up a lot of bench space and most of all, I need a display I can read easily as my eyesight deteriorates, something with big bright characters. So I need digital displays, voltage meters, current meters, and in this case a little luxury in the form of a resistance meter to quickly identify E24 series resistors, all within 15cm of the project breadboard and in a compact, portable case.

The main PSU, described in a previous article, provides power to the lid using a 40 way ribbon cable enabling the two to be connected while the lid is closed. This provides switched 5v and 12V supplies for the panel electronics and to supply the breadboard.

All power and signal inputs are provided by 2x8way PCB header sockets in parallel with an 8-way dupont socket. This is probably overkill, most breadboards having power rails but it was easy to do.

On the power sockets, the main 0V rail of the power supply is common to all supplies and is made available. Above this is a 5V power supply, switched on the base unit, and above this are two supplied +12V and -12V supplies, which are currently fixed though I have an idea to hack the supply to make it variable and provide a 3.3-20V variable supply.

Step 2: The Electronics

I've posted screen prints of the breadboard layout, what the circuit looks like when built on matrix board, a schematic as a PDF and the original Fritzing files. This isn't particularly complex electronics and is there to mount limiting resistors, buffer amplifiers and fan out connections for the Arduino board. But there are several images to show the many connections a bit more clearly. Most of the wiring was made up from standard lengths of pre-crimped dupont ribbon cable reassembled into multiway housings to make them both easier to re-plug and more reliable.

The Arduino Mega 2650 is mounted in the lid with the USB socket available for programming. It drives the TFT touchscreen used to display all outputs and inputs.

8 digital inputs are made available via a 2 x 8-way PCB header and their status displayed on the screen if that function is selected. This is a simple on/off display, red off, green on. I may add oscillating as a future change.

4 voltage inputs are also made available via the PCB header, and a voltage divider, the voltage displayed on the screen. Each input voltage on the front panel, with reference to the common ground, is passed to a divide by 7 voltage divider and then buffered by one of four op-amps in a TL074 configured as a rectifying amplifier, just to avoid accidents with negative voltages. Would be nice to add a polarity indication at some stage but not this time round. Output from each op-amp is to one of the ADC inputs of the Arduino.

A further PCB header exposes both serial and I2C connections. This was done to allow implementation of a serial display console and a basic I2C identification function.

The voltage/digital inputs may prove to be not all needed so they may be re-configured to provide digital switching outputs.

The Arduino powers a resistance array on a voltage divider to provide a resistance meter functionality. The output of this is buffered by an op-amp (half a TL072) before being read by the Arduino and the resistance calculated. The purpose of this is not accurate resistance measurement but to identify E24 series values quickly, though with some calibration it could be used as a basic meter. It's operation is to detect when a resistance less than 9M9 is present on the two springs mounted on the front panel and then selectively switch 5V to each resistor in the divider array until the value closest to 2.5V is measured or the last resistor selected, a calculation and comparison is then made to determine the E24 value closest. The 5V is sourced from digital outputs 3-10 on the Arduino which are reconfigured as high impedance inputs between each measurement to minimise errors. Arduino pins D3-10 were deliberately used as a future addition might be a capacitance meter using the PWM capability of these outputs which could potentially only be a software change.

A modified INA3221 board provides additional voltage and current measurements via the I2C interface with inputs from the front panel. Everything is wired using jumper cables so that the reassignment of functions will be easy in the future.

Step 3: INA3221 Voltage/current Input

This was intended as a quick fix to provide voltage/current measurements in the box but it turned out that as implemented on the board I bought it was intended to monitor battery charging so had to be modified to provide three independent measurements. If when building this project you can source an INA3221 board which implements this chip as per the datasheet then this isn't necessary.

Looking at the picture, three cuts have to be made in the PCB traces to separate the measurement resistors. The pads for these three resistors also have to be cut to separate them from the rest of the PCB. The resistors are then joined to the pads by soldering additional wires as bridges. I'm documenting this because this is a common board and may be the only one available.

Connections to the board from the front panel are then made via jumper leads across the measurement resistors.

The power for the board is taken from the Arduino 5V pins as is the ground, with the I2C connections going to the electronics PCB.

Step 4: The Display Screen

This was an eBay purchase and available from lots of sources and is an ILI9486 powered display. I found that it ran best with the MCUFRIEND libraries of David Prentice but it does have to be calibrated before use which just required that one of the library examples provided by David is run with the screen connected, follow the instructions on the screen and write down the displayed parameters, inserting into the Arduino_Workstation_v01 code file if different.

For this project a touch screen is essential, it revolves round not having dedicated switches and the facility to just add menus and functions in the future without lots of rewiring.

Step 5: Connecting It Together

The Arduino Mega is located on the LHS of the lid, with its USB and power ports accessible from outside the case. On the RHS next to the Arduino are the electronics mounted on matrix board and above this is mounted the INA3221 board on the rear of the lid.

Also on the rear of the lid at the LHS above the Arduino is a common ground connection board to which all grounds are connected.

As many leads as possible were consolidated together into multiway connectors. This makes plugging the circuits together much easier and reliable, and the mutual support of connectors in a multiway housing provides improved resistance to coming loose. A list of these consolidations follows.

All the connectors were added in a logical manner giving greatest access for making connections with my clumsy fingers, leaving the front panel connections until the end, with the final display connections being passed through the mounting hole to be completed last. The screen was fixed in place with a 3D printed bezel.

Step 6: Consolidated Leads

  1. Voltage and resistance inputs to the Arduino ADC ports, five leads 20cm with individual male connectors on one end consolidated into a six way housing with a gap to accommodate the gap in the Arduino headers.
  2. 4 way 10cm cable from a four way housing to two 2 way housings to connect the voltage pins on the front panel to the circuit board.
  3. 8 way 10cm cable from a 2x4 way male header to a 8-way female header
  4. 4 way 10cm cable from 4 way female housing to 4 way female housing to connect Serial and I2C to front panel
  5. 4 way 10cm cable from 4 way housing to four single connectors to connect INA3221 to front panel
  6. 4 way 20cm cable to connect four way female housing to four way male housing to take Serial and I2C from Arduino to circuit board fan-out.
  7. 8 way 10cm cable from 8 way female housing to 8 way female housing to take digital inputs from front panel to circuit board.
  8. 8 way 10 cm cable to take 8 way female housing to one 3 way male housing and one 5 way male housing to connect the resistance divider to the circuit board. The two housings are used to accommodate the non-standard gap in the headers on the Arduino board.
  9. 2 way 20cm cable to take 2 way female housing to two single male connectors for the INA3221 power supply.
  10. 2 way 10cm cable to take 2-way female housing to two single female housings to connect the third INA3221 monitor connection to the front panel.
  11. 2 way 10cm cable to take 2-way female housing to 2 way female housing to connect the INA3221 to the I2C fanout connections.

Step 7: Arduino Code

This project is based around the Arduino Mega 2650 for the simple reason I wanted a lot of I/O ports dedicated to tasks in a simple format. The libraries for the TFT touchscreen default to supporting the Arduino Uno and have to be edited to support the Mega. Editing the libraries is supported by the original TFT code author, is simple and described in the next step.

Using a touchscreen display is the basis of this part of the project but as the display someone ends up using may be different to the one I used, the code only places hardware specific functions in separate routines so all modifications necessary can be identified.

A working version of the code is included here and will be updated but the most recent updates will be on github.

The main function of the code revolves round the display, each element on the display having an entry in a single array which holds the element type, where on the screen it displays, colour, and additional parameters such as input source. A screenshot of this array with comments is shown above. It also holds a field to control whether it is to be displayed on the screen or not. By editing this array, new features can be added, or features removed. The 'loop' routine of the code runs through this array on a continuous basis, processing each eligible element sequentially and then repeating. There are currently 6 different elements.

Menu elements - these do not display information but when touched execute an associated subroutine, identified in the element parameters

Digital elements - display as a box on the screen as either red or green depending on the status of the associated digital input pin. The example console is wired for 8 digital pins but this can be increased or decreased as desired.

Analogue elements - display an approximate voltage as measured on the associated analogue pin. Four are originally specified.

Precision elements - display input from an external precision volt/current meter module. There are only three of these but a second or third module could be added.

Resistance element - this is a single element displaying the input from the resistance meter.

Touch - this is the only routine that is always executed to detect if the screen has been touched and then make a decision based on what has been touched. ie if a menu item, what does that entail being displayed next.

The screen has three status modes, normal, large and full screen and all elements change their operation depending on the status. The three modes are selectable from the menu by touching an element and the associated menu option.

Normal mode - displays 8 digital inputs, four analogue voltage inputs, three precision elements, the resistance element and four menu elements. Selecting Normal from the menu puts the display into this mode.

Large mode - is selected by touching any of the elements on the screen followed by Large. When selected, that element type is the only type selected and the elements of that type are rearranged to fill the whole screen.

Full screen mode - is selected by touching any of the elements on the screen followed by Full Screen. When selected, that element is the only element displayed and is rearranged to fill the whole screen giving maximum visibility of that one item.

To add additional functionality, the following routines need to be added

'draw' routine which is called to get the information for that element, call the appropriate screen update routine and register the returned touch information

'logic' routine which accepts the information from the draw routine and uses the appropriate screen driver routines to put the information on the screen and return the correct touch information for the area of screen drawn

'setup' routine which is called as part of the Arduino setup

Other routines can be included but there should not be any interdependence between element code, if an element hasn't been enabled then the it's code shouldn't get executed and the simple multifunctional structure retains it's integrity.

Step 8: Editing the Arduino Libraries

The display I used works very well with the Arduino Uno and the base libraries written for it but performs slowly when directly transferred to the Arduino Mega. To correctly drive the display, a different set of data pins have to be used and this change of use has to be setup in the libraries. This is a simple change and was intended by the author. The pictures highlight the changes made.

The two files are stored in the MCUFRIEND_kbv\utility folder as mcufriend_shield.h and mcufriend_special.h. The changes required are first to the 'shield' header file to ensure the first line reads

#define USE_SPECIAL

to ensure that the 'special' header file is loaded.

The 'special' header file must also be updated to ensure that the line

#define USE_MEGA_8BIT_PROTOSHIELD

is uncommented.

These two changes mean that the display code for this display will operate using pins 20-29 on the Arduino Mega instead of the default 3-10 on the Uno.

Step 9: Screen Shots

I've put screen shots here so it is easy to see what the console should be doing. The next section refers to loading the code into the Arduino.

The first screen shows the 'normal' screen with Menus across the top, voltage measurements on the LHS, voltage and current measurements on the RHS and digital pin status along the bottom, red for 'false/low', green for 'true/high'. Finally in the centre is the resistance measurement.

The second screen shows the digital inputs enabled in Large mode, each input clearly displayed.

The third screen shows the voltage inputs in Large mode.

Step 10: Loading the Arduino Code

The code is attached, but as mentioned earlier will be put up to github at some time and the location added here. The main source code file is Arduino_Workbench_v01.ino and the other routines are to provide the various features.

If the libraries have been modified ok and the Arduino Mega2650 has been set as the target platform in the Arduino IDE, then the code should compile first time.

The libraries that will need to be loaded are Adafruit GFX and Touchscreen libraries which should be available from the Arduino library manager, a copy of MCUFRIEND_kbv downloadable from github and for the INA3221, the SwitchDocLabs library SDL_Arduino_INA3221 also downloadable from github, both come up quickly on a google search.

Step 11: Final Touches

The idea is to use it for project work so a removable panel has been made comprising mounting bolts for Arduino boards and a breadboard, the whole attached to the lid by velcro to make them detachable and so that different boards can be made to contain projects and that the box can be reused for different projects running concurrently.

I expect that this will be a source for a few ideas to make something different, better or both. I will be adding the additional features I've mentioned, and adding them in but if this is of any help then please take what you want and enjoy. If there are any glaring issues, then please let me know.

Right now I'm going to be getting on and using it, I've a few projects to work on!

Be the First to Share

    Recommendations

    • Fandom Contest

      Fandom Contest
    • First Time Author Contest

      First Time Author Contest
    • Backyard Contest

      Backyard Contest

    Comments