setting_up_the_slave_umds
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
setting_up_the_slave_umds [2016/12/21 17:34] – [Edit getData File] walkeradmin | setting_up_the_slave_umds [2016/12/21 18:29] – [Program Start] walkeradmin | ||
---|---|---|---|
Line 143: | Line 143: | ||
In the getData file we need to replace the IP Address with the IP Address of our Master UMD Pi. | In the getData file we need to replace the IP Address with the IP Address of our Master UMD Pi. | ||
\\ | \\ | ||
+ | \\ | ||
+ | To change the IP Address use: | ||
+ | \\ | ||
+ | sudo nano / | ||
\\ | \\ | ||
You could use HostNames, but I have found hostnames on Pi's pretty unreliable. | You could use HostNames, but I have found hostnames on Pi's pretty unreliable. | ||
Line 149: | Line 153: | ||
---- | ---- | ||
- | ==== Raspi Config | + | ==== Edit launchUMD File ==== |
+ | \\ | ||
+ | The launchUMD file contains a link to the UMDisplay0x.py file | ||
+ | \\ | ||
+ | < | ||
+ | #!/bin/sh | ||
+ | # launchUMD.sh | ||
+ | # navigate to home directory, then to this directory then launch script | ||
+ | |||
+ | cd / | ||
+ | cd home/ | ||
+ | sudo python UMDisplay01.py & | ||
+ | cd / | ||
+ | </ | ||
+ | \\ | ||
+ | This file needs to be edited so that the line <color blue> | ||
+ | \\ | ||
+ | sudo nano launchUMD.sh | ||
+ | \\ | ||
+ | |||
+ | ---- | ||
+ | ==== Edit UMDsiplay0x File ==== | ||
+ | \\ | ||
+ | The UMDisplay0x file contains the code to write to the LCD. We do have to edit this file to tell it which of the two LCD lines to display from the my_data.txt file | ||
+ | \\ | ||
+ | < | ||
+ | # write line 1 and 2 to the LCD | ||
+ | lcd_string(" | ||
+ | lcd_string(" | ||
+ | </ | ||
+ | \\ | ||
+ | <color red> | ||
+ | \\ | ||
+ | lcd_string(" | ||
+ | lcd_string(" | ||
+ | \\ | ||
+ | <color red> | ||
+ | \\ | ||
+ | \\ | ||
+ | Edit the UMDisplay0x.py file by using: | ||
+ | \\ | ||
+ | sudo nano / | ||
+ | \\ | ||
+ | |||
+ | ---- | ||
+ | ==== Test LCD Code ==== | ||
+ | \\ | ||
+ | Assuming that you have connected the LCD to the RPi (via the ribbon cable and driver board) then you can test the code that runs the LCD, on the slave this file is the: | ||
+ | \\ | ||
+ | UMDisplay0x.py (where x is 2, 3, 4 4 etc.) | ||
+ | \\ | ||
+ | This is a python script, you can run this script by entering at the command line: | ||
+ | \\ | ||
+ | ./ | ||
+ | \\ | ||
+ | If you are lucky, you will see some text on the LCD, chances are however you will not. This is due to the Potentiometer settings on the driver board, you will need to change these to set the Backlight and LCD intensity. | ||
+ | \\ | ||
+ | \\ | ||
+ | {{: | ||
+ | \\ | ||
+ | \\ | ||
+ | Adjusting these two potentiometers will allow you to balance the text and backlight intensity to get the brightness level you require. | ||
+ | \\ | ||
+ | \\ | ||
+ | |||
+ | ---- | ||
+ | ==== Making it Automatic ==== | ||
+ | \\ | ||
+ | The last part is to automate the process of starting the UMD code. For this we need to add the launcher file to a system file on the RPi. | ||
+ | \\ | ||
+ | \\ | ||
+ | Edit the file / | ||
+ | \\ | ||
+ | sudo nano / | ||
+ | |||
+ | add this line at the end: | ||
+ | sudo ./ | ||
+ | \\ | ||
+ | To test this, reboot and the LCD should start up automatically (the LCD won't clear on boot, but wait for the " | ||
+ | \\ | ||
+ | \\ | ||
+ | |||
+ | ---- | ||
+ | ===== UMDsiplay0x.py File Differences ===== | ||
+ | \\ | ||
+ | There are a couple of differences between the Python scripts on the Master and the slaves, here is an overview of those differences. | ||
+ | \\ | ||
+ | \\ | ||
+ | ==== #import ==== | ||
+ | \\ | ||
+ | On the #import section there is one difference | ||
+ | < | ||
+ | Master | ||
+ | |||
+ | # | ||
+ | import RPi.GPIO as GPIO | ||
+ | import time | ||
+ | import socket | ||
+ | import fcntl import fcntl | ||
+ | import struct | ||
+ | import os | ||
+ | </ | ||
+ | \\ | ||
+ | On the slave there is an extra library that is imported (the os library). The <color red>os library</ | ||
+ | \\ | ||
+ | \\ | ||
+ | |||
+ | ---- | ||
+ | ==== Program Start ==== | ||
+ | At the Program Start section of the Python code there is an extra line. | ||
+ | \\ | ||
+ | ## Get text file from master Pi UMD001 (runs the file getData in the Python folder) | ||
+ | os.system("/ | ||
+ | \\ | ||
+ | The <color red> | ||
+ | \\ | ||
+ | \\ | ||
+ |
setting_up_the_slave_umds.txt · Last modified: 2023/03/09 22:35 by 127.0.0.1