Author Topic: How do I use make an accelerometer work with the link port?  (Read 3407 times)

0 Members and 1 Guest are viewing this topic.

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
How do I use make an accelerometer work with the link port?
« on: October 12, 2012, 11:00:09 pm »
While looking through my older projects, I realized there was something I'd always wanted to do—make PapiJump work with an accelerometer so I could tilt it back and forth like an iPhone. I have plenty of wires and stuff that I could use, but the problem is that I know absolutely nothing about hardware.

happybobjr posted some info in the topic, but I have no idea what those terms mean—what's "left," "right," and "ground"? I can't learn from Google either, because I don't even know what to start searching for :/

What do I do with the link port to let me read values from it in a program?
« Last Edit: October 12, 2012, 11:04:47 pm by Deep Thought »




Offline thepenguin77

  • z80 Assembly Master
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1594
  • Rating: +823/-5
  • The game in my avatar is bit.ly/p0zPWu
    • View Profile
Re: How do I use make an accelerometer work with the link port?
« Reply #1 on: October 12, 2012, 11:34:08 pm »
First, a little terminology, the plug that plugs into the link port is composed of 3 parts, the sleeve, the ring, and the tip. The sleeve, (the part closest to the wire) is electronic ground (0V). The other two (the ring and the tip) are both data lines. By default these sit at 3V.

Ok, so when you open up calcsys and look at port (00h), you'll notice that it reads 03. It's reading 3 because both the tip and the ring are at 3 volts (the tip is bit 0 and the ring is bit 1).

Now, a pair of headphones is basically a short circuit from both the tip and ring to the sleeve. In normal operation the tip goes to the left earphone and then to ground and the ring goes to the right earphone and then to ground. But, the main point I'm trying to get across here is that the headphones lower both the tip and the ring to 0V. So now, to see what I'm talking about, you can plug a pair of headphones into your calculator and you'll notice that port (00h) now reads 00 (and your calculator is relatively frozen).

The basic idea here is that when disconnected, both the tip and the ring will gives 1's over port (00h). But when you connect them to ground (the sleeve), they will read 0.


Now that that's out of the way, you can start messing around with your accelerometer. The basic idea here is that when your accelerometer is tilted to the left, it will connect the ring to ground and when it is tilted to the right, it will connect the tip to ground (you can swap left/right ring/tip). The way to do this is up to you, but the simplest way would simply be a marble in a tube that connects the circuit when it reaches either end.

Edit:
   In axe, you can read the value of port (00h) by using the "Port" command (ClrTable).
« Last Edit: October 12, 2012, 11:36:25 pm by thepenguin77 »
zStart v1.3.013 9-20-2013 
All of my utilities
TI-Connect Help
You can build a statue out of either 1'x1' blocks or 12'x12' blocks. The 1'x1' blocks will take a lot longer, but the final product is worth it.
       -Runer112

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: How do I use make an accelerometer work with the link port?
« Reply #2 on: October 12, 2012, 11:50:08 pm »
So port 0 basically has bit 0 set if the tip is connected to the sleeve and bit 1 set if the ring is connected to the sleeve?

Thanks a lot!
« Last Edit: October 12, 2012, 11:50:40 pm by Deep Thought »




Offline DrDnar

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 546
  • Rating: +97/-1
    • View Profile
Re: How do I use make an accelerometer work with the link port?
« Reply #3 on: October 13, 2012, 02:00:18 am »
Yeah, it's pretty simple. You can also monitor switches and drive small relays from the link port.

One addendum: The correct link voltage is 3.3 V OR 5.0 V. The higher voltage is used only on the early TI-83+ models. But frying newer calculators isn't an issue; modern calculators probably tolerate up to at least 6 or so volts.

Kerm already implemented a similar idea for an Etch-a-Sketch.

Also, you can control many Canon and Pentax dSLRs from your calculator---and others with an adapter---cf. my program and a less accurate method for the TI-83+.
« Last Edit: October 13, 2012, 02:24:42 am by DrDnar »
"No tools will make a man a skilled workman, or master of defense, nor be of any use to him who has not learned how to handle them, and has never bestowed any attention upon them. . . . Yes, [] the tools which would teach men their own use would be beyond price."—Plato's The Republic, circa 380 BC

Offline Keoni29

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2466
  • Rating: +291/-16
    • View Profile
    • My electronics projects at 8times8
Re: How do I use make an accelerometer work with the link port?
« Reply #4 on: October 18, 2012, 05:06:20 am »
You can make a two wire serial protocol to communicate with a microcontroller. You could use a microcontroller simillar to an arduino board as a buffer which gathers information from an accelerometer and send it to the calculator on demand.

Edit: This might work for you as well:
T  G  R
|  |  |
|  |  |
|  |  |
|  |  |

T=tip
G=ground
R=ring

The | lines connected to tip and ring are metal plates. The line | connected to ground is a little rod which can move freely. Mount this to the back of your calc. Every time the wire shorts either tip or ring to ground you can read change in the port state.
« Last Edit: October 18, 2012, 05:10:32 am by Keoni29 »
If you like my work: why not give me an internet?








Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: How do I use make an accelerometer work with the link port?
« Reply #5 on: November 10, 2012, 07:43:07 pm »
Thanks for the help everyone! Here's what I ended up with: http://ourl.ca/5580/268974/