This is a first attempt at building a robot. For now it is able to follow a line, and to drive around free with obstacle avoidance. In the near future I will program it to follow someone/thing, and in the far future I will try to let it solve a maze. ie. find it's predefined goal in a maze. The programming bit wasn't the hardest for me as I am studying Computer Science. It was the electronics that I really had to dive into. But in the end that was also not the hardest. I really enjoyed building my first robot and I think many will follow.
The parts that I used for this robots are:
Mini Bot Board II
Atom Basic Pro
2x Continous rotation servo
1x 180 degree servo
Ping))) Ultra Sound sensor
Tracker sensor (3x Infrared sensors)
I am already busy in designing a wooden chasis for it. So the Rebel II is already being desinged. I hope I can soon upload some videos of it running. Also I will make the source code available if someone is interested.
Tell me what you think of it? some suggestions for improvement, critisism, all is welcome.
UPDATE:
added 3 videos. In the first video rebel is following a line. In the second one it is navigating around and avoiding obstacles. In the third video, at the end, the batteries fell off and he dragged his guts around :P
Line following, Driving around free with obstacle avoidance
Actuators / output devices: 2x Continous Rotation servo's for wheels, 1x 180 degree servo for controlling
Control method: Full autonomous
CPU: Atom Basic Pro on a Mini Bot Board II
Operating system: AtomBasic
Power source: 9 Volt for powering the board, 4x AA (1.2V) for powering the servo's
Cool, I thought it could walk at first, looks like legs
Have you got a picture from the side?
AtomBasic!?! Can you dump some code? Like, how do you turn the servo? How is the tracker sensor made? Prefab? From where, which (programming) interface?
Thanks for sharing it, and welcome to the club of us who creates life
(You ask for critisism - but without video and / or pictures from the side it is very hard to judge… But it looks cool I would like it for cristmas as it is, just to try some code on it etc)
I will try to make more pictures tomorrow and also shoot some videos. The track sensor is indeed prefab for me as a non-electronic guy, never soldered anything, this seemed the best solution imho. I will try to make one myself one day, as I understand more of the electronics. AtomBasic is almost the same basic language (with slight differences) as the basic language for the picaxe, and/or basic stamp microcontrollers.
To make a servo turn you would write (servo on pin 0):
servopin CON P0
Main: Pulsout servopin, 4800 Pause 20 Goto Main
With this code the continuous rotation servo would go full speed forward, and the normal servo would turn totally left. Turning totally right (or driving backwards) would be a pulslength 1000 and centering (or stopping) is 3900. I think this code is almost Identical to that of the picaxe (except for the pulslenghts of course).
Thank you for your reaction, your robots are a great inspiration for me, and your site is really great!
It is in fact not me who is a genius, it is just because I use Picaxe; You can never do that kind of thing with any of the other systems…
With Picaxe you just write
servo 0, 150
main:
'Do funny stuff
goto main
- And so, while you are doing funny stuff, the Picaxe keeps that pulse going… Just untill you turn off the pin (pin0 = 0) - or turn the servo somewhere else (servo 0, 225)
It is almost like multitasking. Yes, I said it; Multitasking in Picaxe!
PS: I am also a “non-electronic guy”! Don’t let it stop you, we can get pre-made everything
Indeed it took me some time Indeed it took me some time to get the navigation as smooth as you in https://www.robotshop.com/letsmakerobots/node/254 but with some “smart” programming, and trial and error I managed to get the same results.
As I’m sure you know, the Arduino does support the same ability if you use the ServoTimer library, but it can only do it on two pins, 9 and 10. If you use the regular Servo library, you can control servos on any pins you want, but you have to call the Servo::refresh() function at least every 50ms, which is not really much better than the Basic Stamp way of doing it. From what I understand, on the Picaxe you can control more than two servos with those servo commands. Is that right, Picaxers? If so, then the Picaxe is still a step ahead in that respect But if you only have one or two servos to control, then the Arduino does just as well.
Unfortunately, as far as I know that’s not right. PWM just means toggling the voltage between on and off at a certain rate to end up with a voltage in between – if you’ve got 5V and you want to get 2V, you just need to switch the line HIGH for 2/5 of the time and LOW for 3/5 of the time. But the total length of the cycle can vary. You could use 50ms (HIGH for 20ms and LOW for 30ms) or 10ms (HIGH for 4ms and LOW for 6ms), etc. As long as the ratio is 2/3, you’ll end up with an average voltage of 2V. Most microcontrollers that offer PWM seem to use really really short cycles, in the microsecond range.
Servos also use PWM for their signals, but they need a specific type of PWM – namely, the total length of the cycle has to be 20ms. If you look at the documentation for analogWrite that you linked to, they mention that the frequency of the Arduino’s PWM signal is about 490 Hz, which means that one cycle lasts 1/490 of a second, or about 2ms. So the pulses would be about 10 times too fast for the servo to understand them.
That’s why they wrote the Servo library, which manually outputs the PWM pulses at the right rate when you call Servo::refresh(), and the ServoTimer1 library, which uses the Arduino’s hardware timers to maintain the PWM pulse in hardware, but the Arduino only has 2 hardware timers, connected to pins 9 and 10, so you can only use that library on those two pins.
With all that said, I’ve never actually tried hooking up a servo to one of the other PWM pins and trying to control it, so I guess I don’t know for a fact that it wouldn’t work. But I figure that if it did work that way, they probably wouldn’t have bothered to write those other libraries