Using the Arduino Robot as R2-D2's feet!

Hi everyone,

Basically, next week we are running a children's music project with a Star Wars theme and we are converting the hall into the Millennium Falcon. We have laser's and smoke with people coming dressed up as every character and even small people as Ewoks. Anyway we have realised that we are missing an R2-D2! So we have sculpted him/her/it from polystyrene and decorated it accordingly, we left enough space at the bottom to fit the Arduino Robot (the offical platform) to move the model around. We ordered a HC-SR04 ultrasound sensor using the very last pennies of the project and it appears that we cannot use it due to it being digital?

Could anybody help us, the kids would be amazed to see him whizzing around!

If the module will not work would it be possible to create a small circuit or routing through another arduino and then to the robot? I currently have it detecting distance via a Mega 2560. I have lot's of different arduinos, breadboards and bits and soldering irons to hand so could knock something together if someone could point me in the right direction?

On a side note, if I get this sensor working to manoeuvre around obstacles, would it be possible for the Robot to play R2-D2 sounds through it's speaker every couple of minutes?

I would be extremely grateful if anybody can help as we really don't wan't to let them down and I am stumped (hence me still sitting here at 2am!)

Thanks guys (and gals)!

Kind Regards,
Jay.

Why is that a problem ? (that it is digital ?) I don't believe you explained that.

Yes that seems to be the problem, all information (well the little that's available) seems to say that I would need to use an analog sensor. Also, all the connector points on the robot are 3 pin and the sensor is 4?

By using this Google Code Archive - Long-term storage for Google Code Project Hosting. it shows that it can operate on just 3 pins but I'm still stuck as to how I would tell the robot to use it?

Any ideas? And thank you for taking the time to respond!

Jay.

Yes that seems to be the problem, all information (well the little that's available) seems to say that I would need to use an analog sensor. Also, all the connector points on the robot are 3 pin and the sensor is 4?

I don't see a part number or a vendor link or datasheet anywhere in your post , nor do I see what your problem is.

State you equipment and state your problem.

Put simply:

I am using the Arduino Robot http://arduino.cc/en/Main/Robot
and want to use a
HC-SR04 ultrasound sensor http://www.micropik.com/PDF/HCSR04.pdf

to dodge obstacles but all documentation regarding the use of a sensor on the robot refer to analog ones but the one that I have is digital.

Hope this clarifies and thanks again!

Take a look at the links in this post :
http://forum.arduino.cc/index.php?topic=236870.new;topicseen#new

This one is digital.

Thanks for that, the only problem is the Ping sensor is 3 pin and mine is 4. The only connection points on the robot are tinkerkit 3 pin plugs. I will probably have to replace the arduino with a rc car and have someone controlling it, I do have a couple of days though so hopefully I can figure something out!

Thanks again.

This sensor has a four pin connector.
http://arduinobasics.blogspot.com/2012/11/arduinobasics-hc-sr04-ultrasonic-sensor.html

it shows that it can operate on just 3 pins but I'm still stuck as to how I would tell the robot to use it?

http://arduinobasics.blogspot.com/2012/11/arduinobasics-hc-sr04-ultrasonic-sensor.html

This is about as simple as it gets.

 /*
 HC-SR04 Ping distance sensor:
 VCC to arduino 5v 
 GND to arduino GND
 Echo to Arduino pin 7 
 Trig to Arduino pin 8
 
 This sketch originates from Virtualmix: http://goo.gl/kJ8Gl
 Has been modified by Winkle ink here: http://winkleink.blogspot.com.au/2012/05/arduino-hc-sr04-ultrasonic-distance.html
 And modified further by ScottC here: http://arduinobasics.blogspot.com.au/2012/11/arduinobasics-hc-sr04-ultrasonic-sensor.html
 on 10 Nov 2012.
 */


#define echoPin 7 // Echo Pin
#define trigPin 8 // Trigger Pin
#define LEDPin 13 // Onboard LED

int maximumRange = 200; // Maximum range needed
int minimumRange = 0; // Minimum range needed
long duration, distance; // Duration used to calculate distance

void setup() {
 Serial.begin (9600);
 pinMode(trigPin, OUTPUT);
 pinMode(echoPin, INPUT);
 pinMode(LEDPin, OUTPUT); // Use LED indicator (if required)
}

void loop() {
/* The following trigPin/echoPin cycle is used to determine the
 distance of the nearest object by bouncing soundwaves off of it. */ 
 digitalWrite(trigPin, LOW); 
 delayMicroseconds(2); 

 digitalWrite(trigPin, HIGH);
 delayMicroseconds(10); 
 
 digitalWrite(trigPin, LOW);
 duration = pulseIn(echoPin, HIGH);
 
 //Calculate the distance (in cm) based on the speed of sound.
 distance = duration/58.2;
 
 if (distance >= maximumRange || distance <= minimumRange){
 /* Send a negative number to computer and Turn LED ON 
 to indicate "out of range" */
 Serial.println("-1");
 digitalWrite(LEDPin, HIGH); 
 }
 else {
 /* Send the distance to the computer using Serial protocol, and
 turn LED OFF to indicate successful reading. */
 Serial.println(distance);
 digitalWrite(LEDPin, LOW); 
 }
 
 //Delay 50ms before next reading.
 delay(50);
}

Thanks for all of your help, the missing link for me is that the Arduino Robot doesn't have pins as such, only tinkerkit type connectors and some points you can solder to (I think anway and if so may be just what I need to use) so its a kind of translation to where I connect it and what changes to make in the code to reflect that I am missing, I hope this helps.

Again thank you for your help, the event is on Sunday!

Jay.

I can't help with the connector issue. Good luck.

Pins tkd0-tkd5 are digital. You need two digital pins per sr04. One for trigger and one for echo. If you can use all six pins, you can run up to three sr04's.

Thanks I will give it a go!

Jay.