-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Welcome to the dac_shield wiki!
This is a work in progress. If you have a specific question which isn't answered here, please leave a comment and we'll add it in!
TODO: link to rev 3 and rev 4 photos
- Adjustment potentiometer - The direction of the adjustment pot has changed. In Rev 4, turning the pot clockwise increases gain and turning counter-clockwise decreases gain. The pot has also been labeled with a "+" and "-" in Rev 4
- Minor routing changes, improved silkscreen size and clarity
Equipment Needed:
- Power DAC Shield
- Dual-output power supply or two batteries
- Arduino Uno, Duemilanove, Mega, or compatible board
- Oscilloscope
The easiest way to get a dual output power supply is to connect two 9 or 12v batteries in series where the middle junction is ground.
The most common split rail power supply uses a 12V center tapped transformer, bridge rectifier and large filtering capacitors.
If you don't have a dual-output power supply, two single-output, isolated power supplies can be used TODO: Add notes about connecting the shield to two bench supplies
The heart of this shield is the MCP4921 ((Datasheet). This DAC uses the SPI protocol and can be written to either using the hard SPI on the Uno or bit-banged on Mega. The first step is to write a method that can send a unsigned 16 integer to the DAC. Since this is a 12bit The max voltage will be 4098, zero volts is 2048 and the negative max voltage is 0. The DAC is triggered one one of the 4 slave select pins (10,9,8,7) depending on the jumper. There are two ways these ping can be written, the first is to use the Arduino Digital Write. `//Method to write to the DAC void writeMCP492x(uint16_t data, uint8_t config,uint8_t ss,volatile uint8_t* slave_port) { // Take the top 4 bits of config and the top 4 valid bits (data is actually a 12 bit number) and or them together uint8_t top_msg = (config & 0xF0) | (0x0F & (data >> 8));
// Take the bottom octet of data uint8_t lower_msg = (data & 0x00FF);
// Select our DAC *slave_port &= ~ss; // Send first 8 bits shiftOut(MOSI,CLK,MSBFIRST,top_msg); // Send second 8 bits shiftOut(MOSI,CLK,MSBFIRST,lower_msg); *slave_port |= `