analog reading (DB15) | Thales IoT Developer Community
August 5, 2019 - 12:47pm, 8388 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,
I'm not sure what pin 13 / 15 you are refering to. If I'm not wrong, ADC is on pad 206 on this module and it is not shared with other interfaces - you can check it in Hardware Interface Description.
If sensor is correctly connected to pad 206 (of course it cannot exceed maximum voltage level which is 1.2[V]), AT^SRADC=1 should be enough to correctly read the value.
Do I understand correctly that you have it working from Java when you use I2C? Are you sure you don't use Gemalto terminal? In terminal indeed you have to configure level shifters via I2C to correctly convert the voltage level between the module and GPIO connector. Maybe in your device also similar approach is used? I think now you should check what exactly is sent over I2C in Java and send the same from AT command (using AT^SSPI command) before AT^SRADC command.
Best regards,
Adam