Hi,
i am pretty new to the arduino community and i am just getting started with my project. It is the control of a Pneumatic controller with its own brain. Once we program it with its software it corresponds those set values to input voltage 0-10vdc and operates accordingly. I want to use the arduino mega 2560 or arduino due rev3 for the project and wanted to know if i can send out modulating voltage output so that i can open and close the pneumatic valve with the smallest increments as possible. If yes could you please direct me to a code that i can learn and implement for my specific case or something which i can learn off and try my own code (i am pretty new to coding as well)?
The Arduino Mega does not have a true DAC (Digital to Analog Converter) and cannot generate the 0-10V DC range you are interested into. You'll need external components.
--> Adding an external DAC would let you achieve this
--> use PWM from the built in analogWrite() wired to a transistor connected to +10V DC, with an attached low pass filter.
PWM will limit you to 256 levels with analogWrite(0) to analogWrite(255).
An LTC1257 powered from 12.7V will give you 4096 steps of resolution over the 0 to 10V range.
https://www.digikey.com/en/products/detail/analog-devices-inc/LTC1257CN8-PBF/888880
VOUT (Pin 7): The buffered DAC output is capable of
sourcing 2mA over temperature while pulling within 2.7V
of VCC. The output will pull to ground through an internal
250Ω equivalent resistance.
VCC (Pin 8): The positive supply input. 4.75V ≤ VCC ≤
15.75V. Requires a bypass capacitor to ground.
Yes, this is close to something i am looking for and is it possible for you to explain me an example circuit where i can clearly get a picture of how it should work and based on that i can take a look at getting the components.
Did you look at the typical connection diagrams in the datasheet?
Code would be pretty simple, use this for a test
#include <SPI.h>
const byte csPin = 10; // latch pin
byte low8bits = 0x3f;
byte high8bits = 0x00; // upper 4 will not be used
// 0x003f should be mid-level output, 0x0fff = full high
void setup() {
SPI.begin(); // default is SPI Clock Mode 0, MSBFirst
pinMode (csPin, OUTPUT);
digitalwrite (csPin, HIGH);
}
void loop() {
// set output to full on, 0x0fff
SPI.transfer (0x0f);
SPI.transfer (0xff);
digitalWrite (csPin, LOW);
digitalWrite (csPin, HIGH); // latch the data in
delay(1000); // hold for second for a test
// set to level defined above
SPI.transfer (high8bits);
SPI.transfer (low8bits);
digitalWrite (csPin, LOW);
digitalWrite (csPin, HIGH); // latch the data in
delay(1000); // hold for second for a test
// set output to full off, 0x0000
SPI.transfer (0);
SPI.transfer (0);
digitalWrite (csPin, LOW);
digitalWrite (csPin, HIGH); // latch the data in
delay(1000); // hold for second for a test
}
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.