I'm trying to read the IR signal from my Itron C1S Power meter. It has an emitter that lights up for 10 ms every Wh of consumption.

This question is based on my prior question: Use a photoresistor to read an IR LED from an Itron energy meter. I connected the transistor

I hooked it up,but I never get any answer... it seems the Phototransistor is not precise enough... Is there a way to amplify it?

here is my connection (note that Im using the TCRT5000 phototransistor, not the one on the picture) :

enter image description here

my code works good and the connection works if I put a reflector in top of the emitter (and if I connect it!).

Here is my code so far:

#include <SPI.h>
#include <Dhcp.h>
#include <Dns.h>
#include <Ethernet.h>
#include <EthernetClient.h>
#include <Temboo.h>
#include "TembooAccount.h" // Contains Temboo account information

byte ethernetMACAddress[] = ETHERNET_SHIELD_MAC;
EthernetClient client;

// Energy meter ini
int inputPulse= 8;
int StateOld = 0;

int PowerMeterSimPin = 4;
int PowerMeterSimCounter = 0;
int PowerMeterSimCounterOn = 0;
boolean PowerMeterOnStatus = false;

boolean myState = false;

unsigned long diffTime_ms, startTime, p_w;

void setup() {

  // For debugging, wait until the serial console is connected.
  if (Ethernet.begin(ethernetMACAddress) == 0) {

  digitalWrite(PowerMeterSimPin, LOW);

  Serial.println("Setup complete.\n");

void loop() {

  int state = digitalRead(inputPulse);
  unsigned long now = millis();

  // simulate the power meter: 
  // each 5 sec, consume 1 Wh. 


  if (PowerMeterSimCounter >= 5*1000){
    PowerMeterSimCounterOn = 0;
    PowerMeterSimCounter = 0;
    PowerMeterOnStatus = true;
    digitalWrite(PowerMeterSimPin, HIGH);
    Serial.println("Meter is on");


  if (PowerMeterOnStatus){
    if(PowerMeterSimCounterOn >= 10){
      PowerMeterSimCounterOn = 0;
      digitalWrite(PowerMeterSimPin, LOW);
      Serial.println("Meter is off");
      PowerMeterOnStatus = false;
  diffTime_ms = now - startTime;

  // detect rising edge of IR detector
  if ((state == true) && (StateOld == false))
    // new start Time
    startTime = now;
    StateOld = true;

    // we know the energy is 1Wh = 3600 Ws
    // calculate the power as p = E/dt
    p_w = 3600UL*1000UL/diffTime_ms;

    Serial.print("Time[ms]; ");
    Serial.print("Power[W]: ");
    Serial.print("Energy[Wh]: ");
    if (myState){
      digitalWrite(PowerMeterSimPin, LOW);
      myState = false;
      digitalWrite(PowerMeterSimPin, HIGH);
      myState = true;


      TembooChoreo CreateObjectChoreo(client);

      // Invoke the Temboo client

      // Set Temboo account credentials

      // Set profile to use for execution

      // Set Choreo inputs
      String ObjectContentsValue = "{\"value_Wh\":1}";
      CreateObjectChoreo.addInput("ObjectContents", ObjectContentsValue);

      // Identify the Choreo to run

      // Run the Choreo; when results are available, print them to serial

      while(CreateObjectChoreo.available()) {
        char c = CreateObjectChoreo.read();
    // don't want to read short pulses as 3600*1000/100 = 36 kW

  if ((diffTime_ms>100)&& (state == false))
      StateOld = false;

(note that the temboo stuff is commented out)

NOTE: According to the Itron Technical Reference Guide, the Meter has an infra red LED: Itron Technical Reference Guide - Screenshot

UPDATE: As recommended by tman, I performed a reading for a long period of the analog value of the meter. Here are the results: enter image description here

As you can see, we have some effect of the sun. Ignore that. As you can see, the signal jumps between 1013 and 970 almost all the time (noise) and some times it goes down to around 870. I'm not sure if this is when the LED of the meter is on. It should be 10 ms, and I'm not sure how much time there is between measurements (shouldn't it be around 2 ms?). I measure with the same setup and this code:

#include <SD.h>
const int chipSelect = 4;
void setup()
  pinMode(10, OUTPUT);
  if (!SD.begin(chipSelect)) {
    Serial.println("Card failed, or not present");

void loop()
  String dataString = "";
   int sensor = analogRead(A0);
    dataString += String(sensor);
  File dataFile = SD.open("datalog.txt", FILE_WRITE);
  if (dataFile) {
  else {
    // do nothing

Is it proper to use more than 1 phototransistor (connected in parallel) to amplify the amount of light collected?

  • \$\begingroup\$ Is the Itron emitter IR or is it visible light? \$\endgroup\$ Commented Aug 27, 2014 at 4:03
  • \$\begingroup\$ It should be IR. see my edit, I attached a picture of the technical Reference Guide. Sadly, there is no more technical information about the LED itself. \$\endgroup\$
    – otmezger
    Commented Aug 27, 2014 at 14:21
  • 1
    \$\begingroup\$ I merely glanced through your code, but how about reading the analog value and see what ranges you're getting for a low state and high state for the LED. \$\endgroup\$
    – tman
    Commented Aug 28, 2014 at 14:17
  • \$\begingroup\$ good point... I'll give it a try. \$\endgroup\$
    – otmezger
    Commented Aug 28, 2014 at 18:09
  • \$\begingroup\$ @tman I updated the question with my measurements results. sadly, it only produced more questions... tell me pls what you think. \$\endgroup\$
    – otmezger
    Commented Sep 1, 2014 at 18:00

1 Answer 1


I've actually done this before, and found that a single unamplified phototransistor is not sufficient. I did some measurement of light and dark currents and came up with the circuit shown below to produce a nice clean digital signal (I did not use an ADC). Note that I happened to simply use parts I already had on hand -- the use of 2N2222 transistors is not critical.


simulate this circuit – Schematic created using CircuitLab

In my particular case, I mounted the IR phototransistor in the cap of a cheap ball point pen, and used a suction cup to temporarily affix it to the top of the meter (you must, of course, be careful not to damage the meter). One can simply accumulate Wh pulses and compute energy usage, of course, but it's also possible to measure the time between pulses and determine demand (in Watts).

Once that's all assembled, the math can be verified using an incandescent light bulb. I happened to have a 100W bulb and so with no-one else at home, I noted the demand with the bulb off and then again with it on. In my case, there was precisely a 100W difference, so it was clear that everything was working as designed.

  • \$\begingroup\$ Thanks. First think I need to do is to darken the meter. It is placed outside on direct light and this is making too much noise. I'll put a cover over it, and then try your circuit out. thanks. \$\endgroup\$
    – otmezger
    Commented Sep 4, 2014 at 15:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.