Author Topic: [Arduino] Bot move left, right functionality  (Read 997 times)

0 Members and 1 Guest are viewing this topic.

Offline RedBullAddicted

  • VIP
  • Sir
  • *
  • Posts: 519
  • Cookies: 189
    • View Profile
[Arduino] Bot move left, right functionality
« on: March 03, 2014, 09:25:21 am »
Hi,

I try to build my first little robot and I guess I need a additional part but I don't know what to look for as I am absolutely clueless.. lol.
Basically my bot now consists out of two dc motors, one servo motor to rotate a ultra sonic distance thingy. With the ultra sonic I can check how far the next wall is away and if the wall is to close the bot should move to the left or the right. At the moment I break one motor and speed up the other to have a rotation. I need to use a delay of a specific time to make him stop after he rotated for 90 degrees. With the delay this is pretty inaccurate. Is there a part that can measure the rotation the bot performed? If yes what is the name of it?

Thanks :P
Deep into that darkness peering, long I stood there, wondering, fearing, doubting, dreaming dreams no mortal ever dared to dream before. - Edgar Allan Poe

Offline Kulverstukas

  • Administrator
  • Zeus
  • *
  • Posts: 6627
  • Cookies: 542
  • Fascist dictator
    • View Profile
    • My blog
Re: [Arduino] Bot move left, right functionality
« Reply #1 on: March 03, 2014, 11:38:05 am »
You probably need a stepper motor for that to know exactly how much the motor had rotated.

Offline techb

  • Soy Sauce Feeler
  • Global Moderator
  • King
  • *
  • Posts: 2350
  • Cookies: 345
  • Aliens do in fact wear hats.
    • View Profile
    • github
Re: [Arduino] Bot move left, right functionality
« Reply #2 on: March 03, 2014, 11:39:22 am »
It's called a rotatory encoder.


You should also be using servos or at least a geared motor for the wheels/drive train though. Steppers could work too, but some servos for the wheels should be good too.


You can get continues rotating servos, or you can remove the potmeter in them as a hack to make them continues. Really simple and fun stuff lol.


Since you are using motors though, I assume your also using a H-Bridge to drive them? And speed control using PWM? Just some thoughts.




Anyway, TLDR: Rotatory Encoders.


P.S.
I think you'll like this site:
http://letsmakerobots.com/
« Last Edit: March 03, 2014, 12:46:19 pm by techb »
>>>import this
-----------------------------

Offline RedBullAddicted

  • VIP
  • Sir
  • *
  • Posts: 519
  • Cookies: 189
    • View Profile
Re: [Arduino] Bot move left, right functionality
« Reply #3 on: March 03, 2014, 03:50:08 pm »
yes :) many thanks techb. Now I only need to get one of these rotatory encoders. But it seems like those are exactly what I was looking for. I already know the page you posted. Its awesome :) I just started out with it so mine is pretty, pretty basic at the moment. Will post some pictures or maybe a video as soon as there is something to see.. lol.
Deep into that darkness peering, long I stood there, wondering, fearing, doubting, dreaming dreams no mortal ever dared to dream before. - Edgar Allan Poe

Offline techb

  • Soy Sauce Feeler
  • Global Moderator
  • King
  • *
  • Posts: 2350
  • Cookies: 345
  • Aliens do in fact wear hats.
    • View Profile
    • github
Re: [Arduino] Bot move left, right functionality
« Reply #4 on: March 03, 2014, 05:34:55 pm »
yes :) many thanks techb. Now I only need to get one of these rotatory encoders. But it seems like those are exactly what I was looking for. I already know the page you posted. Its awesome :) I just started out with it so mine is pretty, pretty basic at the moment. Will post some pictures or maybe a video as soon as there is something to see.. lol.


Do what you need to. And you don't know how happy I am to see something like this here. We need more hardware stuff, and I even have a few tuts lined up If I would ever post them. Arduino is good for intro level stuff, but RBA needs the other. The other being embedded systems. 


Don't get wooed by Arduino, in the end it is just a boot loader, and making thing easy. Behind that "Arduino" is an Atmega 328 AVR waiting for you. Waiting for you to learn clock cycles, <- yes they are desperately important, code your own and learn why that crystal is there to support such things.


We/you are stepping into how and why a processor works, this simple 8bit core can "really" show you why a stack over flow is so important, or why we preach memory management [at least me]. I WANT you to learn the whys and hows it happens.


But I am doing exactly, what my wife hates me for though. Making her/you learn. What the diff here is, I have a feeling you want to know. You want to understand what happens in the digital world, cause that's the only world that you or I or anyone here can relate to.


I am not a psychologist, and even in this thread evaluating why I married her...


But you wanna know about embedded systems, there it is, Arduino is overrated, it "Arduino" is like python, treat it as a gateway if you really want to know things. It is easy, it is something noobs or such can get into. BUT, just like python, you need to know how it works, when and where to use it.


You can and will eventually know what I am talking about if you go down this road. Just ask PORTA and PORTB.

Arduino is easy, the question I ask (drunken or not), do you want to know? Easy or what it was supposed to be?



Again sorry for this, I am drunk and have seen things in this embedded world and am at a cross roads. I know and have done things the hard way, and have done things the easy. I will admit the easy has lead me into the hard and have been learning since. I....

Do the Arduino thing until you want to know and learn MORE, I am here to show and teach, not discriminate. Drunkin speeches or not, you are a friend RBA and I will try and guide. But when it comes to config a Cisco router or advice on network topology, I will be the dog begging  ::)

PM me or put it here, I will help in this embedded world you want to endure. Only the best for a friend.

Again, drunken posts are the best right?

Going back to the matter at hand {ahem}
You will need two encoders  one for each motor. A zero point turn radius is ideal for a two wheel bot. The Arduino you have should handle the bot okay. The next logical step in this project is PID. PID is usually reserved for line following things, but PID might be where you *could* go next with the code of things.

If hardware is more your style, then you could go with more of a B.E.A.M. approach and have feelers or antennas signaling the motors and such. But, thing are up to the person at hand. Just let me know where you wanna take it and I'll help.
« Last Edit: March 03, 2014, 05:49:06 pm by techb »
>>>import this
-----------------------------

Offline RedBullAddicted

  • VIP
  • Sir
  • *
  • Posts: 519
  • Cookies: 189
    • View Profile
Re: [Arduino] Bot move left, right functionality
« Reply #5 on: March 04, 2014, 07:10:10 am »
Hi techb,

many thanks for the offer and I would love to learn more  about these things. I started with arduino because it is easy and I basically have/had 0 knowledge when it comes to electronics. I thought starting out with arduino would be a great way to change that. I bought a starter kit cause I had some extra money due to countless hours of work the last 2 month. The starter kit contains a book with 15 sample projects as samples on how to work with these microcontrollers. I finished all of them and the bot is my first "own" (more or less) project which should give me more insight into that fantastic world :) As you already mentioned, this is just the beginning and I want to dig deeper and deeper. As soon as I finished the bot or at least have some nice functionality I would be more than glad to hear your thoughts about how to go on. We should really find a time where we can talk about these things. You can pm me your suggestions for a call or post them here and I am sure we find a way around these damn timezones.. lol. (that sounds weird, doesn't it?). By the way.. this is how the bot looks like at the moment:


Manual control (via the serial port) is nearly done. Afterwards I want to try to give it some intelligence to make him able to do things on his own. Then I want to add some more parts like a piezo and a lcd display. Can't think of much more at the moment. As said before this is my first "real" project with arduino :)

Cheers,
RBA

 
Deep into that darkness peering, long I stood there, wondering, fearing, doubting, dreaming dreams no mortal ever dared to dream before. - Edgar Allan Poe