Computing stuff tied to the physical world

Voltage Plug

In AVR, Hardware on Oct 2, 2009 at 00:01

The Voltage Plug generates up to four 0 .. 3.3V levels using MCP4725 12-bit DAC’s controlled from I2C:


This sketch switches between 0 and 4095, displaying as 1.2 mV and 3.295 V on my multimeter, respectively:

Picture 1.png

The cycle time was set to 5 seconds to give my auto-ranging multimeter time to adjust itself.

There is room for 4 DAC chips, which seems like a bit of overkill, but I couldn’t think of anything else to put there and the board looked so empty :) – perhaps some sort of voltage-follower op-amp or amplifier stage would make more sense? Anyway, I’ll probably remove two of those chips from the plug again.

The MCP4725 only has one pin to specify the lower address bit. There are in fact 4 different chips available from the manufacturer, to support up to 8 DAC’s on a single I2C bus. Since I got the “A3” version – and since I mixed up high and low again – this particular test uses address 0x67. For the final version I’ll fix the low-address bit and use “A0” versions, i.e. 0x60 and 0x61.

  1. Hi Jean-Claude,

    Wow! I was a bit worried about the amount of IO taken up by the RF chip. Would this plug be using PWM so we could drive a FET with it?


    • No this is a real DAC, actual voltage on the output pins. The DIO pins on ports 2 & 3 can generate PWM using the Arduino’s analogWrite() to pins 5 & 6, respectively.

  2. I know, even traced out where the other PWM pins whent (I2C port and the RF module if I did my homework correctly). But [whining mode] I’d very much like to have more PWM pins… [/whining mode]. I’ve been looking at I2C solution for this, but have not yet found much more then the FLEXEL chip which seems to be a bit overkill

    • Well, one idea would be to create a “Slave Plug” with two ATtiny85’s on board, listening on I2C and daisy-chainable. The two output headers could use “port” pinout conventions, so that with the proper firmware loaded into these slave processors, you could have them drive other plugs autonomously, i.e. without attention from the master JeeNode. Or perform other continuous tasks.

      In your case, each of these could generate 2 PWM signals, given the proper firmware.

      Am still exploring this, but one tricky part might be how to get the firmware into these slaves. A custom boot loader which listens on the I2C bus would be neat, but will take some work.

Comments are closed.