MacBot-1 (my first ...
 
Notifications
Clear all

MacBot-1 (my first robotic arm)

12 Posts
4 Users
1 Likes
1,251 Views
Macoofer
(@macoofer)
Member
Joined: 4 years ago
Posts: 27
Topic starter  

Hiya folks,

 

I figured I might as well post some pics and such on the first robot I'm trying to create from scratch.

I haven't gotten very far yet, I'm waiting for parts, more knowledge on those parts and particularly on howto program the Arduino accordingly, apart from the fact that I started this robot project about 4 weeks ago.

It's a 6-DOF DIY 3D printed robotic arm, that when fully standing upwards is about 46cm tall.

The design is a modified design I found on thingiverse.

This current model is powered by 3 15kg servo motors for the waist, shoulder and elbow and 3 SG90 mini servo motors for the wrist, hand and gripper.

I printed all the parts with an Ender 3D Pro and the code I have so far to test it is a collection of various example codes I analyzed and stuck together to in the attempt to get it to do what I hope it will do 😊 .

20200510 224649

- The first picture is the modified design, made in Autodesk Fusion 360

20200510 224707

- The second picture is the current build, where I have all the servos in place, yet 3 are actually connected atm for testing purposes

20200510 224717

- The third picture is the prototyping wiring: Its based off an Arduino mega and the servos directly managed with the digital outs of the mega (Im waiting for some servo motor drivers to ship in) The current setup has a couple of pot-meters which I can use to move the arm in various positions. On the bottom right of the Breadboard you can see two small pushbuttons; when the left one is pushed it stores the current angles of the servos in an array ( this test setup has 8 memory positions). When the right button is pushed it goes through the 8 stored memory positions sequentially in a loop. 

20200510 224723

- The last picture is has two lcd displays, that spit out various real time data to help me understand the difference of what I think the robot is doing and what the robot is actually doing (I had a lot of errors and crashes due to my bad programming and couldn't explain why, adding these helped a lot)

The small 16x2 lcd displays the pot1 and pot2 values in both the analogue values (0-1023)  and the degrees they were mapped to (0-180)

The large 20x4 lcd displays the memory step it is currently at (n-8) The destination angle of a certain servo (in this case Servo2, the shoulder PD2) Po2 is the old, or last known sent angle to that servo.

and AgR2 (AngleRealtime)  shows the actual angle the servo is at.

(one of the things I noticed eg is that the actual angles slightly deviate from the planned destination angles)

I have gotten to the point where im able to smoothen the movement of the individual servo movements. but they are still all serial (waist->shoulder->elbow->etc) since the arduino has single processing serial output.

The next brainbreaker I'm currently trying to figure out is how to emulate multitasking, so that the arm can move all the servo's at the same time (smooth) with independent speeds, directions and angles. So that when I send a command to move eg. 3 servos in one "movement" or "memory-step" they all start at the same time and all finish at the same time, but due to the different amount of degrees they might all have to travel, one would have to move slower or faster than another.

 

Well, that's how far I've gotten so far!

I will keep you updated on the progress and will most likely knock on the forums' door for some help on tackling my current brainbreaker 


   
Quote
(@bushgeek)
Member
Joined: 4 years ago
Posts: 6
 

I think this is a great project to grind through. Looks like the mechanical part is not difficult for you but the coding is.

I have a few questions for you:

  • Did you try to build a simpler arm as a warm-up? Just wondering.
  • Why do you say:
    Posted by: @macoofer

    the arduino has single processing serial output

    Aren't you controlling the servos directly using PWM pins, not Serial?

  • Are you familiar with using millis() and "tight loops" for timing, as in the built-in sketch BlinkWithoutDelay? This tutorial or similar may help: https://www.programmingelectronics.com/arduino-millis-multiple-things/

   
ReplyQuote
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
 

@macoofer

Looking good!

Arduino can kind of perform some parallel writes by manipulating port registers directly.

There is a good reference here: Arduino Port Manipulation

Cheers!


   
ReplyQuote
Macoofer
(@macoofer)
Member
Joined: 4 years ago
Posts: 27
Topic starter  

@bushgeek

 

Thanks for the suggestions!

 

Before making this actual robot arm, I made a test setup with just two servos on a breadboard (I still have this setup as a means to quickly try out new code.)

During my searches I came across the millis(), looked into that and found a bunch of examples on using that with servos but in a very unclear way to me. With a very useful link from @robotbuilder, posted in another topic, I managed to get a better grasp of that concept.

I hadn't been able to get back into it due to work, but will very soon.

The "the arduino has single processing serial output" may have been confusing in the way I wrote it.

What I meant by it is that the arduino cannot straight up run parallel tasks and goes through code sequentially (if, for and while loops). In order to break this down, I have to use the suggested millis() or similar.

 

So yah, the mechanical part is not so much my limitation, my newbee knowledge on Arduino's (or any microcontroller) and the programming of them, since I literally just started to learn the code, is my main challenge. 😀 

But, as I was hoping when I joined this forum. There are quite a few people in here (you included 😉 ) that have skills in that, that are far beyond mine and have shown to be willing to help. And already did!

So, I'm going to dive deeper into the millis() section and experiment with that this weekend.

I'll post my findings here 😊 


   
ReplyQuote
Macoofer
(@macoofer)
Member
Joined: 4 years ago
Posts: 27
Topic starter  

@frogandtoad

 

Thanks for the link,

However, in my current stage of knowlegde I'm not sure if that is the kind of tweaking-depth I should dive in atm, lol

I got some good links to the millis() function, I just need to fiddle around with that and write some additional dissecting code to calculate the various distances and speeds for each movement on each servo. I know it can be done, since I've seen people use it, now I just have to understand it and do it myself 😉 


   
ReplyQuote
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
 

@macoofer

Posted by: @macoofer

Thanks for the link,

However, in my current stage of knowlegde I'm not sure if that is the kind of tweaking-depth I should dive in atm, lol

Not a problem, I thought you had a grip on it as you mentioned wanting to emulate multitasking... something to look into when you become more comfortable with Arduino.

Cheers!


   
Macoofer reacted
ReplyQuote
Macoofer
(@macoofer)
Member
Joined: 4 years ago
Posts: 27
Topic starter  

Well, after some electronics-downtime, due to work and such.

And some time to read up on some more coding I conjured up a new piece of code to see if I could get this to work, with the millis()  funtion.

 

And the good news is...   IT WORKS!

 

Behold!:

 

 

So, it is still a test setup, driving 4 servos atm,  but I finally got them to do what i wanted.

For the synchronised movement of all degrees of freedom on my robotarm it can now independantly move all of them, adjusting their speeds automatically so they all start and end at the same time, regardsless of how far they have to move and in which direction.

 

To be continued...

 

Macoofer

 

p.s. Thanks again to those who pointed me out in the direction of those very usefull millis() tutorials!! 


   
ReplyQuote
Macoofer
(@macoofer)
Member
Joined: 4 years ago
Posts: 27
Topic starter  

   
ReplyQuote
Macoofer
(@macoofer)
Member
Joined: 4 years ago
Posts: 27
Topic starter  

   
ReplyQuote
robotBuilder
(@robotbuilder)
Member
Joined: 5 years ago
Posts: 2037
 

@macoofer

You actually had time to redo the previous post.  You can edit a post within a one hour time limit.

The source code is much easier to read although I note the indentations (tabs) are not consistent and the lines after the last else statement are not indented at all.

Ideally for training an arm you would hold the hand and move the arm manually while the changing positions were recorded rather than using POTS.  You can use an identical arm with POTS instead of motors and move that about to record the changing positions and also to control the motorised arm.

 


   
ReplyQuote
Macoofer
(@macoofer)
Member
Joined: 4 years ago
Posts: 27
Topic starter  

@robotbuilder

 

I found out about the better way to put the code 3 hours after I posted the previous post, so the edit option was no longer available, hence the additional post 😉 

My code is still a bit messy, but as mentioned, the cleaning part is the next step, I was already happy I got it to work this far with my limited knowledge on coding 🤣 

 

As for the suggested pot-arm, I actually was looking into that, so you could say that was a good anticipated pointer into the direction I needed to go!  Thanks 😊 

Guess its back to waiting for my additional parts to arrive, before I can make the 2nd arm to program the first one.

Meanwhile I'll work on the code...

 

"There's a way to do it better - find it."  - Thomas Edison


   
ReplyQuote
robotBuilder
(@robotbuilder)
Member
Joined: 5 years ago
Posts: 2037
 

@macoofer

Another thought I had was perhaps signals from pressure sensors or switches in the joints that would be activated in the actual arm when a force was applied by someone trying to physically move the gripper end. These signals could be used to turn the motors in the direction the user was applying pressure. Any changes in the angle of the joints could be recorded for playback.

I would like to build a robotic arm myself but one which would be guided by feedback.  So for example you place a block on the table and using vision to locate the block and its orientation the program would compute the path the arm has to take and the opening/closing of the gripper required to pick up the block. This involves inverse kinematics to compute the rotation required for each joints to achieve this outcome. Of course is you are going to use ROS I would assume inverse kinematic computations would come with it.

 


   
ReplyQuote