3

Is anyone can assist me how to set up 3.5 inch Waveshare touch screen display works in Android Things on Raspberry Pi 3?

Usually, I only run script from LCD Show for 3.5 inch that available in Waveshare site. But android doesn't support sudo which used in that script.

I'll use it to develop mobile device app system. So it will need display that come handy for mobile use. Any other display with hdmi connection works perfect as it is easy to setup. But it will need more power source. While portable battery that come with 2 power output only provide a single port with 2.1 Ampere. The other one only provide 1 Ampere. And I have no luck looking for portable battery that comes with 2 port with 2 Ampere output.

Does anyone have successfully setting up 3.5 inch display to Raspberry Pi 3 with Android Things? Or how do I setting the SPI pin to succesfully connect to 3.5 inch Waveshare display?

adadion
  • 131
  • 1
  • 7

2 Answers2

4

I got touch input working for my Waveshare touch input display running on Android Things.

There is a demonstration on Youtube. I also go it working on a KeDei 3.5" touch input display. They both use the XPT2046 touch controller although the KeDei details are a little bit different.

I based my work on this driver for sending touch events to the Android OS and on BitBank's C code for SPI reading.

The driver is available as an Android Things Library project here: https://github.com/dirkvranckaert/touchinputdisplaydriver

All the details for using the driver are in the readme of the project. Your display is waveshare 3.5" so your resolution will be different. So to initialize the library you will need something like this: WaveshareProfile.getInstance(new ScreenDimension(800, 480, ScreenDimension.Ratio.R_4_3)); and then replace your dimensions and ratio. Please let me know if you have verified this to be working or not. If it works I'll add your dimension settings, if not I would be glad to work with you to get the library compatible for you as well!

The full detail on how I have implemented this library is available in a medium article: https://medium.com/@dirkvranckaert/android-things-and-touch-display-compatibility-b013a77a8bb8

2

If you can access GPIO pins and SPI from your Android program you can use code I've written (in C) to talk directly to that display:

https://github.com/bitbank2/SPI_LCD

Select the HX8357 display type; it's the LCD controller used in that display. I provide simple functions for reading the touchscreen position, drawing pixels, rectangles, tiles and text. If that's enough for your project, it's pretty easy to use my functions.

BitBank
  • 156
  • 4