Jump to content
43oh

Adafruit's TSL2591 shield for MSP430s?


Recommended Posts

Hello,

I bought an Adafruit TSL2591* shield but unfortunately it looks like there's no lib for MSP430s. There's code for Arduino and some posts about the TSL2561. Unfortunately I don't have any experience with I2C and hope/wonder if someone is interested to get it running on the MSP430s? That's a really nice sensor.

 

* :

 

High Dynamic Range Digital Light Sensor

When the future is dazzlingly-bright, this ultra-high-range luminosity sensor will help you measure it. The TSL2591 luminosity sensor is an advanced digital light sensor, ideal for use in a wide range of light situations. Compared to low cost CdS cells, this sensor is more precise, allowing for exact lux calculations and can be configured for different gain/timing ranges to detect light ranges from 188 uLux up to 88,000 Lux on the fly.

The best part of this sensor is that it contains both infrared and full spectrum diodes! That means you can separately measure infrared, full-spectrum or human-visible light. Most sensors can only detect one or the other, which does not accurately represent what human eyes see (since we cannot perceive the IR light that is detected by most photo diodes) This sensor is much like the TSL2561 but with a wider range (and the interface code is different). This sensor has a massive 600,000,000:1 dynamic range! Unlike the TSL2561 you cannot change the I2C address, so keep that in mind.

The built in ADC means you can use this with any microcontroller, even if it doesn't have analog inputs. The current draw is extremely low, so its great for low power data-logging systems. about 0.4mA when actively sensing, and less than 5 uA when in power-down mode.

 

Link to post
Share on other sites

Nice, it compiles after a few changes (<Adafruit_Sensor.h> to "Adafruit_Sensor.h") now, but unfortunately the Serial Monitor doesn't output anything at all. I tried a simple Serial. example but still no output. The MSP430G2553 is on the LaunchPad rev. v1.5 but the following code is not working. I remember the Serial Monitor working with using basically the same Serial code, weird that it is not working now.

void setup() {
  Serial.begin(9600);
}
void loop() {
  Serial.print("Hello");
  delay(500);
}

It seems there are problems with Linux. I'll look at it.

Link to post
Share on other sites

The MSP430G2 launchpad is a pain in the butt under Linux. I recommend flashing your sketch, unplug the LP, hold RESET, plug in the LP (holding RESET) then open the Serial Monitor app inside Energia. Then let go of RESET.

 

In my own experiments what I've done is put a snippet of code at the beginning that won't let the setup() routine advance until the S1 (P1.3) pushbutton has been pressed. That way I have a moment to open my serial app in Linux before the sketch starts spamming the serial port. It seems to be a glitch with the launchpad's UART sending serial data to Linux when there is no active program in Linux connected to the port.

Link to post
Share on other sites

Thanks, I'll try it out. At the moment it didn't work maybe because I did already so many things from tutorials (of which nothing worked) and I was planing to do a fresh OS install anyway (Ubuntu 14.10 64bit), then I'll try again. If it won't work, that's not so bad in my case because I want a portable Lux meter anyway and will use a Nokia 5110 LCD.

*edit*
After a fresh OS install and unpacking the original archive energia-0101E0014, it unfortunately doesn't work (weird, I remember it working without doing anything). Anyway I'll connect the Nokia LCD and try reading the sensor now.

*edit*
Got it working with the LCD :) I was able to measure up to a constant value of ~120000 Lux (although it goes "up to 88,000 Lux") using a Cree XM-L LED in a C8 Flashlight case, but if it got even brighter (doesn't make sense anyway because in nature 100k Lux are about the highest), the value decreased. So I guess reliable are "up to 88,000 Lux" or 120k Lux if this value is correct, which is very nice because such Lux meter can cost quite something and are not even open source.

 

Can't attach the sources, it says " You can upload up to 197.98MB of files (Max. single file size: 175bytes)". I'll try again later.

 

*edit*

Now attaching is working again.

MSP430_TSL2591.zip

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...