SerialViewGLCD

Da raspibo.
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
200px

Graphic LCD w/ ATMEGA328
Visualizzatore porta seriale con LCD Grafico comandato da ATMEGA328
Repository: nessuno

GLCD w/ ATMEGA328

ATTENZIONE
Le immagini, se presenti, sono puramente indicative.
Fra i simboli di redirezione "<" e ">", sono inseriti i nomi fittizi da sostituire con reali (per esempio: <nomefile.txt>)
Fra parentesi quadre "[]" sono indicati comandi opzionali.


Descrizione

Visualizzatore porta seriale con LCD Grafico comandato da ATMEGA328

Collegandogli una porta seriale, ne visualizza la trasmissione.

Utile quando impossibilitati a spostare il computer dove necessario (o sprovvisti del secondo pc) per "debuggare" un programma. Per esempio quando si deve provare un'antenna RF, trasmittente e ricevente.

Ho realizzato una versione bluetooth. Con questa e` possibile (per esempio) inviare messaggi da un cellulare e visualizzarli sul display.

Hardware

I codici articolo sono (spero) tutti riportati nel circuito elettrico: File:Atmega328-glcd.pdf

Versione con antenna bluetooth HC-05: File:Atmega328-glcd-bluetooth.pdf

Software

Ho usato pari pari, l'esempio fornito con la libreria (Serial2GLCD)

/*
 *  openGLCD Library - Serial Input displayed on glcd
 * 
 * This sketch displays text characters sent over the serial port 
 * (e.g. from the Serial Monitor) on an attached GLCD.
 * Lines will wrap and scroll the text when needed.
 * When a new line character is received new text is wrapped to the next line.
 *
 * If you use the Arduino IDE Serial Monitor and want lines to wrap
 * when you press <enter> or click on the [Send] button, you must
 * turn on the NewLine option down by the BaudRate setting.
 * 
 * 
 * 2013.06.15  bperrybap  - conversion to openGLCD
 * 2011.12.04  bperrybap  - original creation
 *	bperrybap@opensource.billsworld.billandterrie.com
 */

// include the library header
// no font headers have to be included
#include <openGLCD.h>


void setup() {
  // Initialize the GLCD 
 GLCD.Init();

 // Select the font for the default text area
  GLCD.SelectFont(System5x7);

  GLCD.println("Listening..."); // output using Print class

  // could also use gText string output routine
  // GLCD.Puts("Listening...\n"); 


  Serial.begin(9600);
}

void loop()
{
char c;

  // when characters arrive over the serial port...
  if (Serial.available())
  {
      // read character from serial library buffer
      c = Serial.read();

      // display character on glcd
      GLCD.write(c); // use Print class for output

      // could also use gText character output routine
      // GLCD.PutChar(c);
  }
}


Setup

Configurazione

HC-05

Normalmente collego al computer la HC-05 con un convertitore USB-TTL (tipo CP2102).

Collegamento in seriale (se c'e` una sola USB, di solito e` sulla 0):

miniterm.py -b 38400 -e /dev/ttyUSB0

e i parametri di come e` stata configurata:

AT+ROLE=0
AT+CMODE=1
AT+PSWD=<Vostra password numerica a 4 cifre>
AT+UART=9600
AT+NAME=glcdserial


Utilizzo

Collegare alimentazione e porta seriale o inviare stringhe via bluetooth ;)


Riferimenti