Elster A1100 IRDA emontx v2 Help...

Has anyone been able to read the IRDA port of an Elster A1100 with a emontx V2 Yet?

If so how did you do it?

I tried the A100c version from this site but it doesn't work...

Thanks

TimSmall's picture

Re: Elster A1100 IRDA emontx v2 Help...

How far did you get with the A1100?  Was there any IR?  Did the code you tried receive any data, but was just unable to parse it?

I'm trying to get data out of a couple of A1100s using a couple of different USB<->IRDA dongle under Linux (since that's what I had lying around) but haven't had any luck, yet.  Looking at the datasheet, it has three configurable baud rates - 2400, 4800 (non-standard for IrDA?) or 9600.

TimSmall's picture

Re: Elster A1100 IRDA emontx v2 Help...

I think the A1100 doesn't have a bright enough Infrared output LED to trigger the TSL261R photo sensor when using Dave Berkeley scheme and the circuit which was linked from the A100C.

Another possibility is that it uses a slightly different wavelength (https://en.wikipedia.org/wiki/Infrared_Data_Association says IrDA uses 850nm to 900nm.  The peak response for the TSL261R is 940nm according to the datasheet, and sensitivity is 70% lower at 850nm than it is at 940nm.

At my best guess, the output from the Elster looked at least an order of magnitude dimmer than an infrared remote control when viewed with my Moto G camera phone.

Interestingly I have a Nokia phone who's IrDA output is completely invisible with the Moto G camera, but again no idea if that's down to brightness or "colour" (wavelength) of IR light.

My analog electronics is weak (and my digital only a bit better), but I thought I might be able to do something with the Atmega328's analogue comparator (either using a voltage divider, or the bandgap output, or even one of the analogue outputs with suitable smoothing connected back to the comparator) to set the threshold.

Any thoughts from any electronics people?

Tim.

TimSmall's picture

Re: Elster A1100 IRDA emontx v2 Help...

Does this sound viable:

Feed the output of the photo sensor into an RC network (with relatively high input resistance to the RC network), to establish a 'base' voltage.  Use this voltage (via a divider to lower it slightly) as one of the Atmega analogue comparator inputs.

Simultaneously feed the photo sensor output into the other input of the analogue comparator, that way it should be able to detect relative intensity instead of absolute intensity, and thus increase the sensitivity of the infrared detector.

?

Cheers,

Tim.

pb66's picture

Re: Elster A1100 IRDA emontx v2 Help...

Going by your OP you've seen the "Reading IrDA data from an Elster A100C electricity meter" thread and the links from that page. Did you also see the "Using TinyTX and LDR to measure Watt on my power meter" thread, Just confirming a change can be detected and then establishing the min and max voltages should help establish if it's going to be readable. I'm no expert but if you can see it with a camera (at all) I would expect it to be readable unless it streams data at some ridiculous speed of course but even that should still be detectable even if not readable I would of thought.

Paul

TimSmall's picture

Re: Elster A1100 IRDA emontx v2 Help...

Hi Paul,

Thanks for your reply.  I suspect the pulse durations may be too short for the LDR.

I created a sketch which toggles the onboard Arduino LED state on change of state of pin 2, and using the photo sensor connected to the arduino as per the A100c circuit.  This could detect my infrared remote control at a distance of up to about 10 centimetres.  I couldn't detect the output of an IrDA USB dongle or that of the Nokia phone.

I then changed the circuit to use the UNO's analogue comparator, and made one input (arduino digital pin 6) 0.7v using a resistor network.  The other input of the comparator (setup to be digital pin 7) was wired to the photo sensor.  Now it will detect the same infrared remote at up to about 2 metres.  Promisingly, it now also detects the IrDA dongle, but still not the Nokia.  As I can see the IrDA dongle with the Moto G phone camera (and also see that it's substantially dimmer than this remote), hopefully it'll be good enough for the Elster A1100 as well...  To complicate matters further, I don't have the Elster meter here - it's over the other side of town!

I took a quick look at the EmonShield schematics, and it looks like this approach won't work with that, unless you have no radio on the board (as one of the comparator inputs DIG6 aka AIN0 is wired to the radio).  You can however tell it to use the internal 1.1v reference instead of dig6, which might be good enough (and I'll try that too).

Perhaps you could shift GND for the photo sensor up toward the 1.1v reference voltage to improve sensitivity, dunno...

Tim.

TimSmall's picture

Re: Elster A1100 IRDA emontx v2 Help...

I wondered about something like the attached to drive the comparator?

The idea is to be sensitive to small pulses, but also to automatically adapt to background light levels.

The idea is that one of the comparator inputs ends up at the averaged-over-time output of the opto sensor, on the basis that the sending LED is mostly off (IrDA SIR sends baseband serial comms with a shortened pulse I believe, and also the LED only sends one short burst of traffic every few seconds).

The other input gets its the instantaneous value instead, dropped slightly by the series diode (dunno if R3 is needed or not?).  The diode would need a suitably low forward voltage drop (maybe a germanium or shottky diode?).

Any good?

I think I'll try out the circuit I already have up (using a simple divider for the comparator instead) first...

Tim.

Robert Wall's picture

Re: Elster A1100 IRDA emontx v2 Help...

If the pulse train is more or less continuous, one way to pull pulses out is to use an integrator to detect the average level and a comparator. The comparator has the raw pulse input for one input and the integrator output for the other, the idea being that if the voltage from your photodiode (or whatever) drifts with temperature, ambient light or anything else, the integrator tracks the slowly changing average value and the comparator switches on the pulses superimposed on it. (I.E. the comparator switches as the pulse crosses the average value, not as it crosses any specific voltage.)

If the pulse train isn't continuous, this is liable to produce a train of random pulses generated from the noise in the circuit.

[You posted while I was typing! Something like that, except you might have a resistor or two too many in there.]

TimSmall's picture

Re: Elster A1100 IRDA emontx v2 Help...

Hi Robert,

Thanks for your reply - I think that's roughly what I had in mind (and we both posted at about the same time).  Do you think the circuit I sketched out is any cop?  I'm assuming it's OK to drive a bit of voltage back into the sensor output (which would happen if the ambient light levels drop whilst the cap discharged through R1).  If that's not acceptable, then perhaps it could do with an extra diode in series with R2, and then another resistor in parallel with the cap?

TSL261R datasheet is here BTW - http://roborugby.ucd.ie/docs/Taos-TSL260R.pdf

Cheers,

Tim.

Robert Wall's picture

Re: Elster A1100 IRDA emontx v2 Help...

You probably do need a bit of hysteresis, too much and you kill it stone dead if the output amplitude is low, but if it's greater than the noise, then you don't have the problem when there are no pulses. (This depends on what you meter outputs, and when. If it responds to interrogation, then you probably need to provoke some output - any output - to set the integrator and then enable the input before you send the command to emit the data you want; then shut down the input when complete.)

I think for speed reasons I'd go for a discrete component front end, delivering pulses that you can read with a digital input, rather than use an analogue input as a comparator, though I might be over-cautious here.

I know I've seen a working circuit with values on it, I'll try to find it.

TimSmall's picture

Re: Elster A1100 IRDA emontx v2 Help...

Hi Robert,

Thanks for the reply.

The Elster A1100's sending LED is mostly off, it does something like:

1 Send a train of pulses which are (I believe) IrDA SIR - which is effectively just RS232 comms with a short IR pulse on each rising (I think) edge.  The train lasts about 1 second, and can be seen flickering using the phone camera.  I think the LED should be lit for less than 25% of the time during this period.

2. Send nothing (i.e. LED off) for about 5 seconds.

3. Repeat.

The meter needs no setup or other provocation to do this, and is the default operation mode on these meters (same as with the Elster A100C).

So I'd guess the overall duty of the LED I'm trying to read is going to be under 5% (possibly well under), and the integrator can probably work over a number of seconds

The ATmega's built-in comparator is effectively a digital input - in the mode I've set it up, you read a register, and you get a '1' if the voltage on D6 is greater than the voltage on D7, and a '0' otherwise.  You can also trigger an interrupt on change of the comparator output (on rise, or on fall, or on both transitions).

Page 235 of http://www.atmel.com/images/Atmel-8271-8-bit-AVR-Microcontroller-ATmega48A-48PA-88A-88PA-168A-168PA-328-328P_datasheet_Complete.pdf gives the details:

In section 23.3.2 "• Bit 5 – ACO: Analog Comparator Output
The output of the Analog Comparator is synchronized and then directly connected to ACO. The synchronization
introduces a delay of 1 - 2 clock cycles. "

... so directly reading the output using a read and binary arithmetic is probably faster than reading the digital ports using the Arduino digitalRead() function (since digitalRead() will probably get compiled to several more instructions vs. just reading the register and doing the necessary binary arithmetic).

I'm trying to keep my component count down (because of time pressure and ease of construction rather than expense)!

I've got a circuit working with a cap and 3 resistors - will post when I've put it through its paces a bit...

Cheers,

Tim.

 

TimSmall's picture

Re: Elster A1100 IRDA emontx v2 Help...

This circuit seems to work surprisingly well.  The infrared remote control works if you bounce it off a couple of walls, and the IrDA devices all work from more than a metre away.  Performance is better in low light, but also works in quite bright conditions.

I've just swapped out R1 for a 4.7k Ohm resistor, as it seems that one of the monitors at my desk is bloody noisy in near IR, and neither my circuit nor the IrDA to USB dongle that I'm using to test will work when they're looking at it.

Changing R1 to 4.7k to make the circuit less sensitive seems to improve matters a lot.  Increasing the value of R3, or increasing the capacitance of C1 would probably also help (depends on the frequency of the IR noise).

One of the comparator inputs gets a smoothed time-averaged version of the opto sensor output.

The second comparator input gets a reduced voltage version of the opto sensor's instantaneous output.

With no light the second comparator input is lower than the first.  A pulse raises the voltage of the second comparator input, and if it exceeds the voltage of the first comparator input then we can read that as a digital signal in the ATmega.

Solved the Nokia mystery too - they don't speak unless they're spoken to (despite the flashing IR transmit icon on their LCD display!) - but if they detect incoming IrDA enquiry then they reply, and this circuit seems to detect that too...

TimSmall's picture

Re: Elster A1100 IRDA emontx v2 Help...

I'm using the onboard LED to debug with this sketch:

// From http://forum.arduino.cc/index.php?topic=149840.15
/* On board LED connected to Pin 13

Adapted by Tim Small from code 
created 27 Feb 2013
by Anthony Fremont

*/

void setup() {
   // initialize serial communications at 9600 bps:
   Serial.begin(9600); 

   ACSR =
     (0 << ACD)  | // Comparator: Enabled
     (0 << ACBG) | // Comparator Bandgap Select: Disabled
                   // (AIN0 is applied to the positive input)
     (1 << ACI)  | // Comparator Interrupt Flag: Clear Pending Interrupt
     (0 << ACIE) | // Comparator Interrupt: Disabled
     (0 << ACIC) | // Comparator Input Capture (to Timer1): Disabled
     (1 << ACIS1) | (1 << ACIS0);   // Analog Comparator Interrupt Mode:
                                    // Interrupt on Rising Output Edge
   
   DIDR1 = (1 << AIN0D) |  // disable digital input on AIN0 (PD6) DIG6
           (1 << AIN1D);   // disable digital input on AIN1 (PD7) DIG7

   pinMode(13, OUTPUT); 
}

void loop() {

   if(ACSR & (1 << ACO)) {     // read comparator output flag
       digitalWrite(13, LOW);
   } else {
       digitalWrite(13, HIGH); // and write the inverse to the LED
       delay(50);              // stretch min on-time to 1/20th sec
   }

             
}


// Enable ACIE to use this...
//ISR(ANALOG_COMP_vect ) {
// digitalWrite(13, !digitalRead(13));   // toggle state of Pin 13
//}
Robert Wall's picture

Re: Elster A1100 IRDA emontx v2 Help...

It sounds like you don't need my circuit anyway, which is just as well as I can't find it! But from reading your posts, you're doing almost exactly the same thing but using the built-in comparator rather than an op. amp.

TimSmall's picture

Re: Elster A1100 IRDA emontx v2 Help...

Hi Robert,

Thanks for the input.

I have things working now using the built-in comparator - final circuit attached.  Annoyingly I only just found that the A1100 manual gives some info on it's infrared output - in particular it specifies that its IR pulse width is 5 μs.

http://web.media.mit.edu/~ayb/irx/irda/IrPHY_1_2.PDF

gives this for IrDA pulse widths at 2400 baud (page 8):

min 1.41  μs 

nominal 78.13  μs

max 88.15 μs

- the datasheet gives the TSL261R typical response time as 70 μs.

This perhaps explains why it works with the A100c, but not the A1100 without the use of the comparator - the signal must be pretty tiny and saw tooth I guess (I don't have a scope so can't see).  It' also explains why it looks dim on the camera phone.

I've ordered a couple of TSL262R-LF from Farnell.  They have a response time of 7 μs.  With a pull-up 100k resistor (as per example circuits which are present in the newer versions of the datasheet e.g. the AMS version), I'm hoping this will be attachable to a digital I/O pin instead.

Wish I'd noticed that a while back!

Tim.

nissan6789's picture

Re: Elster A1100 IRDA emontx v2 Help...

Hello! I run this python code:

https://github.com/DaveBerkeley/elster_meter/blob/master/solar_meter_rea...

and I get the below messages:

=========== RESTART: C:\Users\LENOVO\Desktop\solar_meter_reader.py ===========
Traceback (most recent call last):
File "C:\Users\LENOVO\Desktop\solar_meter_reader.py", line 11, in <module>
ser = serial.Serial('/dev/ttyUSB0', 9600)
File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python35-32\lib\site-packages\serial\serialwin32.py", line 38, in __init__
SerialBase.__init__(self, *args, **kwargs)
File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python35-32\lib\site-packages\serial\serialutil.py", line 282, in __init__
self.open()
File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python35-32\lib\site-packages\serial\serialwin32.py", line 66, in open
raise SerialException("could not open port %r: %r" % (self.portstr, ctypes.WinError()))
serial.serialutil.SerialException: could not open port '/dev/ttyUSB0': FileNotFoundError(2, 'The system cannot find the path specified.', None, 3)

What have I done wrong?

[Duplicate post deleted. Moderator (RW)]

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.