Show Posts
Pages: 1 2 3 [4]
46  Development / Other Software Development / Quad 12-bit DAC MCP4728 libary on: February 10, 2011, 06:24:57 pm
I write a library for mcp4728 because I used it High Power RGB LED Shield that I will post later.

It is basically 4 channel version of mcp4725 ( you can find the break out board from sparkfun). If you want to have mcp4725 library, let me know. I will write a library.

Basic spec of mcp4728.

- Quad 12-bit voltage output Digital-to-Analog Convertor (DAC)

- I2C communication with programmable address.

- Internal or External voltage reference

- EEPROM for default values.

Documentation


I did document the source code. Example files have description for functions.

Here is a part of example file. full example pde code http://code.google.com/p/neuroelec/source/browse/trunk/mcp4728/examples/BasicUse/BasicUse.pde

Code:

    #include <Wire.h>
    #include “mcp4728.h”

    void setup()
    {
    Serial.begin(9600);  // initialize serial interface for print()
    dac.begin();  // initialize i2c interface
    }

    void loop()
    {
    /*
    Basic analog writing to DAC
    */

    dac.analogWrite(500,500,500,500); // write to input register of DAC four channel (channel 0-3) together. Value 0-4095
    dac.analogWrite(0,700); // write to input register of a DAC. Channel 0-3, Value 0-4095
    int value = dac.getValue(0); // get current input register value of channel 0
    Serial.print(“input register value of channel 0 = “);
    Serial.println(value, DEC); // serial print of value

    dac.voutWrite(1.8, 1.8, 1.8, 1.8) // write to input register of DAC. Value (V < VDD)
    dac.voutWrite(2, 1.6) // write to input register of DAC. Channel 0 – 3, Value (V < VDD)
    float vout = dac.getVout(1); // get current voltage out of channel 1
    Serial.print(“Voltage out of channel 1 = “);
    Serial.println(vout, DEC); // serial print of value
    }




Source code


http://code.google.com/p/neuroelec/



Download


http://code.google.com/p/neuroelec/downloads/list
47  Forum 2005-2010 (read only) / Development / Re: Colour sensor on: December 02, 2010, 02:21:03 pm
you can try ADJD-S371. works OK. you can get it from sparkfun.

48  Forum 2005-2010 (read only) / Development / Re: Any interest in high-power LED driver shields? on: December 07, 2010, 11:54:46 am
Quote
Nice job. I had to put my design on hold after measuring some huge EMI spikes at switching instants.

Since the Linear driver is fixed frequency, is there a limited voltage input/output range determined by your inductor choice?

Turn out you are right. I need to adjust frequency depending on output voltage. glad to connect frequency adjust pin to ad5254.


Quote
Hi, I am very interested in acquiring some of these LED shields, can you please tell me how we could proceed. Best regards

I have couple of mistake on my first design. Not a major things though. I manually fixed them. . If you are interest, I will sell couple of extra boards (about $35). Please contact me through my blog.
49  Forum 2005-2010 (read only) / Development / Re: Any interest in high-power LED driver shields? on: December 02, 2010, 03:11:08 pm
Frequency is adjustable with AD5254 (3 channel for current adjustment, 1 for frequency adjustment). At 2.1Mhz, it seem to working OK with 5-24V that I tested. Mostly follow Linear tech reference design which  support up to 45V. Love to test EMI but I don't have ocilloscope smiley-wink
50  Forum 2005-2010 (read only) / Development / Re: Any interest in high-power LED driver shields? on: December 02, 2010, 02:21:57 pm
I got my version of high-Power LED shield working. It acts like high power blinkM (got an idea from here)

for detail, check http://neuroelec.wordpress.com/

video  http://www.youtube.com/watch?feature=player_embedded&v=s5hF5bNYl-U


51  Forum 2005-2010 (read only) / Interfacing / Re: Check clock line status on I2C(TWI) ? on: January 17, 2011, 11:18:24 pm
I'm working on 4 channel dac mcp4728 not mcp4725.
52  Forum 2005-2010 (read only) / Interfacing / Re: Check clock line status on I2C(TWI) ? on: January 17, 2011, 10:38:57 pm
Thanks for reply. As figure 5-11 note 2.b, timing of LDAC seem to be critical. It seems LDAC pulse has to happen low clock of 8th bit. I tried LDAC pulse after 2nd byte, it does not work. I checked timing of the pulse using another arduino, it happened after receive ACK.
53  Forum 2005-2010 (read only) / Interfacing / Check clock line status on I2C(TWI) ? on: January 17, 2011, 09:20:48 pm
I'm working on interfacing mcp4728. Everything seems working fine except writing programmable slave address. Based on the datasheet, I need LDAC pin low right after 8th bit before ACK.   http://ww1.microchip.com/downloads/en/DeviceDoc/22187E.pdf

I dig around wire and twi library. It seems TWSR only return status after ACK or NACK is received. Is there a way to check clock line itself or way to check when TWI send all 8 bit ?
Pages: 1 2 3 [4]