Show Posts
Pages: [1] 2 3 4
1  Using Arduino / Sensors / Re: Vehicle Detection Sensor- Any Recommendation?? on: February 17, 2013, 06:00:51 pm
google waterproof ultrasonic sensors.
There are loads of them to choose from.
you could make a small waterproof enclosure for the electronics, which should leave them fairly well protected.

The biggest hurdle to cross in my mind is placement.
How do you keep them from getting stolen or run over by drivers cutting through a space?

I like GoForSmoke's idea of putting them on poles, but that seems like a recipe for false readings.  vehicles have a range of heights and angles, and reading a space from above would have a much wider range to activate the signal.  There is also the possibility that a car could park and if the sonar didn't get bounced back directly, it may not even see the car.

Going from underneath would be much easier to code, and sounds more reliable to me.  But that leads us right back to the stolen or crushed possibilities.

2  Using Arduino / Sensors / Re: Vehicle Detection Sensor- Any Recommendation?? on: February 14, 2013, 12:01:41 pm
why not use an IR or ultrasound distance sensor?

you wouldn't have to fiddle with magnetic anything, just tell the arduino if the sensor detects an object closer than 12" over the sensor, there is a car there.
put the sensor right in the middle of the parking space, so it wont miss the vehicle.
you could also program it to dismiss counting objects that are over the sensor for less than 1 minute.  That way, if someone walks over it or something else like that, it wont record that as a parked car. 

this seems like a much more simple option, and more reliable than a magnetic sensor.
if the parking space is in a lit parking garage, you could also use a light dependent resistor.  when a car is over the sensor, it would be darker.  even at night in a lit garage.  you would just have to tinker with it to find a darkness level at witch to trigger the action you are looking for.

Just a few ideas I had, figured I would share smiley
N8
3  Using Arduino / Sensors / Re: Ultrasonic sensor AR400P12: how to use them? on: February 13, 2013, 11:33:11 am
I am having a similar issue.
I broke my PING))) sensor, and have removed the transducers from the circuit in hopes of being able to use them again.
I have been searching online for a circuit to drive them, but have had little luck.

I have found some circuit diagrams, but I am having some issues with figuring out how to use this with an arduino.  They seem to be stand alone circuits, and I want to control them with the arduino code.

here is a link to some of the info I have found.  If you or anyone else can make heads or tails of it, and suggest how to use this with the arduino, it would be greatly appreciated.

http://www.next.gr/audio/ultrasonic-circuits/ultrasonic-transceiver-l13839.html

http://www.next.gr/other-circuits/switch-circuits/Ultrasonic-switch-circuit-l7910.html

http://www.next.gr/audio/ultrasonic-circuits/ranging-system-l13831.html

those links seem to be the most useful I have found, but I am still too new to electronics to figure out exactly what they are doing, and I would prefer not to burn any more components trying to figure it out on my own.

Hope some of that helps, and if you figure out how to use this info, please share smiley

N8

ETA: it seems to me, you might (or should) be able to use the Arduino in place of the 555 timer on the transmitter to send out the ultrasound pulse, then use the dual op-amp circuit for the receiver.  I do sort of understand how these circuits are working, but not well enough to integrate it into the arduino.  At the very least I am thinking you could trigger the 555 with the arduino, but that seems redundant to me, as the 555 can handle the triggering all by itself.  I am mostly at a loss on how to wire this to an arduino and how to handle coding for it.

This is also assuming that the transmitters and receivers are all the same or similar, which is doubtful, or there wouldn't be so many different models of them.
4  Community / Exhibition / Gallery / Re: Arduino robot controlled using computer on: February 11, 2013, 03:30:17 pm
very cool bot and video!
I really like the arm that extends out the bottom to help with climbing over objects, that was a very cool solution.

Also got a kick out of how quick it backed up when you put the heat to it, smart bot smiley-razz

very unique robot, nice work!

N8
5  Using Arduino / Sensors / Re: Broken PING))) hack? on: February 11, 2013, 03:19:50 pm
Thanks again Tim

I just noticed you are from Ohio also, nice to see another buckeye on the forum smiley  (I am pretty close to the other end of the state from you, near Dayton)

I will looking into the Ping_timer example and try it in my code.

I took out the 30mS delay and reduced the iterations and it did seem to help.  Now he only hits chair legs (too narrow a profile to the ping to see coming) and does react faster to objects that it sees.

After looking around google for a bit, it seems ultrasound has the widest detection area, so I will likely stick with it.  Need to buy a couple more sensors and mount them up to increase the options for steering anyway.  With a couple more sensors, it would make sense to learn the 15 sensor example anyway.  I work the next two days, but have wed/thurs off, and will probably make my way to radio shack and pick up a 2nd sensor for the front. 

overall I am very happy with how the bot works, I am mostly looking to add sensors to increase the available information so it can make better decisions.  Use a left and right sensor that overlap a bit, then have the bot steer in the direction where there is more open space.  Make it drive smarter rather than simply trying to dodge objects at the last minute.

I really appreciate the suggestions, and I will update this thread when I have tried the ping_timer and added a second sensor.

I would still like to use the transducers from the broken sensor, but until I learn how to drive them, it looks like buying a new one is the easiest way to go.

Thank you!
N8
6  Using Arduino / Sensors / Re: Broken PING))) hack? on: February 11, 2013, 01:57:40 pm

To be successful with a fast moving robot, first you're going to need to not use any delay statements.  Secondly, doing 10 ping iterations won't be a good idea (takes too long).  I also don't think the max distance of 400cm is a good idea either (maybe 200-300 cm).  Why two different max distance values?

With some cleaning up and rethinking how you will schedule the pings and motor control I think you'll have much better success.  You don't really care about accuracy with something that's moving fast so that's worthless.  More important would be pinging more frequently or using multiple sensors to detect objects better.

Tim

Thanks for the reply Tim!

My original code had a handful of delays in it, and I have wrote them all out but that first one.  The 30mS delay at the beginning was in the sample code for the NewPing library, and I wasn't positive that it could be removed.  I was already considering taking out the iterations, or at least reducing them to 3 or 4.  Without the iterations in there, my first bot would stop and turn around at odd times, so they did help that some.  I may just leave 3 iterations in the code to help clean up the occasional bad read from the sensor. 

I have two max distances because I wanted the bot to be able to see out to 400cm, but I wanted it to start reacting at a shorter distance.  That way I could have a full speed ahead mode, and still get the bot to react at different distances.  It is mostly wrote in there for debugging purposes.  If the code gets longer, or more complicated as I make it better, I can still play with the distances it works with and only have to change them in one spot in the code.  That helps me keep things consistent, and not have to search for values to change as I change the code.
It probably isn't needed with how simple the code is right now, but it seemed like a good idea at the time.

The code as it is wrote right now works pretty well, it needs a few minor adjustments, but as long as the bot can see whats coming, even at full speed it does a pretty good job of stopping and dodging.  My first code was horrible, delays in it, my original max distance was 160cm and the thing hit nearly everything it could.  I have come a long way so far refining it, and only have a little bit of adjusting to make it as good as it can get with one fixed sensor in the front.

Eventually I would like to have at least one sensor in the back to it doesn't back into objects when turning around, and minimum two sensors in the front to expand its point of view and angle of view.  Is there a range finding sensor that works better than ultrasound?  I know there are other types out there, but the only one I have right now is the PING.  I would really like to add the transducers from the broken PING sensor, and get them working, but it is really starting to look like it may just be easier to buy more working sensors and use them.  I need to find a cheaper sensor option, these PING sensors are a bit too expensive to justify putting three or four of them on this toy project.
I actually started this just to learn how to accurately drive motors, and this was an easy way to do that with the parts I had available, and still have something fun to use it on, rather than just watching the motors spin on my bench with no purpose.
It helped me understand how to take a sensor reading and get a quick reaction from the sensors based on that.  I have had enough fun building this bot that I am going to leave him together rather than use it's components for something else, but I also don't want to sink a whole lot more money into it, already had to buy the RC car battery he is powered by, and a second PING sensor to replace the one I broke.

I will look around at some different sensors and see if I can't find a cheaper option and buy three or four of them.

Thank you very much for the suggestions!  I will remove that last delay and reduce the iterations.  I agree these things will make it a bit better and response time faster.

N8
7  Using Arduino / Sensors / Re: Broken PING))) hack? on: February 11, 2013, 03:06:18 am
I have some hope of my idea working now.
Just watched a youtube video of a guy using two different robots at the same time.
both had PING sensors, and they didn't seem to interfere with each other.  In fact, at one point, they avoided each other.
So at least I know my idea is somewhat feasible.

Now if I could only figure out how to drive the second set of eyes without the pre-built circuit they come on...

making progress, I guess.

Sorry I keep posting, but I am trying to figure this out on my own, so I want to keep what I know updated, that way the scope of my question is limited to only what is left to figure out smiley
8  Using Arduino / Sensors / Re: Broken PING))) hack? on: February 11, 2013, 02:30:20 am
OK, so I let curiosity get the better of me, and I went ahead and pulled the transducers off the circuit board and was pleasantly surprised to see they are marked with a T and an R.  That absolutely answers one of my questions.

This does lead me to a new question though.

Lets say I am able to get this second pair working.

If I mount them on the front of my bot, with a transmit on one side, pointing at an angle and I set the receiver on the other side of the car but pointing the same angle as the first one, then take the second set and do the same but pointing at a different angle.
(horrible sentence structure, I know but I am starting to confuse myself here...)
with the way I picture this setup, the ultrasonic pings would basically cross each others path.  would the sound waves interfere with each other and cause my data to be bad?

seems likely they would interfere, but I don't know.

That does seem like a good way to get a nice wide range with them and not overlap too much or leave too much of a blind spot in the middle.
position them in a way that the transmission from one wouldn't be able to hit the receiver of the other.  point them just off from each others angles so they don't overlap, but they do point away from each other.

if this is making any sense at all I am thrilled.  communication of ideas isn't my strong suit.  I am much better at just building what I think about and try not to venture into asking questions when I don't have to smiley-razz

So basically, it sounds like I would at least need a temperature sensor for the pair without a circuit, because sound waves travel at different speeds in different temps (something else I learned on this search!)
What I am hoping is, I can use a temp sensor and the transducers off the bad ping sensor with just the arduino clock and get results, then use the other PING sensor that is still working to feed in the other result, and allow my bot to make decisions based on more incoming data.

What I would eventually like to get to, is the bot will take in both sets of data and then steer himself into the most wide open spaces he can, rather than just try and dodge at the last minute.  Then I might be able to set up a maze style obstacle course and see if the bot can navigate the paths.  I don't expect it to solve the maze or anything, just be able to steer around in tight environments without having any outside input, and without having to constantly stop and back up to adjust steering.

If you have followed along this far, thank you.  You are clearly a patient person smiley-razz
I figure if I share what my goals are here, perhaps someone might even be able to suggest an easier option that what I am thinking of, mostly because I am pretty sure what I have in my head wont work due to interference and the complication of only having one working PING sensor and some loose transducers...

Just for good measure, this is the code I am using at the moment.

Code:
// Using Seeed Motor Shield with L298 dual H bridge and PING))) distance sensor to drive a converted RC car robot

#include <NewPing.h>  //use NewPing library for the PING))) sensor.
#define triggerPin 4  // define triggerPin on Arduino Pin 7
#define echoPin 4     // define echoPin on Arduino Pin 7
#define maxDistance 400  // define maxDistance as 400cm
#define Iterations 10   // define Iterations as 10

NewPing sonar(triggerPin, echoPin, maxDistance);  // set sonar with the triggerPin, echoPin, and set maxDistance

const int minDist = 0;  // set minimum distance = 0 for switch case
const int maxDist = 300;  // set maximum distance = 160cm for switch case

const int motorA2 = 8;  // set L298 input 1 as motorA2 on Arduino Pin 8
const int motorA1 = 11; // set L298 input 2 as motorA1 on Arduino Pin 11
const int motorA = 9;   // set L298 output 1 as motorA on Arduino PWM pin 9 (drive motor)
const int motorB2 = 12; // set L298 input 3 as motorB2 on Arduino Pin 12
const int motorB1 = 13; // set L298 input 4 as motorB1 on Arduino Pin 13
const int motorB = 10;  // set L298 output 2 as motorB on Arduino PWM pin 10 (turn motor)

void setup()
{
  pinMode(motorA1, OUTPUT);  // set motor pins as output
  pinMode(motorA2, OUTPUT);
  pinMode(motorA, OUTPUT);
  pinMode(motorB1, OUTPUT);
  pinMode(motorB2, OUTPUT);
  pinMode(motorB, OUTPUT);
}

void loop()
{
  delay(30);  //delay 30 milliseconds
  //this sets the data coming from the PING))) sensor to integer uSeconds.  This takes 10 readings
  //from the sensor and avrages them for better accuracy.
  unsigned int uSeconds = sonar.ping_median(Iterations);
 
  //maps the data coming from the PING))) sensor to one of 4 options to be handled by the switch case
  int Speed = map(uSeconds / US_ROUNDTRIP_CM, minDist, maxDist, 4, 1);
 
  //if statement to handle any sensor readings higher than 160cm
  if(uSeconds / US_ROUNDTRIP_CM >= maxDist)
  {
    analogWrite(motorA, 255);  //Drive forward at full speed
    digitalWrite(motorB, LOW);
    digitalWrite(motorA1, LOW);
    digitalWrite(motorA2, HIGH);
  }
 
  switch(Speed)  //This switch takes the distance readings that were mapped to four options and decides what to
                 //do based on how close the robot is to an object case 1 is farthest away, case 4 is closest.
  {
    case 1:  //drive forward, but at a slower speed
    analogWrite(motorA, 200);
    digitalWrite(motorB, LOW);
    digitalWrite(motorA1, LOW);
    digitalWrite(motorA2, HIGH);
    break;
    case 2:
    analogWrite(motorA, 150);
    digitalWrite(motorB, LOW);
    digitalWrite(motorA1, LOW);
    digitalWrite(motorA2, HIGH);
    break;
    case 3:  //slow down even more and turn right while still going forward
    analogWrite(motorA, 125);
    analogWrite(motorB, 175);
    digitalWrite(motorA1, LOW);
    digitalWrite(motorA2, HIGH);
    digitalWrite(motorB1, HIGH);
    digitalWrite(motorB2, LOW);
    break;
    case 4:  //stop and back up while turning right for a half second, then stop again
    digitalWrite(motorA, LOW);
    digitalWrite(motorB, LOW);
    analogWrite(motorA, 150);
    analogWrite(motorB, 175);
    digitalWrite(motorA1, HIGH);
    digitalWrite(motorA2, LOW);
    digitalWrite(motorB1, LOW);
    digitalWrite(motorB2, HIGH);
    break;
  }
}

Still have some minor tweaking to do on this code to get the bot to stop and back up just a pinch earlier.  He doesn't hit too many objects anymore, but he does tend to just nudge them with the front bumper before he actually starts to back up.  probably try and get him to stop one or two inches earlier, and keep him from hitting anything he can see.
only having the one pair of eyes facing only forward isn't the best way to do this.
I have seen some people using servos to turn the eyes to look around, but this also seems clumsy to me, and I would like a pretty smooth running machine if it is possible with this kind of simple setup.

I am pretty happy with the code as I have it wrote though, it is easily tweakable, and simple enough to follow, and it works when things are coming up right in front of the bot.  Now I just want to increase his field of vision and make him a bit smarter.  buying more PING sensors for this kind of project doesn't seem all that cost effective, which is why I started looking down this path in the first place.

OK, so...
This is everything I can think of to share that may be pertinent information, that way if anyone has any better ideas, or some guidance on how to get my dead eyes working again, I would love to hear it!
don't be afraid to criticize me here, I am posting to find where I may be going wrong, and to get suggestions for improvements.

Thanks
N8
9  Using Arduino / Sensors / Broken PING))) hack? on: February 11, 2013, 01:26:37 am
Hello,
I have built an object avoidance robot using an old RC car frame and motors.
It is coming together quite nicely, and at this point I am fine tuning the code.

I am using a PING))) ultrasonic sensor to detect objects, and it has some issues I am trying to solve.  This buggy moves pretty fast, and with the shortcomings of ultrasound, it doesn't avoid objects coming at it from an angle.
Early in this build process I was careless with my setup and burned out the main chip on my first PING))) sensor.  Now I have an idea, but I am not sure it will work.

I would like to pull the "eyes" off the broken sensor and put them to use on my robot.
point them out to the sides at a slight angle to increase the robots vision and perhaps pick up those odd angles a bit better in the process.
Is there a way to use these sensors without the circuit they come on?  I don't have the equipment or experience to use the tiny surface mount parts that comes on the sensor, but I hate to throw out the bad one, they cost too much to just junk it.
Is there a circuit I can build that would allow me to use these additional two eyes?
is it possible to wire the other two eyes in parallel with the two on the working sensor?  (this one sounds like a super long shot, but it was an idea I had so I figured I would ask)

I looked around on the web and noticed some of these sensors do not come with a circuit, so I figure this task shouldn't be out of the question, but I do not know how I would go about making them work without the board they come on.

I am also not sure if both eyes on the sensor are used together (one to send out signal and the other to receive), or if they both send and receive and come up with an average of both readings?

lots of things I don't know at this point, and would really love some guidance.

I am going to keep searching on my own, but if anyone out there has some suggestions, or could point me in the right direction, I would greatly appreciate it!

thanks in advance
N8

Edit to add:
I have done a few google searches, and it seems to me the most likely scenario is the two eyes on the sensor are different.  one to transmit a signal and the other to receive it back.  Most of the transducers (just learned that is what they are called smiley-razz ) you can buy in pairs without a circuit already built onto them are Tx and Rx.  Still no luck finding a way to use them without the pre-built circuit.
confirmation that they are tx and rx and some idea on how to drive them correctly would still be greatly appreciated!
10  Using Arduino / Project Guidance / Re: Have robot, won't travel? on: February 05, 2013, 05:15:35 pm
Well, I went out and bought a new PING))) sensor, and a 9.6V 1600mAh battery, and just for fun, and seeed studios motor shield.
I now have my robot working, though the code needs tweaked a bit, because once in a while it still hits objects. 
I wrote my own code for this one, using the NewPing library and the seeed motor shield.

I wrote the code so the robot first tries to slow down and turn while still driving forward to avoid an obstacle, then if it can't avoid it, it stops and turns a bit then keeps going.

Here is the code as I have it working now...

Code:
// Using Seeed Motor Shield with L298 dual H bridge and PING))) distance sensor to drive a converted RC car robot

#include <NewPing.h>  //use NewPing library for the PING))) sensor.
#define triggerPin 7  // define triggerPin on Arduino Pin 7
#define echoPin 7     // define echoPin on Arduino Pin 7
#define maxDistance 400  // define maxDistance as 400cm
#define Iterations 10   // define Iterations as 10

NewPing sonar(triggerPin, echoPin, maxDistance);  // set sonar with the triggerPin, echoPin, and set maxDistance

const int minDist = 0;  // set minimum distance = 0 for switch case
const int maxDist = 160;  // set maximum distance = 160cm for switch case

const int motorA2 = 8;  // set L298 input 1 as motorA2 on Arduino Pin 8
const int motorA1 = 11; // set L298 input 2 as motorA1 on Arduino Pin 11
const int motorA = 9;   // set L298 output 1 as motorA on Arduino PWM pin 9 (drive motor)
const int motorB2 = 12; // set L298 input 3 as motorB2 on Arduino Pin 12
const int motorB1 = 13; // set L298 input 4 as motorB1 on Arduino Pin 13
const int motorB = 10;  // set L298 output 2 as motorB on Arduino PWM pin 10 (turn motor)

void setup()
{
  pinMode(motorA1, OUTPUT);  // set motor pins as output
  pinMode(motorA2, OUTPUT);
  pinMode(motorA, OUTPUT);
  pinMode(motorB1, OUTPUT);
  pinMode(motorB2, OUTPUT);
  pinMode(motorB, OUTPUT);
}

void loop()
{
  delay(30);  //delay 30 milliseconds
  //this sets the data coming from the PING))) sensor to integer uSeconds.  This takes 10 readings
  //from the sensor and averages them for better accuracy.
  unsigned int uSeconds = sonar.ping_median(Iterations);
 
  //maps the data coming from the PING))) sensor to one of 4 options to be handled by the switch case
  int Speed = map(uSeconds / US_ROUNDTRIP_CM, minDist, maxDist, 4, 1);
 
  //if statement to handle any sensor readings higher than 160cm
  if(uSeconds / US_ROUNDTRIP_CM >= maxDist)
  {
    analogWrite(motorA, 255);  //Drive forward at full speed
    digitalWrite(motorB, LOW);
    digitalWrite(motorA1, LOW);
    digitalWrite(motorA2, HIGH);
  }
 
  switch(Speed)  //This switch takes the distance readings that were mapped to four options and decides what to
                 //do based on how close the robot is to an object case 1 is farthest away, case 4 is closest.
  {
    case 1:  //drive forward at full speed
    analogWrite(motorA, 255);
    digitalWrite(motorB, LOW);
    digitalWrite(motorA1, LOW);
    digitalWrite(motorA2, HIGH);
    break;
    case 2:  //drive forward, but at a slower speed
    analogWrite(motorA, 200);
    digitalWrite(motorB, LOW);
    digitalWrite(motorA1, LOW);
    digitalWrite(motorA2, HIGH);
    break;
    case 3:  //slow down even more and turn right while still going forward
    analogWrite(motorA, 170);
    analogWrite(motorB, 170);
    digitalWrite(motorA1, LOW);
    digitalWrite(motorA2, HIGH);
    digitalWrite(motorB1, HIGH);
    digitalWrite(motorB2, LOW);
    break;
    case 4:  //stop and back up while turning right for a half second, then stop again
    digitalWrite(motorA, LOW);
    digitalWrite(motorB, LOW);
    delay(100);
    analogWrite(motorA, 200);
    analogWrite(motorB, 170);
    digitalWrite(motorA1, HIGH);
    digitalWrite(motorA2, LOW);
    digitalWrite(motorB1, LOW);
    digitalWrite(motorB2, HIGH);
    delay(500);
    digitalWrite(motorA, LOW);
    digitalWrite(motorB, LOW);
    delay(100);
    break;
  }
}

Just wanted to share the progress I have made with it.

Next I would like to mount the sensor on a servo, and get it to look left and right when it stops, so it can choose if it should turn left or right based on how far away objects are to each side.
Need to figure out an easy way to mount all this up, so it is stable enough to move with the servo, and not fall apart.  Not sure how I am going to do that yet, but it should be fun working it out!

I am more than happy to take any suggestions on ways to improve my code as I have it written.  I am not married to it, and always welcome advice on how to do things a little bit better.

Thanks for checking it out!
N8
11  Topics / Device Hacking / Re: motion detector hack? on: February 03, 2013, 08:10:05 am
So I'm wondering if you've had any luck with your project.  Have you been able to locate the output pin from the final stage of the amplifier?  Hopefully, you're on your way to using this motion sensor for your own purpose.  I look forward to hearing about it.

Hello flyboy, thanks for the response!

Sorry it took me a while to get back to you, I hadn't checked this post for a while, figuring it was dead :/

I ended up just pulling the IR sensor off the board and taking a good look at it.  I found the same part online, and have been able to identify the pins.
The OpAmp chip on the back of the board is SMD, and I don't have the capability to use that yet, though I have it saved for when I can use SMD parts, as I fully plan to learn how to use them smiley

I have some through hole OpAmps I can use, and might just try and design my own circuit around this IR sensor and see if I can't put it to use, though that is more on the back shelf right now.

After a bit more investigation on the board this came off of, the additional two wires I assumed were data lines ended up both being for the reed switch.  I am guessing one is to latch it on when the IR sensor detects motion, and the other to release it when there is no motion detected?

I have worked with reed switches quite a bit making brush-less motors and really don't know where there would be two wires to operate the reed switch, but they were both labeled under the screw terminals, so this is as near as I can figure the wires were used for.  The processor on the main board in the basement might have had a latching output which needed a separate signal to turn it off?  Don't really know, but I also pulled the reed switch off the board and have it saved also, which is nice, because all the other ones I have have burned out in HV experiments I have run in the past.  (pulsing power through a Ford Model T ignition coil at high frequency will kill a reed switch in a hurry, if anyone was wondering smiley-razz )


If nothing else, I got a handful of useful parts off the board, which is always nice to find free components around the house in the junk we don't use anymore!

Thanks for the advice, you have pointed me in the right direction for figuring out how to wire up this IR sensor when I get around to designing a project that would use one!

Much appreciated!
N8
12  Using Arduino / Project Guidance / Re: Have robot, won't travel? on: February 01, 2013, 12:15:29 pm
Thanks for the tip JimboZA

I will have to check that out.  I was pretty surprised that this thing wouldn't run on a 9V or 4AAs because it ran on 3AAs with the original circuit.  I figured it was the motor driver gobbling up power, but wanted to be sure.

I went and did a dumb thing, not paying attention, and smoked my PING sensor, so this project is on the shelf until I get a new set of eyes....
Might try a IR distance sensor this time, or maybe two, give me a wider range of view and more options.
I have lots of ideas for this project, cool ways to take this very simple code and make a really nice driving automaton out of it.  Pretty bummed I burned out the distance sensor just as I was getting things to work....
That's what I get for trying to run a test in a hurry before I have to leave for work.
Live and learn eh?

Since I am now down to buying new parts, might as well give that Pololu 2130 a shot and see if I can't reduce the power pack needed in the first place.  Make this thing semi-smart and semi-efficient smiley-razz

Thanks again!
N8
13  Using Arduino / Project Guidance / Re: Have robot, won't travel? on: February 01, 2013, 10:51:11 am
Thank you Chagrin smiley

That was more or less what I thought was needed, but wanted to fish for the answer a bit before I strap more power to this thing.  If there was something in the code I wasn't seeing that was draining power, I didn't want to add more juice only to burn out a component with a bad line of code.

Thank you for the reply, Looks like I might need to pick up a regular RC car battery.  It should run off a 9V battery with more available amp hours.
I don't think I should need to go the 12V route.  It was already moving pretty fast for the PING sensor for the few minutes it would drive off a fresh set of 4AA powering the motor.
Don't mind me, just thinking "out loud" now
off to ponder
Thanks
N8
14  Using Arduino / Project Guidance / Have robot, won't travel? (solved) on: February 01, 2013, 01:49:33 am
Hello all

I have ventured off into autonomous robot territory.  Figured I would start off with a project that seemed pretty standard intro to robotics kind of stuff.  I grabbed a small RC car, stripped it down to frame and motors, and hooked it up to an arduino through the Arduino Motor Shield R3.
I found a pretty basic sketch to run it, and haven't really even taken the time to modify it, though I do plan to add some bells and whistles, and see if I can't make it a little smarter smiley

Here is the sketch I am using now.

Code:
/*
RC Car to Robot Conversion
by Randy Sarafan

Used to convert an RC car into a robot that uses a PING sensor to avoid obstacles,
and an Arduino motor shield for motor control.

For more information see:
http://www.instructables.com/id/RC-Car-to-Robot/

Built atop Ping example code by Tom Igoe
*/

// this constant won't change.  It's the pin number
// of the sensor's output:
const int pingPin = 7;

void setup() {
  
  //establish motor direction toggle pins
  pinMode(12, OUTPUT); //drive motor -- HIGH = forwards and LOW = backwards
  pinMode(13, OUTPUT); //turn motor -- HIGH = left and LOW = right
  
  //establish motor brake pins
  pinMode(9, OUTPUT); //brake (disable) the drive motor
  pinMode(8, OUTPUT); //brake (disable) the turn motor

  //Turns brake off for drive motor
  digitalWrite(9, LOW);

  //Turns brake on for turn motor
  digitalWrite(8, HIGH);

  //Sets initial speed of drive motor
  analogWrite(3, 200);
  
  //Sets initial direction of drive motor
  digitalWrite(12, HIGH);
}

void loop()
{
  // establish variables for duration of the ping,
  // and the distance result in inches and centimeters:
  long duration, inches, cm;

  // The PING))) is triggered by a HIGH pulse of 2 or more microseconds.
  // Give a short LOW pulse beforehand to ensure a clean HIGH pulse:
  pinMode(pingPin, OUTPUT);
  digitalWrite(pingPin, LOW);
  delayMicroseconds(2);
  digitalWrite(pingPin, HIGH);
  delayMicroseconds(5);
  digitalWrite(pingPin, LOW);

  // The same pin is used to read the signal from the PING))): a HIGH
  // pulse whose duration is the time (in microseconds) from the sending
  // of the ping to the reception of its echo off of an object.
  pinMode(pingPin, INPUT);
  duration = pulseIn(pingPin, HIGH);

  // convert the time into a distance
  inches = microsecondsToInches(duration);

  //
  //if objects are less than 12 inches away
  //the robot reverses and turns to the right
  //for 2 seconds
  //
  
  if (inches < 12){
    
    //brake drive motor and pause 1/10 second
    digitalWrite(9, HIGH);
    delay(100);

    //
    //setting turn motor
    //
    
    //turn off brake for turn motor
    digitalWrite(8, LOW);

    //set turn motor direction
    digitalWrite(13, HIGH);

    //activate turn motor
    analogWrite(11, 255);
    
    //
    //setting drive motor
    //
    
    //turn off brake of drive motor
    digitalWrite(9, LOW);
    
    //set drive motor backwards direction
    digitalWrite(12, LOW);
    
    //activate the drive motor
    analogWrite(3, 200);

    
    //backup for 2 seconds
    delay(2000);
    
    //
    //stopping
    //
    
    //brake both motors
    digitalWrite(8, HIGH);
    digitalWrite(9, HIGH);
    
    
  }
  
  //
  //when nothing is within 12"
  //the robot simply drives forwards
  //
  
  else{
    
    //
    //Setting drive motor
    //
    
    //set drive motor forward direction
    digitalWrite(12, HIGH);
    
    //turn off brake of drive motor
    digitalWrite(9, LOW);    
    
    //activate drive motor
    analogWrite(3, 200);
  
  
  }
  
  delay(100);
}

long microsecondsToInches(long microseconds)
{
  // According to Parallax's datasheet for the PING))), there are
  // 73.746 microseconds per inch (i.e. sound travels at 1130 feet per
  // second).  This gives the distance travelled by the ping, outbound
  // and return, so we divide by 2 to get the distance of the obstacle.
  // See: http://www.parallax.com/dl/docs/prod/acc/28015-PING-v1.3.pdf
  return microseconds / 74 / 2;
}

I haven't really even looked through the code yet, but I don't think my problem is in the code, I just posted it in case there was anything in there that might help.

My issue is, the code works perfectly, as long as the car isn't on the ground.  I can hold it up in the air, and the drive motor does what it is supposed to, and the turn motor works when it is supposed to.  But when I put it down, it works on a nice flat surface for a few minutes, then it seems to run out of power.  It wont move much at all on carpet.

The car originally ran on 3 AA batteries, though I never even turned it on before I tore it apart.  It was pretty light weight, and with all the Arduino gear on top, it does have a bit more load to move, but I would think the difference would be negligible.

The car uses one DC motor to drive the rear wheels, and one DC motor to turn the front wheels.  When the car needs to back up and turn, it has noticeably less power, and is usually the first direction to stop working.  I have tried 3 AA's and 4AA's to drive the motors.  I tried using a 9V to power the arduino, and the motors through the shield, which is how it is set up to work.  No matter how I configure the power in, I don't get enough drive, and it dies after only a few minutes.

Does anyone have any idea how I might fix this?  The inscrutable where I got the code worked on just the 9V supplying the arduino, and used the Vin pin to supply power to the shield.  His seemed to work just fine, and I have a nearly identical RC car, the same motor shield and PING sensor.  Not sure where I am loosing so much energy, and it has me stumped.

Any suggestions would be greatly appreciated!
Thanks
N8
15  Using Arduino / Project Guidance / Re: The Ultimate Laser Tag Game (Asked by the ultimate noob) on: January 21, 2013, 08:05:18 pm
Hello

First, I am more than intrigued with this idea, and have been mulling it over in my head a bit.

I have an idea to solve the hit point system issue.  This may not be feasible the way I see it, but I am throwing it out there to see if it might work.
I am just riffing of the top of my head, so if I am wrong on certain details, please correct me.
What about using real laser pointers as the laser?
Each player would have to wear glasses to protect their eyes (if they even make glasses like that, but it seems I have seen such a monster before)
for the hit sensors, What about arrays of LDRs with with a light diffuser in front of them.  wouldn't the diffuser screen spread out the light beam from the laser enough to effect one zone of the LDR array, and the drop in resistance could trigger a point value to be sent through blue tooth to the shooters unit and add to his XP and level.

With an actual laser beam, you could keep the keep the area of the target affected much more precise. 

I am not sure if this would work or not, but it sounded workable in my head and I figured I would throw it out there.
Hope it helps
N8
Pages: [1] 2 3 4