This is a guide to cover connecting and configuring the official Raspberry Pi 7" touchscreen, along with rotating the LCD output in balenaCloud
There are a few connections to make from the display controller board to the Raspberry Pi. This includes the flat/ribbon cable for the video signal, and additional connections to the GPIO header port for power and communication for the touchscreen.
First, release the ribbon cable connect by pulling the black latch on the connector away from the board. Insert the ribbon cable, ensuring the orientation of the cable is such that the exposed contacts on the cable will connect with those in the socket, and push the latch back, being careful to maintain even pressure on both sides as you do so. Be careful not to force anything, if the cable and latch don’t insert or close easily, remove them and try again; these connectors are delicate and easily damaged.
Next, make the connections to the header pins for the GPIO connections. We’d recommend following the colour convention used, i.e. red for +5V and black for ground, as it helps to reduce the chances of accidentally making the wrong connections and damaging your components.
Once you’ve made the required connections to the display controller board, it’s time to mount the Raspberry Pi to the 4 standoff posts and make the other end of the connections. The display comes with the 4 screws required to do this.
The ribbon cable for the display connects to the port on the Raspberry Pi marked
Display. The latch on this connector operates in the same way as that on the display controller board.
Next, make the connections to the GPIO header, again being careful to ensure the connections are correct at both ends to avoid damage to either board.
|LCD Pin||Pi GPIO board pin||Lead Color|
|Power (Vcc 5V)||2||Red|
Note: we've included the pinout labelling for the Raspberry Pi GPIO port below, but pay extra care as the board pin numbers referred to above are different to the GPIO BCM numbers.
The back of the case can then be installed, mounting it to the display with the 4 screws provided. The back cover is then replaced and we can power up!
Depending on your display, you may find that initially the output is upside down. We can easily rotate the output using a custom fleet configuration variable within balenaCloud.
Configuration variables within balenaCloud can be applied at an application level, meaning that they apply to all devices in that fleet, or can be applied on a per-device basis. As we’re only running a single device in this application right now, and we don’t know if future devices will require the same configuration, it makes sense to apply this at the device level.
From the application dashboard, navigate to the device page by clicking on the device name. Then, in the left-hand menu, click device configuration:
Scrolling to the bottom of this page gives you the option to add custom device variables. In this case we are going to add
BALENA_HOST_CONFIG_lcd_rotate and set the value to
2 which means rotate by 180 degrees.
Once this has been added in the dashboard, the system transmits the new configuration to the device and it will reboot so the changes take effect.
What projects are you planning to build with your display? We'd love to find out, so head on over to the forums and let us know!