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
Personal Blogs
  • Community Hub
  • More
Personal Blogs
Legacy Personal Blogs Crawling Worm Robot #2 : ATTiny85 Controller Added
  • Blog
  • Documents
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: dubbie
  • Date Created: 14 Dec 2020 5:57 PM Date Created
  • Views 1254 views
  • Likes 8 likes
  • Comments 1 comment
  • crawling worm
  • attiny85
  • drv8833
Related
Recommended

Crawling Worm Robot #2 : ATTiny85 Controller Added

dubbie
dubbie
14 Dec 2020

Having made the Crawling Worm Robot kit ( Worm Robot | element14 | Dubbie Dubbie ) which doesn't have any form of controller, the obvious next step is to add a controller and then see what might be achievable, so that is what I have done.

 

I have added an ATtiny85 microcontroller, mainly because that is the device I have been playing with recently and I only need a couple of digital outputs, plus a DRV8833 dual H bridge driver, using only one bridge, to control the DC motor. From my experiments with the ATtiny85 I have discovered that it needs at least 2.8V to work reliably so rather than use the existing 2 x AA battery module I added a 3.7V LiPo battery instead, ,just to give that little bit of extra confidence. It is a simple circuit and is shown below:

 

image

 

I have used a small protoboard to hold the ATtingy85 and DRV8833 PCBs during this initial development stage, as shown below. I can always make these connections more permanent if it seems to work out OK.

 

image

 

At present it is all just held together with Bluetac and a wire tie as illustrated in the picture below. Assuming all goes well I have plans to 3D print a framework for an updated Crawling Worm Robot.

 

image

 

I wrote a simple programme that just turns the motor on for two seconds, then waits for 0.5 seconds, when it reverses the motor for another 2 seconds and turns off the motor with another 0.5 second delay. The programme is based on the one used in the Sand Cat Detector with a few simplifications. Rather than deleting the unwanted statements I have commented out the statements controlling the second H bridge in the DRV8833 just in case I ever try a version of this with two DC motors. There is also a function for implementing PWM control of the motor which I am saving for future experiments. The programme is listed below.

 

/*  Dubbie Dubbie

*  The Worm Mobile Robot

*  Controls one DC motor and varies the speed

* 

*  Dec'20

*  Just for Fun

*/

 

#define leftforward 5

#define rightforward 2

#define leftbackward 3

#define rightbackward 4

#define motor1A 3

#define motor1B 2

#define motor2A 1

#define motor2B 0

#define go LOW

#define stop HIGH

#define text_delay 500

#define cm10 3300  // Should be the delay for 10 cm travel

 

 

void setup(void)

{

  pinMode(motor2B, OUTPUT);

  pinMode(motor2A, OUTPUT);

  stopmotor();  // Make sure both motors are stopped

  delay(100);     

} /* setup */

 

void loop(void)

{

 

char value;

int accel;

 

accel = 0;

value = 100;

 

while (1)

  {

    forward();

    delay(2000);  // Forward

    stopmotor();

    delay(500);

    backward();

    delay(2000); // Backwards

    stopmotor();

    delay(500);

  } /* while */

 

 

} /* loop */

 

 

void DCmotorpwm(int mark, int total, int count, int inhigh, int inlow)

 

{

 

int countindex, pwmindex;

 

countindex = 0;

pwmindex = 0;

 

digitalWrite(inhigh, HIGH);   // Set the motor direction

digitalWrite(inlow, LOW);

 

for (countindex = 0; countindex < count; countindex++)

  {

    for (pwmindex = 0; pwmindex < mark; pwmindex++)

      {

        digitalWrite(inhigh, HIGH);

        delayMicroseconds(10);      

      } /* for */

    for (pwmindex = mark; pwmindex < total; pwmindex++)

      {

        digitalWrite(inhigh, LOW);

        delayMicroseconds(10);      

      } /* for */

  } /* for */

 

 

//digitalWrite(inhigh, LOW);   // Set the motor off

//digitalWrite(inlow, LOW);

} /* DCmotorpwm */

 

void forward(void)

 

{

//  digitalWrite(motor1A, HIGH);  

//  digitalWrite(motor1B, LOW);

  digitalWrite(motor2A, HIGH);  

  digitalWrite(motor2B, LOW);

} /* forwardboth */

 

void backward(void)

 

{

//  digitalWrite(motor1A, LOW);  

//  digitalWrite(motor1B, HIGH);

  digitalWrite(motor2A, LOW);  

  digitalWrite(motor2B, HIGH);

} /* backwardboth */

 

void stopmotor(void)

 

{

//  digitalWrite(motor1A, LOW);

//  digitalWrite(motor1B, LOW);

  digitalWrite(motor2A, LOW);

  digitalWrite(motor2B, LOW);

} /* stopmotor */

 

I wanted to check that changing the direction of the DC motor would also change the direction the Crawling Worm Robot would move. I wasn't entirely sure that it would, but fortunately it does, as illustrated in the video below.

 

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

 

So I have made a step forwards in converting the Crawling Worm Kit into an actual robot - with a controller and (hopefully at some point) sensors as well. As mentioned above, I am planning to make a 3D printed framework for the Crawling Worm Robot to replace the wooden version and to customise it for the ATtiny85 controller and H bridge driver.

 

Dubbie

  • Sign in to reply

Top Comments

  • DAB
    DAB over 5 years ago +1
    Great update. DAB
  • DAB
    DAB over 5 years ago

    Great update.

     

    DAB

    • 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