MAX44009

One of the questions I wanted to answer with my Garduino was how much light is lost through the plastic covering of the Greenhouse.  What I have found is it is very difficult to find a light sensor that has the dynamic range from darkness to full sun, but I finally stumbled on the MAX44009, which has a range from 0.045 to 180,000 Lux.  The downside of this device is no one is making a breakout board for it, so I was on my own.

Homemade breakout board for the MAX44009

Yes, this beautiful homemade PCB does work.  I made it by the laser toner transfer method, but my home printer, a Brother HL-4040CN did not work; the toner did not stick to the copper board no matter how long I put the iron on it.  I ended up creating a PDF file with Gerber2PDF and printing the image on some HP printers at work.  Unfortunately,  in my rush to not be caught screwing around with something that wasn’t work related, I forgot to make a mirror image of the PCB, so everything is backwards on the PCB.  Even with the HP toner, the toner transfer was not very good, but, considering the fact that the MAX44009 chip is 2mm x 2mm and the pads for the 6 pins are 0.36mm x 0.48 mm, the toner transfer was accurate enough to work.  Adding to the fact that this was the first time I used my hot air re-work station to do something constructive, you could have knocked me off my chair with a feather when the final assembly actually returned valid data.

It wasn’t a complete Eureka moment, though, because while the data sheet says the I2C address can be selected (with the AD pin) to be 148 or 150, that does not seem to be true.  I found this important utility, I2CScanner which runs through every I2C address, and shows which addresses a device is responding to.  This really saved me, because it showed that the real address of the MAX44009 was 203 (I forgot to note the address when AD is low, so I’ll document that when I make the improved version of the PCB).  Once I had the right address, interfacing with the MAX44009 is very straightforward, since it uses the I2C Wire Arduino  library:

#define MAX_ADDR 203

float getLux()
{
int luxHigh=readI2CAddr(0x03);
int luxLow=readI2CAddr(0x04);
int exponent=(luxHigh&0xf0)>>4;
int mant=(luxHigh&0x0f)<<4|luxLow;
return (float)(pow(2,exponent)*mant)*0.045;

}

int readI2CAddr(int addr)
{

Wire.beginTransmission(MAX_ADDR);
Wire.write(addr);
Wire.endTransmission();

Wire.requestFrom(MAX_ADDR,1);

int n=0;
for(n=0;n<25;n++)
{
if(Wire.available())
break;

delay(100);
}

if (n==25)
return 0;
else
return Wire.read();
}

I was expecting to have to handled the situation where I would have to programatically change the sensitivity of the device so that I would have to set longer integration times in low light conditions, and shorter ones in bright conditions, but the device handles that all by itself.  The device can be configured in a manual mode so that the user has control of exactly what integration time will be used for each reading, but in my case, the automatic setting behaved the way I wished.

I’ve created an Eagle library that contains the land pattern for the MAX44009.

I really like the I2C bus, but its major disadvantage is the max length which is reportedly pretty short.  I currently have the MAX44009 sitting off of about 2.5 M of 6 conductor satin cable, connected to the same 3.3V bi-directional voltage translator circuit my BMP085 is connected to, and it is working well.  I expect when I have to connect another MAX44009 to measure the light loss from inside the Greenhouse, though, the length will become a problem.  I will be researching some I2C bus lengthing techniques and will report on them in the future.

The waterproof enclosure for the MAX44009 consists of a plastic food container with a clear plastic cover, and the bottom cut out for ventilation.

 

This is the PDF for the Break Out Board that I used for the Toner Transfer method to create the PCB.

About these ads

6 responses to this post.

  1. Do you have a circuit diagram for your breakout board?

    I’m not experienced in I2C, but for connection to the Arduino, should the pullup resistors be: SDA – 10k pullup to Vc, SCL – 10k pull down to GND, INT – 10k pullup to Vcc?

    Reply

    • There really isn’t a circuit diagram for the breakout board; it is simply bringing out the 6 pins on the MAX44009 to something that can be soldered.

      All the SDA,SCL, and INT require pull up resistors. Because the capacitance of the cable from the arduino to the chip goes up the longer it gets, I needed to bring down the resistance in order for the signal to be reliably transmitted (the whole RC time constant thing). As long as current sunk by the SDA/SCL pins is less than 20mA, it will work. In my current iteration of my weather station, I’m using P82B715 I2C bus extenders, which adds even more complication as to the value of the pull-up resistors.

      Reply

  2. Thanks for the reply. Pull up resistors will work, but I’m thinking about current consumption… They boast about the low current of the IC but as soon as you add pull up resistors, the total current draw is a lot higher. And as you say, a high resistance will give a long time constant. I’ve heard that you can avoid the need for pull ups as long as the line length is short. According to the data sheet a pullup is required on SCL only if there are multiple masters on the bus, or if the master in a single-master system has an open-drain SCL output.

    Reply

  3. Posted by Danilo on January 23, 2013 at 11:50 am

    Do you know if the problem related to the device address occurs just for your part or is a common problem for the MAX44009?

    Thank you.

    Reply

  4. Posted by John on January 31, 2014 at 10:00 am

    Hey there!

    I was wondering if you could help me out, Im trying to program the MAX44009 using a RaspberryPi.

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: