User Tools

Site Tools


setting_up_the_slave_umds

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
setting_up_the_slave_umds [2016/12/21 17:47] – [Edit UMDsiplay0x File] walkeradminsetting_up_the_slave_umds [2023/03/09 22:35] (current) – external edit 127.0.0.1
Line 2: Line 2:
 \\  \\ 
 {{:rpi_umd_001b.jpg?650|}} {{:rpi_umd_001b.jpg?650|}}
-\\  
-\\  
-<color red>This page is work in progress and is incomplete</color> 
 \\  \\ 
 \\  \\ 
Line 34: Line 31:
     sudo nano /etc/dhcpdc.conf     sudo nano /etc/dhcpdc.conf
          
-    Add these lines to the end of the file (default is dhcp) using  your own IP Address details+    Add these lines to the end of the file (default is dhcp) using your own IP Address details
          
     eth0     eth0
Line 171: Line 168:
 \\  \\ 
     sudo nano launchUMD.sh     sudo nano launchUMD.sh
-\\  
 \\  \\ 
  
Line 199: Line 195:
  
 ---- ----
 +==== 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:
 +\\ 
 +    ./UMDisplay02.py
 +\\ 
 +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.
 +\\ 
 +\\ 
 +{{:rpi_umd_005.jpg?300|}}
 +\\ 
 +\\ 
 +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 /etc/rc.local to automate this process.
 +\\ 
 +    sudo nano /etc/rc.local
 +    
 +    add this line at the end:
 +    sudo ./home/pi/Python/launchUMD.sh
 +\\ 
 +To test this, reboot and the LCD should start up automatically (the LCD won't clear on boot, but wait for the "Waiting for 5 Seconds for Network Start" message).
 +\\ 
 +\\ 
 +
 +----
 +===== 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
 +<file>
 +Master                                  Slave
 +
 +#import                                 #import
 +import RPi.GPIO as GPIO                 import RPi.GPIO as GPIO
 +import time                             import time
 +import socket                           import socket
 +import fcntl                            import fcntl
 +import struct                           import struct
 +                                        import os
 +</file>
 +\\ 
 +On the slave there is an extra library that is imported (the os library). The <color red>os library</color> allows the running of command lines from within Python.
 +\\ 
 +\\ 
 +
 +----
 +==== 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("/home/pi/Python/getData")
 +\\ 
 +The <color red>os.system("/home/pi/Python/getData")</color> calls the getData script. This is the script that pulls the latest my_data.txt file from the UMD Master. This command is the one that needs the extra #import library.
 +\\ 
 +\\ 
  
  
setting_up_the_slave_umds.1482342475.txt.gz · Last modified: 2023/03/09 22:35 (external edit)