PCF8591 AD DA Board

From Waveshare Wiki
Jump to: navigation, search
PCF8591 AD DA Board
PCF8591-AD-DA-Board

A/D Converter & D/A Converter Module with I2C interface, PCF8591 on board, 8-bit resolution, 4 channel AD, 1 channel DA, voltage output
{{{name2}}}

{{{name3}}}

{{{name4}}}

{{{name5}}}

Primary Attribute
Category: Modules
{{{userDefinedInfo}}}: {{{userdefinedvalue}}}
Brand: Waveshare
Website
International: Waveshare website
Chinese: 官方中文站点
Onboard Interfaces
I2C DA AD
Related Products

Overview

The PCF8591 AD DA Board features an 8-bit A/D Converter & D/A Converter PCF8591 with four analog inputs, one analog output, and a serial I2C-bus interface.

The PCF8591 AD DA Board features I2C pinheader on one side and an I2C connector on the opposite side. Hence, it's more flexible to connect the board to your development system. The board also supports I2C cascading, allowing the use of multi modules connected to the I2C bus at the same time by connecting the pinheader and connector.

Features

  • Chip: PCF8591
  • Working voltage: 3.3V/5V
  • Max transfer rate: 11.1KHz
  • ADC precision: 8 bits
  • DAC precision: 8 bits
  • ADC channel: 4
  • DAC channel: 1
  • Interface: I2C

Pinouts

PIN Description
VCC 3.3V/5V
GND Power ground
SDA I2C data input
SCL I2C clock pin

Setup software

Enable I2C Interface

Open a terminal and run the following commands:

sudo raspi-config 
Choose Interfacing Options -> I2C ->yes 

RPI open i2c.png
Reboot Raspberry Pi:

sudo reboot

Install libraries

BCM2835 libraries
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.68.tar.gz
tar zxvf bcm2835-1.68.tar.gz 
cd bcm2835-1.68/
sudo ./configure && sudo make && sudo make check && sudo make install
Install wiringPi
sudo apt-get install wiringpi
wget https://project-downloads.drogon.net/wiringpi-latest.deb
sudo dpkg -i wiringpi-latest.deb
gpio -v
Python3
sudo apt-get update
sudo apt-get install python3-pip
sudo apt-get install python3-pil
sudo apt-get install python3-numpy
sudo pip3 install RPi.GPIO
sudo pip3 install spidev

Download examples

Open a terminal of the Raspberry Pi

sudo apt-get install p7zip-full -y
sudo wget  https://www.waveshare.com/w/upload/1/17/PCF8591-Code.7z
7z x PCF8591-Code.7z -O./PCF8591-Code
cd PCF8591-Code/RaspberryPi/

Hardware connection

PCF8591 Raspberry Pi Description
Board order
VCC 5V Power input
GND GND Power ground
SDA 3 I2C data input
SCL 5 I2C clock pin

PCF8591-AD-DA-Board-RPI 1.jpg

Run examples

C examples

cd ~/PCF8591-Code/RaspberryPi/
cd wiringPi
sudo make clean
sudo make 
sudo ./test

Python example

cd ~/PCF8591-Code/RaspberryPi/
cd python
sudo python3 PCF8591.py

Expected result

The AD values of four channes are printed.

C example
Python example

The STM32 examples are based on the STM32F103RBT6 and the STM32H743. The connection provided below is based on the STM32F103RB. If you need to use other STM32 boards, you may need to change the hardware connection and port the code yourself.

Hardware connection

PCF8591 STM32 Description
VCC 3.3V Power input
GMD GND Power ground
SDA PB9 I2C data input
SCL PB8 I2C clock pin
PCF8591-AD-DA-Board-STM32 1.jpg

Examples

The examples are developed based on the HAL libraries. Download the Demo codes archive to your PC. Unzip and find the STM32 project from PCF8591-Code\STM32\STM32F103RB\MDK-ARM.

  • Open the PCF8591 AD DA Board.uvprojx file by Keil
  • Build and the project
  • Program the project to your STM32 board.
  • Connect the UART1 of your STM32 board to the PC and check the serial data by SSCOM software.
Color STM32 3.png

The Arduino example is written for the Arduino UNO. If you want to connect it to other Arduino boards, you may need to change the connection.

Hardware connection

PCF8591 Arduino Description
VCC 5V Power input
GMD GND Power ground
SDA SDA I2C data input
SCL SCL SCL clock pin
PCF8591-AD-DA-Board-Arduino 1.jpg

Examples

  • Download the demo codes to your PC and unzip
  • Install the Arduino IDE in your PC
  • Go into PCF8591-Code/Arduino/PCF8591
  • Run the PCF8591.ino file
  • Select the correct Board and the Port
MQ5 Arduino 1.jpg
  • Build the project and upload it to the board.
  • Open the serial monitor of the Arduino IDE or the SSCOM software and check the serial data.
PCF8591 Arduino 1.jpg

FAQ

Support

If you require technical support, please go to the Support page and open a tickets.

Beware of knock-offs

Please note that we've found some poor copies of this item in the market. They are usually made of inferior materials and shipped without any testing.

You might be wondering if the one you're watching or you've purchased in other non-official stores is original, feel free to contact us.