Phillip Hardy
Published

Use Powershell to adjust the Adafruit 7" Touchscreen

Learn how-to enable the adafruit 7" touchscreen to be displayed correctly using powershell on a running Windows 10 IoT Raspberry PI device.

BeginnerFull instructions provided6,997
Use Powershell to adjust the Adafruit 7" Touchscreen

Things used in this project

Hardware components

Raspberry Pi 2 Model B
Raspberry Pi 2 Model B
I use an 8GB Sandisk Class 10 Micro SDHC card with the board for Windows 10 IoT
×1
5V 2A DC Power supply with Micro USB Connector/Cable
This is for powering your Raspberry PI 2 board and LCD Panel. I use one with 2A, so that I can power the LCD panel directly from the Raspberry PI 2 board and attach other small accessories.
×1
Adafruit 7" LCD Touchscreen
Can be any Adafruit 5" or 7" Touchscreen or Non-Touchscreen if you prefer. I am using the adafruit 7" LCD panel with Touchscreen capability.
×1
HDMI Flat Cable #2197
Any existing HDMI cable you have should work fine - You connect the standard HDMI from the LCD Panel to the HDMI port on the Raspberry PI board. I am using this flat cable that I got from the Adafruit store because it has a small profile which occupies very little space.
×1
Micro USB Cable
Any existing Micro USB cable you have should work fine - You use this to both power the LCD Panel and enable the touchscreen functionality.
×1
Cat 6 UTP Network Cable
The network cable connects between the raspberry pi 2 board and a network switch, or alternatively you could use a cross-over cable for direct connectivity. This is used so that the Windows 10 PC can remote powershell to the Windows 10 IoT on the Raspberry PI 2 device.
×1

Software apps and online services

Windows 10 IoT Core
Microsoft Windows 10 IoT Core

Hand tools and fabrication machines

Windows 10 PC
I use a WIndows 10 Insider PC to Powershell to the Raspberry PI 2 device along with using Visual Studio 2015 RC for remote debugging and development on the board. The WIndows 10 PC is connected to a network switch either wired or wireless.

Story

Read more

Schematics

Cable Wiring

Code

Powershell to set the contents config.txt and/or paste in if required.

Powershell
paste the following into powershell once connected and in the [172.16.47.23]: PS C:\EFIEPS folder - it will create the config.txt file displayed in the above project.
Set-Content config.txt "
gpu_mem=32                      # set ARM to 480Mb DRAM, VC to 32Mb DRAM
framebuffer_ignore_alpha=1      # Ignore the alpha channel for Windowa.
framebuffer_swap=1              # Set the frame buffer to be Windows BGR compatible.
disable_overscan=1              # Disable overscan
init_uart_clock=16000000        # Set UART clock to 16Mhz
hdmi_group=2
hdmi_mode=87
hdmi_cvt 800 480 60 6 0 0 0
"

Powershell Commands used in this project for reference

Powershell
# View the status of the Windows Remote Management Service (WinRM)
Get-Service | Where Object {$.Name -eq WinRM}

# Start the Windows Remote Management Service (WinRM)
Start-Service WinRM

# Remove the PSREADLINE module which may result in an unexpected experience
Remove-Module psreadline -force

# Trust your Raspberry PI 2 Windows 10 IoT Core Device
Set-Item WSMan:\localhost\Client\TrustedHosts -value 172.16.47.23

# Enter the Remote Powershell session
Enter-PSSession -ComputerName 172.16.47.23 -Credential Administrator

# View the contents of the config.txt file
Get-Contents config.txt

# Set the contents of the config.txt file
Set-Content config.txt "
gpu_mem=32                      # set ARM to 480Mb DRAM, VC to 32Mb DRAM
framebuffer_ignore_alpha=1      # Ignore the alpha channel for Windowa.
framebuffer_swap=1              # Set the frame buffer to be Windows BGR compatible.
disable_overscan=1              # Disable overscan
init_uart_clock=16000000        # Set UART clock to 16Mhz
hdmi_group=2
hdmi_mode=87
hdmi_cvt 800 480 60 6 0 0 0
"

# Reboot your device immediately
Shutdown /r /t 0

# Shutdown your device immediately 
Shutdown /s /t 0

Credits

Phillip Hardy

Phillip Hardy

1 project • 7 followers
strong passion for automation, integration and powershell.

Comments