Other Parts Discussed in Thread: ADS1115
Tool/software: TI C/C++ Compiler
Dear Sir,
Could you please let me know how can measure voltage by software, thanks
Measure condition: CHG Relay+ -> input 100V
This is my schematic as below
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi,
Generally, the ADS1114 is a rather easy ADC to use. In the configuration that you have, I would use the device in single-shot conversion mode. You would set the device configuration, wait for the conversion to be completed and then read the conversion. I'm not sure what the maximum voltage you're trying to measure and what data rate you want, but here's an example with some generic settings.
Set OS=1 to start the conversion, MUX[2:0]=000 for AINP=AIN0 and AINN=AIN1, PGA[2:0]=010 for FSR=±2.048V, MODE=1 for single-shot conversion mode, DR[2:0]=101 for 128SPS, and COMP_QUE[1:0]=11 to disable the comparator. You can change these to different settings, I'll use these as an example.
Then you would combine these settings to write of 8183h to write to the config register. This would be a four byte transaction. Below, I assume that the ADDR pin sets the address to 1001 000.
1001 0000 I2C address write
0000 0001 Config register pointer
1000 0001 81 MSB Config register
1000 0011 83 LSB Config register
After this, you would wait for the ADC to complete the conversion. This wait time is the data period plus 10% (to compensate for the internal oscillator variation of the device). An additional 20us is added for the wake up time for ADC for each conversion. This time is calculated as:
Wait time = nominal data period + 10% + 20μs
= (7.82ms × 1.1) + 20μs = 8.62ms
Once this time has passed, you would read from the device: This would be done in a 5 byte I2C transaction:
1001 0000 I2C address write
0000 0000 Conversion register
1001 0001 I2C address read
xxxx xxxx Read conversion data MSB
xxxx xxxx Read conversion data LSB
After this read, you can repeat the process to read it again. If you were using the ADS1115, you can set up these registers for each input channel.
Joseph Wu