Relay Switch

From Bike Wiki
Jump to navigation Jump to search

The Autonomous Bicycle Team has used relay switches for electrical training projects and to control the direction of the rear motor.

Explanation and Purpose

A switch is a device used to toggle if an electrical circuit is connected or disconnected. Compared to a mechanical switch, a relay switch uses a small outside electric current to control a switch for another circuit. Cornell Autonomous Bicycle has a blue module with four boxes on it, consisting of four relay switches. Each relay switch consists of three terminals: NO, COM, and NC. A red LED built into the relay switch will blink in time to the rate at which the switch is being toggled. In addition, the relay board itself has 6 pin-out ports, as described below:

Terminal Explanation
NO Normally Open Terminal: The default state of a wire connected here is to have the circuit open.
COM Common Terminal: A wire inserted here can connect to the NO or NC terminals.
NC Normally Closed Terminal: The default state of a wire connected here is to have the circuit closed.
Pin-out Port Explanation
GND Ground connection to the relay switch module.
IN1 Small outside electric current to be used with relay switch 1.
IN2 Small outside electric current to be used with relay switch 2.
IN3 Small outside electric current to be used with relay switch 3.
IN4 Small outside electric current to be used with relay switch 4.
VCC Power supply to the relay switch module.

The relay switch is connected directly to the printed circuit board through the use of the PCB's relay pins. Besides the GND and VCC pins, any of the PCB's relay pins can be used for any of the relay switches. The specifications of the relay pins are as follows:

Pin Number Connection on PCB
1 GND
2 Arduino Pin 47
3 Arduino Pin 48
4 Arduino Pin 50
5 Arduino Pin 49
6 VCC

Use in Electrical Training Projects

The relay switch is great tool to provide practice using a breadboard and writing Arduino code. For this training project, a simple circuit is created using an Arduino, relay switch, and LED that would make the LED turn on when the relay was on and off when the relay was off. The connections of the LED to the relay switch can be altered between using the NO and NC terminals to see the difference. When connected to NO, the LED will be off when the Arduino is not sending a current signal; when connected to NC, the LED will be on when the Arduino is not sending a current signal. In addition, this training project provides a great introduction to troubleshooting circuits using an oscilloscope.

Use in Controlling the Rear Motor

The relay switch was used on the bicycle in an attempt to toggle the direction of the rear motor between forwards and reverse. In this case, a small current determined by the Arduino is used toggle a switch controlling the current to the reverse pin on the rear motor control unit. This allows code to be written that toggles when the rear motor goes forwards or backwards. Toggling the direction of the rear motor is essential to having the bike trackstand.