go away spammer

Author Topic: 50$ robot Sensor problem  (Read 3459 times)

0 Members and 1 Guest are viewing this topic.

Offline flubber_butt_2001Topic starter

  • Jr. Member
  • **
  • Posts: 25
  • Helpful? 0
50$ robot Sensor problem
« on: November 16, 2009, 08:09:15 PM »
Hi,

I'm making the 50$ robot right now and I am having some sensor problems. It seems that my robot just keeps going straight. I've checked the photoresistor to make sure its working and it is because I am getting the correct changes in resistance when I measure them with a multimeter. I've also made sure my output pins are correctly soldered to the IC socket pins. There is no connection problems there. I know that the chip is being programmed because I've adjusted the led light on/off code also. I'm at a loss for ideas anymore and any help would be much appreciated.

Thanks

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,165
  • Helpful? 111
    • Webbot stuff
Re: 50$ robot Sensor problem
« Reply #1 on: November 16, 2009, 08:39:28 PM »
With the power disconnected - have you use a meter to ensure that there is a good connection from the sensor header pin to the microcontroller pin?
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline flubber_butt_2001Topic starter

  • Jr. Member
  • **
  • Posts: 25
  • Helpful? 0
Re: 50$ robot Sensor problem
« Reply #2 on: November 16, 2009, 10:06:31 PM »
Yes, I have checked that the connections between the sensor bus pins and the microcontroller pins are good but still nothing.
« Last Edit: November 16, 2009, 10:10:10 PM by flubber_butt_2001 »

Offline mayukh

  • Jr. Member
  • **
  • Posts: 8
  • Helpful? 0
Re: 50$ robot Sensor problem
« Reply #3 on: November 16, 2009, 10:14:31 PM »
Have you switched on the robot and checked the voltage at the photoresistor input pins on the MCU with a multimeter in a well lit area and shade?
____________________

Regards,
Mayukh.

Offline flubber_butt_2001Topic starter

  • Jr. Member
  • **
  • Posts: 25
  • Helpful? 0
Re: 50$ robot Sensor problem
« Reply #4 on: November 16, 2009, 10:23:09 PM »
Hi,

Sorry, I'm kind of new to this. What do you mean check the voltage at the photoresistor input pins? Are you talking about the voltage that's going into the photoresistor or the voltage that's being outputted and going into the microcontroller? and how would I go about measuring this. Thanks for all the help everyone. It's much appreciated

Offline flubber_butt_2001Topic starter

  • Jr. Member
  • **
  • Posts: 25
  • Helpful? 0
Re: 50$ robot Sensor problem
« Reply #5 on: November 16, 2009, 11:10:46 PM »
I was also wondering, should there be resistance across the + and - leads of the sensor bus when i use the multimeter? This is when the battery pack is unplugged but it goes to inifinity when it is plugged in

Offline SmAsH

  • Supreme Robot
  • *****
  • Posts: 3,959
  • Helpful? 75
  • SoR's Locale Electronics Nut.
Re: 50$ robot Sensor problem
« Reply #6 on: November 17, 2009, 12:20:43 AM »
there shouldnt even be a readinigh betweenn the + and -... Maybe a very hight one...
What is the reading?
Howdy

Offline flubber_butt_2001Topic starter

  • Jr. Member
  • **
  • Posts: 25
  • Helpful? 0
Re: 50$ robot Sensor problem
« Reply #7 on: November 17, 2009, 12:43:54 AM »
I'm getting 10.1 kohm when the battery isnt plugged in and infinity when it is plugged in

Offline AtomicWaste

  • Jr. Member
  • **
  • Posts: 19
  • Helpful? 0
Re: 50$ robot Sensor problem
« Reply #8 on: November 17, 2009, 01:37:30 AM »
I recently had the same problem and just solved it. Push on the microcontroller a slight bit where it connects to the sensors. Sometimes the chip bends up slightly at the ends, and the connections between the pins on the atmega and those on the sensors data bus aren't secure enough.
"Give a man a fire, he's warm for a day. Set a man on fire, and he'll never be cold the rest of his life." - Unknown

Offline flubber_butt_2001Topic starter

  • Jr. Member
  • **
  • Posts: 25
  • Helpful? 0
Re: 50$ robot Sensor problem
« Reply #9 on: November 17, 2009, 02:24:06 AM »
I recently had the same problem and just solved it. Push on the microcontroller a slight bit where it connects to the sensors. Sometimes the chip bends up slightly at the ends, and the connections between the pins on the atmega and those on the sensors data bus aren't secure enough.

I've done a check on all the microcontroller pins while they are plugged in to make sure that they are connected to my input pins for my sensor bus output pins. They all seem to check out that they're connected.

Offline hopslink

  • Robot Overlord
  • ****
  • Posts: 202
  • Helpful? 14
Re: 50$ robot Sensor problem
« Reply #10 on: November 17, 2009, 05:38:12 AM »
...What do you mean check the voltage at the photoresistor input pins? Are you talking about the voltage that's going into the photoresistor or the voltage that's being outputted and going into the microcontroller? and how would I go about measuring this...
Check the voltage going to the microcontroller. Connect the black lead of your meter to ground (0V), switch it to measure DC volts on a 20V range, turn on the power to the circuit, connect the meter red lead to the input pin of your microcontroller being careful not to short between pins. You should get a value somewhere between 0 and 5V and this should vary as you change the light levels on the photosensor.
Quote
I was also wondering, should there be resistance across the + and - leads of the sensor bus when i use the multimeter? This is when the battery pack is unplugged but it goes to inifinity when it is plugged in.
If the sensors are plugged in when you measure then this is normal - you are measuring the resistance of the photosensor including its bias resistor. Unplug the sensors and you should see the resistance between the lines jump to infinity.
With the power on resistance readings are meaningless. In resistance mode your meter supplies a small current to measure voltage across the resistor you are testing. If the circuit is powered the voltage the meter sees will be dominated by whatever the circuit supplies and so readings will generally be garbage.

Offline mayukh

  • Jr. Member
  • **
  • Posts: 8
  • Helpful? 0
Re: 50$ robot Sensor problem
« Reply #11 on: November 17, 2009, 05:43:11 AM »
Hi,
You see, the photoresistor circuit is basically a voltage divider. Depending on how you wire the resistance up, it either allows current to pass (ie voltage high) when light falls on the resistor, or it does not (ie voltage low). So if you have wired everything up and you are using PC0 pin and PC1 pin for your photodiode input to the atmega8, what you do is put the red end of your multimeter on PC0 pin and the black end into the small hole of the 7805 IC ie ground. Now if you take this contraption into a sunny spot, the voltage should read nearabouts 5V and when you take it to a shady area, the voltage should read a very minimum value maybe 0. It may be the other way around depending on how you have wired up the photoresistor circuit, but this change in voltage has to occur. Check this first and see whether the appropriate micro controller pins are getting the appropriate voltage input...Should be easy enough.
____________________

Regards,
Mayukh.

Offline flubber_butt_2001Topic starter

  • Jr. Member
  • **
  • Posts: 25
  • Helpful? 0
Re: 50$ robot Sensor problem
« Reply #12 on: November 17, 2009, 11:09:22 AM »
So I've made the measurements you have described and I am getting a constant 4.87 V no matter where I go and what lighting the photoresistor is in. I'm not exactly sure what I should do right now. I'm really sorry for all these noob questions but I've only just started and am very interested in learning. I appreciate your help a lot!

Offline hopslink

  • Robot Overlord
  • ****
  • Posts: 202
  • Helpful? 14
Re: 50$ robot Sensor problem
« Reply #13 on: November 17, 2009, 12:43:29 PM »
OK next test ;)

Take your sensors off the robot. They should have three terminals a 0V, +5V and sensor output - like at the bottom of this tutorial page. For each sensor make the following resistance measurments:
Between 0V and output.
Between 0V and +5V.

Do this with each sensor in the light, and again the dark, so there should be 8 readings. Post the results (you get merit for clear labeling  :P).

Offline flubber_butt_2001Topic starter

  • Jr. Member
  • **
  • Posts: 25
  • Helpful? 0
Re: 50$ robot Sensor problem
« Reply #14 on: November 17, 2009, 05:14:56 PM »
So I've done the test and jotted down some values. Here is what I got which seems like the photoresistor sensors are working.

Photoresistor sensor 1

0V & output =  1kohm with light
       =  infinity without light

0V & +5V = 0.75kohm with light
              = infinity without light

Photoresistor Sensor 2

0V & output =  0.82kohm with light
      =  infinity without light

0V & +5V = 1.09kohm with light
               =infinity without light

OK next test ;)

Take your sensors off the robot. They should have three terminals a 0V, +5V and sensor output - like at the bottom of this tutorial page. For each sensor make the following resistance measurments:
Between 0V and output.
Between 0V and +5V.

Do this with each sensor in the light, and again the dark, so there should be 8 readings. Post the results (you get merit for clear labeling  :P).

« Last Edit: November 17, 2009, 05:37:59 PM by flubber_butt_2001 »

Offline hopslink

  • Robot Overlord
  • ****
  • Posts: 202
  • Helpful? 14
Re: 50$ robot Sensor problem
« Reply #15 on: November 17, 2009, 08:00:45 PM »
Good. Exactly what was wanted!

From these results it looks like you have:
Wired your sensors with the photoresistor between 0V and output (which is fine).
Used a bias resistor with a value around 220Ohms between output and +5V (which is a bit low).
If this is way off the mark then shout.

Also sensor 1 is giving a strange result. The resistance from 0V to output should always be lower than the  0V to +5V resistance by the value of the bias resistor (you are measuring photoresistor resistance vs. photoresistor+bias resistor). There are two reasons this could be:
1) You got confused and labeled wrongly (so you lose the merit  :P)
2) The output and +5V wires are swapped (easily done), this would also explain a constant +5V reading from a sensor.
Repeat the measurement in the light for this sensor and check the results. If it is case 2, simply swap the output and +5V wires over at whichever end of the cable is easiest.

On to the bias resistor value. In the configuration you have, in the light, and with the resistor values 820 Ohms(photosensor) and 220 Ohms(bias) the output voltage cannot swing below 4V(approx). In the dark this is much worse and the voltage will not be really drop below 5V at all.
The easiest way to get a reasonable bias resistor value is to grab your photoresistor and take a set of resistance readings:
1) In the brightest conditions you expect to operate the robot with, say on your desk with the ceiling light on.
2) In the same conditions but with the sensor shaded (not completely covered, just shaded, say on the floor under your desk)
For each set get a mean (average) value, then pick a bias resistor value halfway between light mean value and shaded mean value. This will get you a much bigger voltage swing at the sensor output. No need to be too precise (but if you want to a formula is available on the light sensor page, see the link in my previous post).

Hopefully that will have it :)
 
 

Offline flubber_butt_2001Topic starter

  • Jr. Member
  • **
  • Posts: 25
  • Helpful? 0
Re: 50$ robot Sensor problem
« Reply #16 on: November 17, 2009, 08:53:50 PM »
The resistor I used for the photosensors were actually 1.62kohm. Sorry, for sensor 1 I did mislabel =P. Is it okay for me to follow the same methodology for the bias resistor if my resistor is already so large?

Offline flubber_butt_2001Topic starter

  • Jr. Member
  • **
  • Posts: 25
  • Helpful? 0
Re: 50$ robot Sensor problem
« Reply #17 on: November 17, 2009, 11:41:58 PM »
Also I did the calculations for the requried resistor. I determined that the resistance of the photo resistor for the darkest light was 56k ohm and the brightest light was 10k ohm. This gave me a requirement of about 24k ohm. Is this a reasonable value?

Offline hopslink

  • Robot Overlord
  • ****
  • Posts: 202
  • Helpful? 14
Re: 50$ robot Sensor problem
« Reply #18 on: November 18, 2009, 03:05:12 AM »
The resistor I used for the photosensors were actually 1.62kohm. Sorry, for sensor 1 I did mislabel =P. Is it okay for me to follow the same methodology for the bias resistor if my resistor is already so large?
Hmmm ??? The plot thickens...

If you used a 1.62k resistor then none of your resistance readings for 0V to +5V should be below that value. The only way you could get lower values is having resistors in parallel. But, if you had a short so your resistors were in parallel you would never see a resistance higher than 1.62k, even in the dark. Are you sure about the 1.62k? Did you measure them with a meter as you built the sensors? Did you take the sensors off the micro board when you tested them?

Can you test again? This time with each sensor in the light and dark test the following, 0V to output, 0V to +5V and output to +5V.

Quote
Also I did the calculations for the requried resistor. I determined that the resistance of the photo resistor for the darkest light was 56k ohm and the brightest light was 10k ohm. This gave me a requirement of about 24k ohm. Is this a reasonable value?
Yes, that's good. For this application you don't worry about absolute precision so a 22k resistor would be fine (you may find a 22K is cheaper than a 24K).

Offline flubber_butt_2001Topic starter

  • Jr. Member
  • **
  • Posts: 25
  • Helpful? 0
Re: 50$ robot Sensor problem
« Reply #19 on: November 18, 2009, 01:04:09 PM »
Reporting back sir. These values are for the sensors I have already soldered at the beginning of my post. This time I used the actually lightest and darkest parts of my room instead of just covering up the photoresistor or using an LED light on it.

Sensor 1

OV & output = 7.4k with light
                   = 30.3k wihtout light

0V & 5V = 11.3k with light
             = 32.9 without light

5V & output  = 0.01k with and without light

Sensor 2

OV & output = 15.7k with light
                   = 43k wihtout light

0V & 5V = infinity with light (possibly broken connection?)
             = infinity without light (possibly broken connection?)

5V & output  = inifinity with and without light (broken connection again?)




« Last Edit: November 18, 2009, 01:16:16 PM by flubber_butt_2001 »

Offline hopslink

  • Robot Overlord
  • ****
  • Posts: 202
  • Helpful? 14
Re: 50$ robot Sensor problem
« Reply #20 on: November 18, 2009, 03:06:31 PM »
It looks like you are right and there is a broken connection with the bias resistor on sensor 2. For sensor 1 the 5V to output reading is way to low for a 1.62k bias resistor so there may be a short there.

I would take both sensors apart and rebuild them with new bias resistors of around the 24k mark, as you calculated before. Use heat shrink or insulating tape to ensure that none of the bare leads can touch each other. Keep going, you'll soon be there!   

Offline flubber_butt_2001Topic starter

  • Jr. Member
  • **
  • Posts: 25
  • Helpful? 0
Re: 50$ robot Sensor problem
« Reply #21 on: November 18, 2009, 09:25:34 PM »
Okay, so I've resoldered new photosensors. This was with the new 24 k ohm resistors that I calculated for but something really weird is happening when I plug in the sensors the motors will continue to rotate one way. Suddenly when I pull out one of the sensors the direction will change for the motors

Offline hopslink

  • Robot Overlord
  • ****
  • Posts: 202
  • Helpful? 14
Re: 50$ robot Sensor problem
« Reply #22 on: November 19, 2009, 08:17:55 AM »
You're missing the point... the sensors are supposed to do the switching without you :P :P :P

That response is not really wierd. The photovore software just compares the voltages on the sensor input pins and switches the motor direction depending on the relative values (take a look in the photovore.c file, the main code for controlling the robot is only 20 lines or so). By unplugging one sensor you are effectively creating a large difference in sensor input voltage.

So you are still not getting responses to varying light levels with both sensors plugged in?

Offline flubber_butt_2001Topic starter

  • Jr. Member
  • **
  • Posts: 25
  • Helpful? 0
Re: 50$ robot Sensor problem
« Reply #23 on: November 19, 2009, 11:14:07 AM »
No, it seems that it still does not wanna work for me =(. Maybe robot strike? I checked the voltages between P01 and Gnd when the sensors are in with varying light levels but it seems that the voltage is still a constant 4.4. I'm not sure on what to do anymore. I've become extremely confused now lol

Offline hopslink

  • Robot Overlord
  • ****
  • Posts: 202
  • Helpful? 14
Re: 50$ robot Sensor problem
« Reply #24 on: November 19, 2009, 12:12:29 PM »
Robot strike eh? >:( Don't accept that... tell it you'll rip it's microcontroller out and stick it in a furby!!!

When you say P01 you mean pin 28 on the micro, just to make sure we are singing from the same hymn sheet. And there are 2 sensors and 2 input pins so there should be 2 sensor voltages (on pins 27 and 28).
Have you seen the pdf with the layout for the controller board from this post? If not have a slow check around your board to see that things match up. Provided all seems ok, and you are still not seeing a varying voltage on the input pins when the light on the sensors varies then it's back to resistance checks on your sensors I'm afraid.

Keep going and you'll get it sorted! :)

Offline flubber_butt_2001Topic starter

  • Jr. Member
  • **
  • Posts: 25
  • Helpful? 0
Re: 50$ robot Sensor problem
« Reply #25 on: November 19, 2009, 06:35:04 PM »
alrighty!! I fixed it! It was in fact a sensor problem. I accidently made the output wire parallel to the 5v wire. I got confused by the diagram/explaination it gave because they said to solder the output wire to the photoresistor wire sticking out but after looking at the circuit diagram, I noticed I made this mistake. Thanks for all the help, it was very much appreciated. Reminded: Next time look at the circuit diagram instead of pictures lol.

Offline hopslink

  • Robot Overlord
  • ****
  • Posts: 202
  • Helpful? 14
Re: 50$ robot Sensor problem
« Reply #26 on: November 19, 2009, 06:44:03 PM »
Good work!

 


Get Your Ad Here