Home Hardware DVK512 Raspberry Pi Expansion Board

DVK512 Raspberry Pi Expansion Board

by shedboy71

Recently I bought a DVK512 Raspberry Pi Expansion Board from Waveshare for my raspberry Pi. If you have never heard of the DVK512 the its a reasonably priced add-on (hat). The following features and image are from the Waveshare site

DVK512-intro

  1. UART interface: easily connects to UART modules such as RS232, RS485, USB TO UART, etc.
  2. 8I/Os interface: easily connects to modules controlled by I/Os, such as 8 Push Buttons, Logic Level Converter, Mix Board, etc.
  3. SPI interface: easily connects to SPI modules such as AT45DBXX Dataflash, L3G4200D Board, etc.
  4. I2C interface: easily connects to I2C modules such as PCF8574 Expansion Board, PCF8563 RTC Board, LSM303DLHC Board, etc.
  5. Character LCD interface: for connecting character LCDs like LCD1602
  6. USB connector: USB TO UART, supported by onboard converter CP2102
  7. Power indicator
  8. User LEDs
  9. User Keys
  10. Potentiometer: for LCD1602 contrast adjustment
  11. RTC battery holder
  12. PCF8563: onboard RTC chip
  13. 32.768K crystal: RTC crystal
  14. CP2102: onboard USB TO UART chip, for debugging
  15. CP2102 jumper
  16. RTC jumper
  17. User LEDs jumper
  18. User Keys jumper

 

Code Example

There are 4 LED’s on the board and Waveshare supply some code examples in Python, Shell and C

I was interested in the C options, 1 of these uses wiringPi and the other BCM2835, I was interested in wiringPi

[codesyntax lang=”cpp”]

/* blink.c
 * you can build this like: 
 * gcc -Wall blink.c -o blink -lwiringPi
 * sudo ./flash
*/
#include<wiringPi.h>

char LED[]={25,26,27,28};
unsigned char i;

int main(void)
{
	wiringPiSetup();
	for(i=0;i<4;i++)
	{
		pinMode (LED[i],OUTPUT) ;
	}

	while(1)
	{
  		for(i=0;i<4;i++)
		{
  			digitalWrite (LED[i], 1) ;
    		delay (200);
  			digitalWrite (LED[i], 0) ;
    		delay (200);
  		}
	}
}

[/codesyntax]

You execute the command make to compile the program while the command make clean will remove the executable files. Here I

pi@raspberrypi ~/DVK512/LED/wiringPi $ make clean
rm led
pi@raspberrypi ~/DVK512/LED/wiringPi $ make
gcc -Wall led.c -o led -lwiringPi
pi@raspberrypi ~/DVK512/LED/wiringPi $ sudo ./led

You should now see the LEDs flashing

Links

You can pick one of these up for under $20
DVK512 # Raspberry Pi Model 2 B/B+/A+ Expansion/Evaluation Development Board with various interfaces

You may also like

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More