Giter VIP home page Giter VIP logo

esp32-adc-calibrate's People

Contributors

e-tinkers avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

esp32-adc-calibrate's Issues

How to setup the lut on Arduino IDE

Goodmorning, I recently discovered the problem of non-linearity on my esp-32 which is an Heltec wifi kit V3. Is it possible to get rid of this problem with your code? How can I set up the library on my arduino ide to try to fix the non-linearity? There's some additional library that I should install? or maybe download and installing something from here? Can you please help me initialize the lut?

Doubt about accuracy of the DAC itself

Hi, thanks for this great effort.

According to my understandings in order to calibrate a device we should use a more accurate and precise device as reference, but here how would you know that DAC of ESP32 is accurate and precise enough to do so? What if the DAC do suffer from the same non Linearity issues as ADC? I mean then have you tested the calibrated ADC with oscilloscope and precise voltage generators or something to see whether the results is improved or worsened?

Sorry that i am not trying it myself because currently i haven't required tools to do so.

'adcStart' was not declared in this scope

Hi,
I get the below errors when running the code in Arduino 1.8.13 with the latest arduino-esp32 build:

error: 'adcStart' was not declared in this scope
error: 'adcEnd' was not declared in this scope

Does not work at high temperatures.

I have a 100k thermistor. When the temperature reaches about 100 degrees, the data goes wrong. The input voltage is about 0.15V. It looks like the readings rest on a dead zone?

Use a more precise signal reference

Because not to use LEDC or I2S PDM to generate a precise signal reference instead of low (8 bit) resolution internal DAC ?

Frequency | Bit depth | Available steps
Max 1220Hz 16 65536
Max 2441Hz 15 32768
Max 4882Hz 14 16384
Max 9765Hz 13 8192
Max 19531Hz 12 4096

You can eg generate a frequency max 1220Hz and have a resolution of 16 bits changing the duty cycle from 0 to 65535.

LEDC is linear and use ESP 16 bit internal timers, it is precise and you can setup it as you like by setting resolution, frequency and finally the desired duty cycle.

I used LEDC in 1bit mode to generate frequencies up 40Mhz to use as master clock signal replacing quartz, to sample audio over I2S so it can generate a precise signal reference on almost any pin, check documentation to know pins that support it.

To improve your project I suggest you these things:

  • add a small poliestere (or ceramic) capacitor from ADC input pin to GND (like a 100nF), this depends on PWM frequency you use, the higher the frequency the smaller the capacitor should be. Probably a resistor too is needed, check projects that output audio with PWM and you'll find a simple RC filter schematic. To be precise the better is to generate a 50% duty cycle, use an adjust capacitor and a trimmer, and check the signal to an oscilloscope, when you see a square wave adjust it to have just a line on oscilloscope, so until you measure around 1.65v (3.3v / 2), at the end some small noise will remain, this not a problem, optionally you can put some other smaller ceramic capacitors in parallel. At the end by check the signal on serial plotter you should see an exact line, no noise at all, you now use 4096 steps not 256 steps, and with capacitor it should be the difference.
  • for your cpp file try to import <driver\ledc>, initialize it... and then in the sampling cycle you can just change the duty cycle every step. If you eg use 16 bits at 1000 Hz, just divide 65536 by 4096 that are max steps for ADC, doing this you find the step to increase a duty cycle in a loop of 4096 steps (that is 16 units).
  • in my opinion to have better accurate measurements you should add a significant delay after you acquire every of 4096 values, like at least 20-50 milliseconds, this help to be more precise depending if you use float or integer math for a lookup table. Optionally sample 10 or more times and then average it help to remove noise. Optionally apply a software LPF filter will remove completely tha ADC noise. I use it and works very well. If you want some code for this I can send you, the code is simple, just a few of lines. I use it on many platforms even when I develop for desktop machines.

Another way slould be to use I2S and setup it in the I2S config as PDM out. This even is used for audio, so it is good and can be used as linear precise voltage reference, more more better than internal 8 bit DAC, it is like default Raspberry 3.5 mini audio jack, not so good like an external audio DAC but can play 16 bit audio.

The best maybe is setup LEDC to 12 bit, use something like 10 or more Khz so you will have high frequency and exactly 4096 steps, the same than ADC. (highter frequency = less noise, you can increase up 19Khz, exact 4096 steps avoid you to divide steps, in your loop just increase by 1 unit every iteraction).

I'm not sure if this help you, I hope yes.
Many thanks for your work.
Max.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.