Learn Arduino?

VK3ZYZ

Moderator
Staff member
Yes, I2C is very handy. Now I only use I2C displays on the Arduino. And for bigger stuff on the ESP32, the SPI interface.
For example, the LCDs have 14 pins, or 16 if you include the back light.
There are 2 power pins, 1 contrast, 3 control pins and either 4 or 8 data pins depending on the mode of operation of the LCD. 8 data pins will be faster but for most times, speed is not an issue for character LCDs.
This is an image I found to show the LCD in the 4 bit mode. D0 to D3 are not used. So 6 Arduino port pins are in use.
In fact, there is another pin, the Read/Write pin that is usually connected to 0V, but can be driven with another port pin if you want to read the LCD RAM. But this is not often done.

1658444744125.png


If you use an I2C interface to drive the LCD, the LCD connects to the I2C board and only 4 wires go to the Arduino. 2 of these are the power, so just 2 port pins are needed.
1658445008123.png


And, these 2 pins, the SDA and SCL (data and clock) pins can be shared with other I2C devices that have a different address.
I2C is very handy indeed.
 
Last edited:

VK3ZYZ

Moderator
Staff member
Here are the layouts for the above lessons.
Blink is just the Arduino, nothing else is required.

BlinkPot and BlinkPot3 have a 10K pot connected as follows....
BlinkPot.jpg

(The pot value does not really matter. try whatever you have on hand.)
It is a good idea to link the +5V and GND from the Arduino to the breadboard rails along the side as shown. And most breadboards have a red line to indicate +V and a black one for GND.
On the breadboard itself, I tend to use some single core telecom cable for the links and cut them to size for neatness. If you can get yourself a short length of 50 pair cable, it has a great variety of colours.

BlinkPot2 has 2 pots...

BlinkPot2.jpg


And PWMPot just uses 1. But now, an external LED is connected to pin 9.
PWMPot.jpg

Notice that on the Arduino board, some pins have a tilde ( ~ ) printed near them. That indicates the pin supports the analogWrite command, that is, PWM output.
 

BillC

Active member
Thanks Denys for an interesting session yesterday morning,I am sure we are catching on a bit more.The syntax protcols require a bit of study. Thanks , Cheers.
 

VK3ZYZ

Moderator
Staff member
Next lesson we will try to get a display going.
I2CLCD.jpg

This looks like it. This has an I2C adapter board to make driving easy. Just 2 wires (plus 5V and Gnd).

Download this zip file and in Arduino. goto Sketch - Include Library - Add zip library... to install it.

Or you can unzip it into arduino/libraries folder before you start Arduino up.

Then, connect your LCD up and load the SADARC_LCD_DEMO to see if it works.
Arduino A5 to I2C_LCD_board SCL.
Arduino A4 to I2C_LCD_board SDA.
Arduino 5V to I2C_LCD_board Vcc.
Arduino gnd to I2C_LCD_board gnd.
Arduino_I2CLCD.jpg


You will need to adjust the trim pot first time for correct contrast.
Also, it is possible the I2C address is different than in the example file and that can be checked. In a later post ;)
 

Attachments

Last edited:

VK3ZYZ

Moderator
Staff member
96mm_LCD.jpg
96mm_LCD2.jpg

For the first few club members who are interested, I have some large I2C LCDs that I've put together from recycled displays.
These are 2x16 char, about 96mm long display area, and have the I2C board attached. You can have one for a measly $5.00 (no steak knives are included). First in first serve.
I hope to get some smaller ones going too. Still 2x16 char, just about 60mm display size.
Note! -These do not fit my 3D printed frame.
Give me a call/email.
 
Last edited:
Top