Lynx

05/01/09

Hi, I discovered this site about a week ago and since then I have decided I have to build a robot. I have been experimenting with PIC microcontrollers over the last couple of months anyway so I decided building a robot would be a good opportunity to implement some of the skills I have learnt. I have no previous robot building experience (with the exception of building 'Cybot' from 'Real Robots' magazine. To be honest I didn't know what I was doing, I just followed the instructions.)

 

***INTRODUCTION***

Once I'd decided I wanted to build a robot I wanted to get my hands on the parts straight away. I had a look at the start here robot and worked out to build it it was going to cost me quite a bit of money. A bit more than I wanted to be spending at the moment and long waits for shipping. For this reason I decided I was going to scavenge parts. The handheld 'dust-buster' broke so I scavenged a motor out of there and I thought I was sorted. I soon found that that motor had a stall current of over 60A. Very quickly I realised this motor was clearly not suitable and would require a very high powered motor driver. I rethought the whole situation and read around here and decided to go for a L293D based motor controller to power two 'Solarbotics' motors with a stall of 600mA each. This was when I worked out there was a better way to go for cost and speed of access to materials. I decided I was going to get the cheapest RC car I could...

 

***FIRST STAGE***

I went down to the local retail park and picked up a small RC motor for about £5 hoping to at least get a small servo out of it. First thing was to check it worked it did so now I was going to pull it apart. Took the cover off and found there was no servo (initial disappointment!) then I realised that it had two small DC motors; one driving the back wheels and one for steering the front. The first step for me was to get a look at the PCB. The PCB was made entirely of discrete components with the exception of one of the black 'blob' looking processor things in the middle. After a long look at the PCB I highlighted where abouts the receiver was and where the motor drivers were (It's a H-bridge style circuit I believe). I carefully chopped straight through the middle of the processor (was the best route I thought. ;)) I then replaced a couple of resistors and drilled a few holes for wires that were needed (power and ground etc hat were on other half of board).

After that carry on I attached a socket to the four pins that were attached to the processor and to my amazement the thing worked despite being slaughtered by my wire cutters. There are four pins when taken high each functions as below...

1. Forward

2. Backward

3. Wheels left

4. Wheels right

If wheels are driven bough forward and back at once etc. bad stuff happens (3A or so flows). The motor driving the wheels has a stall of about 1.5A at 4.5V driving the motor driver and the motor steering the wheels stalls constantly which is how it operates and it stalls at around 600mA.

At this point I could really start to see how the PIC is going to control the robot. I screwed the bit of PCB remaining down and used a small 'blob' of hot glue to hold it firm. I also added four PCB standoffs to attach a second tier to (attached with hot glue gun too). I then wasn't sure what to use as a light but rigid second tier floor. I eventually settled on using the packaging from my PICkit2 from Microchip. I cut a rectangle out, rounded the edges off, drilled the holes and bolted it to the standoffs (I can attach another floor to the standoffs when I need too). I next added a switch to turn the motors on and off located at the back of the robot attached with hot glue. The leads protruding at the moment are for the battery. There is a compartment for 3xAAA but at the moment I'm using a power pack while it's on the desk on it's back. I've got to get a power board sorted yet.

Things I'm adding next...

Led indicator to signal that motors are turned on.

 

***FUTURE IDEAS***

Need to add a small board probably on second tier maybe with two small relays to select whether the PWM output of the PIC is on the forward pin or the reverse and on the right or left for steering. This stops bad things happening when both forward and backward or left and right are selected at once! This will also allow me to use the PIC16F628 initially which is useful because I'm familiar with it.

Power distribution board probably on the second tier too (second tiers looking full already ;)). I'm not regulating the voltage I don't think and just going to feed everything from the 3xAAA for now and see how it goes. Might get away with it. Can handle the power but don't know about PIC getting an unregulated voltage but we'll see. I think I'll see about regulating it to between 3 and 4 somehow for the PIC.

In the more distant future I hope to add a sensor to the front (for now) but I'm not sure which yet. May go sharp IR but may go the ultrasonic transceiver. I'm thinking I'll mount it on a small servo. Still thinking yet though. Need some headlights (obviously =P). I'll have the PIC and sensor power etc. switched separately to the motor power ie. I'll add another switch.

Well I think that's about it for now... Sorry about the poor pictures (I'm not good with a camera!). Any questions, advice or feedback then please fire away. This seems a very cool place by the way! =]]

 

-----------------------------------------------------------------------------------------------------------------------------------------

05/01/09

I added the LED to the top of the switch which indicates when the motors are powered up. It is really only viewable when viewed straight-on. That works out pretty well so that it's discrete and not too out of place.

 

-----------------------------------------------------------------------------------------------------------------------------------------

07/01/09

I've drawn up a schematic for the board that is going after the microcontroller but before the motor driver board. It will be there to select whether the PWM signal is going into driving the wheels forward or backwards and select whether the wheels are going left or right. It will ensure there is never a 'shoot through' situation where the wheels try to go forward and back ward or left and right at the same time. The PCB has two of the pictured schematic on.

The next update I'll make here will be when I have populated the PCB and have the motors being driven by a PWM test program on my proto board. Then once the board is confirmed to be working and all seems to be going as planned the board will then be mounted on robot and work on the power board commenced.


This is a companion discussion topic for the original entry at https://community.robotshop.com/robots/show/lynx

i like the platform you

i like the platform you chose…that mini RC car and that you found your H bridge on there

curios on what kind of sensors you will be using and how fast can that little thing go?

 

speed

Because of the speed that some RC cars have i think you might need to use PWM to slow things down depending on what you want to do

Thanks And About The Speed…

First off about what sensors I’m going to use…

I’m thinking about using a ultrasonic sensor such as the SRF05 or an IR sensor such as one of the Sharp IR sensors. If it’s analogue I’ll hook it up to the ADC on the PIC or otherwise just straight onto one of the PICs digital input pins. Any recommendations?

As for the speed…

Don’t get me wrong this thing can be quite ‘zippy’ but I am going to use PWM. I have a feeling that the original RC car was actually using PWM on it’s motors anyway (to stop it going crazy) controlled from the processor that was on the board. I’m hoping to have it go slow when it’s maneuvering (about this speed (https://www.robotshop.com/letsmakerobots/node/2743)) but speed up to go almost as fast as it can if it detects a lot of free space in front of it (1m maybe). Just got to see how it goes.

Fyi; The code on the wall

Fyi; The code on the wall racers “does not include PWM”…

But they do drive by PWM!

Confused?

The code is made to make constant ajustments; The result is that if something is in front, it is in fact slowing down, because the motor / relays gets on/off’s all the time… and then, as you dream off, it get’s full speed when nothing is in front.

My drift is; I’d recomend you to make the code take care of the speed, just set up rules for the thing and let it decide… and let it decide thousands of times pr minute, as fast as the microcontroller can decide / the relays can click. Result is what you want, but in a much more dynamic way.

This kind of project is - in other words - very diferent from a slow tracked robot. To that kind of project, I’d recomend you to hard code any action. But a robot that drives fast, has inertia, slides - that needs to be “it’s own master” regarding such things as PWM.

It may be a hard project, codewise, best of luck :slight_smile:

Code And PWM

Frits,

I intend to use a PIC16F628 running on the 4Mhz INTRC oscillator and I’ll be writing the program in assembly code. I will use the CCP module on the PIC to do the PWM. That will mean it will run constantly in the background once initialized and all I will have to do is write to a register to set the duty cycle. What I’m saying is that say for instance the robot is driving along with nothing in front of it, I will write a long duty cycle (100% maybe) to the relevant register. Now the robot will continue to run at that speed until I write a different value to the register. Soon as I detect anything ahead (say at 1m) I’ll write a new value to the PWM so that the duty cycle will be short (10% duty cycle maybe) to slow the robot down. That way the robot will slow while closing in on the object. That way when the robot is close to the object (15cm) it can take action to avoid the object. Because the robot has already slowed down drastically it hopefully won’t skid when turning and will be able to maneuver with precision. So whenever the robot is near anything else it will be going slow.

To start with I’ll be running the robot at a slow speed constantly so I can follow whats going on. I can then speed up at suitable locations later on.

Does that make sense? =)

Sure, it makes sense :)And I

Sure, it makes sense :slight_smile:

And I am pretty sure you will be taken by surprise by the speed things happen, how physics will not do as you think it should, and you will have to redo your code many, many times :slight_smile:

Coding something that has inertia & drives like a car as opposite to steering with to motors driving the 2 sides is a pretty hard starter-task. I know many experienced programmers have had to give up on it - even when it was a robot they made long after they had moved from more steady creations.

But go for it, what can happen? :slight_smile:

Thanks for your advice
Thanks for your advice Frits. I’ll see how it goes. I learnt something a short while back which is never assume any code is going to be quick and easy. It always takes longer than you think. It’d be no fun if there wasn’t any challenge. :wink: