Tag: Robot

  • ESP-Now Remote Control Test

    ESP-Now Remote Control Test

    To control a robot, I wanted to see if ESP-NOW, a communication method developed explicitly for the ESP family, would work. This project aims to determine whether ESP-NOW provides a reliable connection over a reasonable distance and whether ESP-NOW can send sufficient data back and forth.
    ESP-NOW makes it possible to set up different types of communication:

    • One-way communication
    • One master and multiple slaves
    • One slave and multiple masters
    • Two-way communication
    • Multiple-way communication (a network of ESP boards)

    In my example, I use the two-way communication protocol to build a remote control that can operate a robot. The robot must also send data back. If you want to read more about the possibilities and background of ESP-NOW, check out this excellent source of information:
    https://randomnerdtutorials.com/esp-now-esp32-arduino-ide/

    Setup

    My first test setup consists of the following components:

    Board 1

    • Joystick (Sends signal)
    • Prints the distance from the distance sensor via Serial

    Board 2

    • Servo (Uses X position from the joystick)
    • HC-SR04 distance sensor mounted on the servo
    • Prints the distance from the distance sensor via Serial

    The joystick on the master board controls the servo on the slave board. The distance sensor rotates along with the servo, and the measured distance is sent back to the master board. The setup is simple, and it gives a first impression of the speed and reliability of the ESP-NOW connection.

    BOM (Bill of Materials)

    In this project, I used:

    • DOIT ESP32 DEVKIT V1
    • ESP32S 38P/V4/Goouuu Expansion board
    • ESP32/V4/Goouuu Terminal Adapter Expansion board
    • Dual-axis XY Joystick Module
    • Tower Pro Micro Servo SG90
    • HC-SR04 Distance sensor
    • Level Converter board
    • Jumpwires
    • 3D printed parts (Optional)

    Of course, you can use different components if you want — no problem at all.

    Preparation

    To use ESP-NOW, you need to know the MAC addresses of the ESP boards. It is essential to send data to the correct board. You can find this easily by uploading the following code and reading the MAC address via the Serial Monitor in the Arduino IDE:

    #include "WiFi.h"
    
    void setup(){
      Serial.begin(115200);
      WiFi.mode(WIFI_MODE_STA);
      Serial.println(WiFi.macAddress());
    }
    
    void loop(){
    }

    Once uploaded, open the Serial Monitor and press the reset button on the DOIT board, and the MAC address will appear.

    Build

    Once we know the MAC addresses, we can start building the setup. I’m using parts from Evenblox to keep everything neatly together and make it easier to transport. You can find these parts and more information on https://www.evenblox.com. Also, check out this great 3D model for mounting your sensor: HCSR04 mount for SG90 servo by rjlew – Thingiverse

    Below you’ll find the schematic of board one (Master) and a photo of the breadboard setup:

    Next is the schematic of board 2 (Slave) and a photo of its setup:

    I’m using the HC-SR04 sensor to measure distance. I’ve written an article about this before — check it out here: HC-SR04 Project – SwanRobotics.

    The servo and the HC-SR04 both run on 5V. The ESP32 operates at 3.3V, so a level converter is needed. There are HC-SR04 versions that support both 3.3V and 5V, but the one used in this project does not. For more information about level converters, check out Level Converter – SwanRobotics.

    Alternatively, you could use the HC-SR04P sensor, which supports both 3.3V and 5V directly.

    Code

    The code is available on GitHub. Remote_control_test_ESP-NOW

    You’ll need to update the MAC addresses in the code to make it work for your setup. The code handles several tasks:

    The remote sends a heartbeat every 200 ms. A heartbeat is essential when the system controls an actual robot. The robot checks for incoming data. If no data comes in, the servo returns to its middle position.
    The joystick value is sent to the robot, which reads it and converts it to a servo position.
    The sensor measures the distance and sends it back to the remote.
    The data from both ESP boards can be monitored via the Serial Monitor in the Arduino IDE, making it easy to test the connection in different locations.

    Once the code is uploaded, it should be possible to view the correct data.

    What’s Next

    This setup works well, and the ESP boards pass data smoothly. I want to test how far the boards can communicate in different environments (home, street, forest), so I’ll add a display to the remote control to show the connection status. That way, I can see when the signal is lost. The joystick is sensitive near the center position, so I plan to smooth that out in software.

  • Levelconverter

    Levelconverter

    In my last article, I wrote about using an MD04 motor driver for my motors. In the example, I used an Arduino Uno to test the motor drivers and made the code work. I want to use the Teensy 4.1 in my robot because of the board’s multiple serial connections and its higher speed. The Teensy runs on 3.3 Volt instead of the 5V Arduino uses. I could not find the voltage level for the I2C wiring in the documentation. According to the manual, the serial communication and the analog input use 5V, so I assume the SCL and SDA are the same.

    To overcome the voltage differences, I used a level converter. A level converter is a small board with a low and a high-level side. A MOSFET and other components on this board compensate for the voltage difference between the two sides. Connect the low-level side (LV) to the Teensy and the high-level side (HV) to the MD03. The image below shows how I wired the Teensy, the motor driver, and the level converter.

    I used a USB breakout board to provide the 5 volts to the high side of the level converter. The low side of the level converter gets its power from the Teensy. I used two pull-up resistors on both sides of the level converter (10K). Technical, the connections remained the same. We used the standard I2C pins, so the software stayed the same. You can use the code example from the previous article.

    Supplies

    Level Converter
    Buy at AliExpress
    Buy at Amazon
    Make sure you get the Bi-Directional version to use it with I2C.

  • Starting over

    Starting over

    My A1 robot is a robot based on a wheelchair. The robot’s purpose was to do telepresence. I built this thing 12 years ago and is collecting dust since then. I could not make it work at that time because of the lack of affordable technology, software possibilities, and my skillset.

    A lot has changed now. The widely available electronics and the amount of cheap computer power give much more functionality out of the box. I want the robot to be a platform capable of driving around autonomy and doing image-recognizing tasks like detecting garbage and faces.

    The old electronics on this robot, like an Intel Mini ITX D945GSEJT and a servo driver, had to go. I ripped the electronics to make room for new components. I have already replaced the pulverized old tyers. The plan is to reuse the wheelchair base, motors, and motor drivers (MD03 from Devantech). The 24 Volt power supply is also staying for testing now. A Teensy 4.1 will do the low-level control, like handling the motor drivers and reading sensor data. This controller has many inputs and outputs and serial, SPI, CAN, and I2C ports.

    I haven’t decided what single-board computer I will use to do higher-level control. A prominent candidate is the NVIDIA Jetson Nano or better. It’s hard to get one because of a chip shortage. Another option is to use one or more Raspberry Pi boards and connect them with ethernet. The Teensy will use a serial connection to transfer data between a Raspberry Pi or the Jetson. This configuration makes it possible to build a modular system and allows swapping components when better components are available.

    The first task is to make the robot drive remote-controlled. I build a remote control for this with a Bluetooth module. There will also be a Bluetooth module connected to the Teensy on the robot. The motor drivers will be connected through I2C, making it possible to read data from the driver like current use and temperature.

  • InMoov Back Covers

    InMoov Back Covers

    Now we are going to put the back covers in place. This is a fairly easy build. Just print all parts and clean them up. It’s important to put all the mounts in place first. The panels should be glued together on the robot itself because to prevent to much stress on the parts.

    On the following picture, the parts are layed out as they should be mounted.

    The top part of the back covers should look like this. I used super glue to glue the PLA parts together. Those cheap clamps are usefull to keep everything aligned.

    At the end you should see something like this.

    If you have questions or comments, please let me know. inMoov is designed by Gaël Langevin so make sure you visit is website at https://inmoov.fr.

  • inMoov Robot Bicep

    inMoov Robot Bicep

    The bicep from the inmoov is not a complex part and are the same for both left and right arm. The covers are sometimes a struggle to mount because in my case the print is a bit taller then it should be.

    My Servo (Hitec HS-805BB+) has a square potentiometer so this doesn’t fit in the orginal LowArmSideV1 version from Gaël . I found a LowArmSideV1 with a square hole on Thingiverse by alansrobotlab (https://www.thingiverse.com/thing:533469). This part receives the square potentiometer snugly.

    Let’s start. I started with gluing the HighArmSide and the LowArmSide parts together twice. Only a few adjustments where needed with sanding paper and a file.

    After this the Reinforcer was added to both sides. I used glue to make a strong connection between the parts.

    Then I glued one of the sides to the RotMid. I didn’t glue the other side, because I want to be able to remove one side, if something is wrong.

    The gears from Pistonanticlock and the Pistonbaseanti prints had some rough edges. I sanded these parts a little bit and then I rotated the piston over and over again in the Piston base. I went back and forth with the sandpaper and after a while it rotated nicely. The Pistonbaseanti needed some adjustments on the axle on the sides. In my case the axle was not completely round, but more like an oval shape. I used a file and sandpaper to make it as round as possible. I also made the holes from the arm sides a little bit bigger.

    The Pistonbaseanti fits together with the Spacer between the two sides.

    The Servobase and the Servoholder are mounted together with screws so you can replace the servo if it breaks down. I used screws with a diameter of 3,5 mm and a length of 16 mm. The wires from the modified servo need to go through the holes on the side of the Servoholder. The potentiometer is to large and has to be detached from the servo. The wires have to be guided through the channel on the side, so the wires don’t get squashed by other parts of the bicep. I used thicker wire then intended, so I had to make the channel for the wire a bit bigger. A drop of hot glue keeps them in place. To guide the wires over the servo I used black tape.

    To mount the Pistonanticlock on the servo I made the four holes bigger with a 3 mm drill. Then I used a screw with a diameter of 3 mm and a length of 16mm. My screws where to long so I had to file them to the right length.

    Then I fitted the Pistonanticlock and the Pistonbaseanti together by turning the servo manually.

    The Elbowshaftgear and the Robcap are glued together and then mounted on the bicep with a 8mm bolt.

    My potentiometer fits nicely in the square hole. It doesn’t need any screws now, but maybe I will add them later. On the potentiometer the Gearpotentio is mounted. The Gearholder then is slided over the gear to prevent is from sliding off.

    The last step in this assembly is to glue all covers together and mount them on the bicep. It’s looks a lot cooler with the covers on. I needed to file some parts because it didn’t fit.

    In the next episode I am going to build the lower arm and will connect the arm to the shoulders part of the inMoov. If you have questions or comments, please let me know. inMoov is designed by Gaël Langevin so make sure you visit is website at https://inmoov.fr

  • InMoov Support Block

    InMoov Support Block

    After the crash of my inMoov robot it took a lot of work to put it back together. To prevent a crash again I decided buy a stable speaker stand for big speakers. To make it fit it was necessary to design a special block to connect the upper body of the inMoov robot to the 35 mm pipe of the speaker stand.

    My speaker stand is from the brand Innox, but there are several brands offering the same product. For example: Speaker stand on Amazon.

    You can find the STL file of this support on Thingiverse.com.

    Make sure you take a look at the website from the designer of the inMoov robot at www.inmoov.fr.

  • Eye Mechanism inMoov robot

    Eye Mechanism inMoov robot

    Wow. Time flies when you having fun. This website is about my the things I build in my free time. Last 2 years where very intense at work and in my private life. Now I decided to work less, to put more time in building robots and at first finish my inMoov robot.

    After the crash on the floor and all the broken pieces the robot in the same state where I left off before my last post. The first thing to do was finishing the Eye Mechanism of my inMoov robot.

    In the designs of the inMoov robot (www.inMoov.fr) you can add small camera’s. In this stage I don’t want to use these yet, so I will use an round piece of 3D printed plastic to cover the hole in the eye. I also want to keep the inMoov robot as robot like as it can be at the moment. So I don’t bother to make the eye as realistic as it can be.

    I made a video of the build on my YouTube channel.

    The Eye mechanism has some small parts.On the picture below you can see the standard parts.

    The parts fitted nicely. The only thing that not fit directly was the EyeHingeCurve. Probably because I used an other servo than Gael Langevin did in his design. I had to adjust the hinge with a knife 😉

    The final eye Mechanism.

    In the Youtube video I used a small test code in arduino to move the eyes. You can use this code to test your own servo. In this example the servo’s are connected to a Arduino Mega on pin 22 and 24. Please change the value’s to your needs.

    /* Based on the Sweep example
     by BARRAGAN <http://barraganstudio.com>
     This example code is in the public domain.
    
    modified 8 Nov 2013
     by Scott Fitzgerald
     http://arduino.cc/en/Tutorial/Sweep
    
    Modified to control Eye mechanism inMoov robot (With Arduino Mega)
     https://swanrobotics.com
     */
    
    #include <Servo.h>
    
    Servo horServo; // Horizontal servo (left tot right)
     Servo verServo; // Vertical servo (Up and down)
    
    // Change these settings to your own setup and preferences.
     int horServoPin = 22;
     int horMaxLeft = 60; // Maximum servo position Left
     int horMid = 90; // Middle servo position horizontal
     int horMaxRight = 120; // Maximum servo position Right
     int horStep = 1; // Step size for position horizontal
    
    int verServoPin = 24;
     int verMaxUp = 45; // Maximum servo position Up
     int verMid = 65; // Middle servo position vertical
     int verMaxDown = 95; // Maximum servo position Down
     int verStep = 1; // Step size for position vertical
    
    int delaySpeed = 500; // time between the movement
     int pos = 0; // variable to store the servo position
     int positionwait = 5; // variable to wait for the servo to reach the position
    
    void setup()
     {
     horServo.attach(22); // attaches the servo on horzontal pin
     verServo.attach(24); // attaches the servo on vertical pin
    
    horServo.write(horMid); // Put horizontal servo in neutral position
     verServo.write(verMid); // Put vertical servo in neutral position
     }
    
    void loop()
     {
    
    // Look right
     for(pos = horMid; pos <= horMaxRight; pos += horStep)
     {
     horServo.write(pos);
     delay(positionwait);
     }
     delay(delaySpeed);
    
    // Look left
     for(pos = horMaxRight; pos>=horMaxLeft; pos-=horStep)
     {
     horServo.write(pos);
     delay(positionwait);
     }
     delay(delaySpeed);
    
    // Look neutral
     for(pos = horMaxLeft; pos<=horMid; pos+=horStep)
     {
     horServo.write(pos);
     delay(positionwait);
     }
     delay(delaySpeed);
    
    // Look Up
     for(pos = verMid; pos <= verMaxDown; pos += verStep)
     {
     verServo.write(pos);
     delay(positionwait);
     }
     delay(delaySpeed);
    
    // Look down
     for(pos = verMaxDown; pos>=verMaxUp; pos-=verStep)
     {
     verServo.write(pos);
     delay(positionwait);
     }
     delay(delaySpeed);
    
    //Look neutral
     for(pos = verMaxUp; pos <= verMid; pos += verStep)
     {
     verServo.write(pos);
     delay(positionwait);
     }
     delay(delaySpeed);
     }

     

     

  • Warning. Not nice to watch!

    Warning. Not nice to watch!

    A few weeks ago I was printing some new parts for my inMoov robot. It was time to make some progress again. But… i was doing some vacuum cleaning and the power cord was wrapped around my inMoov robot. I am still wondering how this happened, but it few down hard. The pieces were al over the place.

    img_7691

    img_7696 img_7695 img_7694 img_7690

    As you can see on the pictures a lot of parts a really broken. PLA is a nice material to print and very hard when it’s printed. I still have to figure out what part have to be reprinted, but I already started with the parts on the lower torso, because al these parts are broken.

    I think inMoov was a little top heavy and the stand was not stable enough. The side to side stability was OK, but front to back bot. At first it was no problem I guess, but when adding the arms a lot off weight was added. I have to find another solution for this before I build it again.

    mount3

     

  • PIR module on the inMoov Robot

    PIR module on the inMoov Robot

    The inMoov will be fitted with a PIR module. This Passive Infrared Sensor measures the infrared light radiates from object it’s pointed at. A PIR module can be used to detect if somebody is in front of the inMoov robot. I am thinking of using the sensor to power up the inmoov robot so it can reduce power when nobody is in front of it.

    I used a simple module what can be purchased on several web shops around the world.

    IMG_3465

    This module has a footprint of 32,5 mm x 24,5 mm x 25 mm and has three pins. One pin is for 5V power and one ground pin. The third pin is the data pin and is High when motion is detected. The modules as two potentiometers. The left potentiometer is for the sensitivity and the right is for the duration the pin should be high after motion is detected. The sensitivity is depending on your situation. For the duration I used the shortest setting because I don’t expect I to miss this trigger.

    The picture below shows how the PIR module is connected with an Arduino. I used this to test the module.

    IMG_3498

    The PIR module has it’s own connection on the Nervo Board. It’s located next to pin A15, D44 and D46. I made a ribbon cable to connect the sensor to the board. The pins on the PIR module and the Nervo Board are not in the same order. I needed to swap the vcc pin and the signal pin on one end as you can see in the picture below.

    IMG_6018

    To test the PIR module and it connections I used a little piece of Arduino code.  The signal pin of the PIR module is connected to pin 23 on the Nervo Board. The code is checking every second if motion is detected and prints the results in the Serial Monitor.

    [code lang=”cpp”]
    /*
    * This is an example of how to use a PIR sensor with an Arduino.
    * www.swanrobotics.com
    */

    // Define pin 23 as input for the sensor
    #define MOTION_PIN 23

    int reading;

    void setup()
    {
    // Setup Motion pin
    pinMode(MOTION_PIN, INPUT);

    // Initilize serial link for debugging
    Serial.begin(9600);
    delay(1000); // 1 second delay to open the serial monitor after uploading
    Serial.println (“Start”);
    }

    void loop()
    {

    reading = digitalRead(MOTION_PIN);
    if (reading == HIGH) {
    Serial.println (“Motion Detected”);
    } else {
    Serial.println (“No Motion Detected”);
    }

    // Wait a second
    delay(1000);
    }

    [/code]

    I have printed the MiddleChest+PIRV1 part which has a space for the PIR sensor. This part is already mounted on my inMoov so I only had to hotglue the PIR module in place.

    IMG_6025 IMG_6024

    This picture below shows the final result in the chest of the inMoov robot

    IMG_6034

    To show you how the PIR is mounted in the inMoov robot I made a small video.

    All this was not possible by the creator of the inMoov robot. Please visit his website www.inmoov.fr

  • Nervo Boards

    Nervo Boards

    The summertime was not the best time to work on my inMoov robot, because of outdoor activities. But now it is getting cold and the Dutch weather is keeping me inside. It is time to moving forward again.

    I ordered the Nervo Boards from the www.inMoov.fr website. I first ordered one set, because I wanted to see what the quality was. This was what I received.

    01inmoovprints

    I was happy with the quality so I ordered the second set also. First I had to figure out how the all boards supposed to fit together. For now I don’t want to use the finger sensors, but they are on the left side on the picture below.

    02Printssorted

    At first I took an Arduino Mega compatible board (Funduino) and inserted the pins needed for the Nervo Board. This is done to be sure that the pins are straight and on the right position. Beware: not all the pins on the Arduino Mega board are used, so leave those position empty.

    03Pins

    Next I fitted the main Nervo Board over the pins on the Arduino Mega. The pins 8 till 13 didn’t fit perfectly. I don’t know of this was caused by the Nervo board or the Funduino. I had to lift one side up to bring the pin closer to the hole.

    04Pins with board

    I soldered all together.

    05pinssolder

    06solderbottom

    My inMoov will use the same Voltage for all the servos, so I soldered the 3 connections on the top side of the board. The solder did stick very well on the pads at bottom right on the picture. A little piece of wire was needed to make a solid connection.

    07bridge

    I removed the head and neck pins from the main board, because I was afraid to burn the headers on the top board. I was easier to solder the pins on the top breakout board first and then solder the 12 pin connectors. Now it was easy to solder the breakout board on the Nervo main board.

    08pinsupper 09upperboards
    After an evening of soldering the result is very nice. The right board doesn’t have the neck and Stomach breakout board on it. You can use an Arduino Uno instead of an Arduino Mega. You never can have enough io. 😉

    10allboard

    To mount the Nervo Board assemblies on my inMoov robot I printed a Mount from Thingiverse. [http://www.thingiverse.com/thing:30270]. It didn’t fit. I remove the rim around the board because I didn’t want to print another one.

    11megamount

    I used two 3 x 16 mm screws to mount the assemblies on the back of the inMoov. There is not a dedicated spot for it, so I looked at a spot where the two screws would fit.

    12oninmoov13With board