-
Notifications
You must be signed in to change notification settings - Fork 456
Added feature to use LCD displays based on HD44780 connected via i2c … #859
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
Merged
MiczFlor
merged 3 commits into
MiczFlor:develop
from
SimonChelkowski:HD44780_LCD_display
May 15, 2020
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
b5d87f9
Added feature to use LCD displays based on HD44780 connected via i2c …
SimonChelkowski 81784bd
modified default information shown in the display rows for the "pause…
SimonChelkowski e8bafa4
In general this commit resolves the comments received for the last tw…
SimonChelkowski 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
Prev
Previous commit
In general this commit resolves the comments received for the last tw…
…o commits in the pull request #859 discussion. - moved all files into teh components directory into the sub-dircetory /components/displays/HD44780-i2c/ - added shebang for Python3 for the driver and the main script - removed the path to the executable (python3) from the sample service file - added README.md file which describes the features, usage and installation of the code.
- Loading branch information
commit e8bafa41052e64864e2a2649cedf52dd804a6efa
There are no files selected for viewing
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,57 @@ | ||
| The following files allow using LCD displays based on HD44780 connected via i2c bus for this project. The following displays have been used for testing: | ||
| - 2x16 display | ||
| - 4x20 display (recommended as more information can be displayed) | ||
|
|
||
| Various informations such as artist, album, track_number, track_title, track_time and many more can be displayed see main script for more display options. | ||
|
|
||
| The required files are: | ||
| - components/displays/HD44780-i2c/i2c_lcd.py | ||
| - components/displays/HD44780-i2c/i2c_lcd_driver.py | ||
| - components/displays/HD44780-i2c/i2c-lcd.service.default.sample | ||
| - components/displays/HD44780-i2c/README.md | ||
|
|
||
|
|
||
| The first file is the main LCD script that makes use of I2C_LCD_driver.py. | ||
| The second file is the library needed to drive the LCD via i2c, originates from DenisFromHR (Denis Pleic) see http://www.circuitbasics.com/raspberry-pi-i2c-lcd-set-up-and-programming | ||
| The third is used as sample service file that runs the i2c_lcd.py main script at boot-up if the service is properly installed (install description can be found below.). | ||
| The fourth file is this file which describes the features, usage and installation of the code. | ||
|
|
||
| ### Installation | ||
|
|
||
| 1. You need to install additional python libraries. Run the following two command in the command line: | ||
| `sudo apt-get install i2c-tools python-smbus python3-numpy python-mpdclient python-mpd` | ||
| `pip install smbus numpy python-mpd2` | ||
| 2. You need to know which I2C bus your Raspberry Pi has available on GPIOs: | ||
| `ls /dev/i2c-*` | ||
| It'll output "/dev/i2c-x", where x is your bus number. Note this bus number as you will need it in step 6. | ||
| 3. Now detect the adapter by using the i2cdetect command, inserting your bus number: | ||
| `sudo i2cdetect -y bus_number` | ||
| The I2C address of my LCD is 27. Take note of this number, it will be need in step 6. | ||
| 4. if i2cdetect is not found install i2c-tools | ||
| `sudo apt-get update` | ||
| `sudo apt-get install i2c-tools` | ||
| 5. Next we need to install SMBUS, which gives the Python library we’re going to use access to the I2C bus on the Pi. At the command prompt, enter | ||
| `sudo apt-get install python-smbus` | ||
| 6. Modify "i2c_lcd_driver.py" line 19 which reads "I2CBUS = 1" and adapt it to your bus number (see step 2.) Furthermore modify line 22 which reads "ADDRESS = 0x27" and adapt it to your I2C address (see step 3.) | ||
| 7. Modify "i2c_lcd.py" to adapt it yo your specific display e.g. 2x16 or 4x20 (default). The lines 15-19 look like the following: | ||
| ```################# CHANGE YOUR SETTINGS HERE!!! ########################################### | ||
| ## Display settings ## | ||
| n_cols = 20 # EDIT!!! <-- number of cols your display has ## | ||
| n_rows = 4 # EDIT!!! <-- number of rows your display has ## | ||
| val_delay = 0.4 # EDIT!!! <-- speed of the scolling text ## | ||
| ``` | ||
| Check if "n_cols" and "n_rows" need to be changed and modify them if necessary. The "val_delay" constant leave for the time being. Lower values will speed up things but will make the text less visible/readable. | ||
|
|
||
| 8. next install and start "i2c-lcd.service" | ||
| `sudo cp /home/pi/RPi-Jukebox-RFID/components/displays/HD44780-i2c/i2c-lcd.service.default.sample /etc/systemd/system/i2c-lcd.service` | ||
| 9. register service by running, it will thereby start on the next boot-up | ||
| `sudo systemctl enable i2c-lcd` | ||
| 10. reboot and enjoy! | ||
| For test purposes you can use the following command to start and stop the service without rebooting | ||
| to start the service instantly run | ||
| `sudo systemctl start i2c-lcd` | ||
| to stop the service instantly run | ||
| `sudo systemctl stop i2c-lcd` | ||
|
|
||
| Best regards, | ||
| Simon | ||
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
1 change: 1 addition & 0 deletions
1
scripts/i2c_lcd.py → components/displays/HD44780-i2c/i2c_lcd.py
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
1 change: 1 addition & 0 deletions
1
scripts/i2c_lcd_driver.py → ...ts/displays/HD44780-i2c/i2c_lcd_driver.py
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a requirements.txt file with all necessary pip packages?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will do so, soon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SimonChelkowski, isn't this redundant to install the apt packages and one line later the same(?) pip packages?