Author Topic: Metrahit USB-IR DIY interface  (Read 11401 times)

0 Members and 1 Guest are viewing this topic.

Offline eb4eqaTopic starter

  • Regular Contributor
  • *
  • Posts: 98
Metrahit USB-IR DIY interface
« on: April 21, 2013, 10:50:21 am »
Hi All,

I have a Metrahit Energy and I would love to have also the genuine IR-USB Interface, called "USB-Xtra". But I am not willing to spend that huge amount of money on something that should be VERY cheap and that will see little use at my "lab". So I decided to to investigate and try to build something at home.

The small IR led+detector combo that can be seen in Dave's teardown of the meter seemed to be a IRDA module, so the first step was getting one. I had an Agilent DSL1100 IrDA transceiver and also a Texas Instruments TIR1000 interface lying around and decided to give it a try. Here is the story (too little time, no pictures, sorry).

There is a PDF document with the protocol information for the Metrahit Energy, which says it communicates at 38400-8N1, so I needed a 614.4KHz clock(38.4*16). I used a Fluke 6060AN 520MHz RF generator (yes, a bit overkill but I have no other) to output a 1mW sine wave which I converted to TTL simply with an 74HC04 gate with Vcc/2 bias resistor at the input, after a 100nF cap to isolate the generator from DC. This clock is fed to the TIR1000.

I used a FTDI FT232-based USB-RS232 converter to connect the PC to the TIR1000 and wired everything up, including the support electronics for the DSL1100, which requires only a few components (see its datasheet).

As simple as it sounds, everything worked at the first try. The first command the meter replied was the "IDN?<CR><LF>" with a nice string of data, as expected. All other commands specified in the document worked too. This looked even too easy....

What was next? Obvious. Download de MetraWin trial software and give it a try. Did it work? NOPE. I was fearing that it would search for the proprietary interface and give up, but using the Serial Port Monitor tool from Sysinternals, it can be seen sending different identification requests at different speeds over the FT232 converter's serial port. Different meters respond to different identification request commands, and for some (probably good) reason, the "IDN?" command was being sent at 9600bps. That meant the the Metrahit Energy was never going to reply to that. Other id request were sent at 38400 but not the string that the Energy requires. And now?

Well, I thought that maybe the official interface also includes a baud rate converter. So I took a PIC 18F4520 board I had around and wrote a quick program that converts a 9600bps string to 38400 and the other way around. I put in betwee the IRDA transceiver and the FT232 converter and I saw it working perfectly with the Intronix LogicPort (what a wonderful instrument), my converter I mean. The 9600 "IDN?" command was sent at 38400 bps, the meter replied and the converter sent the string back to the PC at 9600. BUT, the Metrawin software refuses to detect the meter.

It may be simply a timing issue or maybe something completely different. Converting from 9600 to 38400 can be done char by char because sending a char at 38400 takes less time that at 9600. But for the reverse conversion, I sotre the complete string (until <CR><LF> is received) and then send it at a time at 9600. This takes a bit of time and it may be that the software times-out.

Anyway, since the interface works with a terminal application, it is just a matter of writing a simple program that does whatever you want to do with the instrument. So I would call this a success, even if the official 30-day evaluation MetraWin software doesn't work. I plan to build a small PCB with a clock generator, IrDA module and transceiver to extract logged data from the instrument. It is easy to plot it with something else.

It would be great to have a genuine a USB X-TRA interface hooked to the logic analyzer, but I will not pay that much for it. Does anyone have one of those? Or at least ideas?

Thanks for reading,
Roberto EB4EQA

 

Offline 0xdeadbeef

  • Super Contributor
  • ***
  • Posts: 1571
  • Country: de
Re: Metrahit USB-IR DIY interface
« Reply #1 on: June 14, 2015, 06:54:02 pm »
I'm aware that I'm digging up a very old thread, but just in case someone else is looking here for this topic, I feel it's the right place to document information regarding the "Starline" Metrahit IR communication.
Anyway, I own a Metrahit X-TRA and always wanted to try the measurement via IR but was to cheap to spend nearly 300€ on the adapter. Back one or two years ago I tried a cheap serial to IrDA adapter from eBay which failed completely and while I figured it would be probably the IrDA bitrate and bought some parts to build my own converter, I put this topic aside for other things.
Now recently, I stumbled over a little IrDA board called "IrDA2 click" which is essentially just a MCP2120 encoder/decoder and a TFDU4101 transceiver and a 7.3728MHz crystal. So I bought this and hooked it up to a cheap eBay FTDI/USB thingie (genuine FTDI though). I configured the baud rate jumpers to 38400 baud (B2=0, B1=1, B0=0), connected 5V/GND (note that by default only the 3V3 input is connected, but you can connect 5V there as well, as it's just a name). I also had to swap RX/TX lines since they are also obviously swapped inside the "IrDA2 click".
So first of all I tried a terminal at 38400baud (8bit, one start, no parity) and sending stuff like "IDN?", "TYPE?" and "POS?" worked immediately.
Then I tried the Metrawin10 demo - not expecting that it would actually work. But it did! My meter was correctly identified and I could start measurement sessions without any issues.
Maybe there is something different with the Energy, but I somewhat doubt it. To me it looks like this fixed 38400baud setup works perfectly well with either a DIY terminal communication or with Metrawin10.
So no need to buy the official cable. Unfortunately, the Metrawin10 SW itself is also quite expensive and while I'm quite sure that it should be possible to reset the trial period by deleting a hidden registry entry, I'm not really sure if this is worth it.
Trying is the first step towards failure - Homer J. Simpson
 

Offline giovannirat

  • Regular Contributor
  • *
  • Posts: 107
  • Country: at
Re: Metrahit USB-IR DIY interface
« Reply #2 on: June 14, 2015, 08:20:21 pm »
Sounds really good.....

As I am also a owner of two older metrahit devices (18c and 18s) i am really interested in more details (schematic, where did you buy the parts, etc..)

I am not shure if my decices are compatible with your "adapter" but i would give it a try..

It would be great if you could share more information.

Thanks
 

Offline 0xdeadbeef

  • Super Contributor
  • ***
  • Posts: 1571
  • Country: de
Re: Metrahit USB-IR DIY interface
« Reply #3 on: June 14, 2015, 09:32:01 pm »
I fear that I read somewhere that the 28S doesn't use IrDA. Also the official adapter (BD232) for the 18S is completely different from that of the Starline series (USB X-TRA).
Anyway, I listed everything I used above. As I said I just used a small IrDA adapter called "IrDA2 click"  configured to 38400baud and some cheap Chinese FTDI adapter. At the moment, this is I just wired the 5V/GND/RXD/TXD lines on a breadboard. Nothing really exciting.
My main statement was that - at least for the X-Tra, there is nothing sophisticated needed to get communication with the meter, either with a terminal program or with the Metrawin10 software.
For this device at least, it's just a plain vanilla 38400 baud IrDA connection.
Trying is the first step towards failure - Homer J. Simpson
 

Offline quarks

  • Frequent Contributor
  • **
  • Posts: 874
  • Country: de
Re: Metrahit USB-IR DIY interface
« Reply #4 on: June 15, 2015, 09:12:43 am »
thanks for the info about IrDa2click.
I will give it a try
 

Offline eb4eqaTopic starter

  • Regular Contributor
  • *
  • Posts: 98
Re: Metrahit USB-IR DIY interface
« Reply #5 on: June 15, 2015, 08:25:23 pm »
This is good news. I had given up but I will take another look at it. Thanks for sharing.

Roberto EB4EQA
 

Offline quarks

  • Frequent Contributor
  • **
  • Posts: 874
  • Country: de
Re: Metrahit USB-IR DIY interface
« Reply #6 on: June 18, 2015, 11:15:14 am »
just made a succesfull first quick test with IrDa2click, FTDI-USB and Metrahit Energy
Many thanks again to 0xdeadbeef for this good information :-+
 

Offline 0xdeadbeef

  • Super Contributor
  • ***
  • Posts: 1571
  • Country: de
Re: Metrahit USB-IR DIY interface
« Reply #7 on: June 18, 2015, 04:32:30 pm »
As a side note: I also looked deeper into the Metrawin10 software to learn about the workings of the trial expiration etc.
Just like I assumed, the trial period can be reset by deleting a hidden registry key or patching certain registry entries.
Then again, in an obsessive fit, I went much further. Don't want to discuss this here,  but if someone is interested in more info for private now-and-then use, he/she is invited to send me a PM.
Trying is the first step towards failure - Homer J. Simpson
 
The following users thanked this post: Assafl, Pipelie

Offline 0xdeadbeef

  • Super Contributor
  • ***
  • Posts: 1571
  • Country: de
Re: Metrahit USB-IR DIY interface
« Reply #8 on: June 25, 2015, 06:36:27 pm »
While the above DIY solution only works with the Starline series, I still think a similar solution could be possible for the older models.
The Sigrok wiki contains some interesting information regarding the 1x and 2x models.
Firstly, it states that "the IR signal is just serial data encoded in a SIR-like fashion, not IrDA or SIR".
While this is definitely not true for the Starline series, it might be true for the 1x/2x series even if the manuals of the adapters say it's SIR.

Furthermore the wiki says that the 1x series (send mode only) uses 8192 baud and the 2x series uses 9600 baud on the IR side and that both use a proprietary binary protocol.
It seems that apart from the Starline Series, only the 27I, 27M, 28C and Metraport 40S use a SCPI like ASCII protocol. So testing the IR communication with an 1x and 2x through an ASCII terminal is futile.
However there's a driver available in the Sigrok git repository which might be interesting for those trying to understand the binary protocol.
Trying is the first step towards failure - Homer J. Simpson
 

Offline MatthiasBerlin

  • Newbie
  • Posts: 7
IR communication
« Reply #9 on: March 05, 2016, 04:07:52 pm »
Firstly, it states that "the IR signal is just serial data encoded in a SIR-like fashion, not IrDA or SIR".
While this is definitely not true for the Starline series, it might be true for the 1x/2x series even if the manuals of the adapters say it's SIR.

Unfortunately I don't own the standards for IrDA and SIR (they are very expensive), but I found a bit on the internet. IrDA is quite a complex protocol stack that includes SIR. SIR itself seems to have to do more than just encoding of the bits, too, for higher baud rates. However, the higher baud rates are not relevant for the Gossen Metrawatt stuff because it uses only some lower ones. The SIR specs also do not allow the 8192 baud required for older Gossen Metrawatt multimeters.

Furthermore the wiki says that the 1x series (send mode only) uses 8192 baud and the 2x series uses 9600 baud on the IR side and that both use a proprietary binary protocol.

If you don't want to use sigrok, the protocol descriptions are available from the manufacturer for free. Just write to the support.

Bye, Matthias
« Last Edit: March 05, 2016, 09:03:25 pm by MatthiasBerlin »
 

Offline noidea

  • Supporter
  • ****
  • Posts: 209
  • Country: au
Re: Metrahit USB-IR DIY interface
« Reply #10 on: January 02, 2018, 04:43:55 am »
While the above DIY solution only works with the Starline series, I still think a similar solution could be possible for the older models.
The Sigrok wiki contains some interesting information regarding the 1x and 2x models.
Firstly, it states that "the IR signal is just serial data encoded in a SIR-like fashion, not IrDA or SIR".
While this is definitely not true for the Starline series, it might be true for the 1x/2x series even if the manuals of the adapters say it's SIR.

Furthermore the wiki says that the 1x series (send mode only) uses 8192 baud and the 2x series uses 9600 baud on the IR side and that both use a proprietary binary protocol.
It seems that apart from the Starline Series, only the 27I, 27M, 28C and Metraport 40S use a SCPI like ASCII protocol. So testing the IR communication with an 1x and 2x through an ASCII terminal is futile.
However there's a driver available in the Sigrok git repository which might be interesting for those trying to understand the binary protocol.

Hi 0xdeadbeef
Sorry to raise this one from the dead, I've just purchased a Metrahit 27i and this post came up when I searched for info on the USB IR interface.
I also found your IrDA USB project  and was wondering on what you thought of my chances of being able to communicate with the 27I were before I go down the path of modding it to suit the older style casing and getting a PCB made and building one.
Thanks if you can help.
« Last Edit: January 02, 2018, 04:50:33 am by noidea »
 

Offline 0xdeadbeef

  • Super Contributor
  • ***
  • Posts: 1571
  • Country: de
Re: Metrahit USB-IR DIY interface
« Reply #11 on: January 02, 2018, 10:44:12 am »
The Sigrok Wiki says that the 27i uses the same text style protocol as the newer "Starline" multimeters but also that it uses a different adapter, namely the BD232 or USB-Hit.
It also says that for these adapters "the IR signal is just serial data encoded in a SIR-like fashion, not IrDA or SIR".
I was told though that the BD232 uses "raw" IR without any encoding. Can't really provide any more details though other than some guy said he got it working with just an off the shelf USB to serial converter and a discrete IR diode circuit.

So I tend to say that my adapter (which kinda replicates the "USB X-Tra" adapter for the Starline series) most probably won't work as replacement for the older adapters like BD232 or USB-Hit.
Trying is the first step towards failure - Homer J. Simpson
 

Offline VeniBenja

  • Newbie
  • Posts: 1
  • Country: 00
Re: Metrahit USB-IR DIY interface
« Reply #12 on: June 06, 2020, 05:53:58 pm »
Hello there, I have two very old Gossen Megawatt multimeters. A 16S and a 18S. The 18S had a lot of problems with the display. I couldn't read it any more. So i decided to open it and try to fix it. The fix where two stripes of paper on the LCD. With the liitle more thickness the rubber conection get much better contract. Now the quality is like a new one again. Because i had the multimeter already open i did some experiments with the IR interface. In this old meters it's just an unidirectional interface for sending data. I pushed the data and on butten and it start sending. I could see it with my phone. The IR LED is on a small board with 3 conectors. I mesured them. The one with the + is the data connector. It's the same for both multimeters. I connected it with the RX pin of an Arduino and piped the output to a terminal. I could direct read some symbols. After changing the configuration to 8192 Baud 6N1 i was suprised to see values in plaintext. Of course it was value of the actual mesurement.  I didn't expect that it was so easy. The best is it works for both 16S and the 18S the same. :-DD :-DD :-DD


Next step i could test to connect it to the offical software. Also i think to buy some IR interface to make the original connection or maybe a ESP32 to integrate it in the case to have a bluetooth and wifi meter. Maybe i can use the powersupply for the IR LED for the controller.

Update: Sucessfully testet to connect my metrahit 16s 18s and 22s with Arduino Mega and read out data with sigrox driver.

Update2: The easiest and cheapest way to build an IR intervace for the Metrahit 1x 2x series seems to use a cheap IR distance sensor such as HW 201. It's just a fototransistor and comparator with IR LED. The IR LED could be used for the serial comunication but actually i just use the transistor comparator combo. I connected the output of the HW 201 to my RX pin. There is a poti on the HW 201. It's normally used for the distance threshold but i used it to get the correct UART Signal. I used an oscilocop to visual the Sigal, it's but you can also do it blind with opending the meter with sigrok and tuning the poti until you receive correct data.
I testet it on linux and windows on windows it doesn't work for some reasons. maybe the diver of the USB serial adaptor doesn't work with this strange baud rate bit combo. i also tested differend USB serial
plugs. The CP2102 doesn't work. The Ardunio Mega 2560 worked well also the pl2303.

« Last Edit: June 28, 2020, 01:37:31 pm by VeniBenja »
 
The following users thanked this post: coromonadalix, emax

Offline thelastdodo

  • Newbie
  • Posts: 7
  • Country: de
Re: Metrahit USB-IR DIY interface
« Reply #13 on: April 11, 2023, 04:37:51 pm »
Just wanted to let you know about another success story using the cheap alternative "Irdroid USB irDA Transceiver".

To make the mounting easier and robust, I created and printed a littel adapter:
https://cults3d.com/en/3d-model/tool/infrared-to-usb-adapter-mount-for-starline-metrahit-am-pm-a-e-s-series

It can be seen in action here:
https://youtu.be/wjbuir5mLuA

Greetings and happy tinkering!
 
The following users thanked this post: quarks

Offline horo

  • Regular Contributor
  • *
  • Posts: 104
  • Country: de
    • My GitHub Projects
Re: Metrahit USB-IR DIY interface
« Reply #14 on: April 11, 2023, 05:33:15 pm »
I was told though that the BD232 uses "raw" IR without any encoding. Can't really provide any more details though other than some guy said he got it working with just an off the shelf USB to serial converter and a discrete IR diode circuit.

That's true for the MetraHit 2x devices. See also the Gossen document Interface Protocol for METRAHit 22-29S/M Multimeters. I used this info together with the sigrok code to develop my project OpenMetra, already mentioned in this thread. :-DMM

 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf