Vernier Sensor

This is where you talk about the NXJ hardware related topics such as the brick, sensors, LEGO pieces, etc

Moderators: roger, 99jonathan, imaqine

Vernier Sensor

Postby ccorrea » Thu Feb 17, 2011 4:08 pm

Hi everybody!!

Anyone know what IC using Vernier sensors (conductivity or other), I think they use some kind of I2C IC. I need to know which one, in order to try to comunicate with them.

Thganks and best regards

Christian
ccorrea
New User
 
Posts: 1
Joined: Thu Feb 17, 2011 3:59 pm

Re: Vernier Sensor

Postby WalrusBrigade » Fri Mar 11, 2011 3:50 pm

I too have been trying to figure out how to access some vernier sensors in lejos. I've got the adapter, but all of the support is for LabView, RobotC or NXT-G. I'm trying to turn 4 force sensors into a force plate, and was going to use the NXT to do the processing and output. But trying to code sensors is a bit beyond my ability. So if anyone can answer this question and already has a way to communicate with them, I would love to hear what it is.

Christian, if you can figure this out would you please post the result so I could try your code. Thanks.

Martin
WalrusBrigade
New User
 
Posts: 13
Joined: Tue Feb 09, 2010 11:33 pm

Re: Vernier Sensor

Postby skoehler » Fri Mar 11, 2011 4:44 pm

WalrusBrigade wrote:I too have been trying to figure out how to access some vernier sensors in lejos. I've got the adapter, but all of the support is for LabView, RobotC or NXT-G. I'm trying to turn 4 force sensors into a force plate, and was going to use the NXT to do the processing and output. But trying to code sensors is a bit beyond my ability. So if anyone can answer this question and already has a way to communicate with them, I would love to hear what it is.

Christian, if you can figure this out would you please post the result so I could try your code. Thanks.


You can use the methods of the SensorPort to do I2C I/O. I think it's very much like in RobotC, once you get the idea of how to translate RobotC command into leJOS calls.
skoehler
leJOS Team Member
 
Posts: 1115
Joined: Thu Oct 30, 2008 4:54 pm

Re: Vernier Sensor

Postby WalrusBrigade » Fri Mar 11, 2011 6:07 pm

Thanks!! I'm not really familiar with RobotC . . . or any C for that matter. I just brought it up because the support for the NXT adapter has RobotC in it. Still, I can fiddle around with SensorPort and hopefully will figure out how to get the data out. By the looks of it I can use the .readRawValue() method and do some processing after the fact. My only concern now is figure out how to configure the sensor properly. Again, thanks for pointing me in the right direction.
WalrusBrigade
New User
 
Posts: 13
Joined: Tue Feb 09, 2010 11:33 pm

Re: Vernier Sensor

Postby skoehler » Fri Mar 11, 2011 7:09 pm

WalrusBrigade wrote:Thanks!! I'm not really familiar with RobotC . . . or any C for that matter. I just brought it up because the support for the NXT adapter has RobotC in it. Still, I can fiddle around with SensorPort and hopefully will figure out how to get the data out. By the looks of it I can use the .readRawValue() method and do some processing after the fact. My only concern now is figure out how to configure the sensor properly. Again, thanks for pointing me in the right direction.


readRawValue is for analog sensors only. For I2C, you have to use other method. Take a look at the source of the I2CSensor class.
skoehler
leJOS Team Member
 
Posts: 1115
Joined: Thu Oct 30, 2008 4:54 pm

Re: Vernier Sensor

Postby sojkic » Tue Apr 10, 2012 3:14 pm

Hi,
do you know how get values from dual-range force sensor (Vernier)? I work in Java and I use nxt unit with Vernier nxt adapter. Can you help me, please? I´m sorry my English is bad.
sojkic
New User
 
Posts: 10
Joined: Fri Apr 06, 2012 5:32 pm

Re: Vernier Sensor

Postby skoehler » Fri Apr 13, 2012 2:27 pm

Please tty SensorPort.S1.readRawValue()
You will probably have to calibrate the sensor yourself.
skoehler
leJOS Team Member
 
Posts: 1115
Joined: Thu Oct 30, 2008 4:54 pm

Re: Vernier Sensor

Postby sojkic » Mon Apr 16, 2012 4:25 pm

skoehler wrote:Please tty SensorPort.S1.readRawValue()
You will probably have to calibrate the sensor yourself.

This method SensorPort.S1.readRawValue() return value -1 and a I don´t know why.
sojkic
New User
 
Posts: 10
Joined: Fri Apr 06, 2012 5:32 pm

Re: Vernier Sensor

Postby skoehler » Mon Apr 16, 2012 6:09 pm

You probably to call SensorPort.S1.setTypeAndMode once before readRawValue will work.
SensorConstants.MODE_RAW is probably the right mode. I'm not sure about the type. Try SensorConstants.TYPE_LIGHT_ACTIVE and TYPE_LIGHT_INACTIVE.
skoehler
leJOS Team Member
 
Posts: 1115
Joined: Thu Oct 30, 2008 4:54 pm

Re: Vernier Sensor

Postby sojkic » Mon Apr 16, 2012 6:57 pm

skoehler wrote:You probably to call SensorPort.S1.setTypeAndMode once before readRawValue will work.
SensorConstants.MODE_RAW is probably the right mode. I'm not sure about the type. Try SensorConstants.TYPE_LIGHT_ACTIVE and TYPE_LIGHT_INACTIVE.

Excellent... The method return some value now, but Do you know how it calibrate, please? Thank you, very much.
sojkic
New User
 
Posts: 10
Joined: Fri Apr 06, 2012 5:32 pm

Re: Vernier Sensor

Postby skoehler » Mon Apr 16, 2012 7:02 pm

Apply a known force, write down the value. Apply another known force, write down the second value. Now perform linear interpolation. Or, even better, apply a third known force, and write down the value. Now look, whether linear interpolation is actually the correct method.
skoehler
leJOS Team Member
 
Posts: 1115
Joined: Thu Oct 30, 2008 4:54 pm

Re: Vernier Sensor

Postby sojkic » Tue Apr 17, 2012 12:51 pm

skoehler wrote:Apply a known force, write down the value. Apply another known force, write down the second value. Now perform linear interpolation. Or, even better, apply a third known force, and write down the value. Now look, whether linear interpolation is actually the correct method.

I´m sorry, but why linear interpolation? This method return value in the unit NXT 555-556. This is mN??? I am tried take first value and writed to variableA and then I used variableB = (variableA - variableB); variableB is the second measured value. It is probably wrong, right? Maybe this are bad questions, i´m sorry. Thank you for your help.
sojkic
New User
 
Posts: 10
Joined: Fri Apr 06, 2012 5:32 pm

Re: Vernier Sensor

Postby skoehler » Tue Apr 17, 2012 1:45 pm

readRawValue() returns the value of the ADC. it's neither Newton-meters or any other unit that has a name.

The r1 and r2 the two raw values and let f1 and f2 be the corresponding known forces.
Then f = (r-r1)*(f2-f1)/(r2-r1)+f1 where r is the current raw value and f is the current force.

That's pretty basic linear interpolation between two known points (r1,f1) and (r2,f2).
skoehler
leJOS Team Member
 
Posts: 1115
Joined: Thu Oct 30, 2008 4:54 pm

Re: Vernier Sensor

Postby sojkic » Tue Apr 17, 2012 2:17 pm

skoehler wrote:readRawValue() returns the value of the ADC. it's neither Newton-meters or any other unit that has a name.

The r1 and r2 the two raw values and let f1 and f2 be the corresponding known forces.
Then f = (r-r1)*(f2-f1)/(r2-r1)+f1 where r is the current raw value and f is the current force.

That's pretty basic linear interpolation between two known points (r1,f1) and (r2,f2).

Yes, I found this pattern, but I didn´t know what to put into the pattern. Where do I get the value of f? r is value from method readRawValue()? Thank you very much for your help.
sojkic
New User
 
Posts: 10
Joined: Fri Apr 06, 2012 5:32 pm

Re: Vernier Sensor

Postby skoehler » Tue Apr 17, 2012 2:21 pm

f is the value you compute. What you actually need are r, r1, r2, f1, f2. And yes, r is the value returned by readRawValue().
skoehler
leJOS Team Member
 
Posts: 1115
Joined: Thu Oct 30, 2008 4:54 pm

Next

Return to NXJ Hardware

Who is online

Users browsing this forum: No registered users and 0 guests

more stuff