1. ah..yeah.. I miss the days without stupid activation

2. 2k1, I've got a couple more questions for ya, this time on reading the inputs. I'm trying to copy your C# code, but it seems that Visual Basic doesn't have a function to convert from decimal to binary.

Digital input question:
I believe I have the code for this working correctly. When I connect the two pins on one of the digital inputs to turn it on, I see the input come on in the software. When I disconnect the pins, the software shows that the input stays on for a while, and shuts off several seconds later. This acts like there is some capacitance to the input lead and it takes a while for the voltage to drain off. Would it make sense to put a resistor between the input and ground, so that the voltage drains faster, which would make the input turn off as soon as you disconnected power from it?

I see that there are 10 bits for each input, 8 in one byte, 2 in another. If I read those in decimal, the first byte ranges from 0-255, while the second byte reads 0, 64, 128, or 192. I've resorted to multiplying the first byte by 4, dividing the second byte by 64, and then adding the two together. I believe that gives me what I want. The word document indicates that bit 1 is the 8th bit, and bit 0 is the 9th bit. What I'm unsure of is which order the bits are in on that second byte?

Also, in the word document, wouldn't the byte with 8 bits be the MSB, and the two bits are the LSB? From my tests it seems that the byte with two bits bounces around all the time, and the byte with 8 bits stays pretty linear as voltage is increased. To me this is saying that the two bits are nothing more than the precision, so we can have 1024 steps instead of just 256. Is this correct?

Here's the quote from the word document that I'm referencing:
LSB – The Least Significant Byte of the analog line’s value. Bits 0 – 7 of this byte contain bits 0 – 7 of the analog line’s value.
MSB – The Most Significant Byte of the analog line’s value. Bits 1 and 0 of this byte contain bits 8 and 9 of the analog line’s value. Bits 2 – 7 of this byte are not used and should be ignored.

3. Nevermind my previous questions, I sorted them out. The digital inputs do like to see some connection back to ground to drain off the voltage. It needs to see either 5v or 0v, not 5v or nothing. If you just short the two leads so that 5v goes to the input, when you un-short them, it just takes a few seconds for the voltage to drain off and shut the input off.

As for the analog inputs, I just gave up on using the two bits in the second byte. I don't need that level of accuracy. Using only the first byte, I believe I am reading the full range of voltage in 256 steps.

Using the other two bits will gain some precision (1024 steps). What I'm finding though is that if I have a potentiometer set and I don't touch it, the input will still jitter between a couple values. Those values seem to be more than 1 step apart, meaning the precision isn't helping much here. Using 256 steps, any jitter I see seems to be between two consecutive steps.

For reference, here's the code I was using to read either 8 or 10 bits.
Code:
```For i = 0 To 9
'Uses only the first byte 0-255 (8 bits)
AnalogIn(i) = CInt(InputArray(i * 2 + 12))

'Uses both bytes 0-1023 (10 bits)
AnalogIn(i) = (CInt(InputArray(i * 2 + 12)) * 4) + CInt(InputArray(i * 2 + 13) / 64)
Next```
My project here isn't for use in a car, but rather in a farm tractor. I'm in the process of building some software that will steer the tractor based on its GPS location. The fusion brain will be controlling some relays that will control a hydraulic valve that turns the front wheels left or right. I anticipate this software running on hardware that isn't the fastest on the market, and I'm trying to keep overhead to a minimum.

2k1toaster, thanks again for your help on this.

4. Oh man.. I can see the computer freezing and your tractor eating the neighbors crops...

5. Originally Posted by Arrow
Oh man.. I can see the computer freezing and your tractor eating the neighbors crops...
Ha ha. There will be someone in the tractor in case something goes wrong. The problem is with falling asleep while driving. Click for example of bad things.

6. Out of curiosity, why not just have the person in the tractor do the steering? Why would you want GPS controlled stearing? Is it more for making straight lines than anything else?

7. Originally Posted by Arrow
Out of curiosity, why not just have the person in the tractor do the steering? Why would you want GPS controlled stearing? Is it more for making straight lines than anything else?
The straight lines do look pretty, but the real reason is efficiency. A human driving will end up with overlap and skips. If you get too far from the last pass, then you're not doing something that you should be. Overlap means you're covering the same ground twice, which is extra \$ for no benefit. When we're doing tillage, we will overlap all the time so as to not skip anything, but that takes extra fuel to do. If we're doing something like applying fertilizer, the overlap and skips can become very expensive. The extra fuel alone will pay for an auto-steer system in a few years, and with fertilizer or planting, its return on investment is probably within a matter of days.

A human can be accurate to within inches if you really concentrate, but after a few hours of that, your accuracy drops to within a foot or two. It's just hard to judge (to within inches) your distance away from something that is 20+ feet away. GPS using the WAAS correction will get down under 1 foot consistently, and other correction services such as RTK can get down to an accuracy of less than one inch.

There are several systems already on the market to steer via GPS, but they all cost between \$7K - \$12K. Currently the industry like to use proprietary hardware, unusual cable connections, and the software interface is, um, less than intuitive. I think I can build a system for under \$2K, and have the interface easier to use than anything else on the market.

8. Originally Posted by mx270a
Nevermind my previous questions, I sorted them out. The digital inputs do like to see some connection back to ground to drain off the voltage. It needs to see either 5v or 0v, not 5v or nothing. If you just short the two leads so that 5v goes to the input, when you un-short them, it just takes a few seconds for the voltage to drain off and shut the input off.
Yes you are correct. The next Brain however will have no digital inputs, because we will be doing all analogue. Of course any analogue can be used as digital even now.

Originally Posted by mx270a
As for the analog inputs, I just gave up on using the two bits in the second byte. I don't need that level of accuracy. Using only the first byte, I believe I am reading the full range of voltage in 256 steps.

Using the other two bits will gain some precision (1024 steps). What I'm finding though is that if I have a potentiometer set and I don't touch it, the input will still jitter between a couple values. Those values seem to be more than 1 step apart, meaning the precision isn't helping much here. Using 256 steps, any jitter I see seems to be between two consecutive steps.
Yes the 2 other bits are the least significant bits, so dumping them is no problem if you dont want them. But to combine them, I found the easiest way was just to convert them into strings, concatonate the strings, and convert back to a number. May not be efficient, but on todays processors even a P3, it makes no difference to make an extra 10byte array.

Originally Posted by mx270a
My project here isn't for use in a car, but rather in a farm tractor. I'm in the process of building some software that will steer the tractor based on its GPS location. The fusion brain will be controlling some relays that will control a hydraulic valve that turns the front wheels left or right. I anticipate this software running on hardware that isn't the fastest on the market, and I'm trying to keep overhead to a minimum.

2k1toaster, thanks again for your help on this.
Sounds like an awesome project! Keep us posted. And no problem for the help, I try when I can. Just finished my last final project for the semester, just have to turn it in tomorrow, so I am on vacation officially starting tomorrow at 11am. Of course I still have to go to work though, but I will have more time for coding.

Originally Posted by Arrow
Oh man.. I can see the computer freezing and your tractor eating the neighbors crops...
If it were a harvester I am sure he wouldn't mind. Neighbour might though...

9. Analog is probably better anyways. With analog you could build a simple voltage divider circuit and get more inputs.

Auto driving tractors! Damn, and i live in a farming area. You need to also add a auto shut off using an invisible fence around the farm. kind of like the invisible fence for dogs.

10. Originally Posted by 2k1Toaster
The next Brain however will have no digital inputs, because we will be doing all analogue.
Well that works. I might un-code the digital input stuff then, so I'm not tempted to use them. Might make things a lot easier in the future if I want to make the software compatible with the new brains.

Originally Posted by 2k1Toaster
...But to combine them, I found the easiest way was just to convert them into strings, concatonate the strings, and convert back to a number.
You might want to look at that code I posted in reply #43. Doing the math on both bytes as decimal numbers might be more efficient than going to a string and back, plus you can do it all in one line of code.

Originally Posted by pRoFiT
...You need to also add a auto shut off using an invisible fence around the farm. kind of like the invisible fence for dogs.
I haven't written any code to do that yet, but I have thought about it. Other companies do things such as have the computer start beeping when your 100 feet away from the end. That can get annoying though. I also read somewhere that one of the systems, if it thinks there is no operator in the machine, will turn the wheels to the far left so the tractor just does circles. Tying it into a kill switch on the engine would be the ultimate in safety, but is a bit of a challenge to do on some tractors.

Page 5 of 8 First 12345678 Last

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•