Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: Plague on July 30, 2015, 12:14:41 PM

Title: $50 dollar robot not working.
Post by: Plague on July 30, 2015, 12:14:41 PM
Okay, so I purchased another Atmega8-16pu because, after trying to fix the other other one, I concluded that it is probably fried.
Using AVR dude  and an Arduino as an isp i was able to successfully load the hex file onto the new Atmega8-16pu without any problem. But when i place the chip in my 50 dollar robot circuit, only the servos spin, continuously. When I introduced light to it, nothing happened the servo kept spining the same way they were spining. I also used the ardunio to check if the photocells were working properly. It gave me values for dark and bright so I think the photocells are fine. Also the circuit is up there in the original question if anyone want to take a look.
What could possibly be wrong. Or should i again purchase another Amtega, because this one might be faulty (Got it from EBAY)? 

If it may be of help i was thinking maybe the way I modified the servos could be the problem? I used a sketch from the arduino forums to modify the servo.
#include <Servo.h> // include the Servo library

// create the servo objects
Servo leftMotor;
Servo rightMotor;

void setup()
{
  leftMotor.attach(13);  // attaches the servo on pin 13 to a servo object
  rightMotor.attach(12); // attaches the servo on pin 12 to a servo object

}

void loop()
{
  leftMotor.write(0);  // 90 is neutral, so neither of the servos should turn
  rightMotor.write(90);
}

HELP!!!!!!!!!!! SO I CAN COMPLETE IT!!! All solutions are welcomed. Also I have tested the circuit and everything is fine.
Be as detailed as possible when giving me solutions, IM a beginner to all this. ;D
Title: Re: $50 dollar robot not working.
Post by: cyberjeff on July 30, 2015, 09:37:18 PM
I'm unsure what you are doing but I think:

You modified the Servo so that it is continuous rotation.

I have not done that, but... If you did not set the servo to neutral before you modified, the potentiometer might not be centered, so it would rotate. I would see if you can adjust it so it stops rotating while you have it set for neutral (90).

I suspect that the Arduino is OK.
Title: Re: $50 dollar robot not working.
Post by: Plague on July 30, 2015, 09:43:39 PM
What about the Photoresistors, any ideas why it isn't quite working?
Because if the servos aren't the problem, I honestly run out of idea as to why this thing won't chase light.
I soldered the pphoto cells correctly as shown in the tutorial (even went ahead and did it twice for accuracy)
Can this be an Atmega problem or programming/software problem. Or even a photoresistor problwm?
 
The servos stop at 90
Title: Re: $50 dollar robot not working.
Post by: cyberjeff on July 31, 2015, 05:39:00 AM
What about the Photoresistors, any ideas why it isn't quite working?
Because if the servos aren't the problem, I honestly run out of idea as to why this thing won't chase light.
I soldered the pphoto cells correctly as shown in the tutorial (even went ahead and did it twice for accuracy)
Can this be an Atmega problem or programming/software problem. Or even a photoresistor problwm?
 
The servos stop at 90

I haven't built a $50 robot, nor will I.

I did look at the code and it is quite old, circa 2007. There is a commonly used Servo lib, but it wasn't written until 2009.

So, I have to ask: Why are you building this? Few people need robots that chase light, so I would think  that it is because you want to learn how to program a robot.

Is that correct?

This was very clever code, but  it isn't 2007 anymore. Programming servos is done differently these days, there are established libraries for servos and analog read for the photo sensors. To rewrite this is not difficult.

What do you want to do?
Title: Re: $50 dollar robot not working.
Post by: mklrobo on July 31, 2015, 07:10:30 AM
 :) Hello!
CyberJeffs' statement;
I haven't built a $50 robot, nor will I.
This is so true, and reflects the choice of the person in relation to the products provided.
A lot of people would rather buy a Raspberry Pi for $35, a Parallax basic stamp for approx. $50 or less,
or any number of ardinu processor products compared to the price of the Axon; not to mention the
ease of use for those products, plus the power and support.
I have not programmed the Axon yet, because of my learning curve. :o
So, why should you buy an Axon, when you have more power, cheaper, and support with the other products?
The Axon board is a good design, and the processor line is a stable one. The Axon can do (I believe)
a lot more functions when clever programming is applied. The software has a simulator and uses
C++ language. The Axon is a gateway to the whole Atmel line of processors, and your software
can program them all, provided you have an STK600 to program them. I have found these processors
virtually everywhere, which gives a lot of uses. The smaller MCU are dirt cheap, $.5 - $1, and are
pretty powerfull for that size.
Ultimately, it is up to the user to create the masterpiece of Ex-machina, and is up to the people in this forum to try to participate in the Axon robotic construction. Other products illustrate a lot of programming capabilities on their products; HOWEVER, it seems that they have half of the whole world
programming their products, and giving that software away FREE. That is a lot of competition, but does
not diminish the potential power of the Axon,  8)  given the perspective I have indicated. What do you think?
Title: Re: $50 dollar robot not working.
Post by: cyberjeff on July 31, 2015, 09:04:06 AM
:) Hello!
CyberJeffs' statement;
I haven't built a $50 robot, nor will I.
This is so true, and reflects the choice of the person in relation to the products provided.
A lot of people would rather buy a Raspberry Pi for $35, a Parallax basic stamp for approx. $50 or less,
or any number of ardinu processor products compared to the price of the Axon; not to mention the
ease of use for those products, plus the power and support.
I have not programmed the Axon yet, because of my learning curve. :o
So, why should you buy an Axon, when you have more power, cheaper, and support with the other products?
The Axon board is a good design, and the processor line is a stable one. The Axon can do (I believe)
a lot more functions when clever programming is applied. The software has a simulator and uses
C++ language. The Axon is a gateway to the whole Atmel line of processors, and your software
can program them all, provided you have an STK600 to program them. I have found these processors
virtually everywhere, which gives a lot of uses. The smaller MCU are dirt cheap, $.5 - $1, and are
pretty powerfull for that size.
Ultimately, it is up to the user to create the masterpiece of Ex-machina, and is up to the people in this forum to try to participate in the Axon robotic construction. Other products illustrate a lot of programming capabilities on their products; HOWEVER, it seems that they have half of the whole world
programming their products, and giving that software away FREE. That is a lot of competition, but does
not diminish the potential power of the Axon,  8)  given the perspective I have indicated. What do you think?

I have no quibble with the hardware, it is the ancient software in the $50 robot. I read through it and could not figure out servo instructions. The Servo lib abstracts this very well, but wasn't available in '07.

As far as the Axon, it seems like a great product, particularlysince it has RF communications built in. Considering that is an add on for almost  everything else, it is a great deal.

I would think that the Axon line is well suited to most robotic projects, Kudos to them!

With that said, my little project requires a great deal of processing and the much faster processor in the Due was my choice.

The Pi is an entirely different animal (a microprocessor rather than a microcontroller) and I see no reason that a Pi could not work hand in hand with an Axon or an Arduino. At least that is my thinking, with the Pi handling the intelligence a microcontroller handling  the mechanics.

Learning curves always exist. I don't write in C++ so learning how it works has been a chore I am working on. With any new language there is usually a couple weeks where not much gets done and it takes months before some fluency. It  is just the way it is. Multidimensional arrays in C++ have taken me a while to absorb.

I work a little different than most people. I really don't desire to do something that has already been done, so wheeled robots hold no interest. Neither do I have an interest in humanoids as they are widely worked on. Nor do I have much interest in speed or robot battles.

Whatever holds your interest, it is a great time for robotics. There is a wide variety of hardware that can be bought or printed. The processors are cheap and the software is fairly mature. And yet we are still on the doorstep of a world where robotics and artificial intelligence will be prevalent.

I'm running with it. My best to you and your project.
Title: Re: $50 dollar robot not working.
Post by: Plague on July 31, 2015, 09:42:09 AM
I honestly strolled to this website to build the 50 dollar robot. My reason none at all when I first started (I just wanted to see what goes into build a simple photovore). However, through the process of encountering errors and problems, I've manage to learn something more than I initially expected. I do not know how to write a program or code or whatsoever, but upon building this robot again, I have a clear understand of what some of these code mean, by looking at them I.e the servo code above (And I've cultivated an Interest in learning how to program). Yes, I understand the software may be outdated, but, I'm gonna assume some people arrive at this website through searches for "How to build a robot" (Just like I did). It would be nice to get an update for someone who wishes to build this photovore in 2015 and is stuck like I am. :-\ ..... I'm.only trying to learn.  :D
And for micronctrollers, I have an arduino. Which I'll get used to eventually.


I Still Need help on my issue though.  8)
Title: Re: $50 dollar robot not working.
Post by: cyberjeff on July 31, 2015, 01:55:38 PM
I stumbled on this site because of the servo mod for continuous rotation. Best I have seen.

When you troubleshoot a program you need to see what is happening with your variables. At the moment you don't know where the problem is, but if you knew what values were coming from the photocells after  the A to D, you could see if they were behaving. Similarly you could see what the values were going to the servo.

Typically you would sprinkle test points (and probably slow down the loop) and track what is going on. That is fairly simple to do with an Arduino when it is tethered to a computer. You open a serial connection through the USB and watch the data being printed out.

That is exactly what I do when I am debugging a program. Debugging by guessing, is a lot like fixing a car by guessing and is why all cars now have diagnostics where you can read the various engine settings and codes.

I would be willing to contribute to code for an Arduino version of the $50 robot, I won't be building one though.
Title: Re: $50 dollar robot not working.
Post by: Plague on July 31, 2015, 04:29:42 PM
I stumbled on this site because of the servo mod for continuous rotation. Best I have seen.

When you troubleshoot a program you need to see what is happening with your variables. At the moment you don't know where the problem is, but if you knew what values were coming from the photocells after  the A to D, you could see if they were behaving. Similarly you could see what the values were going to the servo.

Typically you would sprinkle test points (and probably slow down the loop) and track what is going on. That is fairly simple to do with an Arduino when it is tethered to a computer. You open a serial connection through the USB and watch the data being printed out.

That is exactly what I do when I am debugging a program. Debugging by guessing, is a lot like fixing a car by guessing and is why all cars now have diagnostics where you can read the various engine settings and codes.

I would be willing to contribute to code for an Arduino version of the $50 robot, I won't be building one though.

I'll try to see if I can Debug based on what you said. I used to arduino to check the light and dark values of the photocells, and i got a good response. Ill see if i can find anything else Also if possible, you can contribute your code just incase.. Much appreciated.
Title: Re: $50 dollar robot not working.
Post by: Plague on August 04, 2015, 08:48:39 PM
I've tested and servo and sensors with the arduino ( The photo resistors read light and dark fine) still no luck. I'm starting to think the hex file for the robot isn't working for me.  :-\......could the resistors attached to the photo resistors have anything to do with it? Help!
Title: Re: $50 dollar robot not working.
Post by: cyberjeff on August 05, 2015, 01:53:02 AM
I've tested and servo and sensors with the arduino ( The photo resistors read light and dark fine) still no luck. I'm starting to think the hex file for the robot isn't working for me.  :-\......could the resistors attached to the photo resistors have anything to do with it? Help!

Let's take some measurements. The resistor in series with the photoresistor acts as voltage divider, with the junction of the two going to the analog to digital converters in the microprocessor.

So,...with the ground lead of your tester on ground let's look at the voltages.

Measure the voltage at pin 7, this should be around 5V.

Now measure the voltage at pin 27 and at pin 28. These should be part way between 0 and 5V. The pin that has the most light falling on it's connected photo resistor should have a higher voltage.

Is this the  case?  Post up the voltages and which photoresistor has the most light.