Show Posts
Pages: 1 [2]
16  Forum 2005-2010 (read only) / Interfacing / Re: Ultrasonic Rangefinder (SRF05) Expected Results? on: November 19, 2008, 08:31:35 am
Yeah I've read both of those - my code does appear to be correct, and I'm getting consistent results; just not what I expected.

I've done as much research as I can into this before posting here.

Could you send me the code you use and some examples of results please? I think that might be helpful. I've tried both modes and get the same results. I've also tried it on two different Arduinos, with two different SRF05 sensors, so I really don't know what's going on!


17  Forum 2005-2010 (read only) / Interfacing / Re: Ultrasonic Rangefinder (SRF05) Expected Results? on: November 18, 2008, 06:21:09 pm
Hi teoxan, thanks for the reply.

I'm aware there are two operating modes for the SRF05. I'm using the single pin mode. However, dividing by 58 does not give results in cm.

Anything below 10cm, I get a 6 digit number. So for 5cm, I get a result of 500000. Above that (i.e. above 10cm), I get a 7 digit number. E.g., 20cm gives 2000000. Up until 100cm, if I removed the last 5 digits, I would get an approximate answer in cm. Above 100cm I still get a 7 digit number, and removing the last 4 digits would give me an approximate result in cm. It seems the result is truncated after 7 digits...

I'm not sure if the result is getting truncated or what (it's an unsigned long... so it shouldn't, I don't think). But I can't just cut off a constant number of digits, as >10cm and >100cm both give a 7 digit number.

Any ideas why this is? At the moment I'm using an unsigned long for the pulse duration, and for the distance. When displaying this result to the LCD, I'm using ltoa(), which presumably could be the cause of errors except for the fact that even outputting the raw values to serial gives the same results...

I'm a bit stumped here. I'm sure it's something obvious that I'm missing. But there is no way that dividing by 58 gives a cm result.



18  Forum 2005-2010 (read only) / Interfacing / Ultrasonic Rangefinder (SRF05) Expected Results? on: October 21, 2008, 10:08:46 am
Hi all,

I've wired up an SRF05 ultrasonic range finder to my Arduino, and used the sketch from here:

My results vary from around 220,000 downwards. Is this to be expected? The SRF05 tech page at robot electronics states that if you divide by 58, you get a result in cm. Evidently this is not the case.

Any ideas why? Is it usual to get such high readings from the sensor? It seems that the readings are accurate (around 20cm away, I get 200000, 10cm away I get approx 100000), and I've tried with two sensors so I don't think it's a hardware problem. It's just that the results don't match with what others seem to be getting. Possibly something to do with the serial communication and the omission of a decimal point somewhere?

Any ideas?
19  Forum 2005-2010 (read only) / Interfacing / Re: Two identical servos, different pulse width? on: October 02, 2008, 05:17:38 am
Not at all! It's just I am used to contributing to other 'n00bs' on linux fora etc., so I do try to do my research before asking the experts; in this case I could have done a little more reading first smiley-grin

I'm sure I'll be asking some more questions about this project in the near future. I'm off to find an ultrasonic rangefinder to continue my tinkering - I need to learn as much as I can before the dreaded real world job starts eating my time!

The reply wasn't flippant - it was just what I needed.

20  Forum 2005-2010 (read only) / Interfacing / Re: Two identical servos, different pulse width? on: October 01, 2008, 04:31:09 pm
OK thanks, I thought that might be the case. Sorry for the slightly obvious question, but I want to be sure of all these things before I move on to more complicated applications.


21  Forum 2005-2010 (read only) / Interfacing / Two identical servos, different pulse width? on: October 01, 2008, 08:11:15 am
Hello all,

I've just started playing with my (newish) Arduino, and have come up against my first issue, hence my first post smiley

I am ultimately looking to use the Arduino for a third year CS project (a bike computer) but at the moment I'm just trying to fiddle around with some servos.

I have two identical Futaba S3003 'standard' servos, connected to two output pins on the Arduino. They are currently being controlled by the 'MultipleServos' sketch which I nabbed from, and Python chatting to the Arduino via serial.

I don't have much experience with electronics, so please excuse my ignorance (Google and myself are well acquainted smiley-grin), but with this Arduino sketch, the MIN and MAX pulses are hard coded. So, if you connect more than one servo, they use the same pulse range. I thought this would be fine as I am using two identical servos. But, for one of them, the default range (MIN = 600, MAX = 2400) is fine, whilst for the other, it isn't.

The python code works by sending a servo ID and movement value (0-180) over the serial, which is converted to a pin number and pulse width. With one of the servos all values appear to work flawlessly. With the other, any value above 177 causes the servo to vibrate, presumably because it is vainly trying to push itself past its maximum movement range.

What is the best solution to this problem? Is is just to reduce the pulse range, and lose some degree of movement on the working servo? Or are my min/max pulse values wrong? Perhaps the working servo is not quite moving to its full extent in one direction? I tried looking for a Futaba S3003 datasheet without success.

Is it usual for identical servos to behave differently like this? I assume the movement range cannot be altered, so are my only options to reduce pulse width/change min/max values/limit movement values to [0-177]?

Cheers, any help is much appreciated. I hope I can soon be contributing something worthwhile instead of asking rambling questions!



I have found the datasheet, but this does not include any values regarding pulse timings. I guess there are approximate 'standard' values across most servos? I'll have a play with changing the pule widths to some other values suggested by various hobby sites.

// EDIT 2

By changing the MIN to 500 and MAX to 2300 things seem to be working OK, but there appears to be slightly shy of 180 degrees movement... am I missing something here? Or is it usual to get 'approximately' 180 degrees of movement?
22  Forum 2005-2010 (read only) / Exhibition / Re: SD card read/write with Arduino on: January 12, 2009, 10:14:53 am
Is it possible to change the Arduino pins that are used by the library? I can't seem to find any reference to the pin numbers in the library source code.



I've found out you need to use the SPI pins, so cannot change the pins in use by the SD card reader... time to get rewiring smiley-grin
Pages: 1 [2]