element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Attack of the Drones
  • Challenges & Projects
  • Project14
  • Attack of the Drones
  • More
  • Cancel
Attack of the Drones
Blog Dromes4All : The First Prototype
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Attack of the Drones to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: dubbie
  • Date Created: 23 Apr 2021 8:13 PM Date Created
  • Views 2040 views
  • Likes 8 likes
  • Comments 6 comments
  • nano
  • 3D Printing
  • dromes4all
  • servo_360
  • attackofthedronesch
Related
Recommended

Dromes4All : The First Prototype

dubbie
dubbie
23 Apr 2021

Having decided to have a go at making some drones, based on the fact that I have four plastic domes and Nanos I have now progressed to an initial prototype. My plan is to make four identical domed drones (I will now call them Dromes) which will be able to operate as a single entity or as four individual drones - well, why not!

 

I got off to a good start as I had two 360 micro servo motors, also called continuous servo motors, and as I want to make at least four I am 3D printing the chassis. In order to minimise the amount of assembling I designed a solid base with an indent the exact same outline as the micro servo motor so that it will just 'click' in and not need any further fixing. This all went well and I made a simple 3D test base. So, I ordered more 360 degree servo motors and hey presto - they are a different size!. The two I already had were Feetech FT90R but the new ones are Feetech FT90R which have a 1 mm longer body. I wondered what the difference between the FS90R and FT90r was, and now I know. So, a second 3D based was created and this time the servos fitted exactly with a satisfying 'click' and do not seem to need any additional fixing.

 

Normally I jump straight into the circuit as it is fun and wait until I have made my mobile robots before thinking about battery supply and encapsulation, which means I end up with a messy looking system. But this time I decided to start with the battery power supply as well as how to encapsulate it. LiPo seems the way to go being much smaller and lighter than AA or AAA batteries. Regretfully 1C LiPos only provide 3.7V and 2C LiPos will be too big - and expensive, so a DC-DC convertor is needed to boost the 3.7V to a better 5.5V needed by the Servos. This additionally means that I can use a 5V Nano rather than trying to mess about with 3.3V versions. Add a couple of 3D printed wheels with O ring tyres and a few wires and the initial prototype was created. See the circuit diagram below:

 

image

 

I've used 360 degree servo motors for mobile robots before so I just borrowed one of my existing programmes, simplified it a bit and made something that will move backwards and forwards for 1 second periods, just so I can make sure everything is working well. It is a simple programme using the servo.h library with an infinite while loop with three functions: mystop(), forwards() and backwards() - all fairly self-explanatory. The while loop is listed below.

 

while(1)

  {

    forward(170);

    delay(1000);

    mystop();

    delay(1000);

    backward(170);

    delay(1000);

    mystop();

    delay(1000);

  } /* while */

 

The following are the three functions used.

 

void backward(int speed)

 

{

  myservo1.write(speed); 

  myservo2.write(max_speed - speed); 

} /* backward */

 

void forward(int speed)

 

{

  myservo1.write(max_speed - speed); 

  myservo2.write(speed); 

} /* forward */

 

void mystop(void)

 

{

  myservo1.write(stop_speed); 

  myservo2.write(stop_speed); 

} /* mystop */

 

At the moment I am using a small protoboard for the Nano while the circuit is being developed so I just added an indent into the top of the battery casing. Sadly, despite measuring the protoboard twice I still made a mistake and it doesn't quite fit into the indent, but a bit of BlueTac fixed that problem. So now I have a fully working Drome!

 

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

At this point I realised that the Dromes will need some form of communication channel as I will need to provide control commands. At present I do not have any solutions in mind, other than  possibly some sort of IR channel. I haven't used IR communications before so that should be interesting and fun, and hopefully cheap as well. I want to add an OLED graphic display to the top of the Drome chassis somewhere, to provide a face and some personality to each Drome. I have used an OLED graphic display before so this does not seem too difficult.

 

If all this goes well I might even add a few flashing LEDs just to make it a bit more fun.

 

Onward now to making a fully working Drome and then three more.

 

Dubbie

  • Sign in to reply

Top Comments

  • bartokon
    bartokon over 4 years ago +3
    Great work! But in my honest opinion duck-tape sentry guns are the best! players.brightcove.net/.../index.html CPP /* * SilnikKrokowy.cpp * * Created on: Apr 11, 2021 * Author: LOLNO */ #include…
  • bartokon
    bartokon over 4 years ago in reply to dubbie +2
    Yes, it works even better with sounds. For example, cat will learn that some buzzer means laser → hunt. I think red color is the most visible, so there should be no problem leaving it outside in full sun…
  • DAB
    DAB over 4 years ago +1
    Nice build. DAB
Parents
  • bartokon
    bartokon over 4 years ago

    image Great work!

    But in my honest opinion duck-tape sentry guns are the best! image

    You don't have permission to edit metadata of this video.
    Edit media
    x
    image
    Upload Preview
    image

    CPP

    /*
     * SilnikKrokowy.cpp
     *
     *  Created on: Apr 11, 2021
     *      Author: LOLNO
     */
    
    
    #include <SilnikKrokowy.h>
    
    
    SilnikKrokowy::SilnikKrokowy(
    GPIO_TypeDef *GPA1, uint16_t GPA_Pin1,
    GPIO_TypeDef *GPB2, uint16_t GPB_Pin2,
    GPIO_TypeDef *GPC3, uint16_t GPC_Pin3,
    GPIO_TypeDef *GPD4, uint16_t GPD_Pin4){
    
    
    //Set pins for control stepper
    GPA = GPA1;
    GPB = GPB2;
    GPC = GPC3;
    GPD = GPD4;
    GPA_Pin = GPA_Pin1;
    GPB_Pin = GPB_Pin2;
    GPC_Pin = GPC_Pin3;
    GPD_Pin = GPD_Pin4;
    
    
    
    
    //Set all outputs to 0
    HAL_GPIO_WritePin(GPA, GPA_Pin, (GPIO_PinState) 0);
    HAL_GPIO_WritePin(GPB, GPB_Pin, (GPIO_PinState) 0);
    HAL_GPIO_WritePin(GPC, GPC_Pin, (GPIO_PinState) 0);
    HAL_GPIO_WritePin(GPD, GPD_Pin, (GPIO_PinState) 0);
    
    
    GP[0] = GPA;
    GP[1] = GPB;
    GP[2] = GPC;
    GP[3] = GPD;
    
    
    GP_PIN[0] = GPA_Pin;
    GP_PIN[1] = GPB_Pin;
    GP_PIN[2] = GPC_Pin;
    GP_PIN[3] = GPD_Pin;
    
    
    };
    
    
    void SilnikKrokowy::turnCW(){
    
    
    act_pos += 1;
    
    
    HAL_GPIO_WritePin(GPA, GPA_Pin, (GPIO_PinState) 1);
    //delay
    HAL_Delay(delay_time);
    HAL_GPIO_WritePin(GPA, GPA_Pin, (GPIO_PinState) 0);
    HAL_GPIO_WritePin(GPB, GPB_Pin, (GPIO_PinState) 1);
    //delay
    HAL_Delay(delay_time);
    HAL_GPIO_WritePin(GPB, GPB_Pin, (GPIO_PinState) 0);
    HAL_GPIO_WritePin(GPC, GPC_Pin, (GPIO_PinState) 1);
    //delay
    HAL_Delay(delay_time);
    HAL_GPIO_WritePin(GPC, GPC_Pin, (GPIO_PinState) 0);
    HAL_GPIO_WritePin(GPD, GPD_Pin, (GPIO_PinState) 1);
    //delay
    HAL_Delay(delay_time);
    HAL_GPIO_WritePin(GPD, GPD_Pin, (GPIO_PinState) 0);
    
    
    };
    
    
    void SilnikKrokowy::turnCCW(){
    
    
    act_pos -= 1;
    
    
    HAL_GPIO_WritePin(GPD, GPD_Pin, (GPIO_PinState) 1);
    //delay
    HAL_Delay(delay_time);
    HAL_GPIO_WritePin(GPD, GPD_Pin, (GPIO_PinState) 0);
    HAL_GPIO_WritePin(GPC, GPC_Pin, (GPIO_PinState) 1);
    //delay
    HAL_Delay(delay_time);
    HAL_GPIO_WritePin(GPC, GPC_Pin, (GPIO_PinState) 0);
    HAL_GPIO_WritePin(GPB, GPB_Pin, (GPIO_PinState) 1);
    //delay
    HAL_Delay(delay_time);
    HAL_GPIO_WritePin(GPB, GPB_Pin, (GPIO_PinState) 0);
    HAL_GPIO_WritePin(GPA, GPA_Pin, (GPIO_PinState) 1);
    //delay
    HAL_Delay(delay_time);
    HAL_GPIO_WritePin(GPA, GPA_Pin, (GPIO_PinState) 0);
    
    
    };
    
    
    void SilnikKrokowy::generate_in_range(uint8_t divider){
    if (turn_steps == 0 ){
    int32_t random_number = 0;
    while (1){
    random_number = random()%(limit_steps+1) - limit_steps/2;
    if ((abs(act_pos+random_number) < limit_steps) and (abs(random_number) > divider)) break;
    }
    
    
    turn_steps = random_number;
    }
    };
    
    
    void SilnikKrokowy::rotate(int32_t max_steps){
    
    
    int32_t loc_var = 0;
    
    
    do {
    if (turn_steps > 0){
    turnCW();
    turn_steps -= 1;
    loc_var += 1;
    }
    else if (turn_steps < 0){
    turnCCW();
    turn_steps += 1;
    loc_var += 1;
    } else {break; }
    } while (loc_var == max_steps);
    };
    
    
    
    
    SilnikKrokowy::~SilnikKrokowy(){
    // TODO Auto-generated destructor stub
    };

     

    Header

    /*
     * SilnikKrokowy.h
     *
     *  Created on: Apr 11, 2021
     *      Author: LOLNO
     */
    
    
    #ifndef INC_SILNIKKROKOWY_H_
    #define INC_SILNIKKROKOWY_H_
    #define FULL_ROTATION_STEPS 2038 //Full rotation
    #define delay_time 6
    #include <stdint.h>
    #include <stdlib.h>
    #include <time.h>
    #include <math.h>
    #include "stm32l0xx_hal.h"
    class SilnikKrokowy {
    public:
    SilnikKrokowy(
    GPIO_TypeDef *GPA, uint16_t GPA_Pin,
    GPIO_TypeDef *GPB, uint16_t GPB_Pin,
    GPIO_TypeDef *GPC, uint16_t GPC_Pin,
    GPIO_TypeDef *GPD, uint16_t GPD_Pin
    );
    
    
    //Turning management
    void rotate(int32_t max_steps);
    
    
    //Limit 10, can't return >10; range -> to limit possible random numbers generated
    //Limit_real = act_pos + random < limit_steps;
    void generate_in_range(uint8_t divider);
    
    
    //Constrain rotation, so we don't end up tangled in wires
    
    
    static const int32_t MAX_STEPS = FULL_ROTATION_STEPS;
    int32_t limit_steps = 0; // /2 +- radius
    
    
    //Pin definitions
    GPIO_TypeDef *GPA; uint16_t GPA_Pin;
    GPIO_TypeDef *GPB; uint16_t GPB_Pin;
    GPIO_TypeDef *GPC; uint16_t GPC_Pin;
    GPIO_TypeDef *GPD; uint16_t GPD_Pin;
    
    
    GPIO_TypeDef *GP[4];
    uint16_t GP_PIN[4];
    
    
    //Actual position
    int32_t act_pos = 0;
    
    
    int32_t turn_steps = 0;
    
    
    virtual ~SilnikKrokowy();
    private:
    
    
    //Turn one step
    void turnCW();  //Clockwise
    void turnCCW(); //Counter Clockwise
    
    
    };
    
    
    
    
    #endif /* INC_SILNIKKROKOWY_H_ */

    Main loop

    //For random number generator
    srand (time(NULL));
    
    
    SilnikKrokowy Y_axis(serwo1_1_GPIO_Port, serwo1_1_Pin,
    serwo1_2_GPIO_Port, serwo1_2_Pin,
    serwo1_3_GPIO_Port, serwo1_3_Pin,
    serwo1_4_GPIO_Port, serwo1_4_Pin
    );
    
    
    SilnikKrokowy X_axis(serwo2_1_GPIO_Port, serwo2_1_Pin,
    serwo2_2_GPIO_Port, serwo2_2_Pin,
    serwo2_3_GPIO_Port, serwo2_3_Pin,
    serwo2_4_GPIO_Port, serwo2_4_Pin
    );
    
    
    uint8_t x_const = 12*3;
    uint8_t y_const = 12*2; // 12 = 180 stopni cos kolo
    
    
    uint8_t rot_div = 8;
    X_axis.limit_steps = X_axis.MAX_STEPS/x_const;
    Y_axis.limit_steps = Y_axis.MAX_STEPS/y_const;
    
    
    
    
      /* USER CODE END 2 */
    
    
      /* Infinite loop */
      /* USER CODE BEGIN WHILE */
      while (1)
      {
    
    
      if (X_axis.turn_steps == 0) X_axis.generate_in_range(20);
      if (Y_axis.turn_steps == 0) Y_axis.generate_in_range(20);
    
    
      X_axis.rotate(X_axis.MAX_STEPS); //V^
      Y_axis.rotate(Y_axis.MAX_STEPS); //<>
    
    
    
    
        /* USER CODE END WHILE */
    
    
        /* USER CODE BEGIN 3 */
      }
      /* USER CODE END 3 */
    }

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • dubbie
    dubbie over 4 years ago in reply to bartokon

    Bartosz,

     

    This looks good. Does the laser turn off or is it permanently on? The cat seems mesmerised!

     

    Dubbie

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
Comment
  • dubbie
    dubbie over 4 years ago in reply to bartokon

    Bartosz,

     

    This looks good. Does the laser turn off or is it permanently on? The cat seems mesmerised!

     

    Dubbie

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
Children
  • bartokon
    bartokon over 4 years ago in reply to dubbie

    Laser is permanently on. If I turned it off cat could lose track of it image I have considered using PWM for brightness, but darker laser could be not visible in bright light.

    This "System" can last like 4 days non-stop on 10k battery bank, so I think power is not an issue.

    The Only thing I could change is lower motor speed based on max distance of the center position for each axis. As laser is further away it goes faster and faster...

     

    Cat loves it and I have some peace because of that image

    I'm calling this design cat-auto-nanny <3 image

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube