Goodmorning everyone. I have a big problem. I need to pilot 9 different DACs (MCP4725) because I have to feed 9 different varactors with 9 different voltages at the same time.
I thought I could do this by using the digital pins of my Arduino Uno board, but then I realized that I have to connect the DACs to the Analog pins (A4 and A5). Is there a solution??
I put my hands on saying that I'm not good at electronics, so I hope you can help me solve the problem.
be advised - it only has an A0 input, which means you can address only two different devices on I2C.
Beyond that, you'll need an I2C multiplexer, such as:
That would allow you to talk to up to 16 devices, two on each of eight I2C sub-busses.
This will complicate your code somewhat, as you need to initialize the devices by selecting their I2C sub-bus, then initialize them, then do the address selection again whenever talking to individual devices.
Hope that helps a bit.
It might be possible to connect all the MCP4725 to the Arduino Uno and have an Arduino output pin for each A0 of the MCP4725 and set them all high.
If a MCP4725 is selected, that A0 pin can be set low and then it can be used. When the Arduino is ready with that specific MCP4725, then the A0 pin is set high again.
It takes 9 digital pins, but you don't need to buy more hardware.
Do you have a steady 5V ? Do you run the MCP4725 at 5V ?
Thank you Koepel.
But, in the way you suggest seems that I cannot menage all the MCP4725 at the same time, isn't it?
I mean that in my case I want to obtain 9 different and indipendent voltages.
Yes, I have a steady 5V and I run the MCP4725 at 5V.
Correct. You have to address each one and set its output voltage independently. That might take around 100 microseconds per device, or all nine in less than 1 ms.
Do not be confused by the "analog pins" A4 and A5, they are used as digital pins in the I2C application, and have nothing to do with analog signals.
I'll ask more directly - are you using the Adafruit product? You can do as Koepel suggests, setting one device's A0 high and the rest low, or vice-versa, then communicating with each item, but it will require more software overhead, and you'll have to manage all that yourself. Doing it that way, though, you do have the advantage of implementing anywhere from 0-n devices, where n is the number of digital signals available to select the boards. You could even go as far as to use an external logic selector, such as a 74ls138, to select one-of-n boards, consuming fewer digital pins. It's up to you, and likely dependent on application details you've probably not told us.
So what would be the effect of not supplying them at the same time? Does it really matter? If it does then you are stuffed, your project is toast.
You can't do it on just one processor. I doubt you can do it on 9 processors but there may be a way to synchronise 9 processors to do something simultaneous, but with the variability of the processors' clock speed you might be struggling, unless you gave them all the same external clock.
Maybe you could feed the voltages into a sample and hold analogue latch and wire the latch enable outputs to a single line. But that is a lot of analogue electronics to get your head round as a beginner.
Einstein proved that there is no such thing as events happening "at the same time".
Our gurus are focusing on your use of "at the same time", and expecting that that means you want it done simultaneously, not "at almost the same time, within a few tens of microseconds", so it might help if you provided some clarity. Then again, the lack of response from you for 20 hours might indicate a lack of interest in continuing.
The lack of response is due to the fact I asked yesterday whike I was working, since I asked your help for a project I have to do for my research activity. Sorry.
With "at the same time" I mean, as you suggest, at the same time within a few tens of microseconds. I have to set the voltage in each varactor to obtain a certain current distribution on a copper structure. So I can set the first voltage (I know that the DAC can keep/maintain the value), and then set all the other, not necessarily all in the same moment.
No need to apologize, it's just that we have posters who initiate a discussion, and are never heard from again.
Thanks for the timing clarification; if software updating of your I2C devices is managed carefully, I don't see that it will be an issue; however, experimentation should be required to see whether an I2C multiplexer or hardware enabling results in faster updates. Conceptually, I think the hardware enabling will be faster. You will, however, need to pay attention to details to minimize delays.
Many thanks for you precious advices. Of course since it's a new topic for me and my research group, we have to make many attempts in order to find the best way to obtain a good compromise.
OK, but this problem was for a PhD and it was about making reflective / absorbing surfaces using varactor diodes. As well, oddly enough, he/she wanted to use 9 diodes. Maybe ask your supervisor if anyone else could be doing this project. Or maybe ask if anyone else in your group has posted here?
Build something. Try it. See how it works. If you are not happy with it, then build something better.
That is how I do things, because when I get some "feeling" how everything works, then I know what to do.
The I2C bus is slow. If that is too slow, then you have to use DACs with a SPI interface.