Vending machine / robot project advice

Yes, that is the one I am using

I may do some experimenting seeing if I can just carry on a while ignoring the blank replies and carry on blind until it picks up a reading again?
but I would like to be able to measure movement along the floor somehow (and turn) so any ideas on how to do this would be much appreciated?
I am new to robots so there may be something obvious way that I do not know about....

I was wondering how you plan on dealing with power. Won't it require mains voltage to run the machine?

Cool progress!

hoff70:
I was wondering how you plan on dealing with power. Won't it require mains voltage to run the machine?
Cool progress!

I am using a cordless drill battery at the moment, but it is not a very good one - so battery is on the list of problems to solve :wink:
maybe eventually get the robot to dock into a charging station of some kind?

The drinks machine uses mains but the robot just has to put the cup into the right place (how to accurately line it up is another problem yet to be solved :wink:

Progress update

I have 3 ultrasound sensors on it and am navigating round just using this
it is a bit hit and miss but progress is being made

(see later video at bottom of this page)

That really is an impressive leap forward you've made there!

strykeroz:
That really is an impressive leap forward you've made there!

Thanks :slight_smile:
I must admit, it is actually starting to fall into place quiet well now...

There is no intelligence in the code, it is just following simple instructions like move back until front sensor reading at 30cm, turn right until right sensor at 10cm etc. etc.

i.e.
// command format = mode , direction to move , setting , sensor to use
// modes
// 1 = set time
// 2 = find a distance (moving towards)
// 3 = find a distance (moving away from)
// 4 = until distance greater than
// 5 = until distance less than

warning_sound(2);
move_robot( 2 , "reverse" , 75 , "front" );
move_robot( 1 , "left" , 1500 , "" );
move_robot( 2 , "left" , 72 , "right" );
move_robot( 2 , "forward" , 65 , "front" );
move_robot( 1 , "right" , 1500 , "" );
move_robot( 2 , "right" , 55 , "left" ); // left towards vending machine
move_robot( 1 , "forward" , 4500 , "" );
move_robot( 1 , "left" , 500 , "" );
move_robot( 1 , "forward" , 4000 , "" );
move_robot( 1 , "right" , 300 , "" );
move_robot( 2 , "forward" , 40 , "front" );
move_robot( 1 , "left" , 1600 , "" );
move_robot( 2 , "left" , 27 , "right" );
move_robot( 1 , "forward" , 9400 , "" );
move_robot( 2 , "forward" , 45 , "front" ); // out of library door
move_robot( 1 , "right" , 1500 , "" );
move_robot( 2 , "right" , 33 , "left" );
move_robot( 3 , "forward" , 35 , "right" ); // forward until right is less than 35 (get fix at door frame)

in areas where there is poor returns coming from the sensors I tell it to run a set length of time then pick up a wall when it is close enough to get a good fix or say run until right sensor reading less ten 30cm etc. etc.

  • this works surprisingly well as when it starts to drift off line then next measurement will tend to bring it back in line

there is a lot more work to do on the code but here it is so far for what it is worth:
http://homepage.ntlworld.com/alan.blackham/arduino/robot%20code%201.txt

Update 3:

lol - I need to give it a rest for a while, I may be getting obsessed :wink:

anyway, I have just done a proof of concept with a full cup of coffee
it is definitely feasible (much to my own surprise, never mind anyone else)

That's actually quite stable isn't it. From the fire extinguishers nearby I take it you had a somewhat pessimistic outlook prior this experiement? :astonished:

strykeroz:
That's actually quite stable isn't it. From the fire extinguishers nearby I take it you had a somewhat pessimistic outlook prior this experiement? :astonished:

Yes, it couldn't have worked out better really, surprising not only because it is a first attempt but because this robot was actually just supposed to be a cheap and cheerful training testbed for getting myself some experience of what would be needed !

I nearly needed the fire extinguishers yesterday :wink:
I connected my battery to my bench power supply to put some charge in it and got the wires the wrong way round - completely toasted a diode in the power supply with lots of smoke.........

Just another update on progress !

I have spent many, many hours; working on the code, rewriting, experimenting etc. etc,
I decided to have another look at the PS2 optical mouse as there are many situations where ultrasound wont work or it is not enough - I have got this mounted underneath the robot and it is now proving helpful
btw - I think when I tried it before I wasn't sampling the data from the mouse fast enough, it is still not 100 percent reliable, but good enough to help

I am finding (as is probably already well known in the world of robots) that the concept of navigating round with a few sensors is very easy but the reality in the real world is a whole different thing, there are so many things can go wrong or give false signals.........

but, progress is still being made (if more slowly now)
here is the latest video which shows it doing a complete one way journey from th vending machine to where I sit
it is still not totally reliable but it has now done this journey three times in a row

btw - I have created a "blog" of the project here: AlanEsq.com is for sale | HugeDomains

Latest news:
I have just had it take my cup from the coffee table, all the way to the vending machine and get a drink dispensed !!
It is a bit hit and miss and I doubt it would manage to do it 2 times in a row without any problem, but it has managed at least once to work :slight_smile:

here is a video of it collecting a drink - - YouTube

I think my biggest problem now is the caster I am using at the back, when the robot has been turning and tries to go in a straight line again it tends to throw it off course. I have ordered an omnidirectional caster which I am hoping will resolve this problem but it is coming from the USA so may take a while to arrive.
Until I get this I don't think there is much more I can do.

UPDATE: IT IS OK, I HAVE SORTED THIS PROBLEM :slight_smile:
just had to comment out a line in the servo.h file to stop it using timer1

Can someone give me some advice regarding timed interrupts please:

I have fitted a servo to the front ultrasound sensor so I can rotate it round, this is going to help a lot as I will be able to check if the wall in front or to the side is square on or not using this.

Problem is, when I came to use the servo I found my sketch wont compile :frowning:
Comes up with an error saying Vector17 has already been defined ????
I have tracked the problem down to my using a timed interrupt in my robot sketch, if I disable this then all works ok

I presume this is because the servo library is trying to use the same timer that I am? as I am using a mega I understand I have timers 4,5 and 6 I can use instead but when I try to change the script it still gives the error

the interrupt code I have is below, if anyone can help out it would be much appreciated (I must admit I don't really understand all this interrupt stuff, just copied the code from elsewhere)

alanesq:
here is a video of it collecting a drink - http://youtu.be/IEv-7nvYL1M

Just magnificent. If we could teach it to do stairs I'd be adding this to my project list too :wink:

lol - maybe next year :wink:

I am getting close now to having it ready to start using
One of the main problems I am having is the PS2 mouse seems to occasionally just stop responding and this results in the robot going off in a random direction until it crashes :frowning:

Just a final update:

The robot is now pretty much finished and is working well :slight_smile:

I still have a problem with the PS2 mouse occasionally just stopping responding - I am still looking into this
but apart from that it is collecting a drink ok pretty much most attempts

full video here: Drinks robot (vending machine) - YouTube