EEVblog Electronics Community Forum

Products => Test Equipment => Topic started by: melka on May 15, 2014, 03:47:22 pm

Title: Another UT61E modding thread
Post by: melka on May 15, 2014, 03:47:22 pm
Hi all, new member on the forum here.
Since I'm cheap and don't do high end electronics, I ordered a UT61E on aliexpress. It cost me 35.88€ with free shipping to France, and I received it about a month later.
For anyone interested, the current listing is here (http://www.aliexpress.com/item/UNI-T-UT-61E-Modern-Digital-Multimeters-UT61E-AC-DC-Meter/548923745.html), at $48.5 / piece.
The meter came with the RS232 cable, so I tried using it right away, but the lack of MacOS software limited me to testing a few stuff on a Ubuntu VM. Seemed to work, but I will not be booting another OS just to get readings from the meter.

- First problem came from my old dumpster-diving saved USB-Serial converter. It's based on the Prolific PL2303 chip, and the drivers from the vendor were just spouting nonsense, the messages seemed to be formatted well but there was an encoding problem of some sort... I used the Nozap PL2303 drivers (http://nozap.me/driver/osxpl2303/index.html), and I could get the data in a serial terminal soft (CoolTerm) without a problem.

- Second : there's a blatant lack of MacOS DMM software. QtDMM can run, but it doesn't include the protocol decoder for the ES51922 chip the meter uses. I tried recompiling it but having never worked with Qt, what I could gather is that it was made with Qt3, then ported to Qt4, and the current version is Qt5. I spent a few hours on it but I then abandoned, being faced with numerous compile errors and stuff. I then tried to run UltraDMM with Wine, but once again, no go. Sigrok under Ubuntu was able to connect and spout some data from the meter, but I couldn't find a GUI for DMMs, just PulseView (which, if I'm correct, is only for logic analyzers), and I wasn't able to compile sigrok-cli under MacOS or install it with brew either...
So I started coding a small utility under Java / Processing. It still needs a shitload of work, but I'll try to make it cleaner, less buggy and put it on GitHub if people are interested, just let me know.

- Third, I put a small DIP ATTiny2313 in there to retain the yellow / blue button original functions, but also add switches for max/min, RS232 and backlight. Currently (when it works, looks like my soldering is not up to par and I got shorts or something once I closed the meter back), a long press (> 1 second) on the yellow buttons switches the backlight, long presses on the blue switchs through the max / max / maxmin / maxmin off functions, and an extra long (> 2 seconds) on the blue switches the RS232 output. The code is done using the arduino tiny core, running at 8MHz on the internal oscillator. I'll try to take pics of the solder points etc... but the wiring is mostly the same as mjlorton's project (http://mjlorton.com/forum/index.php?topic=284.0). Tiny was programmed using an chinese USBASP.

Heres my shitty code with broken interrupts and way too much overhead :
Code: [Select]
/*

UT61E.ino
melka@blaste.net
===============================
Small sketch to use the blue and yellow button to switch various "blocked" functions.
For the backlight to work, use a NPN transitor (BC547) in this configuration

  VB+
   |
   _
  | | RES
  |_|
   |
   _
   V LED 1
     |
   _
   V LED 2
   |
ES51922_BKOUT (might need a resistor) ---|< BC547
         |
         |
          GND
WIRING

   TINY 2313
   –––––––––
x| |VCC +3V
x| |x
x| |x
x| |x
    x| |BLUE SELECTOUT PORTB.4
Pin 4  SELECTIN ORANGE| |RED VAHZOUT PORTB.3
Pin 5 VAHZBIN BLACK| |YELLOW RS232 PORTB.2
x| |GREEN MAXMIN PORTB.1
x| |WHITE BKLIT PORTB.0
VB-    GND| |x
   –––––––––
*/

#define BKLIT PB0 // WHITE
#define MAXMIN PB1 // GREEN
#define RS232 PB2 // YELLOW
#define VAHZOUT PB3 // RED
#define SELECTOUT PB4 // BLUE

#define SELECTIN 4 // ORANGE
#define VAHZIN 5 // BLACK

#define SWITCHDELAY 50 // Delay in ms for pulsing the outputs
#define OFFDELAY 1100 // Delay in ms for switching off the maxmin function

boolean RS232_ENABLED = false;

// Vars to hold the state of the 2 input buttons
int stateSELECT = HIGH;
int shortSELECT = LOW;
int longSELECT = LOW;
int extraSELECT = LOW;
unsigned long startSELECT;
unsigned long endSELECT;

int stateVAHZ = HIGH;
int shortVAHZ = LOW;
int longVAHZ = LOW;
unsigned long startVAHZ;
unsigned long endVAHZ;

// Function to pulse the outputs to LOW
void switchPIN(uint8_t PINNUMBER,int DELAY) {
PORTB &= ~_BV(PINNUMBER);
delay(DELAY);
PORTB |= _BV(PINNUMBER);
}

int MAXMININDEX = 0;
void cycleMAXMIN() {
if (MAXMININDEX <= 2) {
switchPIN(MAXMIN,SWITCHDELAY);
MAXMININDEX++;
} else {
switchPIN(MAXMIN,OFFDELAY);
MAXMININDEX = 0;
}
}

// To switch RS232 on, the RS232 pin on the ES51922 must be pulled LOW,
// and left high to disable it.
// TODO : check if pin high disables the auto power off, in which case,
// make output floating.
void switchRS232 () {
if (RS232_ENABLED) {
RS232_ENABLED = false;
PORTB |= _BV(RS232);
} else {
RS232_ENABLED = true;
PORTB &= ~_BV(RS232);
}
}

// Interrupt function for the yellow button
void ISR_VAHZIN() {
  if(digitalRead(VAHZIN) == LOW && stateVAHZ == HIGH) {
  startVAHZ = millis();
  stateVAHZ = LOW;
}
if(digitalRead(VAHZIN) == HIGH && stateVAHZ == LOW) {
  endVAHZ = millis();
  shortVAHZ = LOW;
  longVAHZ = LOW;
  if((endVAHZ - startVAHZ) > 30 && (endVAHZ - startVAHZ) < 500) {
    shortVAHZ = HIGH;
  } else if((endVAHZ - startVAHZ) >= 1000 && (endVAHZ - startVAHZ) < 2000) {
    longVAHZ = HIGH;
  }
  stateVAHZ = HIGH;
}
}

// Interrupt function for the blue button
void ISR_SELECT() {
if(digitalRead(SELECTIN) == LOW && stateSELECT == HIGH) {
  startSELECT = millis();
  stateSELECT = LOW;
}
if(digitalRead(SELECTIN) == HIGH && stateSELECT == LOW) {
  endSELECT = millis();
  shortSELECT = LOW;
  longSELECT = LOW;
  extraSELECT = LOW;
  if((endSELECT - startSELECT) > 30 && (endSELECT - startSELECT) < 500) {
    shortSELECT = HIGH;
  } else if((endSELECT - startSELECT) >= 1000 && (endSELECT - startSELECT) < 2000) {
    longSELECT = HIGH;
  } else if ((endSELECT - startSELECT) > 2000) {
  extraSELECT = HIGH;
  }
  stateSELECT = HIGH;
}
}

void setup() {
// Set ports as output and pull high
DDRB |= B00011111;
PORTB |= B00000111;
// Set buttons pins as Input and use internal pullups, then attach interrupts
pinMode(SELECTIN,INPUT_PULLUP);
attachInterrupt(0, ISR_SELECT, CHANGE);
pinMode(VAHZIN,INPUT_PULLUP);
attachInterrupt(1, ISR_VAHZIN, CHANGE);
// Wait for the DMM to boot
delay(2000);
}

void loop() {
    if (shortVAHZ == HIGH && longSELECT == LOW) {
switchPIN(VAHZOUT,SWITCHDELAY);
shortVAHZ = LOW;
};

if (longVAHZ == HIGH) {
switchPIN(BKLIT,SWITCHDELAY);
longVAHZ = LOW;
};

if (shortSELECT == HIGH && shortVAHZ == LOW) {
switchPIN(SELECTOUT,SWITCHDELAY);
shortSELECT = LOW;
};

if (longSELECT == HIGH && shortVAHZ == LOW && longVAHZ == LOW) {
cycleMAXMIN();
longSELECT = LOW;
};

if (extraSELECT == HIGH) {
switchRS232();
extraSELECT = LOW;
}
}

Title: Re: Another UT61E modding thread
Post by: simonmc on May 15, 2014, 08:29:56 pm
This looks interesting. I'm expecting a ut61e in the post soon, as well as a ut136b for my daughter. I had a vague feeling the arduino enviroment could be used to program other amtel chips, but this post made me actually have a look how. This seems it could be very useful to me. Thanks for making me 'get off my butt' and look it up!
Title: Re: Another UT61E modding thread
Post by: melka on May 16, 2014, 08:08:46 am
Hey simon, glad to hear my post was useful in some way.
As I said, you can flash a shitload of different AVRs with a usbasp (http://www.fischl.de/usbasp/). I bought mine for something like 3$ shipped on ebay a couple years ago, and it still works... This thing is pretty handy if you want to use a smaller IC like a tiny85. Since a couple versions at least, the Arduino IDE supports uploading your code with the usbasp, but if you want to work with smaller chip, you'll need to install the tiny-core (https://code.google.com/p/arduino-tiny/) & you might need to check the fuses with another tool (command line avrdude, or on macosx, AVRfuses, a nice little GUI for avrdude) before your first upload. Don't remember the exact details but I think it's something about small chips like the tiny being set with a low clock or something at the factory, and it's too slow for burning the flash, something like that, don't remember...
Or you can just use your Arduino as a programmer  (http://arduino.cc/en/Tutorial/ArduinoISP).
Just to get you a bit more fired up, for non-timing critical projects, you can just use the IC with power, a decoupling capacitor, and that's about it... When you start working with small 8 pin SOIC chips (hotplate soldering FTW), it becomes real interesting :)
Title: Re: Another UT61E modding thread
Post by: simonmc on May 16, 2014, 10:14:57 am
Funnily enough an usbasp is one of the next things im getting. i will have to look into the fuses and such like.