Giter VIP home page Giter VIP logo

cs1237_adc_library's Introduction

Description:

This is the library for the CS1237-IC from Chipsea. the translated datasheet can be found here

The library is designed to be used with one or two CS1237-ADCs-Chips, because if you uses the high frequency mode (1280Hz), the timing is though. The gain (1,2,64,128), the sample rate(10Hz,40Hz,640Hz,1280Hz), the reference voltage (internal, or external) and the channel(external differential signal, temperature sensor) can be configured.

You have to use one Clock line for each ADC. I have experimented with multiple ADC-Chips on one clock-line, but it is impossible to snchronize these chips. Synchronisation is very important, because depending on the configured sample rate there is a regular interrupt from the ADC Chip on the data line. If the data transmission is in progress, while the interrupt happens, the transmitted value is wrong.

This library is written with hardware interrupts and timers, so it can run in the background.

Preconditions

  • At this time it is only allowed to connect only two ADCs with one clock and one data line each.
  • you could use nearly any GPIO for the clock lines and any GPIO with an interrupt function for the Data line.

Compatibility

This library was only tested on the ESP32 DEV_KIT_V4

Author

Written by Julian Weidinger for an University Project.

cs1237_adc_library's People

Contributors

julianweidinger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cs1237_adc_library's Issues

debug spikes

If the data transfer is at the same time, when there is a new ADC measurement ready in the IC, then the DOUT-Pin goes to high for 26,13us. You have to make sure, that the data transfer is in the time between the old and the new measurement depending on the configured sample rate. The perfekt timing would be direct after the measurement.

returned ADC values are 16 bit wide on Arduino Nano

Hi Julian,
thanks for the great library.
One observation I'd like to share:
I was testing the library on a arduino nano and used the read_without_interrupt function.
I noticed that all the returned values were clipped to 16 bit complement.
To fix that, I found that digitalRead was returning an int, so to make the 23 bit shift working I casted to uint32 before that.

 //   reading_ |= digitalRead(_dout) << (23 - i);
     reading_ = reading_ |  (((uint32_t) digitalRead(_dout)) << (23 - i));

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.