Help regarding auto matic Robot using QUICK START BOARD...
RITESH KAKKAR
Posts: 254
Hi Guys,
Please help me too complete this automatic robot, the working of this robot start with single press and the bot has to complete the task based on logic used in code...this video has three robot manual, automatic and collector all have to do different task as shown in animation film.
So, please have a look on this video for understanding it rule and task.
The Mechanical design and motor driver with encoder on whel are working, I am using DC metal gear motor for driving Bot and H-BRIDGES of L398 for controlling and encoder are mounted on wheel using photo transistor and IR TX which gives serial output form data....On one revolution 8 serial pulses are form.
The rule and theme are here. http://www.roboconindia.com/frmtheme2012.aspx
and game rule are here. http://www.roboconindia.com/frmtheme2012.aspx
Thanks
Please help me too complete this automatic robot, the working of this robot start with single press and the bot has to complete the task based on logic used in code...this video has three robot manual, automatic and collector all have to do different task as shown in animation film.
So, please have a look on this video for understanding it rule and task.
The Mechanical design and motor driver with encoder on whel are working, I am using DC metal gear motor for driving Bot and H-BRIDGES of L398 for controlling and encoder are mounted on wheel using photo transistor and IR TX which gives serial output form data....On one revolution 8 serial pulses are form.
The rule and theme are here. http://www.roboconindia.com/frmtheme2012.aspx
and game rule are here. http://www.roboconindia.com/frmtheme2012.aspx
Thanks
Comments
1) You need to get batteries that are appropriate for the motors you have. You may already have that, but since I didn't see it in the picture I need to point that out.
2) You need a power source for your propeller quick start board, if it is going to be the brains. An alternate approach is to use a lap top as your main cpu and the quick start board as an I/O interface to your H -Bridge, your sensor and your encoder.
a) If you are using a laptop, your quickstart board will be powered though the USB
b) If you are using an onboard power supply you can supply 4-9v to pin 40(+) and 39 (-)
c) If you have a regulated 3.3v supply you can plug that in through J4 (I think)
3) Connect your H-Bridge circuits to some pins on your board. For each motor you will use two pins on the propeller.
4) Write some SPIN code (or PASM if you prefer) to set the two pins to the motor code to set the pins low low, high low, low high with a couple seconds pause between each transition. The motor should stop and then go in two directions.
Getting the quickstart card to control the H-brdige is a good first step. Once you get that started we can help you with the encoder, the sensors, and so on.
Hi,
I have tested the H-BRIDGES with QS using PWM also working fine..!!
so, I need to go for encoder with propeller using some count depend according to rule (they can be changed after hardware working)..
so, i want to control both motors and encoder for now .
thanks
There is an object in the OBEX, written by Kye, for using PWM on two motors.
I know Kye also has an object for controlling a single motor with a quadrature encoder. The problem with that object is it requires the motor to have a quadrature encoder (two pulses 90 degrees out of phase). I think your encoders are just single pulse types.
I don't know of an object that monitors a single pulse encoder. I think one could monitor a single pulse encoder with Spin by using counters. I personally have very little experience using the Propeller's counters. I tend to just copy parts of other programs that use counters when I need them in my programs.
I'll try to find an example of a program that can count pulses.
If I remember correctly, your encoders output 8 pulses per revolution of the wheel. It might be difficult to control the motors well with only 8 pulses per revolution.
I've been working on a project off and on to drive four motors each with a quadrature encoder. I've found it difficult to maintain a desired speed with encoders that output 333 pulses per revolution. This doesn't mean one can't control a robot with only 8 pulses per revolution, just that I don't know how to do it.
Hopefully your motors will be well matched to each other so they will both drive at the same speed given the same PWM signal.
Have you been able to read the encoders with the QS yet?
It sounds like you have been able to output a PWM to a motor. Can you control both motors using PWM from the QS?
If your encoders run on 5V, you'll want to use 3.3K to 10K resistors between the encoder and the QS so the 5V pulses don't damage the Propeller chip.
Please let us know more information about the encoders. I'll be looking for an example of a program that can count pulses.
Here's the part that counts pulses.
I'm guessing you'd just have the pulses counted in the background and check phsa every so often to see how many new pulses were counted.
I'm thinking the code would be something like this.
This is just a guess on my part of how the counters are working. You'd probably want to adjust the speeds of the motors based on how different the values of phsa and phsb are from each other.
I hope someone with more counter knowledge and experience will jump in to correct me.
Mecanum wheels, I'm guessing?
HI,
I have control one motor only using PWM in one direction...
and i am not able to read without any code!!
Here is my algorithm of automatic robot...
1. on pressing switch the robot start to move straight for few meters that will be counted by encoder mounted on wheel on one revolution 8 pulses will be there.
2. then stop lift the load with help of rack, then move backward less than starting position.
3. while moving in back direction stop and rotate 90* with help of encoder.
Note: i am using PWM to match the speed of both driving wheel both motor rated for same RPM!!)
so, i need object in which i can change the encoder number and PWM for both motors.
Let's start with just driving both motors using PWM.
I modified Kye's demo program to drive forward then backward. The backward amount is a little more than the forward amount. These amounts can easily be changed this is just to make sure the PWM object can control your motors.
When we get this to work, we can add encoders.
Here's my version of the program:
I chose motor control pins that are connected to LEDs on the QuickStart board. The LEDs (on left side of QS) should get brighter as the motors go faster.
Here is the section that assigns the motor control pins:
The current code only drives the motors up to half speed. We can change the speed and ramp amounts later.
_DefaultForwardTime is how long the robot will travel forward in 20ms units. So when _DefaultForwardTime is set to equal 50, then the robot will travel forward for one second. This time does not include the time it takes to robot to "ramp up" to speed or the time for the robot to slow down to a stop.
The LED on the right side of the QS should blink when the program is finished.
This program compiles but I have not tested it with any motors. I did trying on a QS board and the LEDs on pins 20 and 22 get brighter and then dimmer followed by the LEDs on pins 21 and 23 also getting brighter and then dimmer. So I think it should work.
I'll try to get some motors and encoders setup here so I can test the program too.
Please let me know if this works in your robot. Once you can control both motors, we can start working on adding the encoders.
@erco, so as not to hijack Ritesh's thread too much, I posted my reply here.
Do you have your button circuit made?
Are you going to use a button or a switch? I suppose the switch could just be the power switch but if you want to use a push button, use a circuit like this:
(Sorry if you already know this stuff.)
In this circuit the pin is normally pulled high. When the button is pressed the pin will go low.
It is also possible to use the QuickStart's touchpads as a start button. Jose uses the QS touchpads with his converted Boe-Bot. I don't think I'd suggest using the touchpads in this case. They aren't as reliable as a normal push button.
Let me know what kind of button or switch you plan to use so I can include it in the next update to the code.
Hi,
How to change the speed of motor i.e. PWM AND direction of motor from code..
I am not getting as the calculation is based on encoder distance not by time delay because time delay will not work fine at all..(i think)
This part of the code changes the speed of the motors.
The motors change speed from being stopped to rotating at half their maximum speed since "_ForwardSpeed" was set to 500. The possible speed values in Kye's object range from -1000 (full speed backward) to 1000 (full speed forward). A speed of zero is stopped.
As I said here:
and here:
I was hoping you could control both motors before adding the encoders.
Once again, I feel like you don't read my posts very carefully.
If you're having trouble understanding English, you might be able to use Google Translate to translate the post into a language you are more comfortable reading.
It would help me understand your posts better if you used question marks when asking a question. There have been several times when I'm not sure if you're just telling me something or asking a question.
The program I posted above should move your robot forward and then backward.
Hi,
The code is working fine in both direction as i change the sign.....but why you are changing speed slowly not fast??
what the reasons??
How fast the speed changes if determined by the constant "_ForwardRamp". I just set this to equal 1 to test that the motors work correct. You can make the robot change speed much faster by changing this part of code:
Try:
or some other value for "_ForwardRamp".
The robot will likely travel staighter if you ramp up to speed instead of just setting the speed at the highest value. It's also easier on the motors if they are ramped up to speed.
This is good. It would be good to have a way of monitoring the encoder readings.
You'd you be able to use a computer to use Parallax Serial Terminal with the QS and have the QS also connected to the motors and encoders?
Yesterday, last year participation of this event has suggest not to use encoder for measuring distance because the surface on which robot will run will be very smooth so, there are chances of slipping wheel so, if this happen using encoder will make incorrect judgment as there are white block on arena line follower with counter will be better..
Do you think this can happen???
My guess is it's easy to get a line following robot to drive straight than it is to use encoders for driving straight. I don't have much experience with either system so I'm hoping someone else will let us know what they think about these alternatives.
Does the robot drive very straight with the current PWM program? Have you tried driving the robot on different surfaces to see if it has more trouble with one kind of surface than another?
If i want to use counter for many purposes, please tell how to write code for that???
I think I already showed you about all I know about counters. As I mentioned before, I've just copied code from other programs that use counters when I've wanted to use them. Counters are one aspect of the Propeller I'd like to learn more about.
It is not clear as to what you wish to count...
@Duane Degn
I know you know, but you can learn a lot just by google searching a name...
You are a patient man Duane Degn...
-Tommy
HI,
Here are some pic of our team for Robocon (more than 2,000km from my home)....
Those are fun pictures. Thanks for posting them.
Did you have fun?
Are you in picture "6.jpg"? If so, which one are you?
You guys look pretty tired in some of those pictures (especially in 9.jpg).
Yes with learning... second from right. Because we were continuously working 24hrs