Tag Archives: board

Working with the SainSmart 5v Relay Board

Today we are working with our SainSmart 5v Relay Board. This is a simple and inexpensive 4 port SPDT relay board (there are boards with more or less relays)  that takes a digital signal (LOW) from the Arduino, through an optoisolator, which triggers a transistor, pulling in the relay. The relay contacts are rated for 10 amps at 120/240vac, and 10 amps at 30vdc or less.
The contact pins are not numbered, and are reversed if you go by what the schematic appears to be saying. Facing the screw terminals, with the board face up (solder side down), the screw terminals are as follows (from left to right):
1 – Normally Open
2 – Common
3 – Normally Closed
1 – Normally Open
2 – Common
3 – Normally Closed
1 – Normally Open
2 – Common
3 – Normally Closed
1 – Normally Open
2 – Common
3 – Normally Closed
When you send a logic low, that turns on the LED, and energizes the coil. However, a disconnected input will drop out the LED and the coil, as will a logic HIGH. We will send a logic HIGH in setup to ensure the relays are disabled on boot.

There is a 6 pin male header, so you will need a cable or female pins to slide over the header to connect it to your Arduino. Pin 1 connects to Arduino GND, Pins 2-5 to Digital output pins, and Pin 6 to Arduino 5v. A red LED for each relay lights when active (LOW).

int relayPin1 = 7;                 // IN1 connected to digital pin 7
int relayPin2 = 8;                 // IN2 connected to digital pin 8
int relayPin3 = 9;                 // IN3 connected to digital pin 9
int relayPin4 = 10;                // IN4 connected to digital pin 10

void setup()
pinMode(relayPin1, OUTPUT);      // sets the digital pin as output
pinMode(relayPin2, OUTPUT);      // sets the digital pin as output
pinMode(relayPin3, OUTPUT);      // sets the digital pin as output
pinMode(relayPin4, OUTPUT);      // sets the digital pin as output
digitalWrite(relayPin1, HIGH);        // Prevents relays from starting up engaged
digitalWrite(relayPin2, HIGH);        // Prevents relays from starting up engaged
digitalWrite(relayPin3, HIGH);        // Prevents relays from starting up engaged
digitalWrite(relayPin4, HIGH);        // Prevents relays from starting up engaged

void loop()
digitalWrite(relayPin1, LOW);   // energizes the relay and lights the LED
digitalWrite(relayPin2, LOW);   // energizes the relay and lights the LED
digitalWrite(relayPin3, LOW);   // energizes the relay and lights the LED
digitalWrite(relayPin4, LOW);   // energizes the relay and lights the LED
delay(1000);                  // waits for a second
digitalWrite(relayPin1, HIGH);    // de-energizes the relay and LED is off
digitalWrite(relayPin2, HIGH);    // de-energizes the relay and LED is off
digitalWrite(relayPin3, HIGH);    // de-energizes the relay and LED is off
digitalWrite(relayPin4, HIGH);    // de-energizes the relay and LED is off
delay(1000);                  // waits for a second

read more: http://arduinotronics.blogspot.com/2013/01/working-with-sainsmart-5v-relay-board.html

Check out our 3D printer starter kit

Ramps 1.4 + A4988 + Mega2560 R3 + Endstop + Cooler Fan Kit For

RepRap 3D Printer

This is the new SainSmart 3D Printer  Starter Kit, developed specially for those beginners who are interested in 3D printer.  You will have a complete set of SainSmart’s most common and useful electronic components. What’s more. We will offer you a detailed tutorials including project introduction and their source codes.You may learn about Sainsmart through using these basic projects.



1.Sainsmart RAMPS 1.4
It is a Mega Pololu Shield, or RAMPS for short,designed to fit the entire electronics needed for a RepRap in one small package for low cost. RAMPS interfaces an Arduino Mega with the powerful Arduino MEGA platform and has plenty room for expansion. The modular design includes plug in stepper drivers and extruder control electronics on an Arduino MEGA shield for easy service, part replacement, upgrade-ability and expansion. Additionally, a number of Arduino expansion boards can be added to the system as long as the main RAMPS board is kept to the top of the stack. This board is mostly based on Adrian’s Pololu_Electronics and work by Tonok. Copper etch resists methods suggested by Vik. Also inspired by Vik’s work with EasyDrivers. circuit design based mostly on Adrian’s Pololu_Electronics Joaz at RepRapSource.com supplied initial pin definitions and many design improvements. Much inspiration, suggestions, and ideas from Prusajr, Kliment, Maxbots, Rick, and many others in the RepRap community.

2. Sainsmart Mega 2560 R3
Sainsmart Mega2560 R3 is an ATmega2560 as core microcontroller development board itself has 54 groups digital I / O input / output terminal (14 groups do PWM outputs), 16 sets of simulation than the input side, group 4 UARTs (hardware serial ports), using the 16 MHz crystal oscillator. With the bootloader, download the program directly via USB without having to go through other external writer. Supply part of the optional USB power, or as an external power using the AC-to-DC adapter and battery. Arduino development IDE interface is based on open-source principles, allows you to free download for use in project work, school teaching, motor control, interactive works.

3. Sainsmart A4988 driver
This product is a carrier board or breakout board for Allegro’s A4988 DMOS Microstepping Driver with Translator and Overcurrent Protection by Pololu; we therefore recommend careful reading of the A4988 datasheet before using this product. This stepper motor driver lets you control one bipolar stepper motor at up to 2 A output current per coil.


4.SainSmart Mechanical Endstop Switch

The mechanical endstop is a simple solution to a simple problem. We want to be able to detect when an X/Y/Z stage has reached its minimum or maximum. Instead of messing with flags or complicated light beam interruptors, we use a mechanical switch. If we place the switch in the path of the stage, then the stage itself will simply close the switch when it moves against it. Other than properly positioning the switch, we do not need to modify the stage at all. If you’re worried about reliability, you can sleep well at night. The switches we use are rated for 1 million operations before failure. Since we only use the switches once per print, that means you’ll be able to do one million prints before having to replace the switch.


5.SainSmart 2004 Smart Yellow LCD Controller With Adapter

This Smart Controller contains a SD-Card reader, an rotary encoder and a 20 Character x 4 Line Yellow LCD display. You can easy connect it to your Ramps board using the “smart adapter” included.
After connecting this panel to your Ramps you don’t need your pc any more, the Smart Controller supplies power for your SD card. Further more all actions like calibration, axes movements can be done by just using the rotary encoder on the Smart Controller. Print your 3D designs without PC, just with a g-code design stored on the SD card.


6.MK2B PCB Heatbed 12V/24V for 3D Printer RAMPS1.4

MK2b is the latest and the best type of heatbed money can buy as of today. 100% compatible with all Prusa and Mendel 3d printer variants.

Package list:

  • 1x SainSmart RAMPS 1.4
  • 1x SainSmart Mega 2560 R3
  • 1x SainSmart
  • 1x SainSmart SD RAMPS Breakout Board
  • 5x SainSmart A4988 driver
  • 1x USB Cable
  • 1x SainSmart RAMPS 1.4 wiring cable
  • 6x SainSmart Mechanical Endstop Switch
  • 1x SainSmart Cooler Fan for 3D ramps
  • 1x SainSmart MK2b