Electronics > Projects, Designs, and Technical Stuff
quick questions about DAC on arduino and psu's
Kilroywashere:
Hey i'm building something just wanted to make sure i understood the design .....
On J1, J2 and J3 the arduino will read the "voltage" once one of the junctions have a complete circuit? ( not that good of a design what happens if you hook up more than one junction?? )
is a 1k and a 220 r going to work as protection for the 0-5v pin?
This is the guys code
void setup()
{
Serial.begin(9600);
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.setCursor(0, 0);
lcd.print("RPS");
lcd.setCursor(0, 1);
lcd.print("-Circuit Digest");
delay(2000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Voltage = ");
}
int voltage;
void loop()
{
int A1 = analogRead(A0);
voltage = map(A1,0,1024,0,22);
Serial.println(voltage);
lcd.setCursor(10,0);
lcd.print(voltage);
delay(1000);
}
it does not like int voltage; .... but thats not my issue what is my issue is
int analogPin = A3; // potentiometer wiper (middle terminal) connected to analog pin 3
// outside leads to ground and +5V
int val = 0; // variable to store the value read
void setup() {
Serial.begin(9600); // setup serial
}
void loop() {
val = analogRead(analogPin); // read the input pin
Serial.println(val); // debug value
}
this code works for 0-5 v ..... and turns it into 0 to 1023 ......
uhhh im getting confusing i think..... I, assuming that i would have to use some protection if i want to get larger than 5v say i wanna get to 20v .... I can assume that i also have to make up some code to account for the difference
Im new to the lcd stuff but i pick up things fast
Schematic 2 seems to be a better job ( cant seem to get it working right i only have a 1x16 lcd .... only tryed to get it to work once but thats beside the point....
Ok well i know i yammed on alot ...... but i think you know what im talking about....
Kilroywashere:
--- Quote from: blueskull on March 24, 2019, 02:29:26 am ---Arduino is your smallest problem. First, you are overvolt-ing your regulators. 7812 has a rated max 35V input, and any sane designers will leave some extra margin.
24V AC, with 10% input fluctuation, can get up to 26.4V, then under zero load, the full wave rectifier outputs 36.07V (assuming diode drop is 0.7V each), and that's apparently not good.
Your adjustable regulator's output is not ground referenced, so is its voltage divider. That will blow your Arduino and you won't get the anticipated regulation.
And where is the groundhan point of your Arduino?
--- End quote ---
Not my design and was not building this ... I was intrested in how he was hooking up his arduino and lcd
My power supply is much better this guys.....
Kilroywashere:
This is what i wanted to build but i wanted a lcd display
MarkF:
--- Quote from: blueskull on March 24, 2019, 02:45:05 am ---
--- Quote from: Kilroywashere on March 24, 2019, 02:35:31 am ---This is what i wanted to build but i wanted a lcd display
--- End quote ---
Get a cheap eBay voltage meter module for less than shipping and you are good.
You can do the same with Arduino, but as you've said, you need a voltage divider. A 10k low side and 39k high side gives you 4.9:1 ratio, so you can sense up to 22.05V (with minimum USB voltage 4.5V on your Arduino).
I recommend to use the internal 1.1V reference voltage instead of V_USB as your ADC reference, so you need to scale your input to less than 1.1V. I would use a 220k high side and a 10k low side. That give you 23:1 ratio, so you have a max 25.3V input range.
--- End quote ---
I would not use such a small (1.1V reference) ADC range. Use the 0-5V ADC input range and set your voltage divider to map the max voltage to the ADC's 5V maximum. That will give the maximum sensitivity for the ADC.
Edit- Why bury your signal down in the noise?? It makes no sense.
MarkF:
--- Quote from: blueskull on March 24, 2019, 03:12:19 am ---
--- Quote from: MarkF on March 24, 2019, 03:03:59 am ---I would not use such a small (1.1V reference) ADC range. Use the 0-5V ADC input range and set your voltage divider to map the max voltage to the ADC's 5V maximum. That will give the maximum sensitivity for the ADC.
Edit- Why bury your signal down in the noise?? It makes no sense.
--- End quote ---
You get all resolution regardless Vref setting. It's a hardware feature, not software scaling.
As for noise, it all boils down to placement and filtering.
--- End quote ---
I said sensitivity. Not resolution.
Mapping 0-5V to 1024 bits would be better than mapping 0-1.1V to 1024 bits. Larger voltage bins.
To each his own.....
Navigation
[0] Message Index
[#] Next page
Go to full version