How Xod Helps You Build Arduino Robots Without Coding
Whatsapp Pinterest

Getting into DIY Arduino robotics can be intimidating if you’ve never coded before. No matter how grand your ideas are if you can’t program your microcontroller your robot isn’t going to do much.

Luckily, there are ways to program your Arduino without writing a single line of code. Today we are looking at basic robotics using Xod, an open source visual programming node-based Arduino compatible IDE.

The Code-Free Robot

Today’s project uses some standard hobby robotics components to create a prototype of a distance sensing robot arm. The combination of a servo and an ultrasonic distance sensor are common in hobby robotics, and you will be adding an LCD screen.

The finished project will log distance values on the LCD screen, and move the servo arm in proportion to the distance detected by the range detector.

With a little imagination, this is a robot arm which tries to grab you if you get too close. Spooky!

Hardware Requirements

All the required components for this project

You Will Need:

  1. Arduino compatible board (this project uses an Uno)
  2. 16×2 LCD screen
  3. HC-SR04 ultrasonic distance sensor
  4. Hobby servo
  5. 10k potentiometer
  6. 220 ohm resistor
  7. 5v power supply
  8. Breadboard and hookup wires

There are quite a few components required for this project, but any good Arduino starter kit should have everything you need. I found everything I needed in the Elegoo Uno R3 starter kit. Alternatively, every component listed above is super cheap and available at all good hobby electronic retailers.

ELEGOO UNO UNO R3 Starter Kit ELEGOO UNO UNO R3 Starter Kit Buy Now On Amazon $35.00

Setting Up the LCD Screen

Fritzing LCD diagram

Add your LCD screen, 10k potentiometer, and 220 ohm resistor to the breadboard according to the above Fritzing diagram.

Setting up an LCD can be pretty intimidating the first time you do it, but keep referring to the diagram, and you’ll get it! To make it simpler, I’ve set the LCD and Arduino pins to be exactly the same as in the official Arduino LCD tutorial so refer to that too if you get stuck.

Adding the Servo and Ultrasonic Sensor

Now add your HC-SR04 ultrasonic sensor to the breadboard. Connect the VCC and GND pins to the 5v and ground rails of the breadboard. Connect the Trig pin to Arduino pin 7, and the Echo pin to 8.

Fritzing Diagram of the LCD and Ultrasonic Range Sensor

Next, attach your servo. The wiring colors can vary here, but as a general rule red connects to the 5v pin, and brown or black attach to the GND pin. The data line, which is usually yellow or orange, connects to pin 10.

The full fritzing circuit

Finally, connect the ground rail of the breadboard to one of the Arduino’s GND pins. That’s it! You are all set up.

Downloading the Xod IDE

A blank XOD sketch
Head to and download the free Xod IDE. It’s available for Windows, Mac, and Linux. There is also a browser-based version, but since you cannot use it to upload Arduino sketches, it will not work for this project.

Download: Xod IDE for Windows, Mac, and Linux

Blink With Xod

When you open Xod for the first time, you’ll see the tutorial project; alternatively you can open it under the Help menu. Unfold the welcome-to-Xod collection in the project browser on the left, and select 101-upload.

XOD's version of the Blink sketch

This node setup is for testing if code uploads successfully to the Arduino. It functions the same way as a Blink sketch in the Arduino IDE. The clock node creates a signal every second. This connects to the flip-flop node, which switches back and forth between true and false every time it receives the signal. The output of the flip-flop connects to the led node, turning it off and on.

Click on the led node, and you’ll see the Inspector pane changes to show its parameters. Change the Port to 13 as shown above, the pin with an onboard LED on an Arduino. Notice that Xod automatically turns 13 into D13. You don’t need to type the D yourself, but it makes no difference to this tutorial if you do!

To test if it works attach your Arduino via USB, head to Deploy > Upload to Arduino and select the correct board type and COM port.

The Xod deployment menu

If you see the Arduino LED flashing, you are good to go! If not, check your board and port number and test again before continuing.

Programming the LCD

Usually, we’d be getting into the long process of coding now, but since we are using Xod, we won’t be writing any. In the project browser, select text-lcd-16×2—you’ll find it under xod/common-hardware. Drag it into your program, and use the Inspector to set it up with the pins as shown.

LCD node setup in XOD

L1 is the first line of the LCD, and L2 is the second, for now we’ve hardcoded “Hello World” to check everything is working. Deploy your program to the Arduino to see it working. If your text is hard to see, try turning the 10k potentiometer to adjust the LCD contrast.

LCD showing a Hello World

Now to set up the distance sensor, and get it talking to the LCD screen.

Distance Sensing

Drag the hc-sr04-ultrasonic-range node into your project, and set the TRIG and ECHO pins to 7 and 8 to match how you set it up earlier.

Setting up the Range sensor in XOD

You’ll find the concat node under xod/core in the project browser. Drag it between your ultrasonic range sensor node, and the LCD node. You’ll use this to concatenate (which is a fancy word for combine) the readout of the range sensor with some text of your own.

This image shows what is going on. The Dm output from the range sensor node is plugged into IN2, and you can see the Inspector marks it as linked. Type “Distance: ”  into the IN1 box. Now, link the output of the concat node to L1 of the LCD node.

Closeup on XOD concat node

Save and deploy the modified program. The top line of the LCD now shows the reading from the range sensor!

LCD screen showing range data

Servo Setup

Getting the servo going requires three parts, so let’s go through them one by one. Start by dragging a map-clip node from xod/math into your program. This node takes information from the Dm output of the range sensor node and maps it to values the servo understands.

The full Servo node tree
Smin and Smax represent the minimum and maximum range to activate the servo, in this case between 5 and 20cm. These values are mapped to Tmin and Tmax, which are set to 0 and 1 as the minimum and maximum servo position.

XOD map-clip node

The fade node under xod/core takes the output value of the map-clip node and smooths it at a defined rate. This prevents any unwanted jerky servo movement. A rate of 2 is a good balance, but you can experiment with different values here to make the servo react faster and slower.

XOD fade node

Finally, the servo node, which you’ll find under xod-dev/servo, takes the output value from the fade node. Change the port to 10. You can leave UPD on Continously as we want our servo to be continuously updating based on the range sensor.

XOD servo node
Save your script and deploy it to the Arduino board. Your prototype robot arm is finished!

Testing It Out

Gif of the finished project
Now, when you put something close to the range sensor, the LCD logs the distance, and the servo moves proportionately to the distance detected. All of this without any code at all.

The full node tree
The full node tree shows just how simple it is to create complex programs in Xod. If you are having any problems, check both your circuit and each node carefully for errors.

The No-Code Arduino Robot

Xod allows anyone to program Arduino boards, regardless of coding knowledge. Xod even works with the Blynk DIY IoT app, making a complete code free DIY smart home a real possibility.

Even with tools like Xod, learning to code is important for DIY projects. Luckily, you can learn code on your smartphone Want to Learn Basic Coding? Try 5 Bite-Sized Coding Apps in Your Spare Time Want to Learn Basic Coding? Try 5 Bite-Sized Coding Apps in Your Spare Time Want to learn basic coding but have little time? These bite-size coding apps will take up just a few minutes of your busy day. Read More to pick up the basics!

Explore more about: Arduino, Integrated Development Environment, Robotics.

Enjoyed this article? Stay informed by joining our newsletter!

Enter your Email

Leave a Reply

Your email address will not be published. Required fields are marked *