Example Code for Arduino-Analog Mode Control

Last revision 2026/01/27

It is the easiest way to run the motor in Analog Mode. Even you haven't connect the analog signal to Veyron, the motor could run once you set the Veyron in Analog Mode, actually, it regard this situation as input votage signal as 0V.And if need to control the speed, the only step needed to do is to connect a 0-5V analog signal to S1/S2 as controlling signal, the speed is adjusted according to the absolute value of input Voltage, and it would stop if the valtage is 2.5V. If you need to set some paramenters to contorl the motor more precisely, you could do as follow.

Hardware Preparation

  • 6-36V External DC Power Supply x1
  • 0-5V voltage signal x1
  • Bluno Nano x1 (or other Arduino with serial port)
  • 12V DC geared motor with Encoder x1
  • Veyron 2x25A Brush DC Motor Driver x1
  • Screw driver x1
  • Jumper wire/ Dupont Line x some
  • USB cable x1

Software Preparation

Arduino IDE (download from https://www.arduino.cc/en/software)

Wiring Diagram

Wire up all devices as follow picture.

The Arrow in the picture(Bluno nano) is available when you need to set some paramenters, but when you need to control the motors(M1/M2), the S1/S2 interfaces are for the signal input.
Veyron_2x12A_analogwire.jpg

Other Preparation Work

Auto-set PID

Press KEY to switch to Set mode; Veyron will auto-set PID parameters.

set

Set parameters via serial

1、Power on, open Arduino IDE, choose the correspond "Board" and "Serial Port", then open the Serial Monitor and set Newline/ Both NL&CR and 57600 bps.

2、Send “1,RCONFIG”,all the paramenters about Veyron will display in the window in a seconds.If not, please check all the steps.(you could try to exchange the sequence of TX/RX)

Veyron_2x25A_set2.jpg

3、Send “1,SER,13,1”,to set the Ecoder Resolution of M1/M2 as 13/1; Send “1,SGR,51.00,1.00”,to set the Gear Ratio of M1/M2 as 51.00 and 1.00; Send “1,RCONFIG” again, to confirm the modified paramenters.

Result

Connect the 0-5V control signal to interface S1, and go into Analog Mode.The motor will run according to the input signal.

The relationship between speed and voltage:
0-2.5V: co-rotating
2.5V: stop
2.5V-5V: reverse

Was this article helpful?

TOP