
We have “written” a DEVIA control board APK for Android devices (any running Android OS 7 and later). This APP, once connected to the Wi-Fi network created by the DEVIA control board, is capable of:
- Rotating two motors (MOTOR1 and MOTOR2) with on-screen sliders.
- Moving 4 servos (connected to SERVO1…4 outputs.
- Enable disable the AUX port of the DEVIA control board (so you get 5V or 12V depending on the pins selected) with a ON/OFF button.
- Trigger a pre-created routine/script in the Arduino code: Want to make your robot to repeat certain movements continuously after pressing a button on your smartphone? Just program it and the trigger button will start/ stop it.
Example: You have the laser pointer robot but want to turn a torch ON/OFF from your smartphone at the same time you are operating it? Create a script, so every time you press the ON/OFF button on the control APP screen, the Aux port of the DEVIA control board delivers 12 or 5V.
The Arduino code is very versatile, you can do many things with it. And, on top of that, there are several Python code examples you can adapt to your needs. This Python code can be run in any computer (and this computer, connected to the DEVIA via USB port or Wi-Fi).
Uploading an APK to the Google PLAY is not easy, and updating it even less. So we opted to create an standalone APK. An APK is the same APP you will find in the Google Play Store but not “packed” for that site. In order to install it, you will need to allow “Unknown Apps on Android”:
MORE INFO: What is an APK? Are they safe?
The APKs are safe if they come from a trusted site. Our APK will not require any special permit to work, will not peek into your contacts list or anything like that. It just needs to use the WIFI in order to connect your device to the DEVIA control board.
Below, the Arduino CODE. The firmware of the robot. Download it and read the steps you have to follow below.
Some Python CODE samples you can use to control your robot from your computer. The functionality of all of them is explained inside the .py files. Extract them all in the same folder. The LaserPointerClass.py file has to be in the same folder with the other .py files.
STEPS:
- Upload the Arduino CODE (instructions below). This code will be the firmware of the robot. Acceleration, speed of the motors, angle, servos behaviour and “pre-programmed action/script” can be changed or created from scratch modifying this Arduino CODE. This CODE will start actions of the robot every time you press a button on the Control APP. NOTE: If you want to create a pre-programmed ACTION/ SCRIPT, that can be started or finished from the control APP (tapping on the AUTO ON/OFF button), you need to define it in the Arduino CODE. More info below.
- Install the Control APP in your Android device.
- Turn the DEVIA control board ON and connect your Android device to the WIFI Network named (JJROBOTS_XX) using the password 87654321.
- Launch the control APP and move your robot!
Remember that you can adjust many parameters of how your robot moves and behaves, modifying the Arduino CODE. The control APP just sends the commands that will start the processes.
How to upload the firmware to the DEVIA control board (or compatible Arduino board)
a) Install the Arduino IDE on your PC from here (skip this step if you have the Arduino IDE already installed) This code has been tested and developed on IDE version 1.8.11 and later versions. If you have a problem compiling the code, let us know.
b) Download the arduino files the link above or from here. Copy the files inside the jjRobots_control_CODE folder in your hard drive
c) Compile and send the code to the DEVIA control board:
- Open your Arduino IDE
- Open the main code in /jjRobots_control_CODE/jjRobots_control_CODE.ino
- Connect your DEVIA board with the USB cable to the PC
- Note: If this is the first time you connect an Arduino board to your PC maybe you might need to install the driver.
- Select the board Arduino/Genuino ZERO (native USB port). In the TOOLS menu->board
- Select the serial port that appears on the tools->Serial port
- Send the code to the board (UPLOAD button: Arrow pointing to the RIGHT)


d) Done!
CONTROL APK
The control APP is quite simple, but versatile. Once you have connected your smartphone/tablet to the DEVIA control board via Wi-Fi (password: 87654321), launch it. You will see a screen like this:

The four sliders in the middle, control up to 4 servos (if any connected)
IMPORTANT: how many degrees will the motors rotate? And the maximum angle described by the servos? How fast the motors will spin? All these parameters are set in the Arduino IDE CODE. Specifically, in the configuration.h file (Opened by default by the Arduino IDE if you have opened the main CODE file: jjRobots_control_CODE.ino):
Definitions found in the Arduino CODE:
- M1: motor 1
- M2: motor 2
- SERVO1,2,3,4: well, they are the parameters defining each servo.
Extracted from the configuration.h file. These definitions set the robot behaviour:
// Robot maximun angles
#define ROBOT_MIN_A1 -180.0
#define ROBOT_MIN_A2 -40.0
#define ROBOT_MAX_A1 180.0
#define ROBOT_MAX_A2 90.0
//#define ROBOT_A1_RANGE = (ROBOT_MAX_A1-ROBOT_MIN_A1)
//#define ROBOT_A2_RANGE = (ROBOT_MAX_A2-ROBOT_MIN_A2)
// Servo definitions
// Servo1:
#define SERVO1_NEUTRAL 1500 // Servo neutral position Gripped angle
#define SERVO1_MIN_PULSEWIDTH 900
#define SERVO1_MAX_PULSEWIDTH 2100
#define SERVO1_RANGE (SERVO1_MAX_PULSEWIDTH-SERVO1_MIN_PULSEWIDTH)
// Servo2:
#define SERVO2_NEUTRAL 1500 // Servo neutral position
#define SERVO2_MIN_PULSEWIDTH 900
#define SERVO2_MAX_PULSEWIDTH 2100
#define SERVO2_RANGE (SERVO2_MAX_PULSEWIDTH-SERVO2_MIN_PULSEWIDTH)
// Servo3:
#define SERVO3_NEUTRAL 1500 // Servo neutral position
#define SERVO3_MIN_PULSEWIDTH 900
#define SERVO3_MAX_PULSEWIDTH 2100
#define SERVO3_RANGE (SERVO3_MAX_PULSEWIDTH-SERVO3_MIN_PULSEWIDTH)
// Servo4:
#define SERVO4_NEUTRAL 1500 // Servo neutral position
#define SERVO4_MIN_PULSEWIDTH 900
#define SERVO4_MAX_PULSEWIDTH 2100
#define SERVO4_RANGE (SERVO4_MAX_PULSEWIDTH-SERVO4_MIN_PULSEWIDTH)
//#define SERVO_SPEED 3
#define ROBOT_ABSOLUTE_MAX_M1 121 //121 //114 //121 // max degrees
#define ROBOT_ABSOLUTE_MAX_M2 142 //146 //146 //142 // max degress
#define MICROSTEPPING 16
#define MOTOR_STEPS 200 //1.8 degree motor = 360/1.8=200
#define M1_REDUCTION 4
#define M2_REDUCTION 3.2
// This depends on your motor type and reduction
#define M1_AXIS_STEPS_PER_UNIT (((MOTOR_STEPS*MICROSTEPPING)/360.0)*M1_REDUCTION)
#define M2_AXIS_STEPS_PER_UNIT (((MOTOR_STEPS*MICROSTEPPING)/360.0)*M2_REDUCTION)
// Maximun motor acceleration in (steps/seg2)/1000 [acceleration in miliseconds] 30 => 30.000 steps/sec2
#define MAX_ACCEL_M1 50 //50
#define MAX_ACCEL_M2 50 //50
#define MIN_ACCEL_M1 2
#define MIN_ACCEL_M2 2
// Maximun speed in steps/seg (max 32765)
#define MAX_SPEED_M1 16000 //16000
#define MAX_SPEED_M2 16000 //16000
#define MIN_SPEED_M1 3000 //1000
#define MIN_SPEED_M2 3000 //1000
// UNCOMMENT THIS LINES TO INVERT MOTORS (by default 1)
//#define INVERT_M1_AXIS 1
//#define INVERT_M2_AXIS 1
How to program an action triggered by the AUTO ON / OFF button?
WORKING IN PROGRESS!
Python code examples. What do they do?
LaserPointer_example_usb.py
Simple code. It will move the two motors connected to MOTOR1 and MOTOR2 connectors 90 and 30 degrees.
Then, set the general speed of the robot to 80% of its full speed and go back to its initial position.
Two pauses have been added to the code so the robot has time to perform the movements.
But keep in mind that you need to tell the code what COM PORT has been selected by your computer when the DEVIA or Arduino board was connected to your computer via the USB cable. By default, as in the code COM4.
import time
from LaserPointerClass import LaserPointerRobot # Import CLASS to control LaserPointer
# Init your laser pointer robot
myrobot = LaserPointerRobot('COM4') # Connect to your robot COM port
print("Example USB connection: simple robot move")
# Move to 90 degrees on axis 1 and 30 degrees on axis 2
myrobot.Move(90,30)
time.sleep(2) # Wait 2 seconds
myrobot.Speed(80) # Set robot speed to 80%
# Goto initial position (0 degrees on both axis)
myrobot.Move(0,0)
time.sleep(2) # Wait 2 seconds
myrobot.Close() # Close robot connection
LaserPointer_example.py
It does the same the previous code do. But in this case, the commands will be sent over Wi-Fi. So you need to connect your computer to the DEVIA control board’s network (named JJROBOTS_XX), using the password 87654321. Then run the code.
LaserPointer_example2.py
Before running the script, you need to connect the PC to the robot’s WIFI (pass: 87654321). This code will move your robot´s motors a certain amount of degrees from one point to another. Define as many as you want.
LaserPointer_example3_servos.py
This code works when the DEVIA is connected over Wi-Fi. It moves the servos 1, 2, 3 and 4 a little and activate the AUX port for 0.5 seconds. (This AUX port can deliver 5 or 12V depending on how you have connected your peripheral to that port)
AUX PORT. Connecting things to it.
The AUX port is controlled by a fast response FET. It can provide +5 or +12V and up to 600mA when enabled. ZERO volts when disabled. It is quite handy if you are planning to feed a LED,DC motor, buzzer…
If you are planning to connect anything to this port, do as indicated below. Do not short circuit the pins when it is active!
