Jump to content

As of July 17, 2015, the LabJack forums here at forums.labjack.com are shut down. New registrations, topics, and replies are disabled. All forums are in a read-only state for archive purposes.

Please visit our current forums at labjack.com/forums to view and make new posts. To post on the current forums, use your labjack.com login account. Your old LabJack forums login credentials have been retired. There are no longer separate logins for labjack.com and LabJack forums.


Photo

labjack U6 and light meter


  • Please log in to reply
25 replies to this topic

#1 Airbender

Airbender
  • Members
  • 13 posts

Posted 17 May 2012 - 04:41 AM

Can anyone help me regarding programming in C(using visual C++ or code blocks compiler) for connecting labjack U6 to a light sensor (lx 1108) Thanks in advance

#2 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 17 May 2012 - 07:59 AM

The Luxtron LX-1108 appears to be an entire light meter with an RS232 interface. If you want to talk to it you will need to learn the protocol for the meter (what bytes you need to send to request a reading and how to interpret the bytes you get back) and will use the Asynchronous feature of the U6:

http://labjack.com/s...rs-guide/4.3.12

If you have not worked with this sort of serial communication before, it would be much easier if you just picked up an analog light sensor. Perhaps you could use the cheap photoresistor available at Radio Shack and everywhere else, or use a more modern sensor if needed.

#3 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 17 May 2012 - 08:01 AM

If you use an analog sensor, you will start by using the test panel in LJControlPanel to see if it is working. Then in C, just call eAIN to get readings:

http://labjack.com/s...rs-guide/4.2.17

http://labjack.com/s...ers-guide/4.3.9

http://labjack.com/s...ud/examples/vc6

#4 Airbender

Airbender
  • Members
  • 13 posts

Posted 20 May 2012 - 02:20 AM

Thank u for de suggestion.Well I have already purchased labjack and a light meter(LX 1108).So I am to go forward with it despite having no prior experience with serial communication.Can anyone help me out with its basics .Will it be possible for me to write codes in C for it? Once again thank u

#5 Airbender

Airbender
  • Members
  • 13 posts

Posted 20 May 2012 - 03:31 AM

Hi Can anyone help me regarding mastering the protocols of lutron lx 1108 to communicate with pc Thanks

#6 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 21 May 2012 - 06:49 AM

Read about asynchronous in Section 4.3.12 of the U6 User's Guide. Note that you will likely need a MAX233 chip or similar. Also see the U6_Asynch example in the VC6_LJUD archive:

http://labjack.com/s...rs-guide/4.3.12

http://labjack.com/s...ud/examples/vc6

You should consider just using a serial port already on your computer, or if your computer does not have a serial port get a USB/RS232 converter. Either way, your meter just plugs into that port and software just makes normal serial port commands.

#7 Airbender

Airbender
  • Members
  • 13 posts

Posted 23 May 2012 - 02:36 AM

thanx again for de reply.Can I connect my light sensor without labjack to a Mac .Software for Mac is not available so is there a possibility of using VMware fusion for using the windows software with or without labjack

#8 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 23 May 2012 - 07:49 AM

You should be able to have/get RS232 serial ports on any OS, and you can write software for any OS that talks to those RS232 serial ports.

Software for Mac is not available

Are you saying that on Windows there is software that reads from your light meter over a serial port, and then adjusts the monitor brightness based on that? So, there is Windows software that does exactly what you want, and you are trying to replicate that software on a Mac?

#9 Airbender

Airbender
  • Members
  • 13 posts

Posted 24 May 2012 - 05:13 AM

Let me clarify it.The situation is: Regarding controlling brightness etc on a monitor,as you have mentioned,I would use win API calls to write the program.Here I need to connect light sensor to my laptop may be via RS 232 to USB converter plus a written software(which I would be writing or purchase if available) or through labjack(but I am not getting the serial communication protocols of lx1108 to talk to it as you mentioned and so right now I don't know how to use labjack) For the Mac I already have the software to control brightness etc and I need to connect the light sensor to it with or without labjack.So wanted to know the possibilities as mentioned in the previous post Waiting a reply

#10 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 24 May 2012 - 07:56 AM

If your computer does not have an RS232 serial port, you can get a USB to RS232 adapter. These should work on any OS. With any OS and any programming language, making calls to send/receive data on a serial port should be straightforward.

#11 Iandol

Iandol
  • Members
  • 46 posts

Posted 27 May 2012 - 02:14 AM

Hi, this may be of no use to you, but there are much simpler calibrated photodiodes to use. I use light->voltage photodiodes from TAOS (now AMS) along with an Arduino to make a little box we use in the lab to measure phospher signals from CRT monitors and allow TTL outs when a particular voltage (i.e. intensity) is reached. You can easily use the VS from the LabJack to power these and then simply read voltage in, then you simply use any of the methods (Python, Fuse, exodriver etc.) to integrate with your OS X interface.

http://www.ams.com/e...ight-to-Voltage

#12 Airbender

Airbender
  • Members
  • 13 posts

Posted 27 May 2012 - 10:17 PM

Thanks for de support.That means you are saying -connect the light sensor+USB to RS 232 adaptor to a PC and use MATLAB etc to write serial communication protocols .This would serve de purpose pl reply Thanks in advance

#13 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 29 May 2012 - 12:00 PM

Yes, that is what I suggest if you must use the light meter with RS232:

http://www.amazon.co...o...7752&sr=8-1

Something like Iandol's solution is the way to go if you want to use a LabJack.

#14 Airbender

Airbender
  • Members
  • 13 posts

Posted 30 May 2012 - 06:11 AM

Thanks for de reply.But the adapter u suggested would not be suitable one.Please tell me an adapter which has a 3.5mm jack RS 232 connection rather than two connection and is also compatible with MATLAB .Do I need any software to create virtual com ports in my laptop? waiting a reply Thanks in advance

#15 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 30 May 2012 - 09:02 AM

So the light meter uses some sort of headphone jack for RS232, rather than a normal DB9 connector? I would ask the manufacturer of the light meter how to connect that to a computer.

#16 Airbender

Airbender
  • Members
  • 13 posts

Posted 03 June 2012 - 10:02 PM

I m trying to use an apple ipod schuffle with some code MATLAB,would it work? Thanks in advance

#17 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 04 June 2012 - 03:05 PM

I doubt MATLAB runs on an iPod, and we don't have any knowledge about developing custom applications for an iPod Shuffle. That is a better question for an iPod or Apple forum, or a MATLAB forum. I suggest you contact Apple and MathWorks and ask their engineers.

#18 Airbender

Airbender
  • Members
  • 13 posts

Posted 07 June 2012 - 06:14 AM

Yes I checked it our.The ipod shufffle doesn't work.The device is not at all detected.Pl suggest a suitable adapter.

#19 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 07 June 2012 - 07:20 AM

Adapter for what? I don't understand.

#20 Airbender

Airbender
  • Members
  • 13 posts

Posted 07 June 2012 - 08:35 AM

A USB to RS232 converter with a earphone type 3.5 mm jack.An apple ipod connecter is such an example.But the pc doesn't detect it.May be the voltage levels are not matching.The pc doesn't have com port-so would a virtual com port driver +MATLAB +Converter work?

#21 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 07 June 2012 - 12:25 PM

So your light meter has an RS232 port, but rather than a normal DB9 connector it uses a headphone type jack for RS232.

You should get a normal USB<=>RS232 adapter like the one in post #13 above, but make your own cable that converts the headphone jack to DB9. Actually, you can probably just buy such a cable from Luxtron or someone else. I did a quick google of "3.5mm RS232 cable" and got lots of results. You will need to determine the pinout of your meters jack and confirm that the cable matches.

I also suggest you read more about RS232:

http://en.wikipedia.org/wiki/Rs232

http://www.lvr.com/spc.htm

#22 Airbender

Airbender
  • Members
  • 13 posts

Posted 07 June 2012 - 09:34 PM

Thanx.I have attached the specification for the connection Meter PC (3.5 mm jack plug) (9W 'D" Connector) Center Pin............................. Pin 4 Pin 2 2.2 K resistor connected between pin 2 and pin 5 Ground/shield.............................. Pin 2 Pin 5 The 16 digits data stream will be displayed in the following format : D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 Pl suggest some way of approach

#23 Airbender

Airbender
  • Members
  • 13 posts

Posted 15 June 2012 - 02:59 AM

Thanx for the support.Well I am able to connect my lux meter to the pc via USB to UART converter and using a 3.5mm mono jack to connect to the lux meter.I have used hyperterminal to acquire data.But instead of getting 16 bit data as posted in my previous post,I am getting a weird data such as: 4}{~:ys|{?:?:?}}?>w?u?w?߷7q߿{y}ο{ww;u>==u-~}{u3?߶? When I use MATLAB I get :timeout occurred before terminator was reached. I have used simple MATALB code with pause: s=serial('com3'); set(s,'BaudRate',9600,'DataBits', 8, 'Parity', 'none','StopBits', 1, 'FlowControl', 'none','Timeout',10); fopen(s); while(1) pause(2); fprintf(s,'0'); data=fscanf(s); data=str2num(data); if(data<=10) display(data) end end fclose(s); I don't know the terminator so I have not used it.Can I atleast get a continuous stream of data if I don't know terminator? Someone pl suggest how to solve this issues.

#24 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 15 June 2012 - 06:38 AM

At this point you should really be getting support from Luxtron. You have a Luxtron meter connected to a computer, so need support with the Luxtron meter and general RS232 expertise. Another good resource is the book I linked (Serial Port Complete by Jan Axelson).

#25 Airbender

Airbender
  • Members
  • 13 posts

Posted 21 June 2012 - 07:36 AM

Hello I succeeded in obtaining the readings .But the number of readings fed by the meter is only around 2 per second.It would not help.So I want to utilise the analog output of the sensor directly by using the labjack.I require around 1khz sampling rate.Pl tell me how to proceed Thanks in advance


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users