Getting into DIY Arduino robotics can be intimidating if you’ve never programmed before. No matter how big your ideas are, if you can’t program your microcontroller, your robot won’t do much.

Luckily, there are ways to program an Arduino without writing a single line of code. Today, we’ll cover basic robotics using Xod, an Arduino-based open source IDU compatible with visual programming nodes.

Robot without code

Today’s project uses some standard robotics components to build a remote sensing robotic arm prototype. The combination of a servo motor and an ultrasonic distance sensor is common in hobby robotics and you will add an LCD screen.

The completed project will record the 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, it’s a robot arm that tries to grab you if you get too close. Frightening!

equipment requirements

All necessary components for this project

You will need :

  1. Arduino compatible board (this project uses Uno)
  2. LCD screen 16×2
  3. HC-SR04 ultrasonic distance sensor
  4. hobby servo
  5. 10K potentiometer
  6. Resistor 220 ohm
  7. 5V power supply
  8. Breadboard and connecting wires

This project requires quite a few components, but any good Arduino starter kit should have everything you need. I found everything I needed in the Elegoo Uno R3 Starter Kit. Plus, every component listed above is super cheap and available at all good electronic hobby stores.

Adjusting the LCD screen

Fritzing LCD chart

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

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

Adding Servo and Ultrasonic Sensor

Now add your HC-SR04 Ultrasonic Sensor to the breadboard. Connect pins VCC and GND to 5V and breadboard ground rails. Connect Contact trig to contact 7 Arduino, and contact echo to eight .

Fritzing Diagram LCD and Ultrasonic Transducer

Then attach your servo. The color of the wiring here may vary, but as a rule, red connected to the 5 V pin, and brown or black — to the conclusion GND . The data line, which is usually yellow or orange color connects to contact 10 .

Full cycle of freezing

Finally, connect the ground rail on the breadboard to one of the pins grounding Arduino. This is it! You are all set.

Download Xod IDE

Blank Sketch XOD
Go to Xod.io and download the free Xod IDE. It is available for Windows, Mac and Linux. There is also a browser version, but since you can’t use it to upload Arduino sketches, it won’t work for this project.

Download: Xod IDE for Windows, Mac and Linux

Flash with Xod

When you first open Xod, you’ll see a tutorial project; Alternatively, you can open it from the menu Reference . Expand a collection welcome-to-Xod in the project browser on the left and select 101-upload .

XOD version of the Blink sketch

This node setup is for testing if the code is successfully uploaded to the Arduino. It works just like the Blink sketch in the Arduino IDE. Knot hours generates a signal every second. It connects to a node trigger which switches between true and false each time it receives a signal. The trigger output is connected to LED node, turning it off and on.

Click on an LED node and you will see the inspector panel change to show its options. Change port at 13, as shown above, is the pin to the built-in LED on the Arduino. Note that Xod automatically turns 13 into D13 . You don’t have to type D yourself, but it doesn’t matter for this tutorial if you do!

To check if it works, connect the Arduino via USB, go to Deploy> Upload to Arduino and select the correct board type and COM port.

Xod Deployment Menu

If you see the Arduino LED blink, you’re good to go! If not, check the board and port number and check again before continuing.

LCD Programming

We usually start the lengthy coding process now, but since we’re using Xod, we won’t be writing it. In the project browser, select text-lcd-16×2 — you will find it in xod/common-hardware . Drag it into your program and use the inspector to set it with pins as shown.

Configuring the LCD node in XOD

L1 is the first line of the LCD, and L2 Second, we’ve hard-coded «Hello World» for now to test that everything works. Deploy your Arduino program to see how it works. If your text is hard to see, try turning the 10K potentiometer to adjust the LCD contrast.

LCD shows Hello World

Now we need to set up the distance sensor and make it talk on the LCD screen.

Probing distance

Drag Node hc-sr04-ultrasonic-range to your project and install TRIG pins and ECHO on the 7 and eight, to match how you set it up earlier.

Setting up the range sensor in XOD

You will find a knot concat to xod/core in the project browser. Drag it between the ultrasonic transducer node and the LCD node. You will use this to concatenate (that’s a fancy word for concatenation) the range sensor readings with some text of your own.

This image shows what’s going on. Exit Dm from the range sensor node connected to IN2 and you can see that the inspector marks it as connected . Enter «Distance:» in field IN1 . Now bind the output of the concat node to L1 LCD node.

Close-up on the XOD knot

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

LCD screen showing range data

Servo setting

It takes three parts to run a servo, so let’s look at them one by one. Start by dragging a node clip-cards from xod/math to your program. This node takes information from the output Dm range sensor node and compares it to values ​​that the servo understands.

Complete tree of servo nodes
Smin and Smax represent the minimum and maximum range for servo activation, in this case 5 to 20 cm. These values ​​are displayed on Tmin and Tmax which are set to 0 and 1 as the minimum and maximum servo positions.

Node XOD map-clip

Knot attenuation in xod/core takes the output value of the map-clip node and smoothes it with a certain speed . This prevents any unwanted jerky movement of the servomotor. A factor of 2 is a good balance, but you can experiment with different values ​​here to make the servo respond faster or slower.

XOD damping node

Finally, servo- node you will find in xod-dev/servo receives the output value from the node fader . Change the port to ten . You can leave UPD always on, so how we want our servo to be constantly updated based on the range sensor.

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

Testing

Gif of the finished project
Now when you place something close to the range sensor, the LCD will register the distance and the servo will move in proportion to the detected distance. All this without code at all.

Complete node tree
The complete node tree shows how easy it is to create complex programs in Xod. If you have any problems, carefully check the circuit and each node for errors.

Arduino robot without code

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

Even with tools like Xod, learning to code is essential for DIY projects. Luckily, you can learn the code on your smartphone to pick up the basics!

Похожие записи