analog reading (DB15) | Thales IoT Developer Community
August 5, 2019 - 12:47pm, 7603 views
good morning!
I want to read the data of a pressure translator, to know the pressure level. I have activated the DB15 port to use the analog inputs in it. I have made the connection through COM1 and it has been successful. But I don't know how to do the reading. I have connected the translator cable on pin 13 and pin 15. which are the analogs. But I don't know what else to do. How do I read by pin 13? or by pin 15?
I know that the reading I do then I must convert because the range of values is 0.5 to 4.5 volts. and I must do an operation to get the real value of the pressure. But I don't know how to read this voltage.
use the example of rs232:
public void lectura(){
try {
int ch = inStream.read();
Logger.message(String.valueOf(ch));
} catch(IOException e) {
Logger.message("Error al establecer comunicación en el puerto:"+e.toString());
}
}
I never get any value with this code, it stays in this line: int ch = inStream.read();
the pressure translator is always returning voltage, if it has no pressure it returns 0.5V, So the mistake is that I am reading badly.
could someone guide me a little?
thank you!
Hello,
please let me know what module do you use (answer to ATI1 command). Do you use your own device or some Gemalto eval board / terminal? RS232Demo is midlet example that can be used to communicate over COM port (RS232, USB) with external device, you cannot use it for analog reading.
For this purpose please check ADC class from our Java api.
Best regards,
Adam
ok, thank you Adam
Investigating a little more and seeing some manuals I have realized that I was not doing anything right.
Now I use the Gpio5V example. It's giving me mistakes, but I just started trying it. If you keep giving me the error I will let you know to help me, thanks.
Of course, I will wait for your feedback.
Best regards,
Adam
I am using the sample app "Gpio5V_lib".
What I want is to read from the Gpio15 or the Gpio13, the level of voltage that enters. which will be between 0.5 and 5 Volts. With this example, put the pin you put, the result is the same. So I don't know how to read correctly.
I also tried this:
Hi,
Gpio5V_lib is used to set or get binary states of pins. It also configures level shifters that are present in concept board or terminal (to convert voltage from module level to 5[V]). As I wrote, please look at ADC class and please let me know ATI1 of module you use and information whether you use gemalto terminal or just the module.
Please also remember about proper voltage level conversion, if it's necessary.
Best regards,
Adam
Hi Adam, thank you very much.
I already understand, I already use the ADC class to get the voltages, or the command "AT ^ SRADC". and I know that the result is in mV up to 1200. The problem that is emerging is that the voltage gives me approximately 250, even if I have nothing connected in the analog input.
-------------------------------------------------------------------------------------------
AT^SRADC=1
^SRADC: 1,251
---------------------------------------------------------------------------------------------
AT^SRADC=1,250
OK
^SRADC: 5,253,254,292,254,255
^SRADC: 5,253,255,254,255,253
^SRADC: 5,254,253,255,254,253
------------------------------------------------------------------------------------------
it also throws me the same result in java.
Then I put 5k of air pressure to increase the voltage and the value remained the same.
I don't know if I should do something before, and I've skipped it.
I'm just using the gemalto module
------------------------------------------------------------------------------------------------------
ATI1
Cinterion
EHS6
REVISION 03.001
A-REVISION 00.000.51
Hello,
many thanks for the information - I will check it on my side and come back to you.
Best regards,
Adam
Hi,
Please,
Could you provide of information with setup you are using?
Terminal, DSB board or just a device for a third party with the module inside?
Regards
ALopez
Somewhere over the rainbow!!! Looking for the Oz Land!!!
*****, I use a device, which has the module inside, this device has a DB15 input, in the manual it says that the analog input is in this DB15 input, on pins 15 and 13 (it has 2 analog inputs). To the device, I am connecting a pressure translator. With 3 cables, 2 power and one read, this read cable is connected to pin 15 or pin 13 (I've tried both). and I execute the commands I put before. Although if I do not have this cable connected the result is the same.
I have written to the providers of this device and they have sent me an example in analog reading java, and it worked for me. the problem in java is that I did not use the I2c bus of the class "I2cBusConnection", reading from this class, I took the values well. From the AT commands I still can't read this, but since it works through java, nothing happens, I do it from the midlet.
Thank you very much for your help
Pages