Author Topic: $50 Robot - 95% complete but can't seem to tell if photocells are working  (Read 3644 times)

0 Members and 1 Guest are viewing this topic.

Offline koolboarder007Topic starter

  • Jr. Member
  • **
  • Posts: 9
  • Helpful? 0
Good morning! I've completed the following steps to the $50 robot:

1.) Assembled structure
2.) Completed circuit board
3.) Uploaded Program to AT Mega 8
4.) Calibrated Servo's
5.) Connected Servo's to circuit and attached to robot structure.
6.) Attached both photocells to robot structure and PINS PC4 and PC5

As you can see, I'm basically done... But what seems strange is that it doesn't seem like the sensors are making any type of affect on the robot... If I cover the photocells with my hands the voltage on the wire going to PC4 will drop considerably and if I put a light on the photocell the voltage will increase to around 4 something volts. I'm pretty certain that this is the expected behavior... Sometimes when I'm playing around with it one of the wheels will start to jiggle a little. So right now I'm playing with the code and changing some of the values going to the servos.

I tried setting both servos to 0 and what I got was that one wheel rotated one way while the other rotated a different way. I'm pretty sure this is correct behavior because the servo's are opposite of each other so I'm telling both to go backwards. I'm trying to do some debugging because I want to see when it catches the two if statements where the light is greater on one side than on the other. I guess I figured this out when I was out tinkering in my garage at 12:00 AM and I let it run out of the garage into the dark and it kept going straight until it ran into a plant. I guess it has a mind of its own :) j/k

Anyhow, I was wondering if anyone else has had a similar problem? I just want to make sure that the sensors are being read correctly. Maybe I need to play with the threshold a little. I guess every case is different and will need to play with the values. I had another quick question about the LED on the board. I noticed the code says: LED_off();//turn LED on; Is that correct? I thought maybe it was put that way because the port PD4 is active low maybe? I wasn't sure. The reason i'm asking is because my LED is not coming on. I've tried setting LED_on(); but it doesn't seem to work either. I have a feeling my LED might have been burned out from to much voltage when I was putting the circuit board together so I can put another one in there, but I wanted to know which function to use to turn it on and then to turn it off. I'm going to use the LED to debug when I hit one of the if statements. Thank you for your help in advance!

Will

Offline koolboarder007Topic starter

  • Jr. Member
  • **
  • Posts: 9
  • Helpful? 0
OK, I was able to figure out the issue. I had the LED put on backwards which is why it was not lighting up. I couldn't figure out why i had this on backwards. When I went back and looked at the circuit diagram it looks like the diagram displays the LED backwards. I changed the function in the program to say "LED_on();" and it came right on after I connected the right ends of the LED. As for the sensors, I think what was happening is that the microprocessor wasn't pushed in all of the way into the 28pin DIP board. The end pin wasn't receiving the value for the sensor. Every once in a while I find that I have to push it in because it starts to come out and drive straight. So if anyone finds that they are having a problem with the sensors, make sure that the chip is pressed in all the way and it will probably fix the problem.



paulstreats

  • Guest
What dip socket are you using?
A standard socket should hold it tight (unless you melted it while soldering - a lot of people seem to do this?) :)
If its a machine pin socket or swiss pin socket(round holes) then they usually dont work well with the flat legs and they do pop out.

Glad you have your robot done. How about a video or some pics ;D

Offline koolboarder007Topic starter

  • Jr. Member
  • **
  • Posts: 9
  • Helpful? 0
I'll make sure to make a video and post it tomorrow. The 28 pin DIP socket I used is the one recommended on the parts list (It has the round holes). It doesn't appear that anything of the pins melted. What probably happened is I was being a little extra cautious to make sure that I didn't break the leads when slipping it into the socket. I gave it a little more force and it seems to be "sticking" a lot better now.

 


Get Your Ad Here