Skip to content

Library and usage examples for interacting with PCF8591 based i2c ADC

License

Notifications You must be signed in to change notification settings

ptrks/avr-i2c-adc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

avr-i2c-adc

This repo will help you get started with using the PCF8591 A/D & D/A I2C capable converter.

Prerequisites

To be able to run these examples you will need an ATmega328/128 microcontroller and a PCF8591 module. I picked up a really awesome module on Amazon that has a built in trim pot, photoresistor and thermistor. This allowed for very fast verification of communication and A/D sampling. This module also has an LED attached to the D/A converter for quick visual verification of values being written to it.

Getting Started

Hooking up the PCF8591 module to your micocontroller is super easy. The only connections required are SDA,SCL,GND and VCC. Here is a table showing the I2C (TWI) pins on bare bones microcontrollers and the popular Arduino Uno.

Pin Function ATmega328p ATmega128 Arduino UNO
SDA PC4 PC4 Analog Input 4
SCL PC5 PC5 Analog Input 5

Compiling and Flashing

My project is using an ATmega328p with a 16Mhz clock. Update CMakeLists.txt as needed:

  • Microcontroller : set(MCU atmega328p)
  • Clockspeed : set(F_CPU 16000000)
  • Programmer: set(PROG_TYPE usbasp)
git clone https://github.com/patrick--/avr-i2c-adc
cd avr-i2c-adc
mkdir build
cd build
cmake ..
make flash

About

Library and usage examples for interacting with PCF8591 based i2c ADC

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published