rockwallaby:
Are you asking for help on your program?
Paul
i wanna teach myself but........
the serial monitor is not replacing the old info in the loop.
it just prints the next under the old. here is my updated code.
//This is my first ever sketch i am writing for my 2650. i might need help.
//This sketch will eventually control my camper with my droid or voice.
//I will worry less about things going wrong with my off grid trailer.
//Worrying can lead to high anxiety. Stress affects you emotionally and physically.
int Water = 22; //Voltage sensor for my SeeLevel II water tank sensor strip
int Tank1 = 24; //load sensor for propane tank 1
int Tank2 = 25; //load sensor for propane tank 2
int Humid1 = 26; //humidity sensor inside
int Temp1 = 42; //DS18B20 temperature sensor under camper
int Temp2 = 27; //DS18B20 temperature inside camper
int Volts = 28; //battery bank voltage
int Amps = 29; //amps being used
int Relay1 = A0; //turns on a relay switch when Temp1 goes below 32degrees
int Mic1 = A2; //Electret mini condenser microphone
int Mic2 = A3; //Electret mini condenser microphone
int Mic3 = A4; //Electret mini condenser microphone
int RB1 = A8; //red and blue blinking led
int RB2 = A9; //red and blue blinking led
int val = 0; //not sure what this does but its needed
int Light1 = A10; //Will control 1156 Leds inside. or maybe i need digital pin.
int Light2 = A11; //Will control 1156 Leds inside. and might need some relays.
int Light3 = A12; //Will control 1156 Leds inside. oh shit, what did i get myself into?
int Light4 = A13; //Will control 1156 Leds outside.
//end of my int pins
//Start Code for one electret microphone
// these constants won't change:
const int ledPin = 13; // led connected to digital pin 13
const int electret = A1;// the amplifier output is connected to analog pin 1
// these variables will change:
int sensorReading = 0;// variable to store the value read from the sensor pin
int sensorMax = 0;
int sensorMin = 1023;
int threshold;
//End Code for the electret microphone
void setup() {
// put your setup code here, to run once:
Serial.begin(9600); // initialize serial communications
pinMode(Temp1, INPUT);
pinMode(Temp2, INPUT);
pinMode(Tank1, INPUT);
pinMode(Tank2, INPUT);
pinMode(Humid1, INPUT);
pinMode(Mic1, INPUT);
pinMode(Mic2, INPUT);
pinMode(Mic3, INPUT);
pinMode(Water, INPUT);
pinMode(Volts, INPUT);
pinMode(Amps, INPUT);
pinMode(RB1, OUTPUT);
pinMode(RB2, OUTPUT);
pinMode(Relay1, OUTPUT);
pinMode(Light1, OUTPUT);
pinMode(Light2, OUTPUT);
pinMode(Light3, OUTPUT);
pinMode(Light4, OUTPUT);
//end my pinmode code
//Start Code for electret microphone
pinMode(ledPin, OUTPUT); // declare the ledPin as as OUTPUT
pinMode(13, OUTPUT);
digitalWrite(13, HIGH);
while (millis() < 3000) {
threshold = analogRead(electret);
// record the maximum sensor value
if (threshold > sensorMax) {
sensorMax = threshold;
}
}
// signal the end of the calibration period
digitalWrite(13, LOW);
threshold = sensorMax;
//End Code for electret microphone
}//end setup
//these will read inputs and write them somewhere that can be seen in a droid app.
//and also to be seen on my laptop online when im home or away. i will need help.
void loop() {
val = digitalRead(Temp1);
digitalWrite(Temp1, 0);
val = digitalRead(Temp2);
digitalWrite(Temp2, 0);
val = digitalRead(Humid1);
digitalWrite(Humid1, 0);
val = digitalRead(Water);
digitalWrite(Water, 0);
val = digitalRead(Tank1);
digitalWrite(Tank1, 0);
val = digitalRead(Tank2);
digitalWrite(Tank2, 0);
//two load sensors outside to measure how much propane i have in each 20lb tank
if (Tank1 <= 17)
{digitalWrite(RB1, HIGH); }//led alerts me when 20lb propane tank 1 is low
if (Tank2 <= 17)
{digitalWrite(RB2, HIGH); }//led alerts me when 20lb propane tank 2 is low
if (Tank1 >= 18)
{digitalWrite(RB1, LOW); }//led is off for propane tank 1
if (Tank2 >= 18)
{digitalWrite(RB2, LOW); }//led is off for propane tank 2
//end load sensors
//it gets to 15 friggin degress in the winter at night.
if (Temp1 <= 31)
{digitalWrite(Relay1, HIGH); }//turns on heat tape or something to
//warm up a outside pipe with using the least amount of power at night.
if (Temp1 >= 32)
{digitalWrite(Relay1, LOW); }//and shuts it off
//end flashing warning led
//start electret code
//read the sensor and store it in the variable sensorReading:
sensorReading = analogRead(electret);
// if the sensor reading is greater than the threshold:
if ((sensorReading >= threshold)) {
Serial.println(sensorReading-threshold); //Will send only positive and absolute values of waveform
}//end electret code
//now i will display all sensors onto my laptop somehow. Help?
//in the future these will be displayed on my droid app.
Serial.print("Water: "); Serial.print(Water);
Serial.println("");
Serial.print("Tank1: "); Serial.print(Tank1);
Serial.println("");
Serial.print("Tank2: "); Serial.print(Tank2);
Serial.println("");
Serial.print("Temp1: "); Serial.print(Temp1);
Serial.println("");
Serial.print("Temp2: "); Serial.print(Temp2);
Serial.println("");
Serial.print("Humidity: "); Serial.print(Humid1);
Serial.println("");
Serial.print("Volts: "); Serial.print(Volts);
Serial.println("");
Serial.print("Amps: "); Serial.print(Amps);
Serial.println("");
delay(10000); //this rechecks every 10 seconds?
}
You cannot "replace" data that's been printed to the serial monitor, characters are printed, the world turns and what's been done cannot be undone.
As the monitor is really just a debugging tool this is not usually a problem. If you really want to do this you need a terminal program that implements control characters (VT100 is the most common IIRC) and then you have to send these control characters to move the cursor back to the home position after (or before) every loop.
int Light1 = A10; //Will control 1156 Leds inside. or maybe i need digital pin.
int Light2 = A11; //Will control 1156 Leds inside. and might need some relays.
int Light3 = A12; //Will control 1156 Leds inside. oh shit, what did i get myself into?
int Light4 = A13; //Will control 1156 Leds outside.
Are you seriously going to drive 1156 (or is that 4624) LEDs?
Graynomad:
You cannot "replace" data that's been printed to the serial monitor, characters are printed, the world turns and what's been done cannot be undone.
As the monitor is really just a debugging tool this is not usually a problem. If you really want to do this you need a terminal program that implements control characters (VT100 is the most common IIRC) and then you have to send these control characters to move the cursor back to the home position after (or before) every loop.
int Light1 = A10; //Will control 1156 Leds inside. or maybe i need digital pin.
int Light2 = A11; //Will control 1156 Leds inside. and might need some relays.
int Light3 = A12; //Will control 1156 Leds inside. oh shit, what did i get myself into?
int Light4 = A13; //Will control 1156 Leds outside.
Are you seriously going to drive 1156 (or is that 4624) LEDs?
______
Rob
you just gave me an idea for a Christmas light display controlled by ........... Arduino!
but seriously i ment to say "1156 LED bulbs".
its the kind of bulbs in your cars turn signal you goofball. lol
I drive a 40+ year-old 6x6 Army truck, there is not a single LED in sight of the thing.
If a comment says "1156 Leds" or even "1156 Led bulbs" that means (to me at least) 1156 LEDs, not a single assembly with X number of LEDs.
Remember you are asking for help from engineers or at least people with an engineering mindset, as such when we see a magic number like that we ask if you really intend driving 1156 LEDs. If the comment was "Will control 1000s of Leds inside" or "Will control a shit-load of Leds inside" I may skip over it until you post again asking why your Arduino dies when you turn the LEDs on.
I drive a 40+ year-old 6x6 Army truck, there is not a single LED in sight of the thing.
If a comment says "1156 Leds" or even "1156 Led bulbs" that means (to me at least) 1156 LEDs, not a single assembly with X number of LEDs.
Remember you are asking for help from engineers or at least people with an engineering mindset, as such when we see a magic number like that we ask if you really intend driving 1156 LEDs. If the comment was "Will control 1000s of Leds inside" or "Will control a shit-load of Leds inside" I may skip over it until you post again asking why your Arduino dies when you turn the LEDs on.
What's the significance of the number 1156?
Rob
i googled and i dont know why they picked that number but its the universal part number for a light bulb with off set nipples.
i gotta go clean 16inches of snow off my camper roof before something happens.
or maybe i will invent a robot to do it. he will have windshield wipers as hands.
if i dont post here within a couple days i will probably be dead.
aahhhhh, nipples. But seriously heres my updated code. my white led dont light when i speak and my blue and red led does not go off after sticking the sensor in snow. i should probably ask in another thread for help. but they will just say "hey, you just posted that in another thread" lol
//This is my first ever sketch i am writing for my 2650. i might need help.
//This sketch will eventually control my camper with my droid or voice.
//I will worry less about things going wrong with my off grid trailer.
//Worrying can lead to high anxiety. Stress affects you emotionally and physically.
int Water = 22; //Voltage sensor for my SeeLevel II water tank sensor strip
int Tank1 = 24; //load sensor for propane tank 1
int Tank2 = 26; //load sensor for propane tank 2
int Humid1 = 28; //humidity sensor inside
int Humid2 = 30; //humidity sensor inside
int Temp1 = 42; //DS18B20 temperature sensor under camper
int Temp2 = 34; //DS18B20 temperature inside camper
int Volts = 36; //battery bank voltage
int Amps = 38; //amps being used
int Relay1 = 40; //turns on a relay switch when Temp1 goes below 32degrees
int RB1 = A9; //red and blue warning led for Temp1
int RB2 = A10; //red and blue warning led for Tank1
int RB3 = A11; //red and blue warning led for Tank2
int Light1 = A12; //Will control 1156 bulbs inside. or maybe i need digital pin.
int Light2 = A13; //Will control 1156 bulbs inside. and might need some relays.
int Light3 = A14; //Will control 1156 bulbs inside. what did i get myself into?
int Light4 = A15; //Will control 1156 bulb outside.
int val = 0; //not sure what this does but its needed
//end of my int pins
//Start Code for one Electret mini condenser microphone pins
// these constants won't change:
const int ElectretLED1 = A2; // led connected to analog pin 2 will light up when i talk
const int Electret1 = A1;//amplifier output connected to analog pin 1
// these variables will change:
int sensorReading = 0;// variable to store the value read from the sensor pin
int sensorMax = 2000;
int sensorMin = 1023;
int threshold = 1200;
//End Code for the electret microphone
void setup() {
// put your setup code here, to run once:
Serial.begin(9600); // initialize serial communications
pinMode(Temp1, INPUT);
pinMode(Temp2, INPUT);
pinMode(Tank1, INPUT);
pinMode(Tank2, INPUT);
pinMode(Humid1, INPUT);
pinMode(Humid2, INPUT);
pinMode(Electret1, INPUT);
pinMode(Water, INPUT);
pinMode(Volts, INPUT);
pinMode(Amps, INPUT);
pinMode(RB1, OUTPUT);
pinMode(RB2, OUTPUT);
pinMode(RB3, OUTPUT);
pinMode(Relay1, OUTPUT);
pinMode(Light1, OUTPUT);
pinMode(Light2, OUTPUT);
pinMode(Light3, OUTPUT);
pinMode(Light4, OUTPUT);
pinMode(ElectretLED1, OUTPUT);
//end my pinmode code
//Start Code for Electret1 microphone
analogWrite(A2, HIGH);
while (millis() < 3000) {
threshold = analogRead(Electret1);
// record the maximum sensor value
if (threshold > sensorMax) {
sensorMax = threshold;
}
}
// signal the end of the calibration period
analogWrite(A2, LOW);
threshold = sensorMax;
//End Code for electret microphone
}//end setup
//these will read inputs and write them somewhere that can be seen in a droid app.
//and also to be seen on my laptop online when im home or away. i will need help.
void loop() {
val = digitalRead(Temp1);
digitalWrite(Temp1, 0);
val = digitalRead(Temp2);
digitalWrite(Temp2, 0);
val = digitalRead(Humid1);
digitalWrite(Humid1, 0);
val = digitalRead(Water);
digitalWrite(Water, 0);
val = digitalRead(Tank1);
digitalWrite(Tank1, 0);
val = digitalRead(Tank2);
digitalWrite(Tank2, 0);
//two load sensors outside to measure how much propane i have in each 20lb tank
if (Tank1 <= 17)
{digitalWrite(RB2, HIGH); }//led alerts me when 20lb propane tank 1 is low
if (Tank2 <= 17)
{digitalWrite(RB3, HIGH); }//led alerts me when 20lb propane tank 2 is low
if (Tank1 >= 18)
{digitalWrite(RB2, LOW); }//led is off for propane tank 1
if (Tank2 >= 18)
{digitalWrite(RB3, LOW); }//led is off for propane tank 2
//end load sensors
//start DS18B20 temperature sensor under camper.
if (Temp1 <= 0)
{digitalWrite(Relay1, HIGH); }//turns on heat tape or something to
//warm up a outside pipe with using the least amount of power at night.
if (Temp1 >= 1)
{digitalWrite(Relay1, LOW); }//and then shuts it off
if (Temp1 <= 0)
{analogWrite(RB1, HIGH); }//turns on warning LED inside
if (Temp1 >= 1)
{analogWrite(RB1, LOW); }//and shuts LED off
//end flashing warning led for DS18B20 temperature sensor
//Start reading the water voltage sensor that i will need help with!
int sensorValue = digitalRead(22);
// Convert the digital voltage reading from (11V - 15V) to a percent (0% - 100%)
float voltage = sensorValue * (11.0 / 15.0);
Serial.print("Voltage: ");Serial.println(voltage); // print out the value you read:
// end reading the water voltage sensor
//start electret code
//read the sensor and store it in the variable sensorReading:
sensorReading = analogRead(Electret1);
// if the sensor reading is greater than the threshold:
if ((sensorReading >= threshold)) {
Serial.println(sensorReading-threshold); //Will send only positive and absolute values of waveform
}//end electret code
//now i will display all sensors onto my laptop somehow. Help?
//in the future these will be displayed on my droid app.
Serial.print("Water: "); Serial.print(Water);
Serial.println("");
Serial.print("Tank1: "); Serial.print(Tank1);
Serial.println("");
Serial.print("Tank2: "); Serial.print(Tank2);
Serial.println("");
Serial.print("Temp1: "); Serial.print(Temp1);
Serial.println("");
Serial.print("Temp2: "); Serial.print(Temp2);
Serial.println("");
Serial.print("Humidity: "); Serial.print(Humid1);
Serial.println("");
Serial.print("Volts: "); Serial.print(Volts);
Serial.println("");
Serial.print("Amps: "); Serial.print(Amps);
Serial.println("");
delay(1000); //this rechecks every 1 seconds?
}
Nice to see another person which has the idea to build a camper control panel
I have just (sort of) finished mine, it's my first Arduino project.
Check it out on:
(On the right hand side there is a translation option, just hover over the flags, you'll see)
The panel is not build in the camper van yet, which is still under contruction.
I have experimented with a gas sensor to detect gas leaks.
Works well, but the power consumption is arround 100mA, which is too much for my likings
(remember it has to be on all the time..)
I'm thinking of replacing that with measuring the weight of my LPG tank (I use a standing
LPG tank, so putting sensors underneath it should be simple)
Good that you have made progress, though in my initial response I hinted at this, in part;
One thing that I have concerns for is that all this electronics will consume some amount of electrical power which may or may not be significant for your setup. Have you done the calculations in regard to what your capacity is in terms of what you get in with 255 Watts of solar panel and what you will use for all your existing electrical loads, such as lights, radio or laptop?
Under unfavourable conditions when you have low solar gain, will you have enough battery capacity to operate all these modules?
Good that you have made progress, though in my initial response I hinted at this, in part;
One thing that I have concerns for is that all this electronics will consume some amount of electrical power which may or may not be significant for your setup. Have you done the calculations in regard to what your capacity is in terms of what you get in with 255 Watts of solar panel and what you will use for all your existing electrical loads, such as lights, radio or laptop?
Under unfavourable conditions when you have low solar gain, will you have enough battery capacity to operate all these modules?
Paul
i am going to add battery backup power for the winter. 3 rechargeable 9volt batteries. i was going to use a switch on the panel to switch them on but then i remembered "automation". i will write a code to switch to battery mode by itself.
i also replaced the red/blue leds with red ones and code them to blink every 10seconds to save power.
Good that you have made progress, though in my initial response I hinted at this, in part;
One thing that I have concerns for is that all this electronics will consume some amount of electrical power which may or may not be significant for your setup. Have you done the calculations in regard to what your capacity is in terms of what you get in with 255 Watts of solar panel and what you will use for all your existing electrical loads, such as lights, radio or laptop?
Under unfavourable conditions when you have low solar gain, will you have enough battery capacity to operate all these modules?
I dunno if that will give you much power - 3 x 9v - most of the time these are around the 500ma rating.
If you wanted to go down that path i would be doing some AA (best price performance) or some of the more exotic Lithium chemistry batteries - have you worked out the current draw yet ?
Craig
Paul
i am going to add battery backup power for the winter. 3 rechargeable 9volt batteries. i was going to use a switch on the panel to switch them on but then i remembered "automation". i will write a code to switch to battery mode by itself.
i also replaced the red/blue leds with red ones and code them to blink every 10seconds to save power.