Out of the shadows, into the unknown & some questions

Because I couldn't find an introduction section anywhere and because this is my first post (yes I was that lurker) I'll take the liberty to introduce myself.

I'm a Dutchman, 39 years old and living in the northern part of the Netherlands. I've been fascinated by robotics since my early childhood, but I never got further than buying some toy robot. My nick, for those who wonders, is from a tag on the chest of the eighties Magnatron robot I got as a kid. Since it's written in large letters it has to be something important, but you can call me Paul as well.

Anyway, I spend some time - actually over a decade - thinking about buying some stuff and start building. Now is the time, better late than never. I was biased towards Pic controllers, because they're cheap and programmable in simple compilable basic. But, I have no experience with microcontrollers so I'm going to buy an Arduino although I dislike the C like syntax. In fact I dislike C syntax in general, but mastering it opens a lot more doors than platform dependend languages. (I used to be a programmer for trade in a 4th generation language, Windows only.)

 

That brings me to the questions. Well almost, first I have to tell you what I want to do: I'm interested in artificial intelligence (and some other applications) so I need a controller with quite some memory to be able to run the code and speed is something not to neglect either. I'm not delusional and don't expect to be able to build a C-3PO copy. I'm already very happy if I'm able to build a robot with "intelligence" close to an insect, that already is a huge task.

I'm not sure which Arduino to buy to do the task. The Mega (revision 3) or the Due. The Due, of course, is faster and has lots more memory, but is more complex because of the voltage differences. 3,3v for the board and 5v for the sensors etc. I also read that the Due is more complex to program. So, will the Due be too complex for a beginner in microcontrollers and with only basic knowledge about electronics? And do I need all that extra processing power? I'm not interested in voice or face recognition, internet control or other fancy stuff which has nothing to do with AI. Even if I wanted to do something fancy, I could daisy chain another controller via the I2C port or is a I2C port too limited to transfer large amounts of data fast? (Eventuall I will daisy chain, multiple MCs busy with a certain task is in my opinion better than one MC busy with everything it shouldn't be busy with.)

And the next question: One of the things I want to do is 2d mapping, I want my robot to have at least some "knowledge" about it's environment. Of course ultrasonic sensors will be used and an infrared sensor, because I read that the beam of a ultrasonic sensor is quite wide so it will be very hard, if not impossible, to do some reasonably detailed mapping. Is this information correct?

The last question: I want a compass module, again to give the robot some sense of it's environment and I want to use the module instead of wheel decoders. Is a compass module accurate enough to replace decoders? I don't want to use servos or steppermotors for propulsion. I want my robot to be a bit bigger. Not that bigger is necessarily better, but it's easier to convince my wife to spend money on something big than on something tiny.

Well that's it in a nutshell.

 

Regards,

Paul

 

 

C/C++ is what the arduino uses but…
Using the arduino ide is not as bad as older c/c++ environments. Also the stuff you do for it and robotics does not need things like complex pointer operations etc or is hidden from you in a class lib. I think C will be the least of your worries. :slight_smile:

Have fun building your first bot!

big tasks are coming if you

big tasks are coming if you want achieve what are you expecting.

I am almost like you, love robots and robotics for long time, and now on the stage to do something, finally.  My choice is the arduino MEGA2560R3, for the same reason you exposed compare to the DUE.

Like you I wanted basic AI and mapping, but I revised my expectations and come with this idea, I class four differents spaces of the robot environment ;

1- the “mobile” space = it is the sapce that move with the robot (what the robot transporting)

Can be easilly achieved when using a battery of sensors like voltage, amps, light, humidity, direction, acceration, shock …

2- the “toucheable” space = the closest environment that the robot can sence without moving to the next space

An other easilly task with ultrasound, IR, bumper contacts …

3- the “moving” space = it is the close environment of the robot, who need to move on it to know what it is

It’s generally the level where the robot maker stop because that getting complex and expensive because of tools like odometry, SLAM, LIDAR.  that still can be achieve with a small processor like an Arduino MEGA, but most of the time something bigger is better like a Raspberry Pi.

4-the last space is the “world” = it’s the largest environment the robot can feel and have an idea of the space and time.

I mean world, not the earth, but the world the robot imagine where he is using GPS, Solar panels, Compass, reel time clock …

 

My robot level “intelligence” will stay in space 2 (toucheable) and reacting to his sensors by proper behaviors.

Hi Paul,I like the sound of

Hi Paul,

I like the sound of your robot, and I always prefer larger bots myself, although they do eat batteries quicker :wink:

 

For a project like yours the approach that I would take would be a system of interconnected sub-systems, for example

Using the Arduino DUE or Raspberry Pi or Beagleboard Black as a host, this one does the heavy lifting, eg processing, mapping, deciding what to do next, then build smaller subsystems for things like sensing - so mabey a smaller arduino, PIC or ATMEL chip that handles all of the ultrasonics, ir etc.  Another subsystem that handles the motor control, again one of the smaller chips for this board and have it control all of the h-bridges, wheel encoders, pid controller if neccessary.  Then I would connect the smaller systems to the main processing board using I2C, SPI (For fast things), or even uart depending on my needs.

By building the system in modules like that you could develop a pretty complex robot, but have the simplicity of debugging smaller modules, and adding modules as you need them.  Also you get the benefit of advanced debugging on the main processor as the tools available for it are more likely to be better than those available for a smaller chip.

I am working on such a module for my drive motors just now, I send messages such as ‘Forward 60mm’ to the board, and then the module takes over driving the motors, providing acceleration ramp up/down, and using pid control to ensure that to the best of my bots ability, it will move forward by 60mm.  This leaves my main processor (a raspberry pi in this instance) to worry about where to go, and leave the motors to get on with their job getting you there.  I personally use a CAN network to talk between modules, I use 1Mb/S transmissions, and because of the way bus arbritration works on CAN, I can ensure that a ‘STOP’ command to the motors is processed before a signal of lesser importance.  (I personally use CAN even though it is a little more expensive than other communication mediums because I use it at work, and have some really nice debugging tools for it)

As mentioned above, you are more likely to be successful starting small, but by building functional blocks for you bot, you are starting small, but by joining like you mentioned with the i2c, Your small systems soon become a very capable bot.

 

Good luck with your build :slight_smile:

Hi and welcome

Hi Paul, welcome and may I say now is the time to start building like no other. I like your reasoning about size and justification for the wife. : D

When I first saw AI in your question it’s hard not to think of a machine that can pass the Turing test but reading on further I think I can see what you really want is for the robot to be aware of it’s environment. In the first case I would have suggested a big computer but for a mapbuilding and planning robot the arduino mega should be fine.

I would not discount wheel encoders in your plans however as I believe of all the tools in your sensor kit they will be the most reliable and accurate. Someone can correct me if I’m wrong there.  You will soon find ultrasonics and infrared rangers can be a beast to tame giving different results under different conditions. Particularly the type of material they reflect from but also lighting, temperature and humidity as well. Also they do not give spot readings but a wide beam.

The compass also will have a degree of inaccuracy, perhaps not as much as the ranging sensors but other issues to affect them are stray magnetic fields in the environment , vibration and tilt. Although tilt compensated compasses are now easy to obtain.

Good luck with your ambitions.

Thanks all for the input.

Thanks all for the input. I’m well aware that creating an “intelligent” robot, which is more or less aware of it’s environment, is not an easy task given the limitations of an Arduino.(It indeed doesn’t have to pass the Turing test. lol) In fact I haven’t programmed anything with such small amount of RAM ever! The ideas I have might (probably) won’t work as envisioned, if at all, but it sure is fun trying and while doing so I’ll learn quite a bit as a bonus.

I did look at the PI, but I didn’t consider it because programming it will be a challenge and besides that: I have abandoned laptops in the attic with more RAM and processing power and I can program it in the language I want! Sure a laptop motherboard uses more power and is larger, but I can live with that.

But, if I want it the “easy” way I might as well buy some kind of interface and hook up sensors to my PC. Still a challenge, but not as fun as going back to basics and try to accomplish a task with microcontrollers. I think I’ll go for a (Funduino) Mega instead of the Due, it’s half as expensive and if I notice that my ideas work I can always buy a Due and use the Mega as a slave for other usefull things.

 

 

 

 

 

 

**I am curious why you think programming th RPi, or, **

any of its ilk would be a challenge? Anything like the RPi is running a linux distro. Most single board computers running a linux distro would allow you to install just about any language that suited your fancy. Python is pushed, because, it is an easy language to pick up and program in.

@ TheGangsta:Quote:" I am

@ TheGangsta:

Quote:

" I am working on such a module for my drive motors just now, I send messages such as ‘Forward 60mm’ to the board, and then the module takes over driving the motors, providing acceleration ramp up/down, and using pid control to ensure that to the best of my bots ability, it will move forward by 60mm. "

I envy your programming skills. I tried to do such a thing but with a poor result. I didn’t know how to make it work properly so I took a break from the project, to be back later with fresh ideas. Guess what, the break was too big, now I don’t even remember what I was trying to do. Sigh. Now I know why my robots sit there unfinished… I get a headache every time I try to do some programming on them. And I want to do complicated things before I can do the simpler ones… of course. Any suggestions, pseudo code, what ever i could adapt to work on my robot?

@Paul:

Wellcome to the active LMR! I am also better with the electronics than with telling the electrons how to move. I have the same goals as you do, although I already have some experience since I’ve been doing small parts of the large project already. So, what I have to say is, you need the encoders, the help your robot to travel certain distances or turn certain angles. For the angles you can use the compass to make corrections. The compass helps you not drive in a straight line, because it can be influenced by rebars in the floors for example, but it helps with knowing your orientation so you can decide where to go on th emap. To get the position on the map, you can triangulate (measure the distance in 3 directions, then calculate the intersection) and compare with the data from the map. For triangulation, use both US and IR sensors, like you said. There are other sensors you may want to use, depending on the final scope of the project. A PIR sensor or a near visible infrared sensor (temperature) can detect humans or pets, combine that with the distance sensors and you can follow or avoid them. All this happens in a 2D space, but our space has 3 dimensions. The best and easiest for 3D space is the Kinect sensor, but for that one you need at least a SBC or a notebook onboard. A LIDAR also works, but processing all that data is not easy. So, take it slowly, think it through and build it one module at a time, code it, test it, move to the next one. However, the hardware needs to be built with the whole project in mind, or you will later need to change things (this is what happened to me). Good luck and keep us posted with your progress!

I have been in that place before

"Guess what, the break was too big, now I don’t even remember what I was trying to do"

What I do these days is break the task up into smaller pieces and then make each piece do one thing and one thing only.
It’s easier to see what you meant to do and it’s usable in more than one place. Main ends up just being a heap of calls then.

It’s not a new idea it’s how I believe most professional programmers work. It would be worth your while to study this technique and methods used in top down problem solving.