Tell me what you want, What you really, really want.

Moderator: Mmiscool

User avatar
By trackerj
#64077 MCP3424 is another good option for a high res ADC. Cheaper, 18bit capabilities,etc, but slower than ADS1115. Depending on your project needs might fit. Have some around, can write an ESPBasic example for it if is for any interest.

If you wait for about a month or so you will find also the driver for ADS1115 in the ESPBasic section here:
http://www.esp8266-projects.com/search/label/ESPBasic
User avatar
By Barnabybear
#64079 Hi, I'm doing some work with one today and read through the data sheet yesterday. Not an easy read. I haven't tried this yet but my take is.
EDIT: this does work.

The ADS1115 has up to 4 analog inputs but only measures one a time. To set which one is being used use bits 14:12 (MUX) in the config register. Then set the pointer to and read the current value from the conversion register.
From Power on.
Code: Select allWrite:
B 0100 1000, IC address (address pin to Gnd).
B 0000 0001 set pointer to config register.
B 1100 0001 config bits 15:8 – set to read AIN0
B 1000 0011 config bits 7:0
End:

EDIT: A delay is needed here. I'm currently using 15ms but less will work you will need to test.

Write:
B 0100 1000, IC address (address pin to Gnd).
B 0000 0000 set pointer to conversion register.
End:

Read:
B 0100 1000, IC address (address pin to Gnd).
ADS sends back 2 bytes (MSB first) containing the value of the conversion register.

To read again
Read:
B 0100 1000, IC address (address pin to Gnd).
ADS sends back 2 bytes (MSB first) containing the value of the conversion register.

To read a different analog input do the same again but set bits 14:12 as follows:
Code: Select all100 = AIN0
101 = AIN1
110 = AIN2
111 = AIN3

So to read all 4 analog inputs you would have to do the above 4 times changing bits 14:12 each time through the loop' I'll know better later when I've had time to test this.

EDIT: changed conversion register as was incorrect.
EDIT: added a delay between write to config reg and pointer set.
User avatar
By simon410
#64096 Thanks for the fast reply,
i have two 5 volt sensors on my project to measure the load on my lorry.
I builded already a systeem with arduino and bluetooth, but the range is to small and the calibration procedure can not be adapted by OTA.
I will try your solution this weekend .