Can anyone please give me any info. on replacing an "Alphanumeric 16x2 LCD" with a "Smart-GPU 320x240 Color Display".
I have tried using the current library to run the Smart-GPU, but all I can get out of it is a graphical display(colors and shapes). Is there a way to display an analog output from an Arduino MEGA 2650? If so where might I find such a library?
The PDF data sheet for the color display can be found here.........http://vizictechnologies.com/#/smart-gpu/4554296549
Thank you in advance for your time and consideration....
On their site they have a link to Arduino Library/Code.
Have you tried that?
You have to use the appropriate commands to send text to the display.
The data sheet is very clear on how to send various types of commands to the screen. So what you have to do is convert your analog input into useful data that you wish to display and then send it to the display using the Display String command on page 35 of the datasheet.
The Display String is included in the Library. You would treat it similarly to the shapes that you have been able to draw:
You have to pass the following data:
int x1, int y1, int x2, int y2, int colour, uint8_t font, uint8_t fill, char text[]
so in your code try this:
//first get a color. The library for this display does not appear to include a color function so I have included one. This will set fontcolor equal to the 565 equiv of white
int fontcolor = getcolor(255,255,255); //My display requires an unsigned int. I just noticed that yours requires an int. I modified this to address that issue.
SMARTGPU::String(0,0,100,20,fontcolor,1,1,"Hello World");
//Function to return 565 color value needed.
unsigned int getcolor(uint8_t red, uint8_t green, uint8_t blue)
{
int outR = ((red * 31) / 255);
int outG = ((green * 63) / 255);
int outB = ((blue * 31) / 255);
return (outR << 11) | (outG << 5) | outB;
}
I have never used this display but this should get you really close. I am not sure how they are handling the font but a number 1 - 7 should work there. The fill value will be either a 1 or a 0 for transparent or background color as the background to your text.
Once you have figured out how to send it fixed text, then you can start figuring out how to send it other types of data.
Sacman:
On their site they have a link to Arduino Library/Code.
Have you tried that?
You have to use the appropriate commands to send text to the display.
The data sheet is very clear on how to send various types of commands to the screen. So what you have to do is convert your analog input into useful data that you wish to display and then send it to the display using the Display String command on page 35 of the datasheet.
The Display String is included in the Library. You would treat it similarly to the shapes that you have been able to draw:
You have to pass the following data:
int x1, int y1, int x2, int y2, int colour, uint8_t font, uint8_t fill, char text[]
so in your code try this:
//first get a color. The library for this display does not appear to include a color function so I have included one. This will set fontcolor equal to the 565 equiv of white
int fontcolor = getcolor(255,255,255); //My display requires an unsigned int. I just noticed that yours requires an int. I modified this to address that issue.
//Function to return 565 color value needed.
unsigned int getcolor(uint8_t red, uint8_t green, uint8_t blue)
{
int outR = ((red * 31) / 255);
int outG = ((green * 63) / 255);
int outB = ((blue * 31) / 255);
return (outR << 11) | (outG << 5) | outB;
}
I have never used this display but this should get you really close. I am not sure how they are handling the font but a number 1 - 7 should work there. The fill value will be either a 1 or a 0 for transparent or background color as the background to your text.
Once you have figured out how to send it fixed text, then you can start figuring out how to send it other types of data.
WOW...!!!!
Thank you so much, your input was very informative and worked great!!
Sacman:
On their site they have a link to Arduino Library/Code.
Have you tried that?
You have to use the appropriate commands to send text to the display.
The data sheet is very clear on how to send various types of commands to the screen. So what you have to do is convert your analog input into useful data that you wish to display and then send it to the display using the Display String command on page 35 of the datasheet.
The Display String is included in the Library. You would treat it similarly to the shapes that you have been able to draw:
You have to pass the following data:
int x1, int y1, int x2, int y2, int colour, uint8_t font, uint8_t fill, char text[]
so in your code try this:
//first get a color. The library for this display does not appear to include a color function so I have included one. This will set fontcolor equal to the 565 equiv of white
int fontcolor = getcolor(255,255,255); //My display requires an unsigned int. I just noticed that yours requires an int. I modified this to address that issue.
//Function to return 565 color value needed.
unsigned int getcolor(uint8_t red, uint8_t green, uint8_t blue)
{
int outR = ((red * 31) / 255);
int outG = ((green * 63) / 255);
int outB = ((blue * 31) / 255);
return (outR << 11) | (outG << 5) | outB;
}
I have never used this display but this should get you really close. I am not sure how they are handling the font but a number 1 - 7 should work there. The fill value will be either a 1 or a 0 for transparent or background color as the background to your text.
Once you have figured out how to send it fixed text, then you can start figuring out how to send it other types of data.
I have figured out how to design the following test screen for the main readout
But I can not figure out how to take the following code(that works great with the alphanumeric LCD display) and display the same with the Smart-GPU display.
void setup()
lcd.begin(20, 4);
lcd.setCursor(0, 0);//where to start cursor
lcd.print("PINA SYSYTEMS ");//print message
lcd.print("SOFTWARE VERSION 1.0");//print message
delay(2000);
lcd.clear();
lcd.setCursor(0, 0); // set the cursor to column 0, line 0
lcd.print("PP1"); // Print a message to the LCD.
lcd.setCursor(6, 0); // set the cursor to column 6, line 0
lcd.print("PP2"); // Print a message to the LCD
lcd.setCursor(12, 0); // set the cursor to column 12, line 0
lcd.print("PP3"); // Print a message to the LCD.
void loop()
lcd.setCursor(0, 1); //sets the cursor to column 0, line 1
inputReading1 = analogRead(sensor1); //getting the voltage reading from the 02 sensor
float voltage1 = inputReading1 * aref_voltage1; // converting that reading to voltage
voltage1 /= 1024.0;
lcd.print(voltage1, 2);//print actual voltage to lcd
delay(200);
lcd.setCursor(6, 1); //sets the cursor to column 6, line 1
inputReading2 = analogRead(sensor2); //getting the voltage reading from the O2 sensor
float voltage2 = inputReading2 * aref_voltage2; // converting that reading to voltage
voltage2 /= 1024.0;
lcd.print(voltage2, 2); //print actual voltage to lcd
delay(200);
lcd.setCursor(12, 1); //sets the cursor to column 12, line 2
inputReading3 = analogRead(sensor3); //getting the voltage reading from the O2 sensor
float voltage3 = inputReading3 * aref_voltage3; // converting that reading to voltage
voltage3 /= 1024.0;
lcd.print(voltage3, 2); //print actual voltage to lcd
delay(200);
Sacman:
On their site they have a link to Arduino Library/Code.
Have you tried that?
You have to use the appropriate commands to send text to the display.
The data sheet is very clear on how to send various types of commands to the screen. So what you have to do is convert your analog input into useful data that you wish to display and then send it to the display using the Display String command on page 35 of the datasheet.
The Display String is included in the Library. You would treat it similarly to the shapes that you have been able to draw:
You have to pass the following data:
int x1, int y1, int x2, int y2, int colour, uint8_t font, uint8_t fill, char text[]
so in your code try this:
//first get a color. The library for this display does not appear to include a color function so I have included one. This will set fontcolor equal to the 565 equiv of white
int fontcolor = getcolor(255,255,255); //My display requires an unsigned int. I just noticed that yours requires an int. I modified this to address that issue.
//Function to return 565 color value needed.
unsigned int getcolor(uint8_t red, uint8_t green, uint8_t blue)
{
int outR = ((red * 31) / 255);
int outG = ((green * 63) / 255);
int outB = ((blue * 31) / 255);
return (outR << 11) | (outG << 5) | outB;
}
I have never used this display but this should get you really close. I am not sure how they are handling the font but a number 1 - 7 should work there. The fill value will be either a 1 or a 0 for transparent or background color as the background to your text.
Once you have figured out how to send it fixed text, then you can start figuring out how to send it other types of data.
I have figured out how to design the following test screen for the main readout
But I can not figure out how to take the following code(that works great with the alphanumeric LCD display) and display the same with the Smart-GPU display.
void setup()
lcd.begin(20, 4);
lcd.setCursor(0, 0);//where to start cursor
lcd.print("PINA SYSYTEMS ");//print message
lcd.print("SOFTWARE VERSION 1.0");//print message
delay(2000);
lcd.clear();
lcd.setCursor(0, 0); // set the cursor to column 0, line 0
lcd.print("PP1"); // Print a message to the LCD.
lcd.setCursor(6, 0); // set the cursor to column 6, line 0
lcd.print("PP2"); // Print a message to the LCD
lcd.setCursor(12, 0); // set the cursor to column 12, line 0
lcd.print("PP3"); // Print a message to the LCD.
void loop()
lcd.setCursor(0, 1); //sets the cursor to column 0, line 1
inputReading1 = analogRead(sensor1); //getting the voltage reading from the 02 sensor
float voltage1 = inputReading1 * aref_voltage1; // converting that reading to voltage
voltage1 /= 1024.0;
lcd.print(voltage1, 2);//print actual voltage to lcd
delay(200);
lcd.setCursor(6, 1); //sets the cursor to column 6, line 1
inputReading2 = analogRead(sensor2); //getting the voltage reading from the O2 sensor
float voltage2 = inputReading2 * aref_voltage2; // converting that reading to voltage
voltage2 /= 1024.0;
lcd.print(voltage2, 2); //print actual voltage to lcd
delay(200);
lcd.setCursor(12, 1); //sets the cursor to column 12, line 2
inputReading3 = analogRead(sensor3); //getting the voltage reading from the O2 sensor
float voltage3 = inputReading3 * aref_voltage3; // converting that reading to voltage
voltage3 /= 1024.0;
lcd.print(voltage3, 2); //print actual voltage to lcd
delay(200);
Heres my test code for the screen I designed......
#include <SMARTGPU.h> //include the SMARTGPU library!
SMARTGPU lcd; //create our object called LCD
void setup()
{
Serial.begin (9600);
lcd.init(); //configure the serial and pinout of arduino board for SMARTGPU support
lcd.start(); //initialize the SMARTGPU processor
lcd.imageSD(0,0,"main7"); //startup image
delay (5000);
}
void loop()
{
Serial.write (1);
int sensor1 = Serial.read();
char PPO1[2] = {sensor1};
Serial.write (2);
int sensor2 = Serial.read();
char PPO2[2] = {sensor2};
Serial.write (3);
int sensor3 = Serial.read();
char PPO3[2] = {sensor3};
Serial.write (4);
int setpoint = Serial.read();
char PPO4[2] = {setpoint};
// enter display data and screen positions
lcd.string(250,70,255,65,RED,FONT7,TRANS,PPO1);
lcd.string(30,70,100,55,GREEN,FONT7,TRANS,PPO2);
lcd.string(155,70,255,65,RED,FONT7,TRANS,PPO3);
lcd.string(90,210,100,55,BLACK,FONT7,TRANS,PPO4);
}
Are you getting errors when you compile? If so what are they?
I assume that all of those variables you are using in your string call are from the library since you are not declaring them anywhere?
Are you at least getting the image to display? Since that is being called in setup, it should come up pretty quick. On my 4D display, I have to pause for a couple of seconds after powerup before sending it the initialize signal to give the display time to power up. I don't know if this is the case for yours or not or if it is handled in the library.
Were you able to do the simple Hello World example? I get the impression that it worked fine. So If you get the image but not the info, then the info must be suspect. Try removing your variable and sending an actual string like "Test" and see if it prints. It took me a long time to figure out how to send data that was not a fixed string to my display. I ended up using sprintf to put the data in a char array that the display accepts. At one time I could explain why, now I just accept that it is so.
Here is an example that builds time for me with leading 0's for seconds and leading spaces for minutes. If you want to other type of data, you will need to google sprintf. I believe that this will not handle a float but it will handle integers all day. There "%2d:%02d" portion of the sprintf function has a lot of different options.
int timemin = 60;
int timesec = 0;
char timetext[10]; //Temporary char array to hold the data to be sent to the display
sprintf(timetext,%2d:%02d",timemin,timesec);
/*
The way that middle section works in this example is
%2d takes the first number it encounters, timemin, and makes it a space padded decimal number. The 2 indicates how many spaces to pad with
It then adds a colon
%02d takes the next number it encounters, timesec, and makes it a 0 padded 2 digit decimal number. That is what the 0 does in front of the 2d. If I had put a 4 instead, it would pad it with a 4.
*/
lcd.string(250,70,255,65,RED,FONT7,TRANS,timetext); //This is your code. This is different from my LCD string code.
//I handle incrementing the time elsewhere but this will print it once.
You might be better off moving the Display to SoftwareSerial if you are using an UNO. Then you can debug print to the serial port to help you troubleshoot.
It helps to know what part is not working.
So as I look closer at your code, try replacing
char PPO1[2] = {sensor1};
with:
sprintf(char PPO1[2], "%d",sensor1);
If that doesn't work, declare the char outside of the function like so:
Yes...!!!
You are 100% correct....I have compiled the code and it does with no errors, and I have sent a "TEST" string and that works great also!!
But getting the actual voltage to print has been a challenge, and I'm sure I'm doing something wrong. Thank you so much for your input, I will give it a go!!!