Very good video. I appreciate the detail by which you explain the working principle of the display. There are many videos where people just use some library without any understanding what they are doing. Your videos really open up what is really going on.
Thank you for this series. I haven't attempted to get my display working yet, but I am now more confident about the attempt whenever I get around to it. :)
I'm glad that you are now not so sure about the 5V compatibility of these displays. I now supply mine at 3V3 and place resistors inline from the Arduino digital outputs. I'm doing this because I also had problems which went away once I started treating them as 3V3 modules.
Marcus Jenkins I wonder if you could treat the data lines as 5v tolerant and make direct connections to them. Just tried it - seems to work OK - 3v3 on Vcc, 5v signals on data lines. Incidently, I accidently put 5v on Vcc of the nRF24L01+ module for several minutes and it seemed to survive!
Great tutorial. I used an old NiMH AA 1.2V rechargeable battery with a potentiometer and it worked just fine (the voltage was variating a little, but not too much to worry about). Regards,
BOY that fellow had it right, I built a compass using this display, the first display actually got so bad I could no longer use it, and had to replace it! I thought I had burned her up, and after soldering it to a permanent board, I was very angry at myself for not heading the warning to use only 3.3 volts even though the display I was using has 3.3-5V printed on the board! It was only after I had completely rebuilt my project on a different board that I discovered I could still use that display when hooked to 3.3 volts and using a 3.3 volt arduino or ESP8266 to drive it, which is what I am using for it in a different project.
Just wanted to say thanks for all your hard work and efforts for these great videos. I know how much time and effort it takes and hope you keep up the great work!!!
Thanks for the video, Julian. Fun thing is I've got a lot of the parts you get in "Postbag !"*, and I can replicate easily. As I have no ammeter* currently - no pun intended- but have a couple of those Hall Effect current measuring xducers, I can turn one of my pro mini's into a useful multimeter for testing a battery protector 'diode' (reverse p-fet) I'm trying. Keep 'em coming! * Thanks for switching me onto the Nano expansion shield, and the lovely LED buck converter PSU, both of which in constant use. (My missus hates 'postbag', cos she knows the kitchen table is soon flooded by Chinese jiffy-bags...) * UPDATE: I now have an Avo 8 I bought for about £30 at a flea-market!
Tempted me to take my module out of the parts bin, which previously would only display all black. Turns out, it's fine but these modules all have very different contrast values. On 3.3v, I had to go as low as 0x9C for Vop and 0x13 for bias to get a readable display. Others stuck with an all black display, don't be afraid to go really low with Vop. My module was a 5110 display, blue soldermask board from eBay, characterised by an SMD resistor/cap at the top of the board.
Great video and salute to your rock knowledge! Dear sir this was great but if you write a blog having all steps, programming code, schematic diagram and all necessary details regarding the circuit and give the address of the blog in video description, I think could be the excellent idea and will make your great effort as a final word in the world of Arduino. Sure this will be your help and we could not pay for that! Regards and looking forward for your kind reply!
LearningZone Thank you very much. I am considering a companion blog (and maybe even a forum), but I'm having so much trouble with my web server at the moment, that now is not the time to launch it. I want a new Qnap server (with dual hot swap drives in Raid1), but what I want and what I can afford are 2 different things!
Julian Ilett That is great sir. But using simple PC tools and blogs somewhere like blogspot could also do the function I think. Hope you will get what you want!
I want to use this code to accept digital input from pin 2 on the Arduino UNO with a DHT11 Temp/Humidity sensor using the DHT.h library. Everything you have shown has worked magnificently. Am I wrong that your using analog in or is the ADC being used...?
I believe you should divide by 1023 rather than 1024. Since the maximum value returned by analogueRead is 1023 you would divide by 1023. You are likely get a result of 4.9951171875 which is rounding up to 5.00 on the conversion. My background is numerical analysis and quantitative analysis and so I'm quite mindful of floating point conversions and "end cases". Thanks for the amazing video, I totally enjoy them and learn tons.
mmilner7666 This intrigues me. I was happy to use /1023 until I thought about the range of voltages that 1023 represents. Sure it's 5v at the top of that range, but it's 4.9951171 at the bottom. So I'm thinking 1023 actually represents the mid point between those 2 values = 4.9975585 plus or minus half a bit. similarly, an ADC result of zero represents a range of voltages between 0v and 0.0048828 volts. Or is it more complicated than this?
Julian Ilett I think that whatever the final value you want displayed may be, you want to scale the ADC values range from 0-1023 to 0-1, and so you should be dividing by 1023. Then if you want the final values to be the midpoints, you should be multiplying by 4.995117 (the lower end of the top step) and adding 0.002441 (half a step). So the final expression would be: ADC / 1023 * 4.995117 + 0.002441 With ADC at 0, the result is 0.002441 With ADC at 1023, the result is 4.997558 Thanks for sharing all these interesting projects, Julian. With the second-to-none clarity of your narration, your channel is up there with my top 5.
Great work, I started watching last night and today I got my 5110 LCD display 4 lines of text with 2 blank lines between the lower 2, very happy. Thank you. Now I just need to merge this code with the 4ch Ohmeter I've been working on this week. Just read through all the comments and saw how you read the datasheet and built this code from the groumd up. I have a cheap serial display that should have worked the same as the Zolen screen, turns out it does not use the ST7565 chip like the Zolen screens. I've got the data sheet but I'm still lost, any ideas?
the C libs have lots of short names. std = standard (not "stud" :-)) con = console (for platforms having a console) io = input output lib = library str = string env = environment (for platforms having an environment) arg = arguments def = defines possible optimization: I don't know that particular screen, but I guess you can write stuff more optimally. It'll need a test :) basically change the LcdWriteData() into 3 functions: LcdEnableDataWrite() which does the first 2 lines LcdWriteDataByte() which does the actual data byte write LcdDisableDataWrite() which does the last line then you can change the LcdWriteString to do the LcdEnableDataWrite() just once (instead of 6 times per character) write all the data, then do LcdDisableDataWrite() once (instead of 6 times per character) Might not be entirely relevant to you if you don't need this to be speedy.
The code is massive. How much space in arduino memory does it require for a simple text? It just looks like driving this lcd I wouldn't be able to drive anything else. Isn't there a unified library gathering all the needed functions together?
Hello, I have a question, Can I graph signals in real time with this LCD? I want to graph biosignal like pulse oximeter (photoplethysmographic signal) and ECG. Beforehand, thank you very much.
area46241 Yes, and it's already been done. The problems I forsee with an ArduScope are getting it to run at useful speeds (fast timebase settings) and taking the analogue input voltage range beyond 0v to 5v.
Thanks so much for these videos they've been really helpfull to see how to do this without libarys, however ... My Voltage only reads 0.00 unless i unplug the pot from the breadboard then it flys up and down erratically. i'm using 3.3 volts but i think i changed the code correctly... float voltage = analogRead(A4) * 3.3 / 1024; LcdXY (50,2); LcdWriteString(dtostrf(voltage,5,2,string));
I know this comment is old, but just in case you're still interested, I think your problem will be in hardware rather than in software. In other words, one of the connections to the pot might be bad or the pot itself might be bad.
arduino is actually c++ based not c. stdlib.h is the standard functions library. when program in visual c++ i don't use as an import because it is imported automatically by the compiler all i need to do is say: using namespace std; and that allows me to use commands like cout, cin and a pile of other functions that i don't even know at the moment
abyssunderground Yes, I'm sure numerous libraries exist for this particular display, but I produced this tutorial series to show how to build the software from the ground up. I'm completely ambivalent about the use of libraries. Use libraries to get the job done quickly, but expect missing functionality and even bugs. Write your own code (produce your own library maybe) if you want a full and complete understanding of the hardware and software. The third option is to fork someone else's work of course.
Julian Ilett That's fair enough. I wasn't aware that's what you were doing so sorry I missed that! I prefer things to "just work" where possible which is where my love for libraries made by those who know what they're doing comes from. I have modified libraries before to work the way I want them to but nothing substantial. In most cases I wouldn't know where to start. I can write software but interfacing directly with hardware is my downfall.
abyssunderground And most of the time Arduino libraries do "just work". Then, one day, you start using a library that "just doesn't work" and you become suspicious and cynical - like me!
Julian Ilett the arduino libraries are not to be trusted, you did the right thing! wherever possible write your own routines and then you have your own libraries...(and share findings etc)
Following on from the comments from Marcus and Julian below (which I can't reply to to keep this properly in context)... the PCD8544 controller chip that these Nokia 5110 LCDs use it is happy to have 5V + (absolute maximum of 7V), but I'm unsure as to whether the LCD is getting it's power from the driver chip's voltage generator, or directly from the supply voltage. I suspect it is from the supply voltage, hence the variance in contrast, etc when run from different supply voltages. The following site may be of interest: www.avdweb.nl/arduino/hardware-interfacing/nokia-5110-lcd.html
i am having problems with getting the coding to work i can get the first load to work but when i try and use the font.h file i get these errors In file included from dualvolt.ino:10:0: font.h:101:1: error: stray '\357' in program }; ^ font.h:101:1: error: stray '\273' in program font.h:101:1: error: stray '\277' in program dualvolt.ino:95:1: error: stray '\' in program dualvolt.ino:95:3: error: 'ufeff' does not name a type Error compiling.
Hi! I think it would help everyone a lot if you would use Pastebin. You could just put link in the description. :) Also if you would create an account over there everyone could find your code much easier if someone would like to find it like months or years from this day. Just a suggestion.
Just a note, folks. I cut 'n' pasted the code from TH-cam and got all sorts of compile errors. Turns out I'd inserted non-printable character(s) at the end of both files. Only painstakingly stepping over the files with the cursor revealed - they were (Sodds Law) after the last character in each file...HTH.
Thanks for your great video! I'm a newbie and I've learnt many things from this, but while using your example in my Energia Project I got a problem with the function "dtostrf()". I typed "LcdString(dtostrf(test,5,2,string));" and it noticed me that "error: 'dtostrf' was not declared in this scope" I had used the function itoa() instead but it still failed. Did I miss any library? Can you help me #Julian Ilett? Thanks you very much.
Julian Ilett Thanks for answering me :). I had searched of it and found it in stdlib, but although I included that library, it still noticed an error: " 'dtostrf' was not declared in this scope". The function itoa supported by that library worked but the result displayed on the LCD did not match. My Project's purpose is getting GPS data (real number) and displaying them on the LCD screen so that itoa is useless. I'm searching for another functions. Thank you and looking forward for your reply.
That's a good point. If I were doing this in assembler, the font would be in a data table in program memory. I'll have a look at that wiki page. Thanks Tobias.
To leave the font data in flash memory instead of consuming valuable SRAM, you only have to change two lines. Change #1: (in font.h or wherever ASCII[] declared) static const byte ASCII[][5] = " to static const byte ASCII[][5] PROGMEM = " Change #2: (in main sketch) LcdWriteData(ASCII[character - 0x20][i]); to LcdWriteData(pgm_read_byte(&ASCII[character - 0x20][i])); Instant saving of 480 bytes of SRAM!
Peter Feerick Peter, many thanks for this, particularly that you gave me step by step instructions! I've now finally made the change and it works well. Video coming soon.
hi. im use Arduino UNO R3 + LCD 5510. im from Vietnam.i speak english very bad. sorry for this. please tell me how to create char unicode in LCD 5510 with Arduino. example: English: Hello! Vietnamese: Chào bạn! ---- my font: a à á ả ã ạ â ấ ầ ẫ ẩ ạ ô ồ ố ổ ỗ ộ u ù ú ủ ũ ụ i ì í ỉ ĩ ị ê ề ế ể ễ ệ e è é ẻ ẽ ẹ ă ằ ắ ẳ ẵ ặ o ò ó ỏ õ ọ y ỳ ý ỷ ỹ ỵ ư ừ ú ử ữ ự đ please help me!!!
Sorry to rain on your parade but all data pins should be no more than 3.3 volts have a look at this link, please playground.arduino.cc/Code/PCD8544/ and it will explain all!!
Very good video. I appreciate the detail by which you explain the working principle of the display. There are many videos where people just use some library without any understanding what they are doing. Your videos really open up what is really going on.
Thank you for this series. I haven't attempted to get my display working yet, but I am now more confident about the attempt whenever I get around to it. :)
So cool i have been looking for all 3 of your tutorials in order to create a gps watch with the nokia 5110 as the LCD and now I can.
Thank You
I'm glad that you are now not so sure about the 5V compatibility of these displays. I now supply mine at 3V3 and place resistors inline from the Arduino digital outputs. I'm doing this because I also had problems which went away once I started treating them as 3V3 modules.
Marcus Jenkins I wonder if you could treat the data lines as 5v tolerant and make direct connections to them. Just tried it - seems to work OK - 3v3 on Vcc, 5v signals on data lines.
Incidently, I accidently put 5v on Vcc of the nRF24L01+ module for several minutes and it seemed to survive!
nice video, thanks for spending so much time teaching us.
one thing I was hoping to see was how many resources were used when you uploaded to the NANO
Great tutorial.
I used an old NiMH AA 1.2V rechargeable battery with a potentiometer and it worked just fine (the voltage was variating a little, but not too much to worry about).
Regards,
#define RST 12
#define CE 11
#define DC 10
#define DIN 9
#define CLK 8
#include "font.h";
void LcdWriteString(char *characters)
{
while(*characters) LcdWriteCharacter(*characters++);
}
void LcdWriteCharacter(char character)
{
for(int i=0; i
hastebin.com/cufoxazoxo.coffee
BOY that fellow had it right, I built a compass using this display, the first display actually got so bad I could no longer use it, and had to replace it! I thought I had burned her up, and after soldering it to a permanent board, I was very angry at myself for not heading the warning to use only 3.3 volts even though the display I was using has 3.3-5V printed on the board! It was only after I had completely rebuilt my project on a different board that I discovered I could still use that display when hooked to 3.3 volts and using a 3.3 volt arduino or ESP8266 to drive it, which is what I am using for it in a different project.
Just wanted to say thanks for all your hard work and efforts for these great videos. I know how much time and effort it takes and hope you keep up the great work!!!
Thanks for the video, Julian. Fun thing is I've got a lot of the parts you get in "Postbag !"*, and I can replicate easily. As I have no ammeter* currently - no pun intended- but have a couple of those Hall Effect current measuring xducers, I can turn one of my pro mini's into a useful multimeter for testing a battery protector 'diode' (reverse p-fet) I'm trying.
Keep 'em coming!
* Thanks for switching me onto the Nano expansion shield, and the lovely LED buck converter PSU, both of which in constant use. (My missus hates 'postbag', cos she knows the kitchen table is soon flooded by Chinese jiffy-bags...)
* UPDATE: I now have an Avo 8 I bought for about £30 at a flea-market!
Tempted me to take my module out of the parts bin, which previously would only display all black. Turns out, it's fine but these modules all have very different contrast values. On 3.3v, I had to go as low as 0x9C for Vop and 0x13 for bias to get a readable display.
Others stuck with an all black display, don't be afraid to go really low with Vop. My module was a 5110 display, blue soldermask board from eBay, characterised by an SMD resistor/cap at the top of the board.
Great video and salute to your rock knowledge! Dear sir this was great but if you write a blog having all steps, programming code, schematic diagram and all necessary details regarding the circuit and give the address of the blog in video description, I think could be the excellent idea and will make your great effort as a final word in the world of Arduino. Sure this will be your help and we could not pay for that! Regards and looking forward for your kind reply!
LearningZone Thank you very much. I am considering a companion blog (and maybe even a forum), but I'm having so much trouble with my web server at the moment, that now is not the time to launch it. I want a new Qnap server (with dual hot swap drives in Raid1), but what I want and what I can afford are 2 different things!
Julian Ilett That is great sir. But using simple PC tools and blogs somewhere like blogspot could also do the function I think. Hope you will get what you want!
Thank you so much for this short series; I found it quite helpful!
stdlib means "Standard Library" if that helps ,awesome Vids Julian, thank you.
I want to use this code to accept digital input from pin 2 on the Arduino UNO with a DHT11 Temp/Humidity sensor using the DHT.h library. Everything you have shown has worked magnificently. Am I wrong that your using analog in or is the ADC being used...?
Hi Julian,
Are you aware that adafruit have a really useful library for this particular display? Love the videos keep them coming :)
I believe you should divide by 1023 rather than 1024. Since the maximum value returned by analogueRead is 1023 you would divide by 1023. You are likely get a result of 4.9951171875 which is rounding up to 5.00 on the conversion. My background is numerical analysis and quantitative analysis and so I'm quite mindful of floating point conversions and "end cases". Thanks for the amazing video, I totally enjoy them and learn tons.
mmilner7666 This intrigues me. I was happy to use /1023 until I thought about the range of voltages that 1023 represents. Sure it's 5v at the top of that range, but it's 4.9951171 at the bottom. So I'm thinking 1023 actually represents the mid point between those 2 values = 4.9975585 plus or minus half a bit. similarly, an ADC result of zero represents a range of voltages between 0v and 0.0048828 volts. Or is it more complicated than this?
Julian Ilett I think that whatever the final value you want displayed may be, you want to scale the ADC values range from 0-1023 to 0-1, and so you should be dividing by 1023. Then if you want the final values to be the midpoints, you should be multiplying by 4.995117 (the lower end of the top step) and adding 0.002441 (half a step). So the final expression would be:
ADC / 1023 * 4.995117 + 0.002441
With ADC at 0, the result is 0.002441
With ADC at 1023, the result is 4.997558
Thanks for sharing all these interesting projects, Julian. With the second-to-none clarity of your narration, your channel is up there with my top 5.
Divide by 1024 is a collection of shifts - so more efficient than divide by 1023. Probably fine unless you are looking for 1/10,000 range accuracy.
Great work, I started watching last night and today I got my 5110 LCD display 4 lines of text with 2 blank lines between the lower 2, very happy. Thank you.
Now I just need to merge this code with the 4ch Ohmeter I've been working on this week.
Just read through all the comments and saw how you read the datasheet and built this code from the groumd up.
I have a cheap serial display that should have worked the same as the Zolen screen, turns out it does not use the ST7565 chip like the Zolen screens.
I've got the data sheet but I'm still lost, any ideas?
the C libs have lots of short names.
std = standard (not "stud" :-))
con = console (for platforms having a console)
io = input output
lib = library
str = string
env = environment (for platforms having an environment)
arg = arguments
def = defines
possible optimization: I don't know that particular screen, but I guess you can write stuff more optimally. It'll need a test :)
basically change the LcdWriteData() into 3 functions:
LcdEnableDataWrite() which does the first 2 lines
LcdWriteDataByte() which does the actual data byte write
LcdDisableDataWrite() which does the last line
then you can change the LcdWriteString to do the LcdEnableDataWrite() just once (instead of 6 times per character)
write all the data, then do LcdDisableDataWrite() once (instead of 6 times per character)
Might not be entirely relevant to you if you don't need this to be speedy.
The code is massive. How much space in arduino memory does it require for a simple text? It just looks like driving this lcd I wouldn't be able to drive anything else.
Isn't there a unified library gathering all the needed functions together?
Best teacher ever !
Thanks a lot !
Hello, I have a question, Can I graph signals in real time with this LCD? I want to graph biosignal like pulse oximeter (photoplethysmographic signal) and ECG. Beforehand, thank you very much.
Did you buy the ribbon cable like that? or did you have to solder the connections?
since 2014, u8g2 came out. can you make a similar #3 showing the new driver ?
how can i get bigger font with this display ? of 2 rows height.
Thank you for your tutorial on this, i did my project at it works now.
Which ports doyou connect potentiometer ?
Hey Julian can you write an oscilloscope program to capture live voltages?
area46241 Yes, and it's already been done. The problems I forsee with an ArduScope are getting it to run at useful speeds (fast timebase settings) and taking the analogue input voltage range beyond 0v to 5v.
Thanks Julian good info on the 5 volt limit
Hi julian, is this code on your web site, can not copy paste from youtube comment list, without it being one line. all the best,
Anyway to view serial input on the LCD?
Thanks for this Julian... Most useful, cheers.
I don't see the code in the comments......
Where can I find it?
Thanks !! it's perfect explained !!
Regards ,
Patrick
Thanks so much for these videos they've been really helpfull to see how to do this without libarys, however ... My Voltage only reads 0.00 unless i unplug the pot from the breadboard then it flys up and down erratically. i'm using 3.3 volts but i think i changed the code correctly...
float voltage = analogRead(A4) * 3.3 / 1024;
LcdXY (50,2);
LcdWriteString(dtostrf(voltage,5,2,string));
I know this comment is old, but just in case you're still interested, I think your problem will be in hardware rather than in software. In other words, one of the connections to the pot might be bad or the pot itself might be bad.
arduino is actually c++ based not c.
stdlib.h is the standard functions library.
when program in visual c++ i don't use as an import because it is imported automatically by the compiler all i need to do is say: using namespace std; and that allows me to use commands like cout, cin and a pile of other functions that i don't even know at the moment
I use these displays on 5v using the Adafruit libraries. They work brilliantly and seems much less complex than your code too. Worth a try?
abyssunderground Yes, I'm sure numerous libraries exist for this particular display, but I produced this tutorial series to show how to build the software from the ground up.
I'm completely ambivalent about the use of libraries. Use libraries to get the job done quickly, but expect missing functionality and even bugs. Write your own code (produce your own library maybe) if you want a full and complete understanding of the hardware and software.
The third option is to fork someone else's work of course.
Julian Ilett That's fair enough. I wasn't aware that's what you were doing so sorry I missed that!
I prefer things to "just work" where possible which is where my love for libraries made by those who know what they're doing comes from. I have modified libraries before to work the way I want them to but nothing substantial. In most cases I wouldn't know where to start. I can write software but interfacing directly with hardware is my downfall.
abyssunderground And most of the time Arduino libraries do "just work". Then, one day, you start using a library that "just doesn't work" and you become suspicious and cynical - like me!
Julian Ilett I've had those moments! I'm battling random crashing issues at the moment and I don't know who is to blame, the code or the hardware?!
Julian Ilett the arduino libraries are not to be trusted, you did the right thing! wherever possible write your own routines and then you have your own libraries...(and share findings etc)
Following on from the comments from Marcus and Julian below (which I can't reply to to keep this properly in context)... the PCD8544 controller chip that these Nokia 5110 LCDs use it is happy to have 5V + (absolute maximum of 7V), but I'm unsure as to whether the LCD is getting it's power from the driver chip's voltage generator, or directly from the supply voltage. I suspect it is from the supply voltage, hence the variance in contrast, etc when run from different supply voltages. The following site may be of interest: www.avdweb.nl/arduino/hardware-interfacing/nokia-5110-lcd.html
i am having problems with getting the coding to work
i can get the first load to work but when i try and use the font.h file i get these errors
In file included from dualvolt.ino:10:0:
font.h:101:1: error: stray '\357' in program
};
^
font.h:101:1: error: stray '\273' in program
font.h:101:1: error: stray '\277' in program
dualvolt.ino:95:1: error: stray '\' in program
dualvolt.ino:95:3: error: 'ufeff' does not name a type
Error compiling.
Thanks, great explanation it works great.
Do you think one case use an attiny85 or an esp2866 instead of the nano ?
yep you can :)
Mine is showing live dat from, sensor:
mq135 and mq3 and dht22, bmp086 pressure sensor and last the time.
Hi!
I think it would help everyone a lot if you would use Pastebin. You could just put link in the description. :)
Also if you would create an account over there everyone could find your code much easier if someone would like to find it like months or years from this day.
Just a suggestion.
Be thankful Julian gives us what he is accustom doing. Always some thing for nothing to make your life easery and make Julian harder.
I am getting errors with "string" in LcdWriteString(dtostrf(voltage,5,2,string);
It keeps saying that string is not declared....
NEVER MIND!!!! did not see the new line you added. :D :D :D
Thanks again for the videos.
Just a note, folks.
I cut 'n' pasted the code from TH-cam and got all sorts of compile errors. Turns out I'd inserted non-printable character(s) at the end of both files. Only painstakingly stepping over the files with the cursor revealed - they were (Sodds Law) after the last character in each file...HTH.
Thanks for your great video! I'm a newbie and I've learnt many things from this, but while using your example in my Energia Project I got a problem with the function "dtostrf()".
I typed "LcdString(dtostrf(test,5,2,string));" and it noticed me that "error: 'dtostrf' was not declared in this scope"
I had used the function itoa() instead but it still failed.
Did I miss any library?
Can you help me #Julian Ilett?
Thanks you very much.
Vũ Bạch Nhật I think dtostrf() is in stdlib, you could try including that - but it should be included by default.
Julian Ilett Thanks for answering me :). I had searched of it and found it in stdlib, but although I included that library, it still noticed an error: " 'dtostrf' was not declared in this scope". The function itoa supported by that library worked but the result displayed on the LCD did not match. My Project's purpose is getting GPS data (real number) and displaying them on the LCD screen so that itoa is useless. I'm searching for another functions. Thank you and looking forward for your reply.
When using fonts, you should use them in PROGMEM. Saves holding the data in sram, arduino.cc/en/pmwiki.php?n=Reference/PROGMEM
That's a good point. If I were doing this in assembler, the font would be in a data table in program memory. I'll have a look at that wiki page. Thanks Tobias.
Why not put it in EEPROM? May as well do it for all my Arduino's - eeprom doesn't ever get used, and I've got a ready font whenever I need it.
To leave the font data in flash memory instead of consuming valuable SRAM, you only have to change two lines.
Change #1: (in font.h or wherever ASCII[] declared)
static const byte ASCII[][5] = "
to
static const byte ASCII[][5] PROGMEM = "
Change #2: (in main sketch)
LcdWriteData(ASCII[character - 0x20][i]);
to
LcdWriteData(pgm_read_byte(&ASCII[character - 0x20][i]));
Instant saving of 480 bytes of SRAM!
Peter Feerick Peter, many thanks for this, particularly that you gave me step by step instructions! I've now finally made the change and it works well. Video coming soon.
error... cant find font.h , if you can help me
#include
static const byte ASCII[][5] =
{
{0x00, 0x00, 0x00, 0x00, 0x00} // 20
,{0x00, 0x00, 0x5f, 0x00, 0x00} // 21 !
,{0x00, 0x07, 0x00, 0x07, 0x00} // 22 "
,{0x14, 0x7f, 0x14, 0x7f, 0x14} // 23 #
,{0x24, 0x2a, 0x7f, 0x2a, 0x12} // 24 $
,{0x23, 0x13, 0x08, 0x64, 0x62} // 25 %
,{0x36, 0x49, 0x55, 0x22, 0x50} // 26 &
,{0x00, 0x05, 0x03, 0x00, 0x00} // 27 '
,{0x00, 0x1c, 0x22, 0x41, 0x00} // 28 (
,{0x00, 0x41, 0x22, 0x1c, 0x00} // 29 )
,{0x14, 0x08, 0x3e, 0x08, 0x14} // 2a *
,{0x08, 0x08, 0x3e, 0x08, 0x08} // 2b +
,{0x00, 0x50, 0x30, 0x00, 0x00} // 2c ,
,{0x08, 0x08, 0x08, 0x08, 0x08} // 2d -
,{0x00, 0x60, 0x60, 0x00, 0x00} // 2e .
,{0x20, 0x10, 0x08, 0x04, 0x02} // 2f /
,{0x3e, 0x51, 0x49, 0x45, 0x3e} // 30 0
,{0x00, 0x42, 0x7f, 0x40, 0x00} // 31 1
,{0x42, 0x61, 0x51, 0x49, 0x46} // 32 2
,{0x21, 0x41, 0x45, 0x4b, 0x31} // 33 3
,{0x18, 0x14, 0x12, 0x7f, 0x10} // 34 4
,{0x27, 0x45, 0x45, 0x45, 0x39} // 35 5
,{0x3c, 0x4a, 0x49, 0x49, 0x30} // 36 6
,{0x01, 0x71, 0x09, 0x05, 0x03} // 37 7
,{0x36, 0x49, 0x49, 0x49, 0x36} // 38 8
,{0x06, 0x49, 0x49, 0x29, 0x1e} // 39 9
,{0x00, 0x36, 0x36, 0x00, 0x00} // 3a :
,{0x00, 0x56, 0x36, 0x00, 0x00} // 3b ;
,{0x08, 0x14, 0x22, 0x41, 0x00} // 3c <
,{0x14, 0x14, 0x14, 0x14, 0x14} // 3d =
,{0x00, 0x41, 0x22, 0x14, 0x08} // 3e >
,{0x02, 0x01, 0x51, 0x09, 0x06} // 3f ?
,{0x32, 0x49, 0x79, 0x41, 0x3e} // 40 @
,{0x7e, 0x11, 0x11, 0x11, 0x7e} // 41 A
,{0x7f, 0x49, 0x49, 0x49, 0x36} // 42 B
,{0x3e, 0x41, 0x41, 0x41, 0x22} // 43 C
,{0x7f, 0x41, 0x41, 0x22, 0x1c} // 44 D
,{0x7f, 0x49, 0x49, 0x49, 0x41} // 45 E
,{0x7f, 0x09, 0x09, 0x09, 0x01} // 46 F
,{0x3e, 0x41, 0x49, 0x49, 0x7a} // 47 G
,{0x7f, 0x08, 0x08, 0x08, 0x7f} // 48 H
,{0x00, 0x41, 0x7f, 0x41, 0x00} // 49 I
,{0x20, 0x40, 0x41, 0x3f, 0x01} // 4a J
,{0x7f, 0x08, 0x14, 0x22, 0x41} // 4b K
,{0x7f, 0x40, 0x40, 0x40, 0x40} // 4c L
,{0x7f, 0x02, 0x0c, 0x02, 0x7f} // 4d M
,{0x7f, 0x04, 0x08, 0x10, 0x7f} // 4e N
,{0x3e, 0x41, 0x41, 0x41, 0x3e} // 4f O
,{0x7f, 0x09, 0x09, 0x09, 0x06} // 50 P
,{0x3e, 0x41, 0x51, 0x21, 0x5e} // 51 Q
,{0x7f, 0x09, 0x19, 0x29, 0x46} // 52 R
,{0x46, 0x49, 0x49, 0x49, 0x31} // 53 S
,{0x01, 0x01, 0x7f, 0x01, 0x01} // 54 T
,{0x3f, 0x40, 0x40, 0x40, 0x3f} // 55 U
,{0x1f, 0x20, 0x40, 0x20, 0x1f} // 56 V
,{0x3f, 0x40, 0x38, 0x40, 0x3f} // 57 W
,{0x63, 0x14, 0x08, 0x14, 0x63} // 58 X
,{0x07, 0x08, 0x70, 0x08, 0x07} // 59 Y
,{0x61, 0x51, 0x49, 0x45, 0x43} // 5a Z
,{0x00, 0x7f, 0x41, 0x41, 0x00} // 5b [
,{0x02, 0x04, 0x08, 0x10, 0x20} // 5c ¥
,{0x00, 0x41, 0x41, 0x7f, 0x00} // 5d ]
,{0x04, 0x02, 0x01, 0x02, 0x04} // 5e ^
,{0x40, 0x40, 0x40, 0x40, 0x40} // 5f _
,{0x00, 0x01, 0x02, 0x04, 0x00} // 60 `
,{0x20, 0x54, 0x54, 0x54, 0x78} // 61 a
,{0x7f, 0x48, 0x44, 0x44, 0x38} // 62 b
,{0x38, 0x44, 0x44, 0x44, 0x20} // 63 c
,{0x38, 0x44, 0x44, 0x48, 0x7f} // 64 d
,{0x38, 0x54, 0x54, 0x54, 0x18} // 65 e
,{0x08, 0x7e, 0x09, 0x01, 0x02} // 66 f
,{0x0c, 0x52, 0x52, 0x52, 0x3e} // 67 g
,{0x7f, 0x08, 0x04, 0x04, 0x78} // 68 h
,{0x00, 0x44, 0x7d, 0x40, 0x00} // 69 i
,{0x20, 0x40, 0x44, 0x3d, 0x00} // 6a j
,{0x7f, 0x10, 0x28, 0x44, 0x00} // 6b k
,{0x00, 0x41, 0x7f, 0x40, 0x00} // 6c l
,{0x7c, 0x04, 0x18, 0x04, 0x78} // 6d m
,{0x7c, 0x08, 0x04, 0x04, 0x78} // 6e n
,{0x38, 0x44, 0x44, 0x44, 0x38} // 6f o
,{0x7c, 0x14, 0x14, 0x14, 0x08} // 70 p
,{0x08, 0x14, 0x14, 0x18, 0x7c} // 71 q
,{0x7c, 0x08, 0x04, 0x04, 0x08} // 72 r
,{0x48, 0x54, 0x54, 0x54, 0x20} // 73 s
,{0x04, 0x3f, 0x44, 0x40, 0x20} // 74 t
,{0x3c, 0x40, 0x40, 0x20, 0x7c} // 75 u
,{0x1c, 0x20, 0x40, 0x20, 0x1c} // 76 v
,{0x3c, 0x40, 0x30, 0x40, 0x3c} // 77 w
,{0x44, 0x28, 0x10, 0x28, 0x44} // 78 x
,{0x0c, 0x50, 0x50, 0x50, 0x3c} // 79 y
,{0x44, 0x64, 0x54, 0x4c, 0x44} // 7a z
,{0x00, 0x08, 0x36, 0x41, 0x00} // 7b {
,{0x00, 0x00, 0x7f, 0x00, 0x00} // 7c |
,{0x00, 0x41, 0x36, 0x08, 0x00} // 7d }
,{0x10, 0x08, 0x08, 0x10, 0x08} // 7e ←
,{0x78, 0x46, 0x41, 0x46, 0x78} // 7f →
};
Julian Ilett Name this file "font.h" and put it in the same folder as the .ino file
Julian Ilett How to fix this problem ?
avrdude: stk500_getsync(): not in sync: resp=0x00
Julian Ilett you said name this file font.h...but you failed to mention where i should save it in (i mean which program)...notepad? arduino ide?
Črt Sužnik He did not. Watch the videos again. (:
Press RESET button of the Arduino and then press upload sketch and release the reset when the message "Size of sketch.." is displayed
I spent a night to figure out this damn nokia! no way to increase the contrast of the lcd :(
you could use while loop if you want infinite loop
while(true)
{
}
GOOD VIDEO
hi. im use Arduino UNO R3 + LCD 5510. im from Vietnam.i speak english very bad. sorry for this.
please tell me how to create char unicode in LCD 5510 with Arduino.
example: English: Hello!
Vietnamese: Chào bạn!
---- my font:
a à á ả ã ạ
â ấ ầ ẫ ẩ ạ
ô ồ ố ổ ỗ ộ
u ù ú ủ ũ ụ
i ì í ỉ ĩ ị
ê ề ế ể ễ ệ
e è é ẻ ẽ ẹ
ă ằ ắ ẳ ẵ ặ
o ò ó ỏ õ ọ
y ỳ ý ỷ ỹ ỵ
ư ừ ú ử ữ ự
đ
please help me!!!
THE GAME HAHAHA
10th view😂😳
Sorry to rain on your parade but all data pins should be no more than 3.3 volts have a look at this link, please
playground.arduino.cc/Code/PCD8544/ and it will explain all!!