Jump to content


Highest Reputation Content


#88 Kill switch code placement

Posted by colintheraven on 31 March 2014 - 03:46 PM

That worked very well. Thanks.


  • 1


#7 How to control motors with H-bridge?

Posted by hawkeye on 25 March 2013 - 10:04 PM

How can the SN754410 be used to control DC motors? Is there an example circuit?

 

Thank you!


  • 1


#69 Trouble with Robotics kit

Posted by Nathan House on 16 March 2014 - 12:17 AM

I would definitely suggest grabbing the code from the ultrasonic sensor tutorial and trying it out. If it doesn't work with that code (which we know works), then it's a wiring issue. Sorry you're having trouble getting it to work, I know how frustrating it can be when stuff doesn't work!

 

 

do you know the distance (cm/inch) that the robot considers an object in the way at? I have to write a paper on what I learned, and that would a useful contribution I think.

 

Well, if you're talking about the code from the tutorial, then the robot changes states (from driving forward to turning) when it detects an object 6cm in from of it. The robot can detect objects much further away than that, but that's the point where the code in the tutorial tells the robot to "take action" and turn.

 

Good luck with your paper!


  • 1


#67 Trouble with Robotics kit

Posted by Nathan House on 11 March 2014 - 03:12 AM

At a cursory glance, I don't see anything wrong with your code, so my guess is that it has something to do with wiring. Do you have both 5V and GND wires going to the breadboard? Your idea of just wiring up a single sensor is a good idea. Reducing the complexity of a circuit and/or program always makes it a lot easier to debug. So try your idea -- just leave one sensor hooked up and take out the code in the program for the other sensors, then see what happens.

 

If you can't figure out what's going wrong, you could always try using code you know works, such as from this tutorial: http://www.foxytroni...ino/programming

 

Let me know what happens!


  • 1


#63 Trouble with Robotics kit

Posted by Nathan House on 07 March 2014 - 05:49 PM

Hey, so sorry for taking so long to get back with you! This is the last week before spring break at my school, so there have been lots of exams and stuff! I read your writeup on your website and it looks great! Nice job!

 

 

I've re-oriented the breadboard so two of the ultrasonic sensors face out, but I've run into a bit an issue with the extension cable for the forward facing one. The cord is rather long and I have no clue how to affix it to the robot! Do you have any ideas?

 

Are you asking how to mount the sensor to the robot, or what to do with the cable since it's so long?

 

If you're trying to figure out how to mount the sensor, take a look at how I did it in this video:

 

 

The sensors have mounting holes in the corners and what I did was I poked holes in the cardboard base of the robot, set the sensor on the base, then ran wire through the holes to affix the sensor to the robot. It actually was very sturdy. You could also use right-angle brackets if the wire doesn't work (they're sold at hardware stores and look like this: http://7layerstudio....7dba7970b-320wi).

 

As far as what to do with the cable, I would fold it back and forth over itself, use a zip tie (or wrap electrical tap around it) to keep it from unraveling, then use some tape to fix it to the robot.

 

If that doesn't make sense, let me know and I can post some pics..

 

Also, once I get this working, I'd like to add some features besides wall avoidance, just to add the cool/techy factor. Do you have any suggestions for extensions?

 

Well, there are lots of things you could do!

 

You could easily make it into a line following robot, which is a fun project, by using 5 IR sensors like these:

 

https://www.foxytron...-optical-sensor

 

You could give it the ability to drive perfectly straight by using a gyroscope (which I think are really cool!) like this:

 

https://www.foxytron...ometer-mpu-6050

 

That board actually has 3 gyroscopes and 3 accelerometers, so you can do a lot with it.

 

You could add a color sensor to it, like this one:

 

https://www.foxytron...r-sensor-module

 

Or you could use some photoresistors (I think there were some in your robotics kit?) to make the robot drive towards or away from light sources.

 

Adding an LCD to the robot is also something cool that you could do..

 

If you haven't been on the Arduino forum, be sure to check it out at forum.arduino.cc. I'm sure people could give you a ton of suggestions for projects on there!

 

Also, if I don't have the parts you need, be sure to checkout https://www.sparkfun.com/. They're a much bigger company and have a lot more sensors and parts than me (for now!).


  • 1


#27 Trouble with Robotics kit

Posted by Nathan House on 01 January 2014 - 11:53 PM

No, you didn't forget them, but I can't seem to get them on. It almost looks like the inside wheel (where it connects to the servo) is too small. Not sure if this is just me failing again <_< or something with the product.

 
They'll fit, but you have to push *really* hard to get them on. I think they are a little bit too small, actually, but they're the only nice wheels I've been able to find that fit onto servos.
 
 

I'm doing this as a science fair project in our homeschool group and because of that I'm doing a write-up of what I've done. If my mom says so, I'm gonna post it to my blog, if you don't mind.

 
Let me know when you get your writeup done, I'd like to see it!
 

One more question, my robot seems to have a slight pull to the right when it's going straight. Do you have any clue why this is?

I suspect it has something to do with the fact that I am splitting power between the two motors by connecting the two with one wire and applying the power at one end.
Thus, because the power and ground connect closer to one motor, it gets just enough extra eletricity to make it pull more than the other.
Could this be the reason?

 
The robot pulling to the right isn't a power issue. It actually doesn't really matter which servo is connected to the battery pack first -- they'll both pretty much get the same amount of power.
 
The first thing I'd check is if the servos are tuned properly. Try setting both servos to neutral in your code (the value "90" is neutral) and see if either of the servos move, or make any noise. If they do, then take a screwdriver and tune the servos by turning the potentiometers on them (if you look on the side of the servos, there's hole that gives you access to an orange potentiometer). You can probably get it driving pretty straight with this method.
 
Unfortunately, even if you get the servos perfectly tuned, it still won't drive perfectly straight. The next step, after tuning the servos, is to take note if it's veering off to one direction or the other and, if it is, try adding an "offset" to one or both of the motors. For example, if it's pulling to the right, you might make the right motor turn a little faster, and the left one turn a little slower.
 
Those are the first two things to do and should get it going pretty straight. A good future project for you would be to use either encoders or a gyroscope (my favorite) to make it drive perfectly straight  :)
 

Also, just a FYI, adding a ball caster to the rear of the robot (and probably the front too) makes it roll much better than the carboard.

 

Absolutely! The old kit didn't have real wheels (just those plastic hubs) or a caster, but the new one does and it makes a huge difference! I actually forgot to put the caster in your kit (I rushed to get it put together so that I could get it shipped out quickly for Christmas), but I shipped it separately the next day (hopefully you got it!).

 

 

Found another error, in the code:

 

the second ultrasonic is spelled utlrasonic. That's all!

 
Thanks, fixed!

 

 


  • 1


#255 Increasing Ultrasonic Sensor Range?

Posted by EinsteinMC on 26 April 2015 - 07:54 PM

How can i modify the code in order to allow the sensor to detect an obstacle that is further away? Basically, I want the sensor to detect obstacles earlier and therefore have the robot respond earlier.

 

EDIT: Forget it, I got it. Had to increase the value in the if statement

if(ultrasonic2Distance > 20 || ultrasonic2Distance < 0) {}

  • 1


#252 Product delivered as promised

Posted by nopola on 04 April 2015 - 07:42 PM

I clicked on the link in your catalog description of the Nano and connected to http://www.wch.cn/do...341SER_EXE.html.

The file CH341SER.EXE loaded correctly and the Nano connected to COM7 which was the next available port.


  • 1


#247 modifying funduino robot code for project.

Posted by Si_Price on 16 March 2015 - 04:54 PM

You mean the distance at which it changes from the drive forward to the turn left state? That would be this code:

if(ultrasonic2Distance > 0 && ultrasonic2Distance < 6) { // there's an object in front of us

That code is saying to go into the IF statement if the distance measured is 6. Making that number smaller means the robot will have to get closer to the object before branching, making the number larger means it will branch sooner.

 

Ah okay thanks, I tried increasing it but my robot still manages to flip himself sometimes, I think it's because of the angle he approaches the wall and the radius of the distance sensor only reading from the front. I have managed to implement the flashing LED and the stop sequence though so that's something! thanks :)


  • 1


#229 ArduinoRobot

Posted by Nathan House on 10 March 2015 - 02:00 PM

No problem, glad you are trying to understand it!

 

timeSerialdelay and timeLoopdelay have an initial value of zero, but then their values are changing later in the program.

 

Inside of the IF statement in loop(), you can see that we set timeLoopDelay = millis(), where millis() is the number of milliseconds the Arduino has been powered on for. Initially, timeLoopDelay is zero, as you noticed. In the conditional statement (IF statement) we check that millis() - timeLoopDelay >= loopPeriod. In other words, we check to see if looPeriod milliseconds has elapsed since the last time the code in the loop was executed. We do this to make the code inside the loop only run every loopPeriod milliseconds, instead of running much more frequently.

 

The timeSerialDelay variable is used similarly, to only print information out to the serial terminal every quarter second instead of constantly printing it out (which makes it impossible to read).


  • 1


#226 modifying funduino robot code for project.

Posted by Si_Price on 06 March 2015 - 09:11 PM

just verified it works perfect, thanks so much for your help I really appreciate it. Once I've got the project up and running I'll post a link to the performance so people can see the results!


  • 1


#21 Trouble with Robotics kit

Posted by Nathan House on 30 December 2013 - 10:45 PM

Hey,

 

Thanks for the well written question and images, your post is the perfect example of the right way to ask a question!

 

From the picture you posted, I think you have the power wires for the servos backwards. Take a look at this diagram:

 

1388442826_continuous_rotation_servo_dia

 

The GND wire should be connected to the corner of the battery pack opposite where the power wires are coming out of it. So in the orientation shown above, the GND wire should be connected in the lower right hand corner of the battery pack.

 

Give that a try and let me know if anything happens!


  • 1


#171 ADC at USB HID Custm

Posted by Nathan House on 13 December 2014 - 12:01 PM

Hi omran,

 

I haven't used the framework in a really long time so I'm not sure on the answer to your question. Please try posting your question on the official Microchip forum, where you should be able to get an answer: http://www.microchip.com/forums/

 

Sorry I can't be of more help!


  • 1


#17 First Feedback

Posted by jpooda on 21 October 2013 - 02:21 AM

I was just clicking through the forums and realized that there was no posts on your feedback forum, so I decided to change that. Well first of all, I love your website and your catalog of products. Your extremely fast at shipping and compared to Adafruit, you were one day faster then them. I found FoxyTronics through Chief Delphi a while back, since I am on FIRST robotics, like you were. (team 1986 to be exact) So I am a permanent customer for you and I will always comeback if your catalog has the product i'm looking for. One thing though, I ordered an arduino from you a while ago, and it was a legit arduino. When I ordered another one a month ago, I realized you switched to an off-brand arduino, will you ever switch back? All in all, love your business and keep up on adding to your catalog!

 

~Jay Urban


  • 1


#159 Problem With My Robot

Posted by Nathan House on 21 October 2014 - 02:37 AM

Oh snap! I know what the problem is! Your servos must somehow be in a different orientation than in the tutorial.

 

Change this:

// drive forward
            rightMotor.write(180);
            leftMotor.write(0);

To this:

// drive forward
            rightMotor.write(180);
            leftMotor.write(180);

And this:

// turn left
            rightMotor.write(180);
            leftMotor.write(180);

To this:

// turn left
            rightMotor.write(0);
            leftMotor.write(180);

  • 1


#149 Problem With My Robot

Posted by Nathan House on 21 October 2014 - 01:27 AM

And the distance looks correct? I.e. if you put your hand right in front of it, the distance is close to 0cm, then as you move away it keeps increasing?


  • 1


#147 Problem With My Robot

Posted by Nathan House on 20 October 2014 - 11:26 PM

Alright, so that means the servos are wired correctly. The next thing I want you to test is the ultrasonic sensor. Here's code from the page I linked to before:

const int serialPeriod = 250;       // only print to the serial console every 1/4 second
unsigned long timeSerialDelay = 0;

const int loopPeriod = 20;          // a period of 20ms = a frequency of 50Hz
unsigned long timeLoopDelay   = 0;

// specify the trig & echo pins used for the ultrasonic sensors
const int ultrasonic2TrigPin = 8;
const int ultrasonic2EchoPin = 9;

int ultrasonic2Distance;
int ultrasonic2Duration;


void setup()
{
    Serial.begin(9600);
  
    // ultrasonic sensor pin configurations
    pinMode(ultrasonic2TrigPin, OUTPUT);
    pinMode(ultrasonic2EchoPin, INPUT);
}


void loop()
{
    debugOutput(); // prints debugging messages to the serial console
    
    if(millis() - timeLoopDelay >= loopPeriod)
    {
        readUltrasonicSensors(); // read and store the measured distances
        
        timeLoopDelay = millis();
    }
}


void readUltrasonicSensors()
{
    // ultrasonic 2
    digitalWrite(ultrasonic2TrigPin, HIGH);
    delayMicroseconds(10);                  // must keep the trig pin high for at least 10us
    digitalWrite(ultrasonic2TrigPin, LOW);
    
    ultrasonic2Duration = pulseIn(ultrasonic2EchoPin, HIGH);
    ultrasonic2Distance = (ultrasonic2Duration/2)/29;
}


void debugOutput()
{
    if((millis() - timeSerialDelay) > serialPeriod)
    {
        Serial.print("ultrasonic2Distance: ");
        Serial.print(ultrasonic2Distance);
        Serial.print("cm: ");
        Serial.println();
        
        timeSerialDelay = millis();
    }
}

Upload the code, then open the serial monitor in the Arduino IDE and see what prints out when you move something back and forth in front of it. It should print out the distance.


  • 1


#145 Problem With My Robot

Posted by Nathan House on 20 October 2014 - 10:59 PM

Hey Rider,
 
Sorry for not getting back with you sooner. I've been sick the past couple of days :-(
 
That's a cool looking robot!
 

Added a separate battery pack because when I Split the pack something was causing my Ardiono To get to hot.

 
Something was probably wired incorrectly if the Arduino was getting hot, but using a separate battery pack is better anyway.
 

Well I have it built and It is doing the exact opposite of what it should do (Drive Forward until it detects an object then turn) Well At the moment its turning right and going straight when it detects something. I have used the Exact code in your Tutorial and built it pretty much the same. Yet I cant find out why its doing this. Do you have any ideas why?

 

So when the robot is supposed to drive straight, it turns, and when it's supposed to turn, it drives straight..

 

Since you're using the exact code from the tutorial, there must be something different with your wiring. Let's try to debug the problem!

 

When you're trying to debug a problem like this, the best thing to do is break it down into smaller steps to make the debugging easier. So let's start by trying to make the robot drive straight. If you look on the tutorial page, you can find this code:

#include <Servo.h>

// create servo objects
Servo leftMotor;
Servo rightMotor;

void setup()
{
    leftMotor.attach(13);
    rightMotor.attach(12);
}


void loop()
{
    leftMotor.write(180);
    rightMotor.write(180);
} 

 Try uploading that to your Arduino and see if it drives forward (or backward). If not, then we can try to figure out why it's not driving straight. If it does drive straight, then we know this part works and can move on to trying something else. The key is to break the problem down into sub-problems and attack them one at a time.

 

Good luck, and let me know how it goes!


  • 1


#136 Ultrasonic Sensor Not Working

Posted by Nathan House on 07 August 2014 - 09:35 PM

It seems as though the wire has a life of its own.

 

It's aliiiiiive! Ha ha :) 

 

Well the behavior you're getting doesn't make any sense to me, so I think it's probably either a power issue or a faulty sensor. I'll go ahead and just send you a new ultrasonic sensor, testing it beforehand to make sure it works, and hopefully that fixes the issue (if not, you'll probably need to get a multimeter to help debug whatever the problem is). 

 

Should I send it to the same address your order went to (Broad St)?


  • 1


#114 Ultrasonic sensor not working

Posted by PatriotAce on 24 April 2014 - 05:55 PM

You might want to check that the sensor's pings aren't hitting the wheels and returning early. I had an issue similar to this and I removed the wheels and tested and it gave me good readings. Try taking off the wheels and testing the code. If you get good readings, you know that the servo wheels are your issue!


  • 1