Work In Progress!

vLabtool V2

python powered instrumentation

Python Powered Scientific Instrumentation tool

A multi purpose lab tool accessible by simple Python functions, and capable of studying a wide range of physical phenomena.

Featured on Hackaday.com

Here.

A common theme in The Hackaday Prize and Hackaday.io in general is tools to make more tools. There are a lot of people out there trying to make the next Bus Pirate, and simply measuring things is the first step towards automating a house or creating the next great blinkey invention.

In what is probably the most capable measurement system in the running for this year’s Hackaday Prize, [jithin] is working on a Python Powered Scientific Instrumentation Tool. It’s a microcontroller-powered box containing just about every imaginable benchtop electronics tool, from constant current supplies, LCR meters, waveform generators, frequency counters, and a logic analyzer.

This project is stuffed to the gills with just about every electronic tool imaginable; there are programmable gain amplifiers, voltage references, DACs and constant current sources, opamps and comparators, all connected to a bunch of banana jacks. All of these components are tied up in a nifty Python framework, allowing a bunch of measurements to be taken by a single box.

If that’s not enough, [jithin] is also working on wireless extension nodes for this box to get data from multiple acquisition points where wires would be unfeasible. This feature uses a NRF24L01+ radio module; it’s more than enough bandwidth for a lot of sensors, and there’s enough space all the wireless sensors you would ever need.

Abstract

Software control of data acquisition equipment allows a much finer control over events that govern an experiment. Timing tasks that are impossible to achieve manually, can be easily taken care of with a few lines of code that control hardware, and physical parameters can also be polled at precise intervals, and processed immediately in order to dictate further events. Inexpensive microcontrollers, most of which are capable of sub microsecond response times, and feature numerous communication channels, are aptly suited for deploying more sophisticated control over scientifi c data acquisition and control tasks.

With the addition of a few peripherals such as analog gains, waveform generators etc., a microcontroller running appropriate control logic can be treated as a slave control unit that can be addressed over USB or a similar available communication pathway in order to conduct an experiment.

Presenting an open-hardware, tested framework on these lines, with a peripheral set aimed at undergraduate level experiments, and an accompanying Python library for measuring parameters such as voltages, frequencies, capacitances, and time intervals, and controlling wave generators, digital outputs, current sources etc. The inputs can accommodate a wide array of sensors dealing with physical parameters such as temperature, pressure, acceleration, luminous intensity etc.

Communication is taken care of by Pyserial, and graph plotting is handled by PyQtgraph[1] due its immense exibility and speed. Since the Python program is in charge of any extracted data, its vast computational resources can be used to seamlessly extract meaningful physical data. This device is built along the lines of ExpEYES [2], but with a wider feature set

Watch a 2 minute intro Video

 

 

A few Experiments carried out using just this setup and a PC
  • Measuring the forward threshold voltage of a diode, and studying the effect of temperature on the band gap.

    Several IV plots were obtained and plotted along a third axis as a 3D line plot. The diode was heated somewhere in the middle of the acquisition ( notice the inflection point ), and this added thermal energy changes the band gap, causing the threshold voltage to drop.

  • An op-amp based multiple-feedback band pass filter was made with values calculated from simulation tools available at http://sim.okawa-denshi.jp/en/OPtazyuLowkeisan.htm . The transfer function was experimentally determined using the device’s waveform generator, oscilloscope, and curve fitting routines from scipy.

    *The PIC1572 based PWM waveform generators used in this video have since been replaced with a high resolution DDS, the AD9833 (0-2MHz, 0.04Hz resolution ).

  • Inexpensive wireless nodes with unique addresses can be used to implement mesh networks for data collection. The wireless nodes are configured to use 3 byte addresses, and this leaves plenty of room for multiple sensing points/parameters.

    The MPU-6050( accelerometer + gyro + temperature sensor) is used in the above video, the data transmitted back is being plotted in real time.

  • The inductance of a solenoid depends on the properties of its core. Adding a ferromagnetic material will raise it, and a diamagnetic material will do the opposite.

    The Inductance meter on the device simply pairs the externally plugged in inductor with a high stability capacitor on the inside. The resultant tank circuit is driven at its resonant frequency which is measured by the frequency counter.

    In the above video, about 6000 discrete datapoints are obtained from an approximately 1cm displacement. After considering electrical noise, a resolution of about 10 microns can be obtained with this simple setup

Full List of Features

The following is a list of currently implemented features

  • Four Channel Oscilloscope
    • 10-bit resolution. 1Mohm impedance. 1MSPS sampling. Selectable level triggering.
    • Up to 10K samples
    • Up to 14 different selectable inputs with various input ranges and amplifications
    • CH1-CH4 . +/- 16.5V down to +/-500mV .( read via 1x-32x Programmable gain amplifiers) . AC coupling available.
    • CH5-CH9 (0-3.3V . Up to 32x analog gain) . High impedance input of 1e13 ohms(taken from datasheet. Circuit layout may alter this value )
    • IN1 – Connected to Charge Time measurement Unit
    • 5V usb supply monitoring
    • +9V supply output monitoring
    • Programmable constant current source output monitoring
    • Interrupt driven acquisition. Frees up device CPU for accepting additional commands and processing them based on when the oscilloscope permits. Unless the scope is running at maximum capture speed, additional measurements and control tasks can be executed. The LCR circuit response experiment is an example that uses this
  • 12-bit voltage measurement with 16 sample averaging on all the above channels. Waveform capture with up to 400KSPS.
  • Four Channel Logic Analyzer
    • Selectable inputs ID1,ID2,ID3,ID4, and CH4( internal comparator)
    • 32-bit counters for 2-channel acquisition ( up to 67 seconds between each level change at maximum resolution. 16-bit counters for four channel acquisition (up to 1mS delay between each level change before overflow occurs during maximum resolution. Clock can be scaled down to increase this delay to 250mS
    • Edges to be recorded can be selected for each input. [ Falling edges, rising edges, all edges etc.]
    • Edge triggering via any of the inputs as well as analog input CH4 via a configurable internal comparator
    • Driven entirely by DMA. This essentially means that the device is free to accept other commands once the Logic Analyzer has been started. It runs in the background, independent of the CPU.
  • 2 x 28-bit phase correlated Sine/Triangular Waveform generators with bipolar outputs
    • Based on AD9833 DDS . Allows Sine/Triangular outputs
    • Default input Clock of 8MHz results in about 0.03Hz resolution from 0MHz-1MHz. The Input clock can be reduced further in order to achieve higher resolution (1MHz => 0.004Hz resolution ).
    • 12-bit control over phase difference between each
    • Two frequency registers per wavegen. The DDS can be instructed to switch between these two for applications such as Frequency Shift Keying(FSK).
    • Amplitude control via an external potentiometer (0-+/-3.3V)
  • 4 x Digital outputs which can also be configured as PWM outputs with phase and duty cycle control. Can also be used to control up to four servo motors.
  • Frequency Counter Up to 64MHz
  • 3 x 12-bit Programmable Voltage sources with ranges 0-3.3V, +/-3.3V, +/-5V.
  • 1 x 12-bit Programmable Constant Current source up to 3.3mA
  • Capacitance meter from a few PicoFarads (Using the CTMU [Constant Current Charging] ) , up to a few microFarads via constant voltage charging.
  • Inductance meter that uses a tank circuit with a 1nF capacitor to generate a corresponding frequency which is then measured by the frequency counter to calculate the inductance. A solenoid with a movable core can be used as a high precision position sensor here ( resolutions < 10 microns ) .
  • Serial Peripheral Interface (SPI)
    • Full software control over frequency ( Up to 32Mhz ), and modes
    • 8-bit / 16-bit write
    • 2-Dedicated chip selects. Four more can be leveraged using the digital outputs
    • Tested with a variety of add-on boards and sensors such as MCP6S21(PGA), AD9833 (waveform generator) , NRF24L01+ ( 2MbPS digital radio with up to 5-BYTE address, auto-acknowledge and 32 byte payloads. Wireless Add-ons planned ) etc
  • Inter Integrated Circuit (I2C) port
    • Configurable clock frequency
    • Port scan
    • Tested with a variety of sensors such as MPU6050(accel+gyro+temp sensor), HMC5883L(magnetometer), BMP80 (Altimeter), MCP4728(12-bit DAC), SSD1306(128×64 OLED).
  • Provision for ESP-12 WiFi on the circuit board . This requires reprogramming the ESP8266, as well as disconnecting the MCP2200 USB-Serial convertor. Addditional 5V power supply must be provided either from a bench top, or a USB charger.
  • 24-bit RGB status indicator LED with daisy chain output for driving additional WS2812 units
  • 500mA polymer fuse to protect USB ports
  • High stability Voltage reference.
  • +/- 9V outputs for powering bipolar devices
  • TP4056 lithium ion charging IC
  • PCB pads for directly connecting the device with a raspberry pi either via its UART output, or by dedicating one of its four USB ports
  • The Firmware includes hardcoded functions to interface with the following sensors/hardware that can be connnected to the expansion slots
    • HX711 24-bit weighing sensor – It has two fully differential channels with 32x,64x,128x Programmable gain amplifiers.
    • NRF24L01+ 2,4GHz radio – Capable of sending packets at speeds up to 2MbPS, with 5 byte addressing, and automatic error correction and acknowledge. This will be instrumental in implementing wireless sensor networks
    • AM2302 Humidity + Temperature sensor
    • TCD1304 – Linear optical array with 1348 pixels, and customizable integration times
    • HCSR04 distance sensor


Software

  • Python Library. A rough draft of the Programmer’s manual can be found at http://pythonhosted.org/LabtoolSuite/interface.html
  • Qt based GUIs for oscilloscope, logic analyzer, peripheral control, data streaming etc are part of the package.
  • Several GUI are being developed towards setting up a standard set of experiments for beginners.
  • Framework for quickly setting up dedicated GUIs .
  • Python takes care of third order calibration, curve-fitting, and other complex data analysis


Licenses

Python – GNU GPL compatible

Python-qt4 – GPL ( As long as everything built on top of it is also open-source )

PyQtGraph – MIT licence

iPython – BSD License

All Python based apps and software designed for this project : GPL-v3

Schematics – GPL-v3

Firmware – Closed Source Until further notice.


A few notes

This project was started with the objective of providing an affordable, yet versatile collection of measurement and control tools for the curious ones among us.

To put it simply, it uses a microcontroller with a fairly powerful set of peripherals, and complements it with a variety of analog and digital tools such as programmable gain amplifiers, waveform generators, LCR meter, CC sources etc. All functionality is controlled via a Python module that runs on the PC to which the device is connected via USB. Digital communication ports allow addition of add-on boards.

A flexible set of tools have been packed into one tightly integrated unit in order to enable students to explore experiments across the sciences.

The hardware is supplemented by powerful Python modules like Scipy whose data processing abilities help extract meaningful parameters from the acquired data

A more compact variant with a lower bill of materials can be found here


Bode Plot experiment

I2C sensor add-ons

Tinkering with 555, IR and distance sensors

Amplitude Modulation with AD633