1. Home
  2. Docs
  3. Niryo One documentation
  4. Tutorials
  5. Control the Conveyor Belt with an Arduino Board

Control the Conveyor Belt with an Arduino Board

This tutorial is designed for Niryo One users. If you are using Ned, please find the new tutorial here.

The Conveyor Belt has a stepper motor that is controlled with the custom Niryo Arduino compatible board. In this tutorial, you will learn how to control the Conveyor Belt with an Arduino board.

This board has: 

  • A communication interface: CAN bus (using MCP2515 to make a SPI-CAN interface), this interface is used to control the Conveyor Belt with the Niryo One
  • A digital input interface: this interface is in the controller module
  • An analog input.

Prepare your programming environment

If you want to control the Conveyor Belt with another Arduino, you need to change the actual firmware.

Step 1: Prepare your Arduino IDE

  • If you haven't installed the Arduino IDE, download it and install it from here. The microcontroller (SAMD type) used in the Niryo Stepper is not already included in the supported boards, so you'll need to add the extension.
  • Open the boards manager:

  • Now,  search for "zero":

  • Click on the package and install it. This may take a few minutes.
  • Once done, restart your Arduino IDE.

Step 2: Get the Conveyor Belt firmware

  • Download the firmware from our GitHub repository.
  • Extract the archive. If the name of the folder is not "NiryoConveyor", then rename it to this name.
  • Open the folder and double click on NiryoStepper.ino. The program will open in your Arduino IDE.

Control the Conveyor Belt with an Arduino Uno

In this part , you will be able to start and stop the Conveyor Belt using your Arduino Uno.


  • Arduino Uno
  • Conveyor Belt


  • Connect Arduino Uno to the digital interface of the Control Box of the Conveyor Belt


Conveyor code:

  • Add this function to NiryoConveyor.ino
void control_conveyor_arduino(int conveyor_speed , int conveyor_direction)
if ((conveyor_speed ==0) or (digitalRead(digital_input_pin) == LOW)){relaxed_mode_with_resistance();fan_LOW();}
else if (digitalRead(digital_input_pin) == HIGH){
fan_HIGH();delay_steps = (10 * (100 – conveyor_speed)) + 200;output(-1800 * conveyor_direction * steps_position / 8, UMAX_20_PERCENT); // 32 microsteps -> more precisionsteps_position = steps_position + 1;delayMicroseconds(delay_steps);}}
  • Copy this code on the loop function of NiryoConveyor.ino
void loop() {// conveyor direction 1 -> forward , -1 -> backward

// conveyor speed : 0 -> 100%

control_conveyor_arduino(40 , 1);


Arduino code:

// constants won't change. Used here to set a pin number:const int conveyorPin = 2;// the number of the LED pinint conveyorState = LOW;

void setup() {

// set the digital pin as output:

pinMode(conveyorPin, OUTPUT);


void loop() {

// add a condition here exemple button Pin state

// if (buttonPin == HIGH) {

conveyorState = HIGH

else {

conveyorState = LOW


// send the state

digitalWrite(conveyorPin, conveyorState);

// set the LED with the ledState of the variable:

digitalWrite(ledPin, ledState);


Now, you can control the Conveyor Belt with the Arduino board.

How can we help?