Showing posts with label Robocon. Show all posts
Showing posts with label Robocon. Show all posts

Sunday, 2 September 2012

Review on HRLV-MaxSonar®-EZ™ Sensors (MB1013) )

I have tried three different ultrasonic sensors, one from Devantech (I guess it was SRF05 but not so sure), one was the first series of MaxBotix when they had resolution of 1 inch and recently I tried MB1013 from high resolution series. With no doubt the last one was the best I have seen. I am going to use this sensor for a competition where I have to detect a wall with hight of 10 cm and my sensor is located 5 cm away from the ground and It did a very good job during our tests. I designed few different tests to see how much I can rely on my ultrasonic sensor.
I found a line of best fit for its output to make sure my reading are the best possible.
These are my points and their ADC reading:
Average ADC reading:                     Distance:
76.3929                                           40
126.9655172                                   65
176.0333333                                   90
226.3103448                                   115
256.8125                                         130
296.0714286                                   150

The best line fit:
y =   0.501x + 1.67
distance = 0.501  *  ADC_reading + 1.67

The equation works quite well. The ultrasonic has 3 different types of output:
1) Analog: which I like it, since it is fast, easy but less accurate compare to others but fine for me
2) Pulse width: a bit more complicated since you have to use a timer. I am using Arduino which does not have a lot of timer and for my robot, I will be using most of timers. If you want  very accurate result then go for next option.
3) Serial output: This is the most accurate output. But wasting a UART may not be a good idea. The other issue is that if you use interrupt to read your UART input, you have to turn other interrupts off which may not be suitable for some situation. If you read UART without interrupt it will take some time since the baud rate is 9600. (I may try this in future just for sake of accuracy)

they are two modes of reading the output from sensor:
1) free run:
It has a filter included and I prefer to use this since it has a filter.
2) Real time:
It has no filter and it will do its reading when you send a signal.

Now I start with tests.

Testing different material:
The sensor has the same output for different type of materials. I tried with metal sheet, carton and polystyrene.

Testing different shapes:
It could detect the cylinder without any issue from sides and it showed an accurate output. Flat surfaces are definitely detected and there is no issue with them.

Object with different size:
the size of object is not going to change the output.

Detecting the closest object:
Even if there is a big object at the back and small object in front, sensor output will be the distance to closest one.

Detecting 15 degrees ramp:
It could detect the ramp with acceptable accuracy from 30 cm to 15o cm. The length of the ramp is 60cm.

I used this ultrasonic on my robot and I think you have to consider the following if you are going to use one:
1) In the real time mode you do not get a very reliable reading (I tried it in a parking lot and I was not happy with it)

2) If you are using the free run mode, your readings are impressive, however you cannot move very fast because it takes some time for changes to appear on you reading. (This is what you should expect when you are using ultrasonic, I did some research and I found out that laser range finder can do a better job at much higher. Hopefully I will be making one laser range finder with my friend.)

3) If you are using the sensor very close (5 cm) to a surface which is not supposed to be detected, you have to make sure that the surface is flat. To give you an idea we had to wooden sheet next to each other with a gap around 1mm. The sensor was detecting the edge from 190 cm. It was detecting the edge of the gap (located at 190cm) instead of the wall which was located ~240 cm away.

Conclusion:
A good sensor for application where respond time can have a delay of 1s. Accuracy is good. Sensor has 3 different outputs which make them easier to use. If you want to have a fast robot forget about ultrasonic and go for laser range finder.

Wednesday, 21 March 2012

Vexta DC Brushless Motor Running with PWM

If you live in Malaysia and Cytron is one of your resources, you should have seen all those expensive brush less motors called Vexta. They come with a gearbox and a speed controller.
I looked at the data sheet and I did not see anything about PWM, so I tried to use PWM to control it and I failed. I was using a roughly 60KHz PWM and it did not work. I tried with 16MHz and I am getting a very good result from them. I am using an AVR board which has an Atmega 1280 on it.
I just wrote the following program to make it work.
////////////////////

  int a=0;
      while(1)
      {
      OCR0A=a;
      OCR0B=a;
      a+=10;
      delay_ms(3000);   //delay_us(500)
        if(a>240)
        {
        a=0;
        }
   
      }
//////////////////////
necessary registers are the following:

PORTB=0x00;
DDRB=0x80;



TCCR0A=0x83;
TCCR0B=0x01;
TCNT0=0x00;
OCR0A=0x00;
OCR0B=0x00;

Keep in mind that I was using a 16MHz clock.


There is something else that I have to share, in the catalog there is a page called connection and operation, in that page all on are indicating gnd and all off the indicate +5 (High). (I don't know why)
So in order to run it with PWM, this is what you do with the speed controller:

PIN 1: not connected
PIN 2: not connected
PIN 3: GND
PIN 4: GND
PIN 5: PWM
PIN 6: not connected
PIN 7: +5V (HIGH)

PIN 8: +5V (HIGH)
PIN 9: GND for clockwise. 1 for counter clockwise
PIN 10: GND
PIN 11: GND

This is the video of the Vexta motor running.

Thursday, 2 February 2012

Which Xbee to buy?

The first thing is about Xbee which is so important is to consider that:
1) XBEE ZNET 2.5 used to be call " 2  series "
2) 802.15.4 used to be call " 1 series "

Version 2 is better because of following:
1) energy saving
2) range (It is too much difference, I loved my series 2 because of its amazing range)
3) being more complicated and therefore more application on bigger networks

Each of the group mentioned above has two type:
1)Pro
2) normal one

As far as I know the Pro version can support longer distance.

Now, I do recommend you to use Series 1 if you are not familiar with Xbee and I think you are not or else you would not read this :D

Keep in mind that your Xbee's serial communication is at 3.3 volt and not 5. Although mine works with both. The data sheet asks for 3.3 volts.

Xbee comes in different type of antenna and power output, make sure you use the one which meets your needs. I can't give you any opinion how to pick the right one because I have 2 different types of them.

Fact: it is really hard to burn a Xbee, I have tried many different things and I was never successful :D
I finally burnt one. :) It receives data when there is no other Xbee around.

I do recommend you buy a break out with FTDI like this or this
It is good to have something like this too. Although, it does not do much.

If you but series 1 this is how you can simply use them, Here.
If for some reasons you have 2 series, do not worry, just read this.

How to test Xbee Series 2 (s2)?

Well, I assume you have one of your Xbee is connected to the computer using a breakout and FTDI 232. something like this or this. (many other company are making the similar ones) The other one has something like this and Rx and Tx (in the case of sparkfun Din and Dout) are connected to each other/ which means that whatever will be send will be received too.

Make sure you have download X-CTU from digi website.

Run the program and you have to connect the serial port which is connected to FTDI, when I tried the name was "COME XX". Go to the modem configuration tab and click on read, if it asked for reset, just connect Xbee's pin 5 to Xbee's pin 10. Check the DH and DL. Keep the number somewhere.

This is the easiest way I found to test my Xbees 2 series.
1) make one as a coordinator AT (AT and API is well explained in Data sheet provided by Digi)
2) make sure that you use DH and DL of your other Xbee.
3) change packetization time to zero (this will send any data available for sending if you choose any other number it will wait for that period and if they were any other data coming, it will send them in one packet)
4) take the other one and program it as router/end device AT
5)  make sure that you use DH and DL of your other Xbee. 
6)  change packetization time to zero (this will send any data available for sending if you choose any other number it will wait for that period and if they were any other data coming, it will send them in one packet)

now you can go to the terminal tab and see if you get whatever you type in red or not, if you do that means everything is working, if not there is still one hope. Change all possible values in networking and address to the same value in the other one. Read the description about each value, if it could be a reason then change them first and try. If it was not still working read the God damn Data sheet. :D

Hint: do not give up easily, one does not simply burn a Xbee. :)

How to test Xbee series 1 (s1)?

Well, I assume you have one of your Xbee is connected to the computer using a breakout and FTDI 232. something like this or this. (many other company are making the similar ones) The other one has something like this and Rx and Tx (in the case of sparkfun Din and Dout) are connected to each other/ which means that whatever will be send will be received too.

Make sure you have download X-CTU from digi website.
Run the program and you have to connect the serial port which is connected to FTDI, when I tried the name was "COME XX". now you can go to the terminal tab and see if you get whatever you type in red or not, if you do that means everything is working, if you don't then click on modem configuration and click on read. If it asked to reset your Xbee, connect pin 5 of Xbee to pin 10. After that write the original version of your Xbee on it. Try the same thing with the other Xbee. Try again and you should be fine, if not just ask me. I am not that used to Xbee myself yet but I guess now you can be happy that your Xbees work fine. You may go to range test tap and play around with it.