How to Interface Relay with CY8C3866

Relay Interfacing with CY8C3866

Tags: Psoc3, cy8c3866, cypress microcontroller, cy8c3866 microcontroller, cypress 8051 microcontroller, cypress, relay interface with psoc3, relay interface with cy8c3866 , relay interface with cypress microcontroller, relay interface, psoc3 interface with rel, how to interface relay with cypress microcontroller, how to interface relay with cy8c3866, how to interface relay with psoc3 getting started cy8c3866, getting started psoc3, psoc3 development kit, psoc3 kit manual, psoc3 interface manual, cy8c3866 interface manual
Overall rating
PSoC 3 Primer kit

The PSoc 3 Primer kit is specifically designed to help students to master the required skills in the area of embedded systems. The kit is designed in such way that all the possible features of the microcontroller will be easily used by the students. The kit supports FX2LP Programmer which is done through USB port.

Cypress 8051 core (CY8C3866), PSoc 3 Primer Kit is proposed to smooth the progress of developing and debugging of various designs encompassing of speed 8-bit Microcontrollers. It integrates on board CAPSENSE BUTTONS, CAPSENSE LINEAR SLIDER, UART, ADC, DAC, Relay, Buzzer, Seven Segment, Serial EEPROM, Temperature Sensor LM35, Matrix Keypad, Switch, LED, Stepper Motor Driver, Traffic Light Controller, RTC, LCD & GLCD Display to create a stand-alone versatile test platform. User can easily engage in Primer in this platform, or use it as reference to application Primer.


Relays are devices which allow low power circuits to switch a relatively high Current/Voltage ON/OFF. A relay circuit is typically a smaller switch or device which drives (opens/closes) an electric switch that is capable of carrying much larger current amounts.

Interfacing Relays

Fig. 1 shows how to interface the Relay to microcontroller. There are 2 input channels. Each input is connected to the triggering coil of the respective relay. There are 2 output channels that each correspond to an input. When the input is energized, the relay turns on and the '+' output is connected to +12v. When the relay is off, the '+' output is connected to Ground. The '-' output is permanently wired to Ground.


Fig. 1 Interfacing Relay to Microcontroller

Interfacing Relay with CY8C3866

We now want to control the relay operations by using CY8C3866 Primer Board. Here we are using two Relays. The relay consists of a coil and a switch. When the coil is energized, the switch closes, connecting the two contacts together. ULN2803 is used as a driver for port I/O lines, drivers output connected to relay modules. Connector provided for external power supply if needed.

Relay Module : Port P1 pins (Realy1 – P1.20) and Relay2-P1.21) for relay module, make port pins to high, relay will activated.

Pin Assignment with CY8C3866



CY8C3866 Lines

RELAY Power Select

RELAY Modules






Note      : Relay selection make switch SW28 to SM/RL label marking position


Circuit Diagram to Interface Relay with CY8C3866


C Program to control Relay in CY8C3866


Title : Program to control Relay



#include <device.h>


void main()


















/* [] END OF FILE */


Join the World's Largest Technical Community

we respect your privacy.