tomtor / ulp-i2c

Esp32 ULP I2C code and bmp180 example
GNU Lesser General Public License v3.0
99 stars 18 forks source link

example for ADS1015/ADS1115? #5

Closed mahesh2000 closed 3 years ago

mahesh2000 commented 4 years ago

Hi, do you have a simple example for an ADS1015/ADS1115? my understanding of the ESP32 assembler is limited. i've already written a .S program that gets adc values and triggers recording of said values into an array when a significant difference with a reference value occurs. the esp32's built-in ADC is too noisy to be of actual use, hence i need to use the ADS1x15. my code is for the arduino but that shouldn't matter because the ULP's .S code is used as-is.

my guess is that a simpler subset of your code is what i need, nothing fancy. Thanks!!

dmartauz commented 4 years ago

@mahesh2000 Were you successful with reads from / writes to ADS1015?

mahesh2000 commented 4 years ago

no, unfortunately not. it looked complicated enough where between doing a basic examplem integrating it with the rest of my .S and .c code and testing it would take the better part of two weeks.

dmartauz commented 4 years ago

Do you think that in general it should be feasible to work with ADS1015 from ULP of ESP32 including 16-bit writes?

mahesh2000 commented 4 years ago

I don't see why not, though it'll probably involve a fair bit of bit-banging. It's of more complexity and testing than I can handle for now. It's too bad, as it'd be a good solution.

tomtor commented 3 years ago

@mahesh2000 Hi, I have an ADS1115 so I might create a demo in the future.

It shouldn't be very complex (the BMP init code in the example is probably more complex then reading the ADS?) and I assume someone has already done this?

If you adapt the readBMP function for the ADS I can have a look at it.

It is important to grow your readADS step by step, because debugging is difficult. So first return always a constant value, eg 100 and check that you receive that in your calling Arduino program. Then slowly expand the code in little steps.

mahesh2000 commented 3 years ago

hi @tomtor, I moved away from the ADS1115, found a more appropriate solution.