go away spammer

Author Topic: Is my photoresistor circuit Dead ?  (Read 5354 times)

0 Members and 1 Guest are viewing this topic.

Offline PtMartinsTopic starter

  • Jr. Member
  • **
  • Posts: 17
  • Helpful? 0
Is my photoresistor circuit Dead ?
« on: October 03, 2008, 03:32:14 AM »
Well, I'm trying to build a robot using some parts from an other robot that a friend gave me. It's the Cybot (http://www.mstracey.btinternet.co.uk/index.htm).

My idea is to use it's circuits, sensors and motors, and fed them into my AxonMCU.

I started with the PhotoResistor Circuit. I have attached the circuit schematic.

On the SK3, Pins 4 and 5 are the output of the Photoresistors. Pins 13 and 11 are GND and 6V. I have connected pins 4 and 5 to the analog I/O on the AXON, and pins 13 and 11 are connected directly to my 4 x 1,5V battery pack.

The result is none, because the sensor's output is always High! The hyperterminal always shows me " 255 ", independently of surrounding light. 

I use a very simple code:
                                  
                                   se0=a2dConvert8bit(0);
                                   rprintf("%d\n",se0);

When I put pin 4 (connected to ADC port 0 ) connected to GND, hyperterminal shows "0"; when I connect it to 5V it shows"255". So I think the port is reading right, but seems to me, the problem is in the photoresistor sensor... Is it dead ?
How can I test them so see if they are alive ?

Thanks

  
« Last Edit: October 03, 2008, 03:56:49 AM by PtMartins »

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Is my photoresistor circuit Dead ?
« Reply #1 on: October 07, 2008, 06:50:58 AM »
Quote
and pins 13 and 11 are connected directly to my 4 x 1,5V battery pack
bad! Only connect the battery to where it says Bat

Quote
Pins 13 and 11 are GND and 6V
It should be 5V, regulated

Quote
Pins 4 and 5 are the output of the Photoresistors . . . The result is none, because the sensor's output is always High! The hyperterminal always shows me " 255 ", independently of surrounding light . . . When I put pin 4 (connected to ADC port 0 ) connected to GND, hyperterminal shows "0"; when I connect it to 5V it shows"255"
If your sensor is connected to 4 and 5, you need to read from pins 4 and 5. For example, your code should look like this:

Code: [Select]
se4=a2dConvert8bit(4);
rprintf("%d\n",se4);

Hope that helps and sorry for the reply delay! (I just moved to the other side of the world, and dealing with major computer virus issues at the moment)

Offline PtMartinsTopic starter

  • Jr. Member
  • **
  • Posts: 17
  • Helpful? 0
Re: Is my photoresistor circuit Dead ?
« Reply #2 on: October 07, 2008, 09:01:12 AM »
well,

actually after my last post, and before your answer, I tried your solutions... and still nothing.

But earlier this morning I paid more attention to the description that comes with the schematic that I posted. It says:

"(...)The only functioning parts are the resistors R21, R22 and capacitors C10, C11, these measure the output from the LDR's by measuring the time it takes for the capacitors to charge up. The LDR's resistance varies with the amount of light falling on them (the more light, the lower the resistance), one end connects to 5V and the other through R21 or R22 to the input of the processor - the capacitors are charged through the LDR's. "

So my plan for tonight is to use a Axon Digital I/O port, say E7, connected to pin 4, and try the following code:

Code: [Select]

timer0init(); //initiate timer 0 system.

sbi(DDRE, PE7); // Configure port E7 as Output

PORT_OFF(PORTE, 7); // Put bit '0' in port E7

cbi(DDRE, PE7); //Configure port E7 as Input

reset_timer_0(); //restart counting time from the beginning

loop_until_bit_is_set(PINE, E7); //wait until the capacitor fully charges

int time_value = tmer0getoverflowcount * 255 + TCNT0; //get the time it took for the capacitor to charge



I'm new to the axon function list, so I expect trouble on my port configuration.

thanks.

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Is my photoresistor circuit Dead ?
« Reply #3 on: October 07, 2008, 09:29:11 PM »
Just out of curiosity, why not use a much simpler photoresistor circuit?

http://www.societyofrobots.com/schematics_photoresistor.shtml

Offline PtMartinsTopic starter

  • Jr. Member
  • **
  • Posts: 17
  • Helpful? 0
Re: Is my photoresistor circuit Dead ?
« Reply #4 on: October 08, 2008, 04:00:29 AM »
Because I have 20 circuits (like the one I posted on my first post) that are parts of the cybot robot I mentioned earlier: a motor driver, battery voltage monitor,a sonar, lots of memory expansion, IR transmitter and receiver, a 32x20 LCD, a 4 button circuit, 1 DIP switch,etc. ...I don't want to throw them out.     

I plan to connect VCC, GND and put something on their input to see what do I get on the Output. I'm avoiding making new circuits, and/or soldering new elements (it requires me to spend more money to buy them).

But you're right, your photoresistor circuit is simpler. If all (or any of) my circuits don't work I will throw them out, and go for another approach.

thanks

 

Offline PtMartinsTopic starter

  • Jr. Member
  • **
  • Posts: 17
  • Helpful? 0
Re: Is my photoresistor circuit Dead ?
« Reply #5 on: October 17, 2008, 05:22:15 PM »
Can anyone please help me ?

I managed to put my photoresistor circuit to work ( It is not dead !!! )

I used the following code:

Code: [Select]
while(1)
{
//get sensor data
//timer0Init();//iniciar o timer 0
sbi(DDRE, PE7); //pin como output
PORT_OFF(PORTE,7); //colocar 0 na saída
//FLIP_PORT(DDRE, 7); //pin como input
sbi(PORTE, PE7);  // enable pull-up resistor for v1f and later
cbi(DDRE, PE7);

reset_timer_0();
//loop_until_bit_is_set(PINE, 7);
while (!(bit_is_set(PINE, 7))){
}
time_value1 = timer0GetOverflowCount()*255+TCNT0;
sbi(DDRE, PE7); //pin como output
PORT_OFF(PORTE,7); //colocar 0 na saída
reset_timer_0();
loop_until_bit_is_clear(PINE, 7);
time_value2 = timer0GetOverflowCount()*255+TCNT0;
   

//time_value = bit_is_set(PORTE, 7);



//output data to USB (use hyperterminal to view it)
rprintf("%d R_Sensor=%d\n",cnt++,time_value1+time_value2);
delay_ms(100);

}

But... now every time I use the bootloader to program the axon, i got always the famous bootloader error:

COM 4 at 115200 Baud: Connected
Bootloader VFFFFFFFF.FF
Error, wrong device informations

If i try 10 times, i get 10 times that error... but sometimes, after i wait a while, i can program the axon, altough with a CRC error:

Program axon.hex: 00000 - 03B05 successful
Verify axon.hex: 00000 - 03B05 failed!
Verify-Error

Can someone help me ? thanks

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Is my photoresistor circuit Dead ?
« Reply #6 on: October 20, 2008, 11:27:23 PM »
I suspect you didn't enter the bootloader command properly. Can you post it here?

Offline PtMartinsTopic starter

  • Jr. Member
  • **
  • Posts: 17
  • Helpful? 0
Re: Is my photoresistor circuit Dead ?
« Reply #7 on: October 21, 2008, 02:10:24 PM »
I enter the bootloader by typing this command:

               C:\MyAxon\FBOOT17.exe -b9600 -c2 -paxon.hex -vaxon.hex

is it ok, right ?

It was fine a few days ago, but now i get that error...

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Is my photoresistor circuit Dead ?
« Reply #8 on: October 23, 2008, 07:21:40 AM »
Is your .hex file Axon.hex, or axon.hex? (its caps dependent)

Offline PtMartinsTopic starter

  • Jr. Member
  • **
  • Posts: 17
  • Helpful? 0
Re: Is my photoresistor circuit Dead ?
« Reply #9 on: October 23, 2008, 03:47:39 PM »
well, my .hex is axon.hex.

Today I noticed that after i turn on my computer, the first time i use the bootloader, everything works fine... but then, after one or two times using the bootloader, i got that error.

Is it a hardware (usb) problem ?

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Is my photoresistor circuit Dead ?
« Reply #10 on: October 23, 2008, 10:35:17 PM »
Hmmmm not sure on this one . . . could be your USB but not sure . . .

When you turn off your Axon, wait like 5 seconds before turning it back on to program.

Is the battery fully charged?

Also, I noticed an inconsistency in your commands:
Quote
C:\MyAxon\FBOOT17.exe -b9600 -c2 -paxon.hex -vaxon.hex
Quote
COM 4 at 115200 Baud: Connected
Bootloader VFFFFFFFF.FF
Error, wrong device informations

Any chance you getting baud and com ports mixed up?

Offline PtMartinsTopic starter

  • Jr. Member
  • **
  • Posts: 17
  • Helpful? 0
Re: Is my photoresistor circuit Dead ?
« Reply #11 on: October 25, 2008, 03:51:41 AM »
that inconsistency is because i tried to lower the baud rate and changed the com port to see if anything changed.

I discovered some day in this week that the circuit I show on the first post is not dead... but it's shorted ! somewhere on the PCB there is a short circuit, and i discovered it when i connect the circuit to the axon, and it was always reseting. I think that my problems started because of that.

I immediately disconnected everything, and the next night i bought some resistors and made your photoresistor circuit, which works perfectly !!


But now I'm afraid that I've ruined my axon because off the short circuit...


Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Is my photoresistor circuit Dead ?
« Reply #12 on: October 26, 2008, 01:14:22 AM »
This short circuiting messing up the bootloader would definitely make sense!

If you don't see any obvious problems, like a pin no longer working or burn marks, then the Axon was probably not damaged. :P

Offline PtMartinsTopic starter

  • Jr. Member
  • **
  • Posts: 17
  • Helpful? 0
Re: Is my photoresistor circuit Dead ?
« Reply #13 on: October 26, 2008, 05:08:16 PM »
then how can i solve the bootloader problem ?  need to buy an avr programmer ?

well, nothing is burn, or smells like burn... and all pins are apparently ok....

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Is my photoresistor circuit Dead ?
« Reply #14 on: October 27, 2008, 03:47:38 AM »
Ok backing up a bit . . .

Does the bootloader problem only occur when you connect your external circuitry? What else do you have hooked up? Are you using a serial to USB adapter?

Did you check to see if the battery was fully charged?

You aren't trying to use the bootloader and hyperterminal at the same time, right?

(Im running out of ideas . . .)

Offline PtMartinsTopic starter

  • Jr. Member
  • **
  • Posts: 17
  • Helpful? 0
Re: Is my photoresistor circuit Dead ?
« Reply #15 on: October 28, 2008, 05:44:45 PM »
OK... i found the problem: the batteries... they have discharged...

I bought 4x2000 mAh Ni-MH rechargeable batteries. Apparently they were not fully charged when I bought them, so it lasted only a few days. The short circuits helped to discharge them a bit more and cause the problems i mentioned. Now a fresh recharge solved all my problems.

Thanks for your help.

Off course I gave up the idea of that photoresistor circuit, and switched to the circuit on the photoresistor tutorial, which worked very very well for me. Today was a (small but meaningfull) victory to me.

But I want to move to my next challenge... a sonar circuit with 2 sonars. Maybe a new topic for other post  :D
« Last Edit: October 28, 2008, 05:45:40 PM by PtMartins »

 


Get Your Ad Here

data_list