Introduction
'Programmable Logic' Project14 competition has given Element14 Community members (and myself) a chance to explore 'Programmable Logic' which is usually not explored by hobbyists or makers in the first place. This may be due to the code or hardware complexity. But recently FPGAs and other PLDs have been made easy for beginners to learn and explore. One best example to quote would be Arduino Vidor 4000. So checking my inventory, I have the below four boards/ kits that would suit this competition's topic,
- Matrix Creator with FPGA - Xilinx Spartan 6 XC6SLX4 [SERA - Smart Extension Relay with Alexa - powered by MATRIX Creator and Arduino MKR1000]
- Digilent Arty S7 with FPGA - Xilinx Spartan 7 XC7S50-CSGA324 [Digilent ARTY S7 Dev Board (Xilinx Spartan 7) - Review] and
- Cypress PSoC6 BLE Pioneer Kit and WiFi-BT Pioneer Kit with PSoC6 [Cypress PSoC 6 BLE Pioneer Kit (CY8CKIT-062-BLE) - Review & PSoC 6 WiFi-BT Pioneer Kit (CY8CKIT-062-WIFI-BT) - Review]
Out of these four, this blog will cover a simple project done using the Cypress PSoC6 BLE Pioneer kit. This project may not use the full (programmable) capacity of the PSoC6 rather uses a single programmable GPIO.
Display for Traffic Predictor
Earlier, I had prototyped a traffic predictor system for the IoT on Wheels Design Challenge. This did not have a display unit rather had an Android mobile application to have the details displayed to the user. Hence I wanted to make a display for my traffic predictor project using the E-Ink Display shield of the Cypress PSoC6 BLE Pioneer kit. Though initially, I had many plans running through my mind, time constraint, unforeseen incident (Breakage of the E-Ink Display Shield) and the fact that I am new to Cypress PSoC family and PSoC Creator, limited the display functionalities to
- Display the logo initially,
- Display an alert in case any vehicle in front approaches closer than a limit and
- Display the real-time temperature of the surrounding.
The display unit would be an extension of the main traffic predictor system (Arduino UNO (replacing ST-Nucleo L476RG board), Ultrasonic Sensor and Servo Motor). Arduino Uno will send a HIGH or a LOW digital signal to the Cypress PSoC6 BLE Pioneer board, instructing when to display the alert in the E-Ink Display Shield and to turn ON/OFF the LED.
Read GPIO Pin and Set LED
The GPIO pin used is F5, port P11[0]. You can find it as 11.0 in the Cypress PSoC6 BLE Pioneer board. The Red LED used is pin E3, port P0[3]. You can find this as P0.3 which the RGB LED on the board.
Code
volatile uint32_t pinReadValue = 0ul; pinReadValue = Cy_GPIO_Read(DIN_PORT, DIN_0_NUM); if(1u == pinReadValue) { Cy_GPIO_Set(RED_Alert_0_PORT, RED_Alert_0_NUM); } else { Cy_GPIO_Clr(RED_Alert_0_PORT, RED_Alert_0_NUM); }
You can also use the below line to write a GPIO Pin
Cy_GPIO_Write(RED_Alert_0_PORT, RED_Alert_0_NUM, pinReadValue);
Schematic
E-Ink Display Shield
The E-Ink Display shield display images from an array of raw data of the image as below.
cy_eink_image_t logo[CY_EINK_IMAGE_SIZE] = { /*Your Array contents from Output Image Raw Data goes here like below 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, // 1 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, // 2 */ };
This can be obtained using the PDI application from Pervasive displays by clicking here. Step by Step instruction for the same is given in the screenshot below. The content below the 'Output Image Raw Data' is the array data of the image required to display the image in the E-Ink Display Shield.
Declare the image variable as an extern in the header file, to use it anywhere in your project.
extern cy_eink_image_t logo[CY_EINK_IMAGE_SIZE];
You can display your image using the below code snippets
//Method 1 - Display image in full screen Cy_EINK_ShowFrame(currentFrame, logo, CY_EINK_FULL_2STAGE, CY_EINK_POWER_AUTO); //Method 2 - Display image from the co-ordinates you define uint8 const fullFrameCoordinates[] = {0, 33, 0, 175}; Cy_EINK_ImageToFrameBuffer(frameBuffer[currentFrameBuffer], (uint8*)background, (uint8*)fullFrameCoordinates);
Demo Video of the project
The below video is the demo of the display unit made for my traffic predictor project.
Top Comments