New PhidgetSBC Firmware Version 1.0.4

General PhidgetSBC Discussion.
galileo

Re: New PhidgetSBC Firmware Version 1.0.4

Post by galileo »

AdamS wrote:You would need to use a code sample for the PhidgetInterfaceKit. There should be a InterfaceKit-simple program in there, and to get the data for the temperature sensor you would need to poll the sensor value of the index in which the temperature sensor is plugged in, or use the sensor changed events.
As you can see above i have used the InterfaceKit-simple program and i was trying to get results from tempsensor...I have used TemperatureSensor-simple.c and i cannot understand why that programm is speciffically built for 1051 sensor???

1st question:What is the difference???As i saw in your forum the 1070SBC and generally any interface kit doesn't recognize sensors in its analog inputs, only voltage!!!am i correct????
so if i take voltage and with the formula that exists in 1125.pdf i can convert the value i take from my sensor to temperature...right?????(And things aren't the same for the humidity sensor too???)so why isn't the programm proper for my 1125 sensor??????????

2nd question: please tell me and be as much explanatory as you can, which functions should i use to take measurements with my 1125 sensor(see also my code above)

3d question: if i want to control a motor in one of my digital output with a pwm, how can i achieve it???Do i must built an external circuit, or PWM is built on board???In any case with which functions do i do that???

Please give me your answers in a more explanatory way...if you cannot provide code samples, then give me a structure of the programms with functions and comments on the program's stucture...

thank you very much for your time...
User avatar
Patrick
Lead Developer
Posts: 3403
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: New PhidgetSBC Firmware Version 1.0.4

Post by Patrick »

1125 is an analog sensor which plugs into 1018. All analog sensors show up as a voltage which must be converted using the formula from the product manual. All analog sensor are accessed from the InterfaceKit API and you should be looking at the interfacekit examples.

1051 is completely different, it is a USB Phidget (not an analog sensor) for interfacing with thermocouples. It has it's own API, and thus it's own examples.

The interfacekit examples generally output a raw sensor value (0-1000). It's up to the user to insert the formula for their specific sensor. The C# full example does implement the formulas for all sensors.

1018 won't do PWM, at least not reliably. We do offer several motor controller that do PWM output.

-Patrick
galileo

Re: New PhidgetSBC Firmware Version 1.0.4

Post by galileo »

patrick wrote:1125 is an analog sensor which plugs into 1018. All analog sensors show up as a voltage which must be converted using the formula from the product manual. All analog sensor are accessed from the InterfaceKit API and you should be looking at the interfacekit examples.

1051 is completely different, it is a USB Phidget (not an analog sensor) for interfacing with thermocouples. It has it's own API, and thus it's own examples.

The interfacekit examples generally output a raw sensor value (0-1000). It's up to the user to insert the formula for their specific sensor. The C# full example does implement the formulas for all sensors.

1018 won't do PWM, at least not reliably. We do offer several motor controller that do PWM output.

-Patrick
I don't have 1018, but 1070SBC...Where can I find the interfacekit API for 1070???in the 1070.pdf on page 37??? And if so, how do i use these commands??? In the manual there is only their description, it is not mentioned the manner of their usage...
I did go to http://www.phidgets.com/products.php?ca ... ct_id=1070 to the "Code Samples For This Product" section and downloaded the http://www.phidgets.com/downloads/examp ... 103.tar.gz ...
So what???you said that the temperaturesensor_simple.c is not for the 1125 sensor(and there is no example for humidity)...I want code sample, so as to understand how to built my program...
Your response to that is to look C# examples to understand how to do it???Did I understand correctly???

And lastly as far as it concerns PWM, what you've told me stands also for the 1070SBC that i got???
I want to set up an experiment, where there is a glass surface with humidity, and when humidity ranges between two limits a simple fan will start so as to make humidity disappear on the glass...So i don't need any motor or servomotor, but i'll need PWM so as to control fan speed...

waiting for your answers...
AdamS

Re: New PhidgetSBC Firmware Version 1.0.4

Post by AdamS »

The 1070 is a 1018 I/O board embedded in a Linux SBC. So really when you are controlling the inputs, outputs and sensors on the 1070, you are really interacting with an Interface kit.

Really when you are using this device in software, as far as the API is concerned, all you are doing is connected to a 1018 board connected to some machine somewhere on your network.

So when Patrick mentioned that the 1018 really isn't capable of driving PWM from its digital outputs, this also applies to the 1070.

As for the code sample, what you want to look at is whatever IntefaceKit example is available for the language you wish to choose. The code written in that code sample is exactly what you would want to use. However, in your specific case with using your temperature/humidity sensor, when you get your sensor value from the event or by polling, you would then apply the formula appropriate for the sensor that is being read.

For example, if you have the temperature portion of the sensor in index 0 of the analog inputs and the humidity portion of the sensor in index 1 of the analog inputs. When a sensor change event occurs, you could check to see what sensor index generated the event, and if it is index 0 you would apply the formula for temperature to the value sent, and it if it is index 1 apply the formula for humidity.

i.e.:

Code: Select all

int SensorChangeHandler(CPhidgetInterfaceKitHandle IFK, void *usrptr, int Index, int Value)
{
   if(Index == 0)
   {
       printf("Temperature: %d", ((Value * 0.22222) - 61.11));
    }
    else if(Index == 1)
    {
       printf("Humidity: %d", ((Value * 0.1906) - 40.2));
     }
}
Writing this code would then output the temperature or humidity value whenever the sensor registered a change in those values. The rest of the code within the InterfaceKit-simple.c example could pretty much stay the same if necessary.

I hope this makes it a bit more clear.
galileo

Re: New PhidgetSBC Firmware Version 1.0.4

Post by galileo »

AdamS wrote:The 1070 is a 1018 I/O board embedded in a Linux SBC. So really when you are controlling the inputs, outputs and sensors on the 1070, you are really interacting with an Interface kit.

Really when you are using this device in software, as far as the API is concerned, all you are doing is connected to a 1018 board connected to some machine somewhere on your network.

So when Patrick mentioned that the 1018 really isn't capable of driving PWM from its digital outputs, this also applies to the 1070.

As for the code sample, what you want to look at is whatever IntefaceKit example is available for the language you wish to choose. The code written in that code sample is exactly what you would want to use. However, in your specific case with using your temperature/humidity sensor, when you get your sensor value from the event or by polling, you would then apply the formula appropriate for the sensor that is being read.

For example, if you have the temperature portion of the sensor in index 0 of the analog inputs and the humidity portion of the sensor in index 1 of the analog inputs. When a sensor change event occurs, you could check to see what sensor index generated the event, and if it is index 0 you would apply the formula for temperature to the value sent, and it if it is index 1 apply the formula for humidity.

i.e.:

Code: Select all

int SensorChangeHandler(CPhidgetInterfaceKitHandle IFK, void *usrptr, int Index, int Value)
{
   if(Index == 0)
   {
       printf("Temperature: %d", ((Value * 0.22222) - 61.11));
    }
    else if(Index == 1)
    {
       printf("Humidity: %d", ((Value * 0.1906) - 40.2));
     }
}
Writing this code would then output the temperature or humidity value whenever the sensor registered a change in those values. The rest of the code within the InterfaceKit-simple.c example could pretty much stay the same if necessary.

I hope this makes it a bit more clear.
ok it's pretty clear what you're saying here...but apart from this, my problem is the attachment of my 1125 sensor onto the 1070SBC...

so what must i do about that???how can i get access to my sensor???because the function above declares that you have the value so as to use it as argument in it...isn't this so???
erik wrote:In interfacekit_simple() on the line where you have

Code: Select all

tempsensor_simple(&tempsensorValue);
replace with

Code: Select all

CPhidgetInterfaceKit_getSensorValue ((CPhidgetInterfaceKitHandle)ifkit, 0, tempsensorValue);
If you are using the 1125 Temperature/Humidity Sensor (http://www.phidgets.com/products.php?ca ... ct_id=1125), then you cannot use any of the code from TemperatureSensor-Simple.
TemperatureSensor-Simple is only used for 1051 PhidgetTemperatureSensor 1-Input (http://www.phidgets.com/products.php?ca ... ct_id=1051).
so eventually i must replace the above function to get functionality with my program???I didn't do it till now because you told me that the temperature sensor-simple code wouldn't do for my sensor...

Do I replace this function in my previous code(the last i've sent) and if i want to see my values printed i replace value in "int SensorChangeHandler(CPhidgetInterfaceKitHandle IFK, void *usrptr, int Index, int Value)" with tempsensorValue??????after i have done the same thing about humidity, and my code will be allright?????
AdamS

Re: New PhidgetSBC Firmware Version 1.0.4

Post by AdamS »

I think you are confused.

Code: Select all

int SensorChangeHandler(CPhidgetInterfaceKitHandle IFK, void *usrptr, int Index, int Value)
{
   if(Index == 0)
   {
       printf("Temperature: %d", ((Value * 0.22222) - 61.11));
    }
    else if(Index == 1)
    {
       printf("Humidity: %d", ((Value * 0.1906) - 40.2));
     }
}
This code is a declaration of the SensorChangeHandler callback function. This function will be called automatically by the library whenever the InterfaceKit generates a sensor change event whenever it detects a change in sensor input value on one of its analog sensor inputs.

Those arguments are simply returned by the event, they are not provided by you and you do not have to declare them. You do not have to provide this variable.

Also, with respect to your code, you have a problem in that you basically took the intefacekit code sample and temperaturesensor code sample and mashed them together, and I think this is where most of your confusion is coming from. None of the temperature sensor code sample code has anything to do with your setup and should just be removed from your code.

What I really suggest for you is to simply start with the a fresh copy of the interfaceKit-simple.c code sample, and replace the code within the SensorChangeHandler declaration with what I posted above and try it out. This is really ALL you should need to get your temperature and humidity data.

To make this easier I have attached a modified version of the InterfaceKit-simple.c file where I have made the necessary change to show how to read the temperature and humidity data. Please look over this file carefully and try it out. This should be all you need to do to read the temperature and humidity value and display it to the screen. Please make sure you have your sensor connected such that the Temperature output is plugged into analog sensor input 0 on the 1070 and the Humidity output is plugged into analog sensor input 1 on the 1070.
Attachments
InterfaceKit-simple.c
Modified InterfaceKit-simple.c file
(7.5 KiB) Downloaded 1191 times
galileo

Re: New PhidgetSBC Firmware Version 1.0.4

Post by galileo »

ok thanks for the code.it's working at last... :?

but
This is my first question!!!
if i want to make a loop and read continuously the two values for a certain amount of time where i should put the loop in my program so as to achieve that?????
The only way i found is to put it in the main function, but if i do that the program starts all over again as many times as the count in the for loop...

2nd question:
i want to connect a D/A converter to the 8 digitals outputs...How can i write a byte to the D/A converter???

Please be as more explanatory as you can be...so as to not send you questions all the time...

Thank you for your time.
_Dejan_

Re: New PhidgetSBC Firmware Version 1.0.4

Post by _Dejan_ »

Hi,
Is new firmware for SBC version 1.0.4.20110120 compatible with Phidget 21 Installer (64-bit) 2.1.7.20101222/20101223 ? Or I must wait for new installer?
_Dejan_

Re: New PhidgetSBC Firmware Version 1.0.4

Post by _Dejan_ »

Look's like do not work or there is some BUG with Phidget Control Panel.
I have connected
RFID and TextLCD to SBC and with Bonjour service connect to TextLCD interface and when I write text to first input box I see it normaly on device but when I write it to second input box it do not show on device anything(only already writen first line)...
lotsacaffeine
Fresh meat
Posts: 4
Joined: Tue Mar 15, 2011 11:26 am
Contact:

Re: New PhidgetSBC Firmware Version 1.0.4

Post by lotsacaffeine »

Did you find a solution to this problem? I'm having the same issue today. I'm on a 64-bit Win7 system. Think that has anything to do with it?

Bill
_Dejan_ wrote:Look's like do not work or there is some BUG with Phidget Control Panel.
I have connected
RFID and TextLCD to SBC and with Bonjour service connect to TextLCD interface and when I write text to first input box I see it normaly on device but when I write it to second input box it do not show on device anything(only already writen first line)...
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests