Posts mit dem Label VFD werden angezeigt. Alle Posts anzeigen
Posts mit dem Label VFD werden angezeigt. Alle Posts anzeigen

Freitag, 11. Januar 2013

LCD4Linux + serial VFD


 LCD4Linux + serielles VFD




Display hängt an /dev/ttyS0
 


obwohl   20x2 muss als 40x1 angesteuert werden!!!

Zum Testen als root:

sudo gedit/etc/lcd4linux.conf
lcd4linux -Fvvq
STRG+C zum beenden
 ############### lcd4linux.conf #######################################


Display myVFD {
   Driver   'SimpleLCD'
   Model    'generic'             #vt100 generic
   Port     '/dev/ttyS0'         #Com
                        #Port     '/dev/ttyACM0'  # Arduino
                        #Port     '/dev/ttyUSB0'  # USB Adapter
   Speed     9600
                        #Size     '20x2'
   Size     '40x1'
   #obwohl   20x2 muss als 40x1 angesteuert werden!!!

                       #Activate parity and set it to odd
                       #Options 0001400
                       #From the BA63 doc, decimal 219 look like a big full block.
  # BarCharValue 219
  
}

#----------------------------------------------------------------------------------

Widget Time {
    class 'Text'
    expression strftime('%a. %d/%m  %H:%M:%S',time())
    width 20
    align 'L'
    update 1000
}



Widget FreeRAM {
    class  'Text'
    expression meminfo('MemFree')/1024
    postfix ' MB RAM'  
    width  10
    precision 1
    align  'R'
    update tick
}



Widget Eth0 {
    class 'Text'
    expression (netdev('eth0', 'Rx_bytes', 500)+netdev('eth0', 'Tx_bytes', 500))/1024/1024
    prefix 'eth0'
    postfix ' MB/s'
    width 20
    precision 3
    align 'R'
    update tick
}


Widget Eth0UL{
    class 'Text'
    expression netdev('eth1', 'Tx_bytes', 500)/1024/1024
    prefix 'U '
    #postfix ' MB/s'
    width 8
    precision 3 #Nachkommastellen
    align 'L'
    update tick
}


Widget Eth0DL{
    class 'Text'
    expression netdev('eth1', 'Rx_bytes', 500)/1024/1024
    prefix 'D'
    postfix ' MB/s'
    width 12
    precision 3
    align 'R'
    update tick
}

#----------------------------------------------------------------------------------

Variables {
   tick 500
   tack 100
   minute 60000
}

Layout L40x1 {
    Row1 {
        Col1  'Time'
        #Col11 'Load'
        Col21 'Eth0UL'
        Col29 'Eth0DL'
    }
}

Display 'myVFD'
Layout  'L40x1'

Dienstag, 8. Januar 2013

serial VFD Display + Arduino Uno = Rhythmbox Titelanzeige

 seriel VFD Display an TX-Output vom Arduino Uno.


Status: Funktioniert nur bei getsratetem Seriellen Monitor!

falls abgestürzt in der Konsole unter root Port freigeben

sudo bash
rm /var/lock/LCK..ttyACM1


To Do: Interpret, Song trennen auf zwei zeilen ausgeben ggf. scrollen




 Arduino Sketch:


/*
Sketch um Rhythmbox Infos auf VFD auzusgeben.

 rb-lcd.py Skript starten!!
 
*/


const int numCols = 20;
const int numRows = 2;
int i;
int empty;


////////////


void setup()
{
  Serial.begin(9600);
  Serial.write(0x04); //DIM
  //Serial.write(0x09); //HT
  //Serial.write(0x11); //DC1

}

void loop()
{

  if (Serial.available()) {
    delay(100);
    Serial.write(0x1B); //ESC
    Serial.write((byte)0x00); //Cursor 0,0


      while (Serial.available() > 0) {  
      Serial.write(Serial.read());
      delay(100);
      i++;

      if (i == (numCols * numRows)) {
        i = 0;
        // this to clear the rest of the serial I/O
        while (Serial.available() > 0) {
          empty = Serial.read();
        }
      
      }
    }
  }
}









Phyton Skript:

#!/usr/bin/python
#Created By Patrick van der Leer a.k.a. Junke
#
#

### CONFIG ###
dev = "/dev/ttyACM0"    # path to the arduino
rows = 2                # number of rows of your LCD
cols = 20               # number of cols of your LCD

###
import os, time
#from subprocess import Popen, PIPE

message = " "
song = "  "

def display():
  error = os.system('echo "%s" >> %s' %(message,dev,))
  if error == 0:
    print "Song '%s'" %(message,)
  else:
    print "Failed to display '%s'" %(message,)


### loop ###
while True:
  p = os.popen('rhythmbox-client --print-playing')
  song = p.readline()
  p.close()
  song = song[:-1]
  while len(song) < (rows * cols): # to make sure the arduino doesnt
    song += " "                    # fill the rest up with black
  if song != message:
     message = song
     display()
  time.sleep(5)