-
Notifications
You must be signed in to change notification settings - Fork 2
Arduino LCD project #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
iainardo
wants to merge
14
commits into
master
Choose a base branch
from
ic-lcd-message-display
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
b80bc69
Ultrasonic sensor project - initial checkin - review required
iainardo 179d89c
Ultrasonic sensor project - minor mods
iainardo 69b5854
Updates to Ultrasonic sensor project post @marc-ed-raffalli review
iainardo 9b13f76
Fixed typos found during review by
iainardo 01fc3ea
Fixed typo found during review by @marc-ed-raffalli
iainardo 01a8ba6
Initial checkin - needs more work
iainardo 402756d
Updates/fixes post review
iainardo bf9cb75
Further Updates to project - work remains prior to review
iainardo 29a598b
Tinkercad LED circuit - initial checkin
iainardo ea3af74
Fixing merge conflicts with Tinkercad LED circuit PR https://github.c…
iainardo 501f87f
Removed inadvertent change to .gitignore
iainardo 32dad27
Arduino LCD project - Initial commit
iainardo e791680
Merge branch 'master' into ic-lcd-message-display
iainardo 614d6da
Fixed review comments. Added "More about the project" comments submit…
iainardo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
205 changes: 205 additions & 0 deletions
205
_posts/en/projects/2019-10-01-electronic-arduino-lcd.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,205 @@ | ||
| --- | ||
| layout: article | ||
| lang: en | ||
| parent: electronic-projects | ||
| breadcrumb: true | ||
| permalink: /en/projects/electronic/lcd-arduino-2019 | ||
| ref: 2019-lcd-arduino | ||
| title: LCD Arduino | ||
| author: fionnc, tristan, Iain Campbell | ||
| description: How to use an LCD and Arduino to display a message | ||
| tags: Arduino, electronic, lcd | ||
| code: true | ||
| --- | ||
|
|
||
| ## Arduino LCD | ||
|
|
||
| This project used a Liquid Crystal display (LCDs) and an arduino to display a message. | ||
| LCDs like these are very popular and broadly used in electronics projects as they are good for displaying information like sensors data from your project. | ||
|
|
||
|
|
||
| <img class="img-fluid" src="{{'assets/posts/2019-10-01-arduino-lcd/lcd-coderdojo-message.png' | relative_url}}"/> | ||
|
|
||
|
|
||
| ### More about the project | ||
|
|
||
| The Arduino has a function known as a serial monitor, an area of the Arduino application in which data can be displayed. | ||
| However, when the Arduino is not attached to a computer, this feature cannot be used as there is no display to show these variables on. | ||
| We decided to solve this issue by attaching a Liquid Crystal Display, or LCD, to the Arduino board and having this display the contents of the serial monitor. | ||
| Normally, the LCD is only used with the larger Arduino Mega due to the large amount of pins and ports needed to control the inputs to the LCD. | ||
| We were able to adapt the circuit to a standard Arduino Uno without loss of functionality, but using the Mega is recommended if other circuits are necessary to acquire data for the LCD to display. | ||
| We also added a potentiometer to the circuit in order to control the contrast of the text to the screen. | ||
|
|
||
|
|
||
| ### Components | ||
| * Arduino Board | ||
| * LCD Screen (compatible with Hitachi HD44780 driver) | ||
| * Pin headers to solder to the LCD display pins | ||
| * 10k ohm potentiometer | ||
|
|
||
|
|
||
| ### Schematic | ||
| * This is the schematic for this project: | ||
|
|
||
| <img class="img-fluid" src="{{'assets/posts/2019-10-01-arduino-lcd/lcd-schematic.png' | relative_url}}"/> | ||
|
|
||
|
|
||
| #### LCD pin out | ||
|
|
||
| The purpose of the pins of the LCD are shown below: | ||
|
|
||
| <img class="img-fluid" src="{{'assets/posts/2019-10-01-arduino-lcd/lcd-pinout.png' | relative_url}}"/> | ||
|
|
||
| For more information see [Components 101 - 16 x 2 LCD Module ](https://components101.com/16x2-lcd-pinout-datasheet) | ||
|
|
||
| #### How the circuit is connected | ||
|
|
||
| * The LCD has 16 pins and the first one from left to right is the Ground pin `GND` or `VSS`. | ||
| * The second pin is the `VCC/VDD` which we connect the 5 volts pin on the Arduino Board. | ||
| * A potentiometer is attached to the `Vo` pin for controlling the contrast of the display. | ||
| * The `RS` pin or register select pin is used for selecting whether we will send commands or data to the LCD. | ||
| For example if the RS pin is set on low state or zero volts, then we are sending commands to the LCD like: set the cursor to a specific location, clear the display, turn off the display and so on. | ||
| * When RS pin is set on High state (or 5 volts) we are sending data or characters to the LCD. | ||
| * Next comes the R / W pin which selects the mode whether we will read or write to the LCD. Here we use write node for writing or sending commands and data to the LCD. | ||
| * There are 8 data pins. In this project we used four of the eight pins. | ||
| * Anode pin Connected to positive `5V` through a 220 Ohm resistor. | ||
| * Cathode pin Connected to `GND` (negative). | ||
| * From the [Arduino’s official website](https://www.arduino.cc/en/Reference/LiquidCrystal) you can find and see the functions of the library which enable easy use of the LCD. | ||
| We can use the Library in 4 or 8 bit mode. In this tutorial we will use it in 4 bit mode, or we will just use 4 of the 8 data pins. | ||
|
|
||
| ### Component diagram | ||
|
|
||
| * The following shows a breadboard diagram which was used for this project. | ||
|
|
||
| <img class="img-fluid" src="{{'assets/posts/2019-10-01-arduino-lcd/lcd-component-diagram.png' | relative_url}}"/> | ||
|
|
||
|
|
||
| ### Code | ||
|
|
||
| * The following code snippet was used: | ||
|
|
||
| ```c | ||
|
|
||
| /* | ||
| LiquidCrystal Library - Hello World | ||
|
|
||
| Demonstrates the use a 16x2 LCD display. The LiquidCrystal | ||
| library works with all LCD displays that are compatible with the | ||
| Hitachi HD44780 driver. There are many of them out there, and you | ||
| can usually tell them by the 16-pin interface. | ||
|
|
||
| This sketch prints "Hello World!" to the LCD | ||
| and shows the time. | ||
|
|
||
| The circuit: | ||
| * LCD RS pin to digital pin 12 | ||
| * LCD Enable pin to digital pin 11 | ||
| * LCD D4 pin to digital pin 5 | ||
| * LCD D5 pin to digital pin 4 | ||
| * LCD D6 pin to digital pin 3 | ||
| * LCD D7 pin to digital pin 2 | ||
| * LCD R/W pin to ground | ||
| * LCD VSS pin to ground | ||
| * LCD VCC pin to 5V | ||
| * 10K resistor: | ||
| * ends to +5V and ground | ||
| * wiper to LCD VO pin (pin 3) | ||
|
|
||
| Library originally added 18 Apr 2008 | ||
| by David A. Mellis | ||
| library modified 5 Jul 2009 | ||
| by Limor Fried (http://www.ladyada.net) | ||
| example added 9 Jul 2009 | ||
| by Tom Igoe | ||
| modified 22 Nov 2010 | ||
| by Tom Igoe | ||
|
|
||
| This example code is in the public domain. | ||
|
|
||
| http://www.arduino.cc/en/Tutorial/LiquidCrystal | ||
| */ | ||
|
|
||
| // include the library code: | ||
| #include <LiquidCrystal.h> | ||
|
|
||
| // initialize the library with the numbers of the interface pins | ||
| LiquidCrystal lcd(12, 11, 5, 4, 3, 2); | ||
|
|
||
| void setup() { | ||
| // set up the LCD's number of columns and rows: | ||
| lcd.begin(16, 2); | ||
| } | ||
|
|
||
| void loop() { | ||
| // Print a message to the LCD. | ||
| lcd.print(" Coderdojo"); | ||
| // set cursor to send line | ||
| lcd.setCursor(0,1); | ||
| // Print a message to the LCD. | ||
| lcd.print(" is Awesome!"); | ||
| } | ||
|
|
||
| ``` | ||
|
|
||
|
|
||
| ### Further experiments | ||
|
|
||
| * We experimented with additional LCD library functions using a `Hello Coderdojo!` message to auto-scroll the text from right to left in a loop as shown below: | ||
|
|
||
| ```c | ||
| #include <LiquidCrystal.h> | ||
|
|
||
| // initialize the library by associating any needed LCD interface pin | ||
| // with the arduino pin number it is connected to | ||
| const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2; | ||
| LiquidCrystal lcd(rs, en, d4, d5, d6, d7); | ||
|
|
||
| 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 Coderdojo!"); | ||
| delay(1000); | ||
| } | ||
|
|
||
| void loop() { | ||
| // scroll 16 positions (string length) to the left | ||
| // to move it offscreen left: | ||
| for (int positionCounter = 0; positionCounter < 16; positionCounter++) { | ||
| // scroll one position left: | ||
| lcd.scrollDisplayLeft(); | ||
| // wait a bit: | ||
| delay(150); | ||
| } | ||
|
|
||
| // scroll 32 positions (string length + display length) to the right | ||
| // to move it offscreen right: | ||
| for (int positionCounter = 0; positionCounter < 32; positionCounter++) { | ||
| // scroll one position right: | ||
| lcd.scrollDisplayRight(); | ||
| // wait a bit: | ||
| delay(150); | ||
| } | ||
|
|
||
| // scroll 16 positions (display length + string length) to the left | ||
| // to move it back to center: | ||
| for (int positionCounter = 0; positionCounter < 16; positionCounter++) { | ||
| // scroll one position left: | ||
| lcd.scrollDisplayLeft(); | ||
| // wait a bit: | ||
| delay(150); | ||
| } | ||
|
|
||
| // delay at the end of the full loop: | ||
| delay(1000); | ||
|
|
||
| } | ||
|
|
||
|
|
||
|
|
||
| ``` | ||
|
|
||
|
|
||
| ### Resources | ||
| * The [Arduino "Hello World"](https://www.arduino.cc/en/Tutorial/HelloWorld) tutorial on LCD and Arduino provides a useful reference. | ||
|
|
111 changes: 111 additions & 0 deletions
111
_posts/en/resources/2019-02-12-tinkercad-resistor-led.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| --- | ||
| layout: article | ||
| lang: en | ||
| parent: electronic-resources | ||
| breadcrumb: true | ||
| permalink: /en/resources/electronic-resources/tinkercad-resistor-led | ||
| ref: LED circuit | ||
| title: Use Tinkercad to build a LED circuit | ||
| author: Iain Campbell | ||
| description: Tinkercad tutorials, LED and resistor experiments | ||
| tags: electronics, LED, resistor, components,circuits, tinkercad | ||
| --- | ||
|
|
||
| ## LED and resistors | ||
|
|
||
| ### Objectives | ||
| * Take a series of Tinkercad online tutorials to get started | ||
| * Understand how to read a basic circuit diagram | ||
| * Build a LED (Light Emitting Diode) and Resistor Circuit | ||
| * Conduct a series of experiments to understand some basics principles about electronics | ||
|
|
||
| ### Prerequisites | ||
| * It is you are already familiar with some of basic electronic components | ||
| * For a recap on components see [Basic Electronic components, how and why to use](https://www.youtube.com/watch?v=6UTOTgbJ_8E) | ||
| * Recap on [Resistors](https://kids.kiddle.co/Resistor) and what they do | ||
|
|
||
| ### Online tutorials | ||
| * Follow the [Tinkercad Starter Tutorials Online Series ](https://www.tinkercad.com/learn/circuits/learning) to get started. This tutorial series will assist you and help you to understand the following: | ||
| * How to use Tinkercad to start simulate circuits | ||
| * How to edit, wire and add components to circuits | ||
| * Follow the [Tinkercad Further Lessons Online Tutorial Series](https://www.tinkercad.com/learn/circuits/lessons) to learn: | ||
| * How to use breadboards | ||
| * Ohm's law | ||
| * The difference between series and parallel circuits | ||
|
|
||
| ### Reading basic circuit diagrams / schematics | ||
|
|
||
| * Follow the [How to Read a Schematic](https://www.youtube.com/watch?v=_HZ-EQ8Hc8E ) for a good overview about how to read basic electronic circuits | ||
| * Read [Sparkfun - How to Read a Schematic](https://learn.sparkfun.com/tutorials/how-to-read-a-schematic/all) and keep it handy as a reference. | ||
|
|
||
| ### Build your first circuit in Tinkercad | ||
|
|
||
| Build a simple LED resistor circuit diagram in Tinkercad. | ||
|
|
||
| #### Simple LED resistor circuit diagram | ||
|
|
||
| <img class="img-fluid" src="{{'assets/posts/2019-02-12-tinkercad-resistor-led/battery-led-resistor.png' | relative_url}}"/> | ||
|
|
||
| ##### Components | ||
| * 9V battery | ||
| * Jumper wires | ||
| * LED (any colour you prefer!) (x1) | ||
| * Diode | ||
| * Switch | ||
| * Resistor (220 Ω) | ||
| * Potentiometer (1kΩ ) | ||
|
|
||
|
|
||
| ##### Breadboard layout | ||
|
|
||
| <img class="img-fluid" src="{{'assets/posts/2019-02-12-tinkercad-resistor-led/resistorLED.png' | relative_url}}"/> | ||
|
|
||
| The following shows a basic LED resistor circuit (without the switch, diode or potentiometer - you can add these yourself as an experiment!) | ||
|
|
||
|
|
||
|
|
||
| ### Experiments | ||
|
|
||
| The following experiments will help understand the basics ideas: | ||
|
|
||
| 1. Build the Battery LED circuit shown above. However, use a 9V DC supply rather than 3V. | ||
| 2. Measure the voltage across the LED when the LED is turned on. Measure the voltage across the resistor. What is the sum of the voltage ? | ||
| 3. Reverse LED pins around. What happens ? | ||
| 4. Take out the resistor and put 9V across the LED ? What happens ? Why ? | ||
| 5. Choose different colour for LED | ||
| 6. Switch LED and resistor around. What happens ? Why ? Are the resistor and LED in series or parallel ? | ||
| 7. Add a [diode](https://kids.kiddle.co/Diode) in series to LED1 | ||
| 8. Reduce voltage from 9V to 3V. What effect does this have to the circuit ? | ||
| 9. Revert to back use 9V battery again | ||
| 10. Add a [potentiometer](https://www.youtube.com/watch?v=7xiHtAwyFgc) to the circuit in replacement of the resistor. Vary the resistance of the potentiometer when the circuit is active and note how this effects the LED. | ||
| 11. Measure resistance across the potentiometer as you vary the resistance. | ||
| 12. Add a switch to the circuit (single pole single throw SPST) | ||
| 12. Measure current through circuit. In addition use Ohm's law to calculate the current, when a 9V batter is used and a 270 Ohm resistor is used. | ||
| 13. Add more LEDS in parallel to existing circuit (different colours) | ||
| 14. Learn more about resistors and [resistor colour codes](http://www.resistor-calculator.com/) | ||
| 15. Use mnemonics to remember the resistor colour codes [“**B**ad **B**ooze **R**ots **O**ur **Y**oung **G**uts **B**ut **V**odka **G**oes **W**ell”](https://en.wikipedia.org/wiki/List_of_electronic_color_code_mnemonics) is my favorite mnemonic to remember the resistor colour code list! | ||
| 16. Reverse the direction of the diode | ||
|
|
||
| ### Quiz | ||
|
|
||
| * Describe to a friend how you use breadboard to prototype a circuit and how the pins of the breadboard are interconnected. | ||
| * Some components have a _____ - a positive and a negative end. | ||
| * What is the symbol for the following component | ||
|
|
||
| <img class="img-fluid" src="{{'assets/posts/2019-02-12-tinkercad-resistor-led/cap.png' | relative_url}}"/> | ||
|
|
||
| * Name some components with a positive / negative terminal. | ||
| * Battery has a voltage measured in ______ ? | ||
| * Current flows through a electronic circuit. Current in measured in ___ ? | ||
| * Resistors have a _______ code which tell you ________ ? | ||
| * If too much current flows through an LED what happens ? | ||
| * If a resistor has colour codes Red Black Orange Gold. What is it's resistance ? | ||
| * Use Ohm's law to calculate resistance. Imagine we want 20 mA of current flowing through the LED in the following circuit. What resistance value do we need for the resistor ? | ||
|
|
||
| <img class="img-fluid" src="{{'assets/posts/2019-02-12-tinkercad-resistor-led/quiz_findResistance.png' | relative_url}}"/> | ||
|
|
||
|
|
||
| ### Report | ||
|
|
||
| * Write about what you learned, you can also write about your own experiments you conducted and what you discovered. | ||
| * A mentor can help publish your experiments to the [Coder Dojo Athlone Projects](https://coderdojoathlone.com/en/projects/) website! | ||
Binary file added
BIN
+48.9 KB
assets/posts/2019-02-12-tinkercad-resistor-led/battery-led-resistor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+15.7 KB
assets/posts/2019-02-12-tinkercad-resistor-led/quiz_findResistance.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.