Author Topic: Digispark with LCD Question  (Read 9611 times)

pvallone

  • Newbie
  • *
  • Posts: 6
Digispark with LCD Question
« on: September 29, 2013, 12:15:30 pm »
Hi, I have a digispark and want to connect it to a LCD. I see tutorials on a LCD with a I2C/TWI bus, but I just have a simple 16X2 LCD http://www.adafruit.com/products/181[/size]. Is this possible? On my digispark, I have six pins D0-D5. I only need 4 for data, one pin to tell the LCD what character set I am using (RS) and a pin to tell the LCD when it needs to read (EN). In the Arduino LCD sample sketch, there is no mention of of pins RS and EN, so I assume they are handled in the [/size]Liquid Crystal [/size]library e.g. <LiquidCrystal.h>. So is it possible to use this LCD with the the [/size]LiquidCrystal library and my digispark?

[/size]Thx

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
Re: Digispark with LCD Question
« Reply #1 on: September 29, 2013, 07:00:21 pm »
It should work with the LiquidCrystal library - but as you guessed, you'll have to modify the library to use different pins for RS and EN - I imagine some googling will find a detailed how to for that/posts on the Arduino forums.  see this thread for example: http://forum.arduino.cc/index.php/topic,161440.0.html

gogol

  • Sr. Member
  • ****
  • Posts: 398
Re: Digispark with LCD Question
« Reply #2 on: September 30, 2013, 01:15:16 am »
Should be possible, to tweak the Liquid-Crystal-Library, as they are using some more pins (e.g. for backlight). 

Better you are just using the IO-Expander-Kit and follow that way, I went down, when I had this problem:    Attention, in the schematics I missed the base-resistor of the transistor, switching the backlight.

That way, you still have 4 pins left, for doing those jobs, where you wish to display the results on the display .. ;-)

I did it just with an  PCF8574P on a small piece of striped lab-pcb.

regards

  gogol

pvallone

  • Newbie
  • *
  • Posts: 6
Re: Digispark with LCD Question
« Reply #3 on: September 30, 2013, 11:47:06 am »
Thanks - I will try to modify the LCD library. I just took a look at the code and it doesn't look terrible complicated. I can see there are a number of constructors, so its possible I might me able to set the pins from the Arduino Sketch. My C++ skill set is much to be desired (I am c# and Java Programmer by day), so if that doesn't work, I just might buy the LCD shield with the 12C installed and all ready to go. Wish me luck.

pvallone

  • Newbie
  • *
  • Posts: 6
Re: Digispark with LCD Question
« Reply #4 on: October 01, 2013, 06:07:14 am »
Ok, i got this working without any library modifications  ;) . So simply, I feel silly, but thought I would post the solution.



LCD Pins to Digi Spark P0-P5


1  2  3  4    5   6    7  8  9  10 11 12 13 14 15 16
-------------------------------------------------------------
-  +  P   p5  -    p4                    p3  p2 p1 p0  +  -


p = potentiometer
- = ground
+ = 5v
Code: [Select]

/*
  LiquidCrystal Library - Hello World
  The circuit:
 * LCD RS pin to digital pin Digi P5
 * LCD Enable pin to digital pin Digi P4
 * LCD D4 pin to digital pin Digi P3
 * LCD D5 pin to digital pin Digi P2
 * LCD D6 pin to digital pin Digi P1
 * LCD D7 pin to digital pin Digi P0
 * LCD R/W pin to ground
 * 10K resistor:
 * ends to +5V and ground
 * wiper to LCD VO pin (pin 3)
 
*/
#include <LiquidCrystal.h>


// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(5, 4, 3, 2, 1, 0);
//LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("hello, world!");
}


void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  // print the number of seconds since reset:
  lcd.print(millis()/1000);
}



gogol

  • Sr. Member
  • ****
  • Posts: 398
Re: Digispark with LCD Question
« Reply #5 on: October 01, 2013, 08:57:47 am »
I am just curious:  Whats the purpose now, that you have no pin left?  You are able to display information, but where is it coming from?



pvallone

  • Newbie
  • *
  • Posts: 6
Re: Digispark with LCD Question
« Reply #6 on: October 01, 2013, 09:08:15 am »
It will be Serial over the Data Pins. I'll test later today and post back.

pvallone

  • Newbie
  • *
  • Posts: 6
Re: Digispark with LCD Question
« Reply #7 on: October 02, 2013, 03:32:40 am »
@gogol - You are right. With all the pins used there is no way to communicate with the digispark. I assumed there was a USB to UART converter on the board as there is with the Arduino.




gogol

  • Sr. Member
  • ****
  • Posts: 398
Re: Digispark with LCD Question
« Reply #8 on: October 04, 2013, 02:16:46 am »
You should still be able to double use some ports, when you make sure, that your use cases will not interfere with each other.  However that is somewhat tricky, as you have to choose the pins wisely, as most pins already have some restrictions, like the zeners and pullup-resistor for USB, the onboard-LED or the restricted current of PB5 (as built-in restriction of the attiny).

So I was just curios and eager to learn, what you may have planned to do. 
regards

  gogol


Bluebie

  • Sr. Member
  • ****
  • Posts: 486
Re: Digispark with LCD Question
« Reply #9 on: October 04, 2013, 07:42:11 am »
Even with an Arduino there are still two pins you cannot use if you want to have communications with a USB connected computer - the two UART pins 0 and 1.

newuser

  • Newbie
  • *
  • Posts: 1
Re: Digispark with LCD Question
« Reply #10 on: July 12, 2014, 10:14:47 am »
I got a Rev2 Digispark as my first entry into Arduino. I have a simple 16X2 LCD without an I2C backpack, and have tried wiring the Digispark up based on this thread without success. The LCD backlight and contrast work, but I cannot get a message to display.

I am trying to use the unmodified Arduino_LiquidCrystal "HelloWorld" on the Digispark. Are there any changes that I need to make to the program to get pvallone's pinout to work?

Thanks