Dies ist eine alte Version des Dokuments!


Data-Logger by DL2FP

FIXME ToDo: DL2FP

Zusätzlich wird noch die PC Software gobetwino benötigt. http://mikmo.dk/gobetwinodownload.html

Womo_Volt_messen.ino
/*
  Wohnmobil Board Spannungsmesser und Lichtwert mit LCD-Anzeige und seriel-out
 (c) by DL2FP 2013-19-02
 
   (( am EPC auf COM1 mit Arduino verbinden , USB links vorne am EPC, 
      da bei COM9 die USB nach einiger Zeit abschaltet!))
 
  Arduino Pins !!!
  ___________________
  mini USB   !!! EPC
  DC Buchse
  ISP 6 POL
 
  IOREF
  Reset
  +3,3 V  (Power)
  +5 V    (Power) !!! Versorgungsspannung
  GND     (Power) !!! Versorgungsspannung  
  GND     (Power)
  +Vin    (Power)
 
  A0 analog in !!! sensor1 Volt
  A1 analog in !!! sensor2 Licht
  A2 analog in
  A3 analog in
  A4 analog in
  A5 analog in
 
  SCL
  SDA
  AREF
  GND
 -13 digital PWM  intern LED morse Status
  12 digital     !!! LCD-Display
 -11 digital PWM !!! LCD-Display
 -10 digital PWM 
  -9 digital PWM !!! Lautsprecher
   8 digital 
 
  7 digital 
 -6 digital PWM 
 -5 digital PWM  !!! LCD-Display
  4 digital      !!! LCD-Display
 -3 digital PWM  !!! LCD-Display
  2 digital      !!! LCD-Display
  TX->1
  RX<-0
   */
 
// include the library codes:
  #include <LiquidCrystal.h> // include LCD Display
  #include <Morse.h> // include morse code.
 
// initialize the LCD-Display library with the numbers of the interface pins
   // LCD-Display Pin1 GND, Pin2 +5V, Pin3 Poti, Pin5 GND, 4-12, 6-11, 11-5, 12-4, 13-3, 14-2, (Display_Pin-Arduiono_Pin)
   // 540 Ohm nach GND, 1k2 Ohm nach +5V, Mitte an Pin3 anstelle des Poti!
    LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
 
    Morse morse1(9, 30, 1); // initialize Morse and Setup speaker to pin 9
 
    int z = (0); // varialble z, Zähler für Einschalt-Verzögerung
    const int mz=(5000); // mz = Zeit zwischen 2 Messwerterfassungen.
 
// the setup routine runs once when you press reset:
void setup() {
   lcd.begin(16, 2); // set up the LCD's number of columns and rows: 
   lcd.print("MOMMENT BITTE");  // Print a message to the LCD.
   Serial.begin(9600);   // initialize serial communication at 9600 bits per second:
    // nur für Leonardo Board, warten -- bis die serielle Scnittstelle abgefragt wird.
    // while (!Serial) {
    //   ;
    // }
}
 
// the loop routine runs over and over again forever:
void loop() {
 // Einschaltverzögerung
   while (z < 2) {
 // delay = Zeit der Einschalt-Verzögerung
    delay (5); 
     z++;
   morse1.sendmsg("OK"); // Status morse LSP
 } 
// Meßwert einlesen und für die Anzeige umrechnen
  int sensor1 = analogRead(A0); // read the input Voltage on analog pin A0:
   float Anzeige1 = (sensor1/51.2); //  durch 51.2 umskalieren auf 20V
  char buffer1[5]; // Umwandlung int in Char für Serial.print
 
  int sensor2 = analogRead(A1);  // read the input Light on analog pin A1:
   float Anzeige2 = (sensor2/10.24); // durch 10,24 um auf 100% zu  skalieren. 
  char buffer2[5]; // Umwandlung int in Char für Serial.print
 
// print out the value you read Sensor1 Volt, sensor2 Licht :  to seriel-Monotor
  // Format für speichern in Datei   c:\Programme\gobetwino\daten1.txt
   Serial.print ("#S|SENSOR1|[");
     Serial.print(itoa((sensor1), buffer1, 10));
    Serial.print (";");
     Serial.print(itoa((sensor2), buffer2, 10));
      Serial.println ("]#");
 
   delay(mz);   // Zeit zwischen zwei Messwerten
 
// Status Ausgabe auf Lautsprecher pin 9 in morsecode
 Morse morse1(9, 30, 1);
  if (Anzeige1 < 10.00) morse1.sendmsg("E");  // EMPTY
  if (Anzeige1 > 14.00) morse1.sendmsg("V");  // VOLL
  if (Anzeige1 > 12.00 && Anzeige1 < 14.00) morse1.sendmsg("R");  // READY
  if (Anzeige1 > 10.00 && Anzeige1 < 12.00) morse1.sendmsg("L");  // LOAD need
 {
 }
 
// LCD - Display Anzeige setzen
   lcd.begin(16, 2);  // (note: line 1 is the second row, since counting begins with 0):
   lcd.print("SPANNUNG  LICHT ");  // Überschrift setzen Zeile 1
   lcd.setCursor(0, 1);  // set the cursor to column 0, line 2
   lcd.print("                "); // Zeile 2 löschen
// Werte Anzeigen
   lcd.setCursor(1,1);
   lcd.print(Anzeige1); // Volt
   lcd.setCursor(7,1);
   lcd.print("V");
   lcd.setCursor(10,1);
   lcd.print(Anzeige2); // Licht
   lcd.setCursor(15,1);
   lcd.print("%");
   delay(1); // Sicherheitshalber !
} 
// ENDE
f11/technik/arduino/programme/data-logger-dl2fp.1362356007.txt.gz · Zuletzt geändert: 2019/09/29 12:01 (Externe Bearbeitung)
CC Attribution-Noncommercial-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0