Coder Social home page Coder Social logo

ads1115's Introduction

STM32 - ADS1115 Single-Ended, Single-Shot, PGA & Data Rate Enabled HAL Library

A simple C library (STM32 HAL) for single-ended single-shot ADC measurments with ADS1115 module. (Tested on STM32F411RE)

This library includes several configurations such as PGA and data rate of ADS1115 and tested on STM32F411RE. Example project available.

  • ! ADS1115_readSingleEnded(...) returns voltage as mV.

  • Don't forget to check datasheet of ADS111x for detailed information: https://www.ti.com/lit/gpn/ADS1113

  • Don't forget to check ads1115.h file.

Example Usage

Configure an I2C peripheral on CubeMX.

/* USER CODE BEGIN 2 */

  // ADS1115 Init
  if(ADS1115_Init(&hi2c1, ADS1115_DATA_RATE_64, ADS1115_PGA_ONE) == HAL_OK){
	  // Device found.
	  HAL_Delay(1500);
  } else{
	  // Device cannot found.
	  while(1);
  }

  float voltageRead;

/* USER CODE END 2 */

And,

 /* USER CODE BEGIN WHILE */
  while (1)
  {

	if(ADS1115_readSingleEnded(ADS1115_MUX_AIN0, &voltageRead) == HAL_OK){
		//Voltage successfully read.
	 }

 /* USER CODE END WHILE */

[Türkçe/Turkish] Kullanım Talimatı

  • Adress değişkenini güncelleyin:

    1. ADDR PIN --> GND ise 1001000
    2. ADDR PIN --> VDD ise 1001001
    3. ADDR PIN --> SDA ise 1001010
    4. ADDR PIN --> SCL ise 1001011
  • ADS1115_Init(...) fonks. ile I2C peripheral ve PGA ile Data Rate ayarlarını yapın. (HAL_OK veya HAL_ERROR)

  • ADS1115_readSingleEnded(...) fonksiyonu ile single-shot okuma yapacağınız portu seçin ve float tipinde değişkeninizin adresini gönderin. (HAL_OK veya HAL_ERROR)

  • Üçüncü adımdan sonra değişkeninizin içerisinde uygun katsayıyla çarpılmış gerilim değeri saklanacaktır.

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.