|
364
|
Using Arduino / General Electronics / Re: Help choosing a relay for a thermostat
|
on: February 17, 2012, 10:20:59 am
|
Looking at the info from my boiler it says the thermostat must be able to switch mains voltage and looking at the diagram it switches the live power to all the circuitry. does not mention current draw though I'm not having much luck finding a relay that will switch 240v, with a 5v <40mA coil at the moment, do they exist? This sort of thing looks idea but 40mA coil draw  Thanks
|
|
|
|
|
366
|
Using Arduino / Project Guidance / Re: Cheapest possible Arduino (DIY)
|
on: February 17, 2012, 07:48:41 am
|
I have just had a quick look at the design I was working on but I think it will have a major flaw.
I have been designing it with a mixture of through hole (atmega chip, connectors) and smd (other support components) but it will be on a simgle sided PCB so that would mean soldering the though hole stuff on the same layer which would reverse it?
Or am I going mad lol?
anyone lol? I can't think straight at the moment but pretty sure its a mistake to mix smd and through hole on a one sided design?
|
|
|
|
|
367
|
Using Arduino / Project Guidance / Re: Cheapest possible Arduino (DIY)
|
on: February 16, 2012, 06:26:22 pm
|
|
I have just had a quick look at the design I was working on but I think it will have a major flaw.
I have been designing it with a mixture of through hole (atmega chip, connectors) and smd (other support components) but it will be on a simgle sided PCB so that would mean soldering the though hole stuff on the same layer which would reverse it?
Or am I going mad lol?
|
|
|
|
|
370
|
Using Arduino / Project Guidance / Re: Temperature display on LCD help please
|
on: February 14, 2012, 07:28:32 am
|
Wow I can't thank you enough that works perfectly  I have adapted it for two temp inputs now! I love my arduino  Next step is to add humidity sensors so I'm looking forward to getting them Thanks again robtillaart, you have done a great job on the code
|
|
|
|
|
371
|
Using Arduino / Project Guidance / Temperature display on LCD help please
|
on: February 13, 2012, 02:45:37 pm
|
Hi all. I have been working towards my first (hopefully permanent) Arduino project  I want to display some temperatures on an LCD and possibly add humidity later. I have been working on some code (with some help from DC42 many thanks for that) I have noticed how much the readings fluctuate - noise I guess and I would like to eradicate some of this. I get a swing of about 1.5 degrees c most of the time. I thought about averaging the readings but can't get the code to compile and I'm stuck on that  Or Would I be better of scrapping using thermistors and dividers and trying to use digital readers? The code below is what I have so far. I'm also dimming the LCD back light by reading a LDR which is working nicely. /* The circuit: * LDR connected to analog pin 0. * LED / transistor connected from digital pin 3 to ground * LCD RS pin to digital pin 7 * LCD EN pin to digital pin 8 * LCD D4 pin to digital pin 9 * LCD D5 pin to digital pin 10 * LCD D6 pin to digital pin 11 * LCD D7 pin to digital pin 12 * LCD R/W pin to ground * 10K resistor: * ends to +5V and ground * wiper to LCD VO pin (pin 3) * LCD LED+ (15) pin transistor * LCD LED- (16) to ground * Thermisor divider 1 output to analog pin 1 * Thermisor divider 2 output to analog pin 2 */
// These constants won't change. They're used to give names // to the pins used: const int analogInPin = A0; // Analog input pin that the lDR is attached to const int analogOutPin = 3; // Analog output pin that the LED is attached to
const int minLight = 100; // at or below this light level, use minimum backlight intensity const int maxLight = 900; // at or above this light level, use maximum backlight intensity const int minBacklight = 5; // lowest backlight intensity to use const int maxBacklight = 255; // highest backlight intensity to use
// include the library code: #include <LiquidCrystal.h> #undef float #define NUMSAMPLES 5 int samples[NUMSAMPLES]; #include <math.h>
double average(int RawADC) { double Temp; Temp = log(((10240000/RawADC) - 10000)); Temp = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * Temp * Temp ))* Temp ); Temp = Temp - 273.15; // Convert Kelvin to Celcius
return Temp; }
// initialize the library with the numbers of the interface pins LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
int sensorValue = 0; // value read from the LDR int outputValue = 0; // value output to the PWM (analog out)
void setup() { // initialize serial communications at 9600 bps: Serial.begin(9600); lcd.begin(16, 2); delay(100); pinMode(13, OUTPUT);
}
void loop() { // read the analog in value: analogRead(analogInPin); delay(200); sensorValue = analogRead(analogInPin); // map it to the range of the analog out: outputValue = map(constrain(sensorValue, minLight, maxLight), minLight, maxLight, minBacklight, maxBacklight ); // change the analog out value: analogWrite(analogOutPin, outputValue);
// print the results to the serial monitor: Serial.print("sensor = " ); Serial.print(sensorValue); Serial.print("\t output = "); Serial.println(outputValue);
uint8_t i; float average;
// take N samples in a row, with a slight delay for (i=0; i< NUMSAMPLES; i++) { samples[i] = analogRead(1)), 1); delay(10); }
// average all the samples out average = 0; for (i=0; i< NUMSAMPLES; i++) { average += samples[i]; } average /= NUMSAMPLES;
//Temperature 1 print lcd.clear();
lcd.setCursor(0,0); lcd.print ("Out: "); lcd.print(average(analogRead(1)), 1);
lcd.print((char)223); lcd.print ("c");
//Serial.print ("Temp1="); //Serial.println(int(Thermister(analogRead(1)))); // display temp
// Temperature 2 print //lcd.setCursor(0,1); //lcd.print(int(Thermister(analogRead(2, 1))));
//lcd.print((char)223); //lcd.print ("c");
//Serial.print ("Temp2="); //Serial.println(int(Thermister(analogRead(2)))); // display temp
// wait 10 milliseconds before the next loop // for the analog-to-digital converter to settle // after the last reading: delay(1000); }
|
|
|
|
|
372
|
Using Arduino / Displays / Re: Easy way to dim parallel LCD backlight with a photoresitor
|
on: February 12, 2012, 07:32:24 pm
|
excellent, thank you for the info. I'm now trying to take an average temperature reading to try and eliminate some of the noise. I am trying to get this code to compile but can't work out the problem, I might have it completely wrong I'm not sure  /* The circuit: * LDR connected to analog pin 0. * LED / transistor connected from digital pin 3 to ground * LCD RS pin to digital pin 7 * LCD EN pin to digital pin 8 * LCD D4 pin to digital pin 9 * LCD D5 pin to digital pin 10 * LCD D6 pin to digital pin 11 * LCD D7 pin to digital pin 12 * LCD R/W pin to ground * 10K resistor: * ends to +5V and ground * wiper to LCD VO pin (pin 3) * LCD LED+ (15) pin transistor * LCD LED- (16) to ground * Thermisor divider 1 output to analog pin 1 * Thermisor divider 2 output to analog pin 2 */
// These constants won't change. They're used to give names // to the pins used: const int analogInPin = A0; // Analog input pin that the lDR is attached to const int analogOutPin = 3; // Analog output pin that the LED is attached to
const int minLight = 100; // at or below this light level, use minimum backlight intensity const int maxLight = 900; // at or above this light level, use maximum backlight intensity const int minBacklight = 5; // lowest backlight intensity to use const int maxBacklight = 255; // highest backlight intensity to use
// include the library code: #include <LiquidCrystal.h> #undef float #define NUMSAMPLES 5 int samples[NUMSAMPLES]; #include <math.h>
double average(int RawADC) { double Temp; Temp = log(((10240000/RawADC) - 10000)); Temp = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * Temp * Temp ))* Temp ); Temp = Temp - 273.15; // Convert Kelvin to Celcius
return Temp; }
// initialize the library with the numbers of the interface pins LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
int sensorValue = 0; // value read from the LDR int outputValue = 0; // value output to the PWM (analog out)
void setup() { // initialize serial communications at 9600 bps: Serial.begin(9600); lcd.begin(16, 2); delay(100); pinMode(13, OUTPUT);
}
void loop() { // read the analog in value: analogRead(analogInPin); delay(200); sensorValue = analogRead(analogInPin); // map it to the range of the analog out: outputValue = map(constrain(sensorValue, minLight, maxLight), minLight, maxLight, minBacklight, maxBacklight ); // change the analog out value: analogWrite(analogOutPin, outputValue);
// print the results to the serial monitor: Serial.print("sensor = " ); Serial.print(sensorValue); Serial.print("\t output = "); Serial.println(outputValue);
uint8_t i; float average;
// take N samples in a row, with a slight delay for (i=0; i< NUMSAMPLES; i++) { samples[i] = analogRead(1)), 1); delay(10); }
// average all the samples out average = 0; for (i=0; i< NUMSAMPLES; i++) { average += samples[i]; } average /= NUMSAMPLES;
//Temperature 1 print lcd.clear();
lcd.setCursor(0,0); lcd.print ("Out: "); lcd.print(average(analogRead(1)), 1);
lcd.print((char)223); lcd.print ("c");
//Serial.print ("Temp1="); //Serial.println(int(Thermister(analogRead(1)))); // display temp
// Temperature 2 print //lcd.setCursor(0,1); //lcd.print(int(Thermister(analogRead(2, 1))));
//lcd.print((char)223); //lcd.print ("c");
//Serial.print ("Temp2="); //Serial.println(int(Thermister(analogRead(2)))); // display temp
// wait 10 milliseconds before the next loop // for the analog-to-digital converter to settle // after the last reading: delay(1000); }
|
|
|
|
|
374
|
Using Arduino / Displays / Re: Easy way to dim parallel LCD backlight with a photoresitor
|
on: February 10, 2012, 08:03:55 pm
|
Been trying to get a decimal place by using fractions for a few hours, cant get it to compile though /* The circuit: * LDR connected to analog pin 0. * LED / transistor connected from digital pin 3 to ground * LCD RS pin to digital pin 7 * LCD EN pin to digital pin 8 * LCD D4 pin to digital pin 9 * LCD D5 pin to digital pin 10 * LCD D6 pin to digital pin 11 * LCD D7 pin to digital pin 12 * LCD R/W pin to ground * 10K resistor: * ends to +5V and ground * wiper to LCD VO pin (pin 3) * LCD LED+ (15) pin transistor * LCD LED- (16) to ground * Thermisor divider 1 output to analog pin 1 * Thermisor divider 2 output to analog pin 2 */
// These constants won't change. They're used to give names // to the pins used: const int analogInPin = A0; // Analog input pin that the lDR is attached to const int analogOutPin = 3; // Analog output pin that the LED is attached to
const int minLight = 100; // at or below this light level, use minimum backlight intensity const int maxLight = 900; // at or above this light level, use maximum backlight intensity const int minBacklight = 5; // lowest backlight intensity to use const int maxBacklight = 255; // highest backlight intensity to use
unsigned int frac;
// include the library code: #include <LiquidCrystal.h>
#include <math.h>
double Thermister(int RawADC) { double Temp; Temp = log(((10240000/RawADC) - 10000)); Temp = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * Temp * Temp ))* Temp ); Temp = Temp - 273.15; // Convert Kelvin to Celcius
return Temp; }
// initialize the library with the numbers of the interface pins LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
int sensorValue = 0; // value read from the LDR int outputValue = 0; // value output to the PWM (analog out)
void setup() { // initialize serial communications at 9600 bps: Serial.begin(9600); lcd.begin(16, 2); delay(100); pinMode(13, OUTPUT);
}
void loop() { // read the analog in value: analogRead(analogInPin); delay(100); sensorValue = analogRead(analogInPin); // map it to the range of the analog out: outputValue = map(constrain(sensorValue, minLight, maxLight), minLight, maxLight, minBacklight, maxBacklight ); // change the analog out value: analogWrite(analogOutPin, outputValue);
// print the results to the serial monitor: Serial.print("sensor = " ); Serial.print(sensorValue); Serial.print("\t output = "); Serial.println(outputValue);
// Temperature 1 print lcd.clear();
lcd.setCursor(0,0); lcd.print ("Out: "); lcd.print(int(Thermister(analogRead(1)))); lcd.print ("."); frac = (Thermister(analogRead(1)) - int (Thermister(analogRead(1)) * 10; lcd.print(frac, DEC);
lcd.print((char)223); lcd.print ("c");
Serial.print ("Temp1="); Serial.println(int(Thermister(analogRead(1)))); // display temp
// Temperature 2 print //lcd.setCursor(0,1); //lcd.print(int(Thermister(analogRead(2))));
//lcd.print((char)223); //lcd.print ("c");
//Serial.print ("Temp2="); //Serial.println(int(Thermister(analogRead(2)))); // display temp
// wait 10 milliseconds before the next loop // for the analog-to-digital converter to settle // after the last reading: delay(1000); }
|
|
|
|
|
375
|
Using Arduino / Displays / Re: Easy way to dim parallel LCD backlight with a photoresitor
|
on: February 10, 2012, 06:58:29 pm
|
Thanks again DC! I am just testing it out at the moment, I have a probe outside and I think its just below 0 right now according to another therm, but the arduino is reporting a solid 0? How would I set it to display a decimal point ie 0.6c? Here is what I have so far  /* The circuit: * LDR connected to analog pin 0. * LED / transistor connected from digital pin 3 to ground * LCD RS pin to digital pin 7 * LCD EN pin to digital pin 8 * LCD D4 pin to digital pin 9 * LCD D5 pin to digital pin 10 * LCD D6 pin to digital pin 11 * LCD D7 pin to digital pin 12 * LCD R/W pin to ground * 10K resistor: * ends to +5V and ground * wiper to LCD VO pin (pin 3) * LCD LED+ (15) pin transistor * LCD LED- (16) to ground * Thermisor divider 1 output to analog pin 1 * Thermisor divider 2 output to analog pin 2 */
// These constants won't change. They're used to give names // to the pins used: const int analogInPin = A0; // Analog input pin that the lDR is attached to const int analogOutPin = 3; // Analog output pin that the LED is attached to
const int minLight = 100; // at or below this light level, use minimum backlight intensity const int maxLight = 900; // at or above this light level, use maximum backlight intensity const int minBacklight = 5; // lowest backlight intensity to use const int maxBacklight = 255; // highest backlight intensity to use
// include the library code: #include <LiquidCrystal.h>
#include <math.h>
double Thermister(int RawADC) { double Temp; Temp = log(((10240000/RawADC) - 10000)); Temp = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * Temp * Temp ))* Temp ); Temp = Temp - 273.15; // Convert Kelvin to Celcius
return Temp; }
// initialize the library with the numbers of the interface pins LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
int sensorValue = 0; // value read from the LDR int outputValue = 0; // value output to the PWM (analog out)
void setup() { // initialize serial communications at 9600 bps: Serial.begin(9600); lcd.begin(16, 2); delay(100); pinMode(13, OUTPUT);
}
void loop() { // read the analog in value: analogRead(analogInPin); delay(100); sensorValue = analogRead(analogInPin); // map it to the range of the analog out: outputValue = map(constrain(sensorValue, minLight, maxLight), minLight, maxLight, minBacklight, maxBacklight ); // change the analog out value: analogWrite(analogOutPin, outputValue);
// print the results to the serial monitor: Serial.print("sensor = " ); Serial.print(sensorValue); Serial.print("\t output = "); Serial.println(outputValue);
// Temperature 1 print lcd.clear();
lcd.setCursor(0,0); lcd.print ("Out: "); lcd.print(int(Thermister(analogRead(1))));
lcd.print((char)223); lcd.print ("c");
Serial.print ("Temp1="); Serial.println(int(Thermister(analogRead(1)))); // display temp
// Temperature 2 print //lcd.setCursor(0,1); //lcd.print(int(Thermister(analogRead(2))));
//lcd.print((char)223); //lcd.print ("c");
//Serial.print ("Temp2="); //Serial.println(int(Thermister(analogRead(2)))); // display temp
// wait 10 milliseconds before the next loop // for the analog-to-digital converter to settle // after the last reading: delay(1000); }
|
|
|
|
|