go_away

Author Topic: Axon Help  (Read 5011 times)

0 Members and 1 Guest are viewing this topic.

Offline BretTopic starter

  • Jr. Member
  • **
  • Posts: 25
  • Helpful? 0
Axon Help
« on: November 18, 2008, 07:38:35 PM »
I got an Axon a few weeks ago and ordered servos, a couple of Sony IR Range finders, a sheet of white plastic for my robot's chassis, connectors, crimpers, etc... I haven't ever programmed a robot before and have never programmed in C, though I do program in VB6 quite a bit. I plugged the servo in and figured out how it works and how to make it move like I wanted to, after some trial and error on my part. This evening my two Sony IR Range Finders showed up and this is where I have ran into some trouble that I can't seem to figure out.

I went into control.c and defined the se0 and se1 integers, then put in the set0=a2dConvert8bit(0) and set0=a2dConvert8bit(1). Then I made a while(1) loop and did the print command for hyperterminal (rprintf("%d %d/n", se0, se1)) I even put in a delay_ms(500) after it so the data would scroll slower.

If I plug a Sony IR Range Finder into A0 I get a value, but it doesn't change with any distance, it just stays the same.

If I plug in another Sony Range Finder into A1 my Axon wants to hang when it initializes and if it gets past that it might give me a few lines of unchanging data and then it will reset, sometimes hanging up when it reinitializes. Sometimes after the initialization it starts spitting out garbage.

I have switched the ports and it acts the same way. A single Sony IR Range Finder gives me redundant data no matter how close or far away an object is and two Sony IR Range Finders causes havoc.

Has anyone run into this before? Is it something I am doing? I appreciate any advice, pointers, or help since this is all pretty new to me.

BTW...I'm having a blast with my Axon so please don't take this as a complaint. I'm just new to this and probably have something hozed up.

Offline mbateman

  • Full Member
  • ***
  • Posts: 82
  • Helpful? 0
Re: Axon Help
« Reply #1 on: November 18, 2008, 10:02:25 PM »
The A2D pins are on F and K. Try putting the IRs on F0 and F1, then it should work for you. Those correspond to a2dConvert8bit(0) and (1).

Offline BretTopic starter

  • Jr. Member
  • **
  • Posts: 25
  • Helpful? 0
Re: Axon Help
« Reply #2 on: November 19, 2008, 06:42:38 AM »
Thank you, mbateman!

I'm not sure where F0 and F1 are though. When I said I was new I guess I should have been more specific and suggested that everyone talk to me like I was a 5 year old.  :-[

Right now my Range Finders are on the top row (ADC) (0) and (1) at the top of the board. I see an F and a K printed on the Axon but I thought those were for the 2 sets of 3 prongs (UART2) just below the top row.


Sorry for being so stupid about all this, but I will figure it out.

By the way, I messed up when I said I had it plugged into A(0) and A(1). I was/am plugged into the top lefhand slots with the ground facing to the outside of the board, so I'm pretty sure that I am plugged into the right spot. Sorry about that.
« Last Edit: November 19, 2008, 07:15:59 AM by Bret »

Offline BretTopic starter

  • Jr. Member
  • **
  • Posts: 25
  • Helpful? 0
Re: Axon Help
« Reply #3 on: November 19, 2008, 07:24:16 AM »
Okay, I saw a post about the F and K slots in the Software area. I am/have been plugged into F(0) and F(1) like I'm supposed to be. Is there anything else going on that could cause the data not to change or cause my Axon to reset and spit out garbage in hyperterminal?

Offline mbateman

  • Full Member
  • ***
  • Posts: 82
  • Helpful? 0
Re: Axon Help
« Reply #4 on: November 19, 2008, 09:20:49 AM »
OK, you are plugged into the correct place, then. Not sure what else might be your problem. Just double check that you have ground on the outside and signal on the inside. (Yes I see that you said that, but doublecheck it anyway ;-) ). Also, make sure you did not accidentally remove the configure_ports(); line from the "main" function of the Axon.c code.

FYI, the top row of pins can be used in many ways. For the A2D functions they are just 0-15. For other functions they are 0-7 = F0-7 and 8-15 = K0-7.

Offline BretTopic starter

  • Jr. Member
  • **
  • Posts: 25
  • Helpful? 0
Re: Axon Help
« Reply #5 on: November 19, 2008, 12:23:13 PM »
Thank you again for your help, mbateman!

I'm at work now, but I will double check to make sure my Range Finder is plugged in correctly and then I will check the Axon.c code to make sure the configuration is there. I also plan on downloading the Axon DAQ and the Axon Test Program 2 and see what that does.

Offline BretTopic starter

  • Jr. Member
  • **
  • Posts: 25
  • Helpful? 0
Re: Axon Help
« Reply #6 on: November 19, 2008, 07:27:03 PM »
I started over again and uploaded the code and went through the steps to get it uploaded onto my axon. The only code I altered was the control.c code and that was to only put the code

int se0, se1;

se0=a2dConvert8bit(0);
se1=a2dConvert8bit(1);

rprintf("%d %d\n", se0, se1);
delay_ms(500);


into the Axon so that I could monitor the data in Hyperterminal. It still acted the same as always.

Next, I uploaded the axom_DAQ.hex file from the website and loaded that. Here are the results from a single Range Finder plugged into th 0 port:

System Warming Up.................Initialization Complete
0 27 45 56 71 81 82 80 79 80 79 78 79 79 80 78 154 0
0 9 19 30 42 53 61 65 69 72 75 75 75 76 75 72 154 0
0 4 10 16 24 33 41 48 58 61 64 66 68 69 70 64 154 0
0 3 7 10 15 ... This is how it went for a bit, then I put my hand in front of the sensor, bringing it forward and back, and this is what I got
159 154 150 147 144 142 140 129 116 113 111 108 106 103 100 106 154 0
159 157 152 151 148 145 143 132 120 117 114 112 109 106 104 109 154 0
159 158 155 153 150 148 145 135 123 120 118 115 112 110 107 112 154 0
159 158 156 154 152 151 148 138 125 123 120 118 115 113 110 115 154 0
159 157 156 154 152 151 148 139 128 125 123 121 118 116 113 118 154 0
159 157 156 154 151 150 148 139 129 127 125 123 120 118 116 120 154 0
Values changed across the entire thing!


My next test was to plug a second Range Finder into port 1 so that I could monitor 2 Range Finders. This is when everything got crazy!

System Warming Up.................Initialization Complete
System Warming Up.................Initialization Complete
AC
System Warming Up..
System Warming Up.................Initialization Complete
Ф Ф9 Ф9 Ф9 Ф9 Ф9 Ф9 Ф9 Ф9 Ф9 Ф9 Ф9 Ф9 Фв Ф╒ Ф├ Фo Ф    Ф< Ф9 ФР Ф9 Ф9 Ф7 Ф9 Фю    Ф9 ФB    Ф9 Ф9 Ф9 Ф9 Ф9 Ф9 Ф9 Ф9 Ф
Ф9 Фm    Ф9 Ф9 Ф9 Ф9 Ф9 Ф9 Ф9 Ф9 Ф9 Ф9 Ф9 Ф9 ФD
Ф9 ФШ    Фo
Ф9 Ф├   cB6╖Ы╪з9hVоо║лUМ<╖╠Wc╜mэ¤u>Ўr1┐Г                                                                                                                                                                                                                                           ....and this just keeps on going.


Does anyone have an idea of what is going on, or is there anything else I can do to narrow down the problem?

I tested my voltage and it is 5.88vdc.
I'm sure my wires are right - ground (black wire) on the outside, power (red wire) is in the middle, and the signal wire (yellow) is on the inside.

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,658
  • Helpful? 169
    • Society of Robots
Re: Axon Help
« Reply #7 on: November 20, 2008, 08:07:44 AM »
Quote
I tested my voltage and it is 5.88vdc.
That's just barely above the required minimum. If at any instant that voltage drops, it will reset. Seeing 'System Warming Up' repeatedly means the Axon is resetting. Find a higher voltage battery ;D


Quote
Values changed across the entire thing!
That's pretty normal. All the pins are really close to each other, so if they aren't plugged into anything, they tend to float to equal the voltage of nearby pins.

Offline BretTopic starter

  • Jr. Member
  • **
  • Posts: 25
  • Helpful? 0
Re: Axon Help
« Reply #8 on: November 20, 2008, 08:28:45 AM »
Thank you, Admin!



I will probably get a plug in power supply to use while I'm testing so that I don't have to keep recharging the batteries and I will get a bigger battery for my robot. I just didn't want to get anything too large for the servos.

I'm also glad to hear that the readings are normal. I was worried that I had hosed something up.

So, I guess my big problem is why can't I get a reading using the regular code (Axon.c, Control.c, etc...). Is there anywhere that I can get to code to Axon_DAQ.hex so that I can look at it. When I look at it under the programming software it is all in hex - which is probably why it's called ".hex"  ;D

Thanks again. I will work on it some more.

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,658
  • Helpful? 169
    • Society of Robots
Re: Axon Help
« Reply #9 on: November 20, 2008, 09:13:30 AM »
Quote
Is there anywhere that I can get to code to Axon_DAQ.hex so that I can look at it.
The DAQ is just a bunch of read ADC and rprintf's, nothing special.


Try out a 6V battery, and report back if it's still not working.

Offline BretTopic starter

  • Jr. Member
  • **
  • Posts: 25
  • Helpful? 0
Re: Axon Help
« Reply #10 on: November 20, 2008, 10:31:00 AM »
The reason that I want to look at the DAQ is because the value changes on my Range Finder with that program but, and I feel like a complete idiot admitting this, I can't get the regular program to 'talk' to my Range Finder - the value doesn't change. I know I'm doing something wrong and if I had a program that I know is working with my Range Finder I could probably see what it is.

I'm not a complete idiot with programming, though I feel like one at the moment. I have done a lot of Visual Basic programming. I started with version 4 and have worked with it ever since, but I'm having a little trouble wrapping my brain around C. It's slowly coming to me, but stuff that is simple in VB is frustrating me in C. Not faulting C, it's just me having trouble adapting to a different way of doing stuff.  :'(

Hopefully I will soon start to figure out how this C stuff fits together and quit bugging you guys with my kindergarten questions.  :-[

Offline BretTopic starter

  • Jr. Member
  • **
  • Posts: 25
  • Helpful? 0
Re: Axon Help
« Reply #11 on: November 20, 2008, 07:38:46 PM »
Okay, I figured out what I was doing wrong on my code.  ;D

I needed to put se0=a2dConvert8bit(0) in the While(1) loop. I had it above the loop, thinking that once it was set to that port it would automatically (magically) get the data because it was set to that port. Stupid me!  :-[

I also plugged a 9 volt (9.7 vdc) power supply to my Axon. It still works the same though it might be lasting a second longer before it resets and then goes crazy. With a single Range Finder it works well, but with two of them I only get a good string of data (sometimes) for a second or two before it resets, quits, or just spits out garbage.

Also, when I was in the regular downloaded code my range finder was only jumping from 59 to 70 when I waved my hand in front of it. When I would plug 2 Range Finders in the values would range from 100 to 250 before reseting, quiting, and/or spitting out garbage.

Does anyone have a suggestion as what I should do at this point?
Are there any other ways I can test it to narrow down the problem?
Anyone have an idea as to what might be going on?

Sorry for being such a pain, but I don't know what else to do?

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,658
  • Helpful? 169
    • Society of Robots
Re: Axon Help
« Reply #12 on: November 20, 2008, 11:15:22 PM »
Quote
I also plugged a 9 volt (9.7 vdc) power supply to my Axon.
What is the current/power rating on it?

Does it work fine with the DAQ hex? (if it does, then its your code)

Offline BretTopic starter

  • Jr. Member
  • **
  • Posts: 25
  • Helpful? 0
Re: Axon Help
« Reply #13 on: November 21, 2008, 06:38:47 AM »
I'm at work now so I will have to check the current when I get home. In about another 10 or 11 hours...  :(

With the DAQ hex it works good with a single Range Finder. All the points increase and decrease their value as the single Range Finder increases and decreases, but you said that is normal so I'm not worried about that any more. When I plug two Range Finders in, on any port, is when the Axon resets, hangs up, gives good data for a few seconds then resets or hangs up, or starts spitting out garbage. I will check my current though and see if that is where the problem lies.

Thank you for your help!

Offline BretTopic starter

  • Jr. Member
  • **
  • Posts: 25
  • Helpful? 0
Re: Axon Help
« Reply #14 on: November 21, 2008, 05:58:34 PM »
Okay, I got home from work and put together a few photo-optic sensors, checked the voltage, tried the Range Finder again, then tried the photo-optic sensors.

I used a power supply and read 9.7 volts @ 147 ma.

I plugged the Range Finders in and got the same horrible results with the DAQ program.

I then tried the photo-optic sensors (photo resisters from the tutorial) and got success! I have 3 of them plugged in and will finish putting the other two together and trying them out.

Soooooo...do I have two bad Range Finders? Why does each work fine seperately?

Thanks!

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,658
  • Helpful? 169
    • Society of Robots
Re: Axon Help
« Reply #15 on: November 21, 2008, 08:49:52 PM »
Quote
9.7 volts @ 147 ma.
There's your problem (or at least one of them). 147mA is really low . . . find a power supply closer to 300mA, and an additional 350mA+ per servo that you use.

Offline BretTopic starter

  • Jr. Member
  • **
  • Posts: 25
  • Helpful? 0
Re: Axon Help
« Reply #16 on: November 21, 2008, 09:01:05 PM »
Thanks again for all your help.

I purchased a 6 volt 2300 nAh NiMH battery from All-Battery.com last week, but they didn't have any chargers in stock so I figured I would look around for another source. I looked again today and ordered the Smart Universal Charger for Nimh battery Pack (2.4V - 7.2V) with the HiTec connector and another battery so next week some time I should be able to charge the battery up and be in good shape.

What I'm using right now is a 6 volt power supply that is running a bit hight (9.7 volts) and it's rated for 2.1 A. I figured that with only 2 Range Finders and nothing else plugged into the Axon it was only drawing 147 mA because that is all it needed.

I can play with my photoresistors until the charger comes in so that should keep me out of your hair for a week or so.  ;)

Thank again, I can't tell you how much I appreciate your help and the help of mbateman!

Offline BretTopic starter

  • Jr. Member
  • **
  • Posts: 25
  • Helpful? 0
Re: Axon Help
« Reply #17 on: November 28, 2008, 08:20:41 PM »
I got another 6v 2300mAh battery and a battery charger, charged my original battery up, hooked it to my Axon with two Sony IR Range Finders and it seems to be working great.

Thank you MBateman and Admin for all your help!

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,658
  • Helpful? 169
    • Society of Robots
Re: Axon Help
« Reply #18 on: November 28, 2008, 09:03:50 PM »
Sharp, not Sony, Range Finders :P

show us your creation when you're done!

Offline BretTopic starter

  • Jr. Member
  • **
  • Posts: 25
  • Helpful? 0
Re: Axon Help
« Reply #19 on: November 28, 2008, 11:09:42 PM »
Ooops.  :-[

Right now I'm mainly playing with sensors and learning C, so it might be a while before I come up with anything worth showing, but as soon as I do I promise to post it.  I have got my range finders where they can follow an object back and forth with the servo from the $50.00 robot. Next I'm probably going to add two more range finders in a verticle configuration so that it not only pans, but tilts as well then I'm on to figuring out how I want it to move.  ;D

 


Get Your Ad Here