Tasmania - Australia
Offline
Sr. Member
Karma: 7
Posts: 252
|
 |
« Reply #15 on: February 06, 2013, 07:06:27 pm » |
Well, I must admit there is not too much for the compiler to verify.
What are you wanting to do, really? I imagine it would really help you if you wrote a functional description of your project. What this will look like will be an abstract overview, an objective detailing your desired outcome based on certain criteria, a technical description on how you intend it to function with both hardware and software, and possible consideration for those unlikely but highly probable problems.
A block diagram or flow chart is always a good place to start.
So, just a quick look at your code, some commenting will again always be a very good thing, to help you remember later on but also if you wish for us to understand what it is you are doing in your program.
I have lots of questions or remarks about your code, probably longer than your code in fact. But why are you bringing in those microphone inputs into your Arduino, I thought they would go to a special voice board you had?
Are you asking for help on your program?
Paul
|
|
|
|
« Last Edit: February 06, 2013, 09:53:32 pm by rockwallaby »
|
Logged
|
|
|
|
|
Earth
Offline
Full Member
Karma: 2
Posts: 103
Webmaster
|
 |
« Reply #16 on: February 06, 2013, 09:44:39 pm » |
But why are you bring in those microphone inputs into your Arduino, I thought they would go to a special voice board you had? Are you asking for help on your program? Paul
im waiting to get the wifi, bluetooth and voice shields from china when i get the money. i will ad more comments to the code soon.
|
|
|
|
|
Logged
|
Webmaster living off grid in a camper with 300watts of solar panels charging 9 absorbed glass mat 12V batteries. i own about 40 dot coms. i can read, write and debug HTML, CSS, JSON and PHP. I can understand some javascript. A++ is new to me. i thought it was a dead language. lol! A rogue planet called Nibiru is close by and will cause disasters all over earth including fireballs, earthquakes, meteors and volcanic eruptions. But i will be ready with Project Camper
|
|
|
|
nr Bundaberg, Australia
Offline
Tesla Member
Karma: 73
Posts: 6841
Scattered showers my arse -- Noah, 2348BC.
|
 |
« Reply #17 on: February 07, 2013, 04:24:23 am » |
i have 255watts of solar panels charging 9 absorbed glass mat batteries This seems quite unbalanced unless the batteries are small. OTOH if the 255W keeps up then your batteries are not getting discharged much and that's a good thing. _____ Rob
|
|
|
|
|
Logged
|
|
|
|
|
Earth
Offline
Full Member
Karma: 2
Posts: 103
Webmaster
|
 |
« Reply #18 on: February 07, 2013, 09:43:52 am » |
i have 255watts of solar panels charging 9 absorbed glass mat batteries This seems quite unbalanced unless the batteries are small. OTOH if the 255W keeps up then your batteries are not getting discharged much and that's a good thing. _____ Rob i have a total of 407Ah. for more info goto http://arduino.cc/forum/index.php/topic,145777.0.html
|
|
|
|
« Last Edit: February 07, 2013, 09:47:18 am by TrailerTrash »
|
Logged
|
Webmaster living off grid in a camper with 300watts of solar panels charging 9 absorbed glass mat 12V batteries. i own about 40 dot coms. i can read, write and debug HTML, CSS, JSON and PHP. I can understand some javascript. A++ is new to me. i thought it was a dead language. lol! A rogue planet called Nibiru is close by and will cause disasters all over earth including fireballs, earthquakes, meteors and volcanic eruptions. But i will be ready with Project Camper
|
|
|
|
Earth
Offline
Full Member
Karma: 2
Posts: 103
Webmaster
|
 |
« Reply #19 on: February 07, 2013, 09:48:57 am » |
DOH! i forgot to buy the voltage sensor to read my water level sensor. but i would hate to run a wire thru. i will check ebay for something to read 11V-15V. ironic that i need a sensor to read another sensor, huh? http://www.ebay.com/itm/FrSky-TELEMETRY-Battery-Voltage-Sensor-FVBS-01-/140847262550 $7.99 http://www.ebay.com/itm/High-Sensitivity-Voltage-Sensor-Module-Arduino-Compatible-/270941562338 $8.58
|
|
|
|
« Last Edit: February 07, 2013, 11:30:41 am by TrailerTrash »
|
Logged
|
Webmaster living off grid in a camper with 300watts of solar panels charging 9 absorbed glass mat 12V batteries. i own about 40 dot coms. i can read, write and debug HTML, CSS, JSON and PHP. I can understand some javascript. A++ is new to me. i thought it was a dead language. lol! A rogue planet called Nibiru is close by and will cause disasters all over earth including fireballs, earthquakes, meteors and volcanic eruptions. But i will be ready with Project Camper
|
|
|
|
Earth
Offline
Full Member
Karma: 2
Posts: 103
Webmaster
|
 |
« Reply #20 on: February 08, 2013, 06:18:43 pm » |
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?
}
|
|
|
|
|
Logged
|
Webmaster living off grid in a camper with 300watts of solar panels charging 9 absorbed glass mat 12V batteries. i own about 40 dot coms. i can read, write and debug HTML, CSS, JSON and PHP. I can understand some javascript. A++ is new to me. i thought it was a dead language. lol! A rogue planet called Nibiru is close by and will cause disasters all over earth including fireballs, earthquakes, meteors and volcanic eruptions. But i will be ready with Project Camper
|
|
|
|
nr Bundaberg, Australia
Offline
Tesla Member
Karma: 73
Posts: 6841
Scattered showers my arse -- Noah, 2348BC.
|
 |
« Reply #21 on: February 08, 2013, 06:33:02 pm » |
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
|
|
|
|
« Last Edit: February 08, 2013, 06:34:57 pm by Graynomad »
|
Logged
|
|
|
|
|
Earth
Offline
Full Member
Karma: 2
Posts: 103
Webmaster
|
 |
« Reply #22 on: February 08, 2013, 06:50:42 pm » |
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
|
|
|
|
« Last Edit: February 08, 2013, 08:46:51 pm by TrailerTrash »
|
Logged
|
Webmaster living off grid in a camper with 300watts of solar panels charging 9 absorbed glass mat 12V batteries. i own about 40 dot coms. i can read, write and debug HTML, CSS, JSON and PHP. I can understand some javascript. A++ is new to me. i thought it was a dead language. lol! A rogue planet called Nibiru is close by and will cause disasters all over earth including fireballs, earthquakes, meteors and volcanic eruptions. But i will be ready with Project Camper
|
|
|
|
nr Bundaberg, Australia
Offline
Tesla Member
Karma: 73
Posts: 6841
Scattered showers my arse -- Noah, 2348BC.
|
 |
« Reply #23 on: February 08, 2013, 07:26:11 pm » |
its the kind of bulbs in your cars turn signal 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
|
|
|
|
|
Logged
|
|
|
|
|
Earth
Offline
Full Member
Karma: 2
Posts: 103
Webmaster
|
 |
« Reply #24 on: February 08, 2013, 08:17:59 pm » |
its the kind of bulbs in your cars turn signal 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.
|
|
|
|
« Last Edit: February 08, 2013, 08:20:50 pm by TrailerTrash »
|
Logged
|
Webmaster living off grid in a camper with 300watts of solar panels charging 9 absorbed glass mat 12V batteries. i own about 40 dot coms. i can read, write and debug HTML, CSS, JSON and PHP. I can understand some javascript. A++ is new to me. i thought it was a dead language. lol! A rogue planet called Nibiru is close by and will cause disasters all over earth including fireballs, earthquakes, meteors and volcanic eruptions. But i will be ready with Project Camper
|
|
|
|
nr Bundaberg, Australia
Offline
Tesla Member
Karma: 73
Posts: 6841
Scattered showers my arse -- Noah, 2348BC.
|
 |
« Reply #25 on: February 08, 2013, 08:26:27 pm » |
Ah, so it's a part number...I get it.
______ Rob
|
|
|
|
|
Logged
|
|
|
|
|
Earth
Offline
Full Member
Karma: 2
Posts: 103
Webmaster
|
 |
« Reply #26 on: February 08, 2013, 08:51:58 pm » |
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.
|
|
|
|
|
Logged
|
Webmaster living off grid in a camper with 300watts of solar panels charging 9 absorbed glass mat 12V batteries. i own about 40 dot coms. i can read, write and debug HTML, CSS, JSON and PHP. I can understand some javascript. A++ is new to me. i thought it was a dead language. lol! A rogue planet called Nibiru is close by and will cause disasters all over earth including fireballs, earthquakes, meteors and volcanic eruptions. But i will be ready with Project Camper
|
|
|
|
Earth
Offline
Full Member
Karma: 2
Posts: 103
Webmaster
|
 |
« Reply #27 on: February 12, 2013, 05:56:03 pm » |
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?
}
|
|
|
|
« Last Edit: February 12, 2013, 05:59:02 pm by TrailerTrash »
|
Logged
|
Webmaster living off grid in a camper with 300watts of solar panels charging 9 absorbed glass mat 12V batteries. i own about 40 dot coms. i can read, write and debug HTML, CSS, JSON and PHP. I can understand some javascript. A++ is new to me. i thought it was a dead language. lol! A rogue planet called Nibiru is close by and will cause disasters all over earth including fireballs, earthquakes, meteors and volcanic eruptions. But i will be ready with Project Camper
|
|
|
|
Eindhoven (NL)
Offline
Newbie
Karma: 0
Posts: 2
|
 |
« Reply #28 on: February 22, 2013, 09:13:52 am » |
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: http://508.winand.nl/?p=1087(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)
|
|
|
|
|
Logged
|
|
|
|
|
|