Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Programming Gyros (http://www.chiefdelphi.com/forums/showthread.php?t=18666)

goegan31 27-02-2003 22:51

Programming Gyros
 
Does anyone have programming for a gyro? My team has thrown this new task at me and I need a little assistance. If you can help me out on this, that would be awesome. Thanks!:)

Brandon Martus 27-02-2003 23:20

I'd check the white papers in the programming section. Also, try to search the forums. I'm guessing this has come up a few times in previous threads, and you could find some info in them.

Other than that, I can't help. Maybe someone else has info.

goegan31 06-03-2003 18:49

New Problem
 
Hey, thanks, the technokat gyro program has been extremely helpful, but it has raised a few questions. First, what is the KFilt variable? It is in your Sensor1Filt, and does not have a value. I think this may be the only source of error to our programming. However, what is happening is the gyro just seems to count from 0 to 256 over and over again. I thought that it may be hooked up uncorrectly, but from what we can tell, it is not. If anyone can help, it is greatly appreciated.

Mark McLeod 10-03-2003 13:42

If hooked up properly at rest the Gyro will normally read 127. It will return other readings only when you move it. Try using a simple test program that only reads the analog input and debug prints the results to eliminate any other potential code errors, e.g.,
debug 2,0,1, DEC3 sensor1

Tell us what pins you hooked to, so we can double check.

Josh Hambright 10-03-2003 14:07

if you still have any questions i will have our programmer get on here later and answer them...we used the gyro extensively this year and he seems to have picked up on alot of the stuff associated with it.

AdmiralPaddon 26-03-2003 08:11

Hey. We're using the Gyros for a project outside of FIRST. If someone can show us or point us to a diagram showing the correct hook-up of the Gyro, we'd be thankful. I've checked the BEI and systron websites, but neither show the model that we have. Also, if there's any special way to hook 2 up (one for pitch, the other for yaw), then we'd be VERY grateful. Thanks!

Josh Hambright 26-03-2003 08:27

Look in the image gallery for 2003. I posted it there. Or do a search for "Gyro Pinout" and you should be able to find it.

<EDit> In case people are lazy i'll post the links here:
Full Sheet:
http://www.chiefdelphi.com/forums/pi...&quiet=verbose

Just the PinOut:
http://www.chiefdelphi.com/forums/pi...&quiet=verbose

</edit>

AdmiralPaddon 28-03-2003 15:15

Thanks! One more question, though.....
 
Hey. I got the code great, but I have another problem. I need to use 2 gyros for my project (one for yaw, one for pitch), Any changes I need to make, or just add a copy the program and substitute sensor2 in for sensor1 and so on? Let me know. Thanks!

AdmiralPaddon 08-04-2003 07:51

Umm, can anyone help? Thanks in advance.

rust710 08-04-2003 08:03

Programing is not really the problem. The issue is one I don't think two gyros are allowed on the robot, but if that is not a issue then the issue is power. Pin 1 on the anolog inputs of the control system is the only 10 volt power supply for the gyro. I don't know if that pin can give enough power for 2 gyros. But other wise hooking them up is the same, except you need to use a diffrent anolog input pin.

Josh Hambright 08-04-2003 09:10

If you can get the gyros from digikey or future active you can use as many as you want as long as you stay within the limits of spending set in the manual...

Atleast it seems that it should be that way.

seanwitte 08-04-2003 09:26

it should be ok
 
The gyro takes 5V, not 10. I can't swear to it, but I think the 5V supply pins on the analog port can only source 25mA. There is one specific pin that is fused that can source more current, which is meant for the gyro. You should be able to connect two gyros to that pin, the data sheets indicate it only draws 20mA. Maybe the gyro from previous years used more current?

The larger problem, I think, is finding one. According to some other posts here, that part is specific to FIRST and isn't available off-the-self. Maybe you can borrow one, but the value counts towards your electronics budget.

Dusan 08-04-2003 20:40

Gyro Help
 
Hey, I think i can help you with your problem ... just e-mail me at
robostangs548@hotmail.com

Send me any specific questions you have about programming the gyro .... and perhaps about electronic wiring.

Cory 08-04-2003 20:54

I am positive that 2 Gyros are allowed. At both inspections in Sacramento and SVR, inspectors saw that we were using two, noth on the robot and on the BOM. At SVR, we had an incredibly thorough inspection and they were also not questioned.

Cory

Dave Flowerday 08-04-2003 21:38

Quote:

Originally posted by Cory
I am positive that 2 Gyros are allowed. At both inspections in Sacramento and SVR, inspectors saw that we were using two, noth on the robot and on the BOM. At SVR, we had an incredibly thorough inspection and they were also not questioned.
Hmm.. unless you bought one gyro from Future or Digikey then I'm afraid you're violating the rules. Check page 28 of the Robot Rules - Yaw Rate Sensor Quantity 1 was included in the kit. If you follow the additional parts flow-chart you'll see that you'll end up in the box that says "Is the part an Additional Electronics Component (refer to rule K5)?" Rule K5 is the one that says it must come from Digikey or Future and no part can cost more than $100.

The fact that the inspectors didn't catch it doesn't make it legal - having been an inspector at Midwest I can tell you that inspectors don't have time to go through the whole list of rules and additional parts and everything - basically except for inspecting for obvious violations or safety problems we have to rely on the teams to follow the rules on their own.

BTW, what are you measuring with two gyros? I know we really wish we were able to use 2 so we could use one for our angular position and one for ramp detection... Is that what you're doing?

Josh Hambright 09-04-2003 00:08

ohh man using 2 gyros would be great....
Just like Dave said, sensing your angular position and the ramp would rule.

I think we actualy have a very similar setup to what alot of teams used, using the gyro to sense turning. Its very useful and nice once we got it working.

We looked into alot of the stuff in future active and digikey and couldn't come up with anything else that could be used other then the gyro other then maybe like some of the compass type stuff but that seems like it would be dificult.

Dusan 09-04-2003 10:52

instead of 2 gyros we use tilt sensors :)

sneses x and y axis

Jared Russell 17-04-2003 23:03

all a gyro is is a tilt sensor...

The Lucas 25-04-2003 00:24

We bought a 2-axis inclinometer (tilt sensor) from Digikey. We wrote a routine on the EDUbot that automatically went straight up the ramp. Unfortunately, the sensor (not the routine) was incredibly slow so it was useless on the actual robot.

AdmiralPaddon 29-04-2003 14:27

Can anyone either send me or point me to a program that I can load onto a BasicStamp processor so that it detects the gyro and controls a motor? Also, is there any difference between this year's and last year's gyroscope programming?



Thanks!

-Admiral Paddon

Caleb Fulton 29-04-2003 14:49

Admiral: Are you asking about using a gyro with a regular stamp or with the robot controller? There's a huge difference with respect to the hardware interfacing...

AdmiralPaddon 29-04-2003 18:11

BasicStamp processor, not the robot controller. SOrry if there was confusion.

Caleb Fulton 29-04-2003 21:34

Here's what I would try to do:

I would make a RC (resistor-capacitor) circuit that is charged by the voltage output from the gyro and read into the stamp with the "rctime" command. If you consult the parallax documentation, this information shouldn't be too hard to find.

KenWittlief 29-04-2003 22:27

doesnt the basic stamp have an analog input channel (ADC input) ?

if not, I wouldnt bother with it - get a MicroChip PIC chip, with an ADC

and you can program it in assembly or C.

seanwitte 30-04-2003 09:14

need an ADC
 
You will need an ADC. PICs are great, but there is an upfront investment in equipment. If you already have a Stamp then you can buy an inexpensive ADC to do the conversion for you.

A suitable part is the ADC0831 8-bit serial analog-to-digital converter. This is the part used by Parallax in their examples. Get an 8-pin socket and solder it straight to the Stamp carrier board. The converted value is passed into the Stamp using synchronous serial communications. The code below will read the converted value:

Code:


'This code is for the ADC0831 serial 8-bit ADC
'constants defining which Stamp pins are  connected to the ADC
ADC_CS                CON        0        'CS on the ADC (pin 1)
ADC_CLK                CON        1        'CLK on the ADC (pin 7)
ADC_D0                CON        2        'D0 on the ADC (pin 6)

'variable holding converted analog value
ADCVal                VAR        BYTE

'************************************************
' SUBROUTINE:        GetADCVal
' PURPOSE:        Shift in the value from the ADC
'                connected to the ADC_CS, ADC_CLK,
'                and ADC_D0 pins on the stamp.
' OUTPUT:        Sets the value of variable ADCVal
' REF:                Based on code from Parallax, Inc.
'************************************************
GetADCVal:
        'pulse the chip select line to start conv.
        HIGH ADC_CS
        LOW ADC_CS

        'bring the clock line low, then send one
        'pulse to wake up the ADC and make it
        'ready to shift out
        LOW ADC_CLK
        PULSOUT ADC_CLK, 210

        'shift in data, most significant bit first
        SHIFTIN ADC_D0, ADC_CLK, MSBPOST, [ADCVal\8]
RETURN

The data sheet for the ADC will tell you which pin is which. You'll only need to make three connections from the stamp to the ADC, defined by the contstants in the code. Just make a call to GetADCVal to grab the current reading from the ADC.

AdmiralPaddon 05-05-2003 08:38

Quote:

Originally posted by Caleb Fulton
Here's what I would try to do:

I would make a RC (resistor-capacitor) circuit that is charged by the voltage output from the gyro and read into the stamp with the "rctime" command. If you consult the parallax documentation, this information shouldn't be too hard to find.

Sorry, I don't know how to build that. Could you point me to where instructions are for that or something? Thanks.

Sorry for being such a newb.

AdmiralPaddon 05-05-2003 10:35

I have 2-state relays. Could I use the output voltage of the gyro to operate those? They work on 5V, on/off. Voltage going through, connection. No voltage, no connection.

AdmiralPaddon 09-05-2003 15:43

Umm, can anyone help? I'd really like to get this done. Thanks!

FotoPlasma 09-05-2003 16:21

Quote:

Originally posted by AdmiralPaddon
I have 2-state relays. Could I use the output voltage of the gyro to operate those? They work on 5V, on/off. Voltage going through, connection. No voltage, no connection.
Uh... You can do that... But it probably wouldn't work in a predictable manner.

The gyro outputs an analog voltage, from 0-5VDC. When it's not moving (CW or CCW around the axis of rotation), it outputs 2.5VDC (as far as I know), which is equivalent to 127, when converted to an 8bit value.

Now, depending on the thresholds of your relays, and if they use hysteresis, this would cause the relays to switch on when the gyro is under rotation, and off when it is standing still... But the states that the relays would be in are dependant on their thresholds.

I have no idea what the application of this kind of system would be, off-hand. If you could explain some sort of project goal, it'd be a lot easier to help you.

Caleb Fulton 09-05-2003 19:39

If you're still interested in it, you can do this relatively easily with a plain old basic stamp, a resistor, and a capacitor... I could help you out if you are still wanting to do it.

AdmiralPaddon 09-05-2003 20:43

Quote:

Originally posted by Caleb Fulton
If you're still interested in it, you can do this relatively easily with a plain old basic stamp, a resistor, and a capacitor... I could help you out if you are still wanting to do it.
Sure. Please send me a picture or diagram.

What I want the device to do is auto-balance a platform. I have a platform with the gyro bolted onto the bottom of the platform, and a servo motor can cause the platform to rotate around the axis that the gyro detects. I'll try to get a picture of it posted on Monday.

Caleb Fulton 10-05-2003 00:26

I'll try to make an ascii diagram of what might be something you could use (note: this is VERY, VERY rough, and I am not sure that it would work):




The program segment for this would be:

Gyro VAR word
high 1
pause 1
low 1
rctime 2,1,Gyro


And Gyro would be a reading that you could monitor and play with to see what tilt rate corresponds to what value, and your servo can adjust from there. It would be simpler than using an AD converter, but it would not be as accurate. This is just the ignorant way that I would try to do it :)

AdmiralPaddon 12-05-2003 10:32

What are the specifications on the transistors shown in te circuit? I see that one's a PNP and the other is a NPN, but will any work? Will I need to hook up transformers to get them to work? Thanks.

AdmiralPaddon 19-05-2003 20:05

Hey. Can I get the specs on those transistors? I guess I'll buy regular PNP and NPN transistors, and see if those work. I'll let you guys know.


All times are GMT -5. The time now is 22:26.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi